blenderproc.python.filter.Filter module
Filter classes to filter entities based on certain attributes
- class blenderproc.python.filter.Filter._Filter[source]
Bases:
object
Static class for filtering elements based on different elements.
- static check_equality(attr_value, filter_value, regex=False)[source]
- Checks whether the two values are equal. If the values have multiple elements,
they must all match (uses broadcasting).
- Parameters:
attr_value (
Any
) – The first value.filter_value (
Any
) – The second value.regex (
bool
) – If True, string values will be matched via regex.
- Return type:
bool
- Returns:
True, if the two values are equal.
- blenderproc.python.filter.Filter.all_with_type(elements, filtered_data_type=None)[source]
Returns all elements from the given list having a given type.
- blenderproc.python.filter.Filter.by_attr(elements, attr_name, value, filtered_data_type=None, regex=False)[source]
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.python.filter.Filter.by_attr_in_interval(elements, attr_name, min_value=None, max_value=None, filtered_data_type=None)[source]
- 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.python.filter.Filter.by_attr_outside_interval(elements, attr_name, min_value=None, max_value=None, filtered_data_type=None)[source]
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.python.filter.Filter.by_cp(elements, cp_name, value, filtered_data_type=None, regex=False)[source]
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.python.filter.Filter.one_by_attr(elements, attr_name, value, filtered_data_type=None, regex=False)[source]
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:
- Returns:
The one element from the given list that matches the given value at the specified attribute.
- blenderproc.python.filter.Filter.one_by_cp(elements, cp_name, value, filtered_data_type=None, regex=False)[source]
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:
- Returns:
The one element from the given list that matches the given value at the specified custom property.