blenderproc.python.types.EntityUtility module

The base class of all things, which can be placed in the scene, in BlenderProc.

class blenderproc.python.types.EntityUtility.Entity(bpy_object)[source]

Bases: Struct

The entity class of all objects which can be placed inside the scene. They have a 6D pose consisting of location and rotation.

apply_T(transform)[source]

Apply the given transformation to the pose of the entity.

Parameters:

transform (Union[ndarray, Matrix]) – A 4x4 matrix representing the transformation.

clear_parent()[source]

Removes the object’s parent and moves the object into the root level of the scene graph.

delete(remove_all_offspring=False)[source]

Deletes the entity and maybe all of its offspring

Parameters:

remove_all_offspring (bool) – If this is True all children and their children are recursively deleted

deselect()[source]

Deselects the entity.

duplicate(duplicate_children=True, linked=False)[source]

Duplicates the object.

Parameters:
  • duplicate_children (bool) – If True, also all children objects are recursively duplicated.

  • linked (bool) – If True, object data is not copied.

Return type:

Entity

Returns:

A new mesh object, which is a duplicate of this object.

get_children(return_all_offspring=False)[source]

Returns the children objects.

Parameters:

return_all_offspring (bool) – If this is True all children and their children are recursively found and returned

Return type:

List[Entity]

Returns:

A list of all children objects.

get_local2world_mat()[source]

Returns the pose of the object in the form of a local2world matrix.

Return type:

ndarray

Returns:

The 4x4 local2world matrix.

get_location(frame=None)[source]

Returns the location of the entity in 3D world coordinates.

Parameters:

frame (Optional[int]) – The frame number which the value should be set to. If None is given, the current frame number is used.

Return type:

ndarray

Returns:

The location at the specified frame.

get_parent()[source]

Returns the parent of the entity.

Return type:

Optional[Entity]

Returns:

The parent.

get_rotation(frame=None)[source]

Returns the rotation of the entity in euler angles.

Parameters:

frame (Optional[int]) – The frame number which the value should be set to. If None is given, the current frame number is used.

Return type:

ndarray

Returns:

The rotation at the specified frame.

get_rotation_euler(frame=None)[source]

Returns the rotation of the entity in euler angles.

Parameters:

frame (Optional[int]) – The frame number which the value should be set to. If None is given, the current frame number is used.

Return type:

ndarray

Returns:

The rotation at the specified frame.

get_rotation_mat(frame=None)[source]

Gets the rotation matrix of the entity.

Parameters:

frame (Optional[int]) – The frame number which the value should be set to. If None is given, the current frame number is used.

Return type:

ndarray

Returns:

The 3x3 local2world rotation matrix.

get_scale(frame=None)[source]

Returns the scale of the entity along all three axes.

Parameters:

frame (Optional[int]) – The frame number which the value should be set to. If None is given, the current frame number is used.

Return type:

ndarray

Returns:

The scale at the specified frame.

hide(hide_object=True)[source]

Sets the visibility of the object.

Parameters:

hide_object (bool) – Determines whether the object should be hidden in rendering.

is_empty()[source]

Returns whether the entity is from type “EMPTY”.

Return type:

bool

Returns:

True, if its an empty.

is_hidden()[source]

Returns whether the object is hidden in rendering.

Return type:

bool

Returns:

True, if it is hidden.

select()[source]

Selects the entity.

set_local2world_mat(matrix_world)[source]

Sets the pose of the object in the form of a local2world matrix.

Parameters:

matrix_world (Union[ndarray, Matrix]) – A 4x4 matrix.

set_location(location, frame=None)[source]

Sets the location of the entity in 3D world coordinates.

Parameters:
  • location (Union[list, Vector, ndarray]) – The location to set.

  • frame (Optional[int]) – The frame number which the value should be set to. If None is given, the current frame number is used.

set_parent(new_parent)[source]

Sets the parent of this object.

Parameters:

new_parent (Entity) – The parent entity to set.

set_rotation_euler(rotation_euler, frame=None)[source]

Sets the rotation of the entity in euler angles.

Parameters:
  • rotation_euler (Union[list, Euler, ndarray]) – The euler angles to set.

  • frame (Optional[int]) – The frame number which the value should be set to. If None is given, the current frame number is used.

set_rotation_mat(rotation_mat, frame=None)[source]

Sets the rotation of the entity using a rotation matrix.

Parameters:
  • rotation_mat (Union[Matrix, ndarray]) – The 3x3 local to world rotation matrix.

  • frame (Optional[int]) – The frame number which the value should be set to. If None is given, the current frame number is used.

set_scale(scale, frame=None)[source]

Sets the scale of the entity along all three axes.

Parameters:
  • scale (Union[list, ndarray, Vector]) – The scale to set.

  • frame (Optional[int]) – The frame number which the value should be set to. If None is given, the current frame number is used.

update_blender_ref(name)[source]

Updates the contained blender reference using the given name of the instance.

Parameters:

name (str) – The name of the instance which will be used to update its blender reference.

blenderproc.python.types.EntityUtility.convert_to_entities(blender_objects, convert_to_subclasses=False)[source]

Converts the given list of blender objects to entities

Parameters:
  • blender_objects (list) – List of blender objects.

  • convert_to_subclasses (bool) – If True, each blender object will be wrapped into an entity subclass based on the type of object.

Return type:

List[Entity]

Returns:

The list of entities.

blenderproc.python.types.EntityUtility.convert_to_entity_subclass(blender_object)[source]

Converts the given blender object into our respective wrapper class.

Parameters:

blender_object (Object) – The blender object.

Return type:

Entity

Returns:

The wrapped object.

blenderproc.python.types.EntityUtility.create_empty(entity_name, empty_type='plain_axes')[source]

Creates an empty entity.

Parameters:
  • entity_name (str) – The name of the new entity.

  • empty_type (str) – Type of the newly created empty entity. Available: [“plain_axes”, “arrows”, “single_arrow”, “circle”, “cube”, “sphere”, “cone”]

Return type:

Entity

Returns:

The new Mesh entity.

blenderproc.python.types.EntityUtility.delete_multiple(entities, remove_all_offspring=False)[source]

Deletes multiple entities at once

Parameters:
  • entities (List[Entity]) – A list of entities that should be deleted

  • remove_all_offspring (bool) – If this is True all children and their children are recursively deleted