blenderproc.filter package

Module contents

blenderproc.filter.all_with_type(elements, filtered_data_type=None)

Returns all elements from the given list having a given type.

Parameters:
  • elements (List[Struct]) – A list of elements.

  • filtered_data_type (Optional[Type[Struct]]) – If not None, only elements from the given type are returned.

Return type:

List[Struct]

Returns:

All mesh objects from the given list.

blenderproc.filter.by_attr(elements, attr_name, value, filtered_data_type=None, regex=False)

Returns all elements from the given list whose specified attribute has the given value.

Parameters:
  • elements (List[Struct]) – A list of elements.

  • attr_name (str) – The name of the attribute to look for.

  • value (Any) – The value the attribute should have.

  • filtered_data_type (Optional[Type[Struct]]) – If not None, only elements from the given type are returned.

  • regex (bool) – If True, string values will be matched via regex.

Return type:

List[Struct]

Returns:

The elements from the given list that match the given value at the specified attribute.

blenderproc.filter.by_attr_in_interval(elements, attr_name, min_value=None, max_value=None, filtered_data_type=None)
Returns all elements from the given list whose specified attribute has a value in the given interval

(including the boundaries).

Parameters:
  • elements (List[Struct]) – A list of elements.

  • attr_name (str) – The name of the attribute to look for.

  • min_value (Optional[Any]) – The minimum value of the interval.

  • max_value (Optional[Any]) – The maximum value of the interval.

  • filtered_data_type (Optional[Type[Struct]]) – If not None, only elements from the given type are returned.

Return type:

List[Struct]

Returns:

The elements from the given list that match the given value at the specified attribute.

blenderproc.filter.by_attr_outside_interval(elements, attr_name, min_value=None, max_value=None, filtered_data_type=None)

Returns all elements from the given list whose specified attribute has a value outside the given interval.

Parameters:
  • elements (List[Struct]) – A list of elements.

  • attr_name (str) – The name of the attribute to look for.

  • min_value (Optional[Any]) – The minimum value of the interval.

  • max_value (Optional[Any]) – The maximum value of the interval.

  • filtered_data_type (Optional[Type[Struct]]) – If not None, only elements from the given type are returned.

Return type:

List[Struct]

Returns:

The elements from the given list that match the given value at the specified attribute.

blenderproc.filter.by_cp(elements, cp_name, value, filtered_data_type=None, regex=False)

Returns all elements from the given list whose specified custom property has the given value.

Parameters:
  • elements (List[Struct]) – A list of elements.

  • cp_name (str) – The name of the custom property to look for.

  • value (Any) – The value the custom property should have.

  • filtered_data_type (Optional[Type[Struct]]) – If not None, only elements from the given type are returned.

  • regex (bool) – If True, string values will be matched via regex.

Return type:

List[Struct]

Returns:

The elements from the given list that match the given value at the specified custom property.

blenderproc.filter.one_by_attr(elements, attr_name, value, filtered_data_type=None, regex=False)

Returns the one element from the given list whose specified attribute has the given value.

An error is thrown is more than one or no element has been found.

Parameters:
  • elements (List[Struct]) – A list of elements.

  • attr_name (str) – The name of the attribute to look for.

  • value (Any) – The value the attribute should have.

  • filtered_data_type (Optional[Type[Struct]]) – If not None, only elements from the given type are returned.

  • regex (bool) – If True, string values will be matched via regex.

Return type:

Struct

Returns:

The one element from the given list that matches the given value at the specified attribute.

blenderproc.filter.one_by_cp(elements, cp_name, value, filtered_data_type=None, regex=False)

Returns the one element from the given list whose specified custom property has the given value.

An error is thrown is more than one or no element has been found.

Parameters:
  • elements (List[Struct]) – A list of elements.

  • cp_name (str) – The name of the custom property to look for.

  • value (Any) – The value the custom property should have.

  • filtered_data_type (Optional[Type[Struct]]) – If not None, only elements from the given type are returned.

  • regex (bool) – If True, string values will be matched via regex.

Return type:

Struct

Returns:

The one element from the given list that matches the given value at the specified custom property.