blenderproc.python.types.ArmatureUtility module

An armature object, which can be connected with Link objects to other armature objects.

class blenderproc.python.types.ArmatureUtility.Armature(bpy_object)[source]

Bases: Entity

An armature object, which can be connected with Link objects to other armature objects.

It enables the transformation of different objects.

_clip_value_from_constraint(value, constraint_name, axis)[source]

Checks if an axis is constraint, and clips the value to the min/max of this constraint. If the constraint does not exist, nothing is done.

Parameters:
  • value (float) – Value to be clipped.

  • constraint_name (str) – Name of the constraint.

  • axis (str) – Axis to check.

Return type:

float

Returns:

Clipped value if a constraint is set, else the initial value.

_determine_rotation_axis()[source]

Determines the single rotation axis and checks if the constraints are set well to have only one axis of freedom.

Returns:

The single rotation axis (‘X’, ‘Y’ or ‘Z’).

add_constraint_if_not_existing(constraint_name)[source]

Adds a new constraint if it doesn’t exist, and returns the specified constraint.

Parameters:

constraint_name (str) – Name of the desired constraint.

Return type:

Constraint

get_constraint(constraint_name)[source]

Returns the desired constraint if existing; otherwise None.

Parameters:

constraint_name (str) – Name of the constraint.

Return type:

Optional[Constraint]

Returns:

Constraint if it exists; else None.

get_location_constraint()[source]

Returns the location constraint if existing; otherwise None.

Return type:

Optional[Constraint]

Returns:

Location constraint if it exists; else None.

get_rotation_constraint()[source]

Returns the rotation constraint if existing; otherwise None.

Return type:

Optional[Constraint]

Returns:

Rotation constraint if it exists; else None.

hide(hide_object=True)[source]

Sets the visibility of the object.

Parameters:

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

remove_constraint(constraint_key)[source]

Removes a specified constraint.

Parameters:

constraint_key (str) – Key to be removed.

remove_constraints()[source]

Removes all constraints of the armature.

set_location_constraint(x_limits=None, y_limits=None, z_limits=None)[source]

Sets location constraints on the armature’s bone.

Parameters:
  • x_limits (Optional[List[float]]) – A list of two float values specifying min/max values along the x-axis or None if no constraint should be applied.

  • y_limits (Optional[List[float]]) – A list of two float values specifying min/max values along the y-axis or None if no constraint should be applied.

  • z_limits (Optional[List[float]]) – A list of two float values specifying min/max values along the z-axis or None if no constraint should be applied.

set_rotation_constraint(x_limits=None, y_limits=None, z_limits=None)[source]

Sets rotation constraints on the armature’s bone.

Parameters:
  • x_limits (Optional[List[float]]) – A list of two float values specifying min/max radiant values along the x-axis or None if no constraint should be applied.

  • y_limits (Optional[List[float]]) – A list of two float values specifying min/max radiant values along the y-axis or None if no constraint should be applied.

  • z_limits (Optional[List[float]]) – A list of two float values specifying min/max radiant values along the z-axis or None if no constraint should be applied.

set_rotation_euler(rotation_euler, frame=None, mode='absolute')[source]

Rotates the armature based on euler angles. Validate values with given constraints.

Parameters:
  • rotation_euler (Union[float, list, Euler, ndarray]) – The amount of rotation (in radians). Either three floats for x, y and z axes, or a single float. In the latter case, the axis of rotation is derived based on the rotation constraint. If these are not properly set (i.e., two axes must have equal min/max values) an exception will be thrown.

  • frame (Optional[int]) – Keyframe where to insert the respective rotations.

  • mode (str) – One of [“absolute”, “relative”]. For absolute rotations we clip the rotation value based on the constraints. For relative, we don’t - this will result in inverse motion after the constraint’s limits have been reached.