unreal.RigHierarchy

class unreal.RigHierarchy(outer=None, name='None')

Bases: unreal.Object

Rig Hierarchy

C++ Source:

  • Plugin: ControlRig

  • Module: ControlRig

  • File: RigHierarchy.h

contains(key) bool

Returns true if the provided element key is valid

Parameters

key (RigElementKey) – The key to validate

Returns

Returns true if the provided element key is valid

Return type

bool

copy_hierarchy(hierarchy) None

Copies the contents of a hierarchy onto this one

Parameters

hierarchy (RigHierarchy) –

copy_pose(hierarchy, current, initial) None

Copies the contents of a hierarchy onto this one

Parameters
find_bone(key) RigBoneElement

Returns bone element for a given key, for scripting purpose only, for cpp usage, use Find<FRigBoneElement>()

Parameters

key (RigElementKey) – The key of the bone element to retrieve.

Return type

RigBoneElement

find_control(key) RigControlElement

Returns control element for a given key, for scripting purpose only, for cpp usage, use Find<FRigControlElement>()

Parameters

key (RigElementKey) – The key of the control element to retrieve.

Return type

RigControlElement

find_null(key) RigNullElement

Returns null element for a given key, for scripting purpose only, for cpp usage, use Find<FRigControlElement>()

Parameters

key (RigElementKey) – The key of the null element to retrieve.

Return type

RigNullElement

get_all_keys(traverse=True)

Returns all element keys of this hierarchy

Parameters

traverse (bool) – If set to true the keys will be returned by depth first traversal

Returns

The keys of all elements

Return type

Array(RigElementKey)

get_bones(traverse=True)

Returns all Bone elements

Parameters

traverse (bool) – Returns the elements in order of a depth first traversal

Return type

Array(RigElementKey)

get_children(key, recursive=False)

Returns the child elements of a given element key

Parameters
  • key (RigElementKey) – The key of the element to retrieve the children for

  • recursive (bool) – If set to true grand-children will also be returned etc

Returns

Returns the child elements

Return type

Array(RigElementKey)

get_control_value(key, value_type=RigControlValueType.CURRENT) RigControlValue

Returns a control’s current value given its key

Parameters
Returns

Returns the current value of the control

Return type

RigControlValue

get_control_value_by_index(element_index, value_type=RigControlValueType.CURRENT) RigControlValue

Returns a control’s current value given its index

Parameters
  • element_index (int32) – The index of the element to retrieve the current value for

  • value_type (RigControlValueType) – The type of value to return

Returns

Returns the current value of the control

Return type

RigControlValue

get_controller(create_if_needed=True) RigHierarchyController

Returns a controller for this hierarchy

Parameters

create_if_needed (bool) – Creates a controller if needed

Returns

The Controller for this hierarchy

Return type

RigHierarchyController

get_controls(traverse=True)

Returns all Control elements

Parameters

traverse (bool) – Returns the elements in order of a depth first traversal

Return type

Array(RigElementKey)

get_curve_value(key) float

Returns a curve’s value given its key

Parameters

key (RigElementKey) – The key of the element to retrieve the value for

Returns

Returns the value of the curve

Return type

float

get_curve_value_by_index(element_index) float

Returns a curve’s value given its index

Parameters

element_index (int32) – The index of the element to retrieve the value for

Returns

Returns the value of the curve

Return type

float

get_curves()

Returns all Curve elements

Return type

Array(RigElementKey)

classmethod get_euler_transform_from_control_value(value) EulerTransform

Returns the contained FEulerTransform value from a a Rig Control Value

Parameters

value (RigControlValue) – The Rig Control value to convert from

Returns

The converted FEulerTransform value

Return type

EulerTransform

get_first_parent(key) RigElementKey

Returns the first parent element of a given element key

Parameters

key (RigElementKey) – The key of the element to retrieve the parents for

Returns

Returns the first parent element

Return type

RigElementKey

classmethod get_float_from_control_value(value) float

Returns the contained float value from a a Rig Control Value

Parameters

value (RigControlValue) – The Rig Control value to convert from

Returns

The converted float value

Return type

float

get_global_control_offset_transform(key, initial=False) Transform

Returns the global offset transform for a given control element.

Parameters
  • key (RigElementKey) – The key of the control to retrieve the transform for

  • initial (bool) – If true the initial transform will be used

Returns

The global offset transform

Return type

Transform

get_global_control_offset_transform_by_index(element_index, initial=False) Transform

Returns the global offset transform for a given control element.

Parameters
  • element_index (int32) – The index of the control to retrieve the transform for

  • initial (bool) – If true the initial transform will be used

Returns

The global offset transform

Return type

Transform

get_global_control_shape_transform(key, initial=False) Transform

Returns the global shape transform for a given control element.

Parameters
  • key (RigElementKey) – The key of the control to retrieve the transform for

  • initial (bool) – If true the initial transform will be used

Returns

The global shape transform

Return type

Transform

get_global_control_shape_transform_by_index(element_index, initial=False) Transform

Returns the global shape transform for a given control element.

Parameters
  • element_index (int32) – The index of the control to retrieve the transform for

  • initial (bool) – If true the initial transform will be used

Returns

The global shape transform

Return type

Transform

get_global_transform(key, initial=False) Transform

Returns the global current or initial value for a given key. If the key is invalid FTransform::Identity will be returned.

Parameters
  • key (RigElementKey) – The key to retrieve the transform for

  • initial (bool) – If true the initial transform will be used

Returns

The global current or initial transform’s value.

Return type

Transform

get_global_transform_by_index(element_index, initial=False) Transform

Returns the global current or initial value for a element index. If the index is invalid FTransform::Identity will be returned.

Parameters
  • element_index (int32) – The index to retrieve the transform for

  • initial (bool) – If true the initial transform will be used

Returns

The global current or initial transform’s value.

Return type

Transform

get_index(key) int32

Returns the index of an element given its key

Parameters

key (RigElementKey) – The key of the element to retrieve the index for

Returns

The index of the element or INDEX_NONE

Return type

int32

classmethod get_int_from_control_value(value) int32

Returns the contained int32 value from a a Rig Control Value

Parameters

value (RigControlValue) – The Rig Control value to convert from

Returns

The converted int32 value

Return type

int32

get_key(element_index) RigElementKey

Returns the key of an element given its index

Parameters

element_index (int32) – The index of the element to retrieve the key for

Returns

The key of an element given its index

Return type

RigElementKey

get_local_transform(key, initial=False) Transform

Returns the local current or initial value for a given key. If the key is invalid FTransform::Identity will be returned.

Parameters
  • key (RigElementKey) – The key to retrieve the transform for

  • initial (bool) – If true the initial transform will be used

Returns

The local current or initial transform’s value.

Return type

Transform

get_local_transform_by_index(element_index, initial=False) Transform

Returns the local current or initial value for a element index. If the index is invalid FTransform::Identity will be returned.

Parameters
  • element_index (int32) – The index to retrieve the transform for

  • initial (bool) – If true the initial transform will be used

Returns

The local current or initial transform’s value.

Return type

Transform

get_nulls(traverse=True)

Returns all Null elements

Parameters

traverse (bool) – Returns the elements in order of a depth first traversal

Return type

Array(RigElementKey)

get_number_of_parents(key) int32

Returns the number of parents of an element

Parameters

key (RigElementKey) – The key of the element to retrieve the number of parents for

Returns

Returns the number of parents of an element

Return type

int32

get_parent_transform(key, initial=False) Transform

Returns the global current or initial value for a given key. If the element does not have a parent FTransform::Identity will be returned.

Parameters
  • key (RigElementKey) – The key of the element to retrieve the transform for

  • initial (bool) – If true the initial transform will be used

Returns

The element’s parent’s global current or initial transform’s value.

Return type

Transform

get_parent_transform_by_index(element_index, initial=False) Transform

Returns the global current or initial value for a given element index. If the element does not have a parent FTransform::Identity will be returned.

Parameters
  • element_index (int32) – The index of the element to retrieve the transform for

  • initial (bool) – If true the initial transform will be used

Returns

The element’s parent’s global current or initial transform’s value.

Return type

Transform

get_parent_weight(child, parent, initial=False) RigElementWeight

Returns the weight of a parent below a multi parent element

Parameters
  • child (RigElementKey) – The key of the multi parented element

  • parent (RigElementKey) – The key of the parent to look up the weight for

  • initial (bool) – If true the initial weights will be used

Returns

Returns the weight of a parent below a multi parent element, or FLT_MAX if the parent is invalid

Return type

RigElementWeight

get_parent_weight_array(child, initial=False)

Returns the weights of all parents below a multi parent element

Parameters
  • child (RigElementKey) – The key of the multi parented element

  • initial (bool) – If true the initial weights will be used

Returns

Returns the weight of a parent below a multi parent element, or FLT_MAX if the parent is invalid

Return type

Array(RigElementWeight)

get_parents(key, recursive=False)

Returns the parent elements of a given element key

Parameters
  • key (RigElementKey) – The key of the element to retrieve the parents for

  • recursive (bool) – If set to true parents of parents will also be returned

Returns

Returns the parent elements

Return type

Array(RigElementKey)

get_pose(initial=False) RigPose

Returns the current / initial pose of the hierarchy

Parameters

initial (bool) – If set to true the initial pose will be returned

Returns

The pose of the hierarchy

Return type

RigPose

get_previous_name(key) Name

Returns the previous name of an element prior to a rename operation

Parameters

key (RigElementKey) – The key of the element to request the old name for

Return type

Name

get_previous_parent(key) RigElementKey

Returns the previous parent of an element prior to a reparent operation

Parameters

key (RigElementKey) – The key of the element to request the old parent for

Return type

RigElementKey

get_references(traverse=True)

Returns all references

Parameters

traverse (bool) – Returns the elements in order of a depth first traversal

Return type

Array(RigElementKey)

get_rigid_bodies(traverse=True)

Returns all RigidBody elements

Parameters

traverse (bool) – Returns the elements in order of a depth first traversal

Return type

Array(RigElementKey)

classmethod get_rotator_from_control_value(value) Rotator

Returns the contained FRotator value from a a Rig Control Value

Parameters

value (RigControlValue) – The Rig Control value to convert from

Returns

The converted FRotator value

Return type

Rotator

get_selected_keys(type_filter=RigElementType.ALL)

Returns the keys of selected elements InTypeFilter: The types to retrieve the selection for

Parameters

type_filter (RigElementType) –

Returns

An array of the currently selected elements

Return type

Array(RigElementKey)

classmethod get_transform_from_control_value(value) Transform

Returns the contained FTransform value from a a Rig Control Value

Parameters

value (RigControlValue) – The Rig Control value to convert from

Returns

The converted FTransform value

Return type

Transform

classmethod get_transform_no_scale_from_control_value(value) TransformNoScale

Returns the contained FTransformNoScale value from a a Rig Control Value

Parameters

value (RigControlValue) – The Rig Control value to convert from

Returns

The converted FTransformNoScale value

Return type

TransformNoScale

classmethod get_vector2d_from_control_value(value) Vector2D

Returns the contained FVector2D value from a a Rig Control Value

Parameters

value (RigControlValue) – The Rig Control value to convert from

Returns

The converted FVector2D value

Return type

Vector2D

classmethod get_vector_from_control_value(value) Vector

Returns the contained FVector value from a a Rig Control Value

Parameters

value (RigControlValue) – The Rig Control value to convert from

Returns

The converted FVector value

Return type

Vector

is_parented_to(child, parent) bool

Returns true if an element is parented to another element

Parameters
  • child (RigElementKey) – The key of the child element to check for a parent

  • parent (RigElementKey) – The key of the parent element to check for

Returns

True if the child is parented to the parent

Return type

bool

is_selected(key) bool

Returns true if a given element is selected

Parameters

key (RigElementKey) – The key to check

Returns

true if a given element is selected

Return type

bool

is_selected_by_index(index) bool

Returns true if a given element is selected

Parameters

index (int32) – The index to check

Returns

true if a given element is selected

Return type

bool

is_valid_index(element_index) bool

Returns true if the provided element index is valid

Parameters

element_index (int32) – The index to validate

Returns

Returns true if the provided element index is valid

Return type

bool

classmethod make_control_value_from_bool(value) RigControlValue

Creates a rig control value from a bool value

Parameters

value (bool) – The value to create the rig control value from

Returns

The converted control rig val ue

Return type

RigControlValue

classmethod make_control_value_from_euler_transform(value) RigControlValue

Creates a rig control value from a FEulerTransform value

Parameters

value (EulerTransform) – The value to create the rig control value from

Returns

The converted control rig val ue

Return type

RigControlValue

classmethod make_control_value_from_float(value) RigControlValue

Creates a rig control value from a float value

Parameters

value (float) – The value to create the rig control value from

Returns

The converted control rig val ue

Return type

RigControlValue

classmethod make_control_value_from_int(value) RigControlValue

Creates a rig control value from a int32 value

Parameters

value (int32) – The value to create the rig control value from

Returns

The converted control rig val ue

Return type

RigControlValue

classmethod make_control_value_from_rotator(value) RigControlValue

Creates a rig control value from a FRotator value

Parameters

value (Rotator) – The value to create the rig control value from

Returns

The converted control rig val ue

Return type

RigControlValue

classmethod make_control_value_from_transform(value) RigControlValue

Creates a rig control value from a FTransform value

Parameters

value (Transform) – The value to create the rig control value from

Returns

The converted control rig val ue

Return type

RigControlValue

classmethod make_control_value_from_transform_no_scale(value) RigControlValue

Creates a rig control value from a FTransformNoScale value

Parameters

value (TransformNoScale) – The value to create the rig control value from

Returns

The converted control rig val ue

Return type

RigControlValue

classmethod make_control_value_from_vector(value) RigControlValue

Creates a rig control value from a FVector value

Parameters

value (Vector) – The value to create the rig control value from

Returns

The converted control rig val ue

Return type

RigControlValue

classmethod make_control_value_from_vector2d(value) RigControlValue

Creates a rig control value from a FVector2D value

Parameters

value (Vector2D) – The value to create the rig control value from

Returns

The converted control rig val ue

Return type

RigControlValue

num() int32

Returns the number of elements in the Hierarchy.

Returns

The number of elements in the Hierarchy

Return type

int32

reset() None

Clears the whole hierarchy and removes all elements.

reset_curve_values() None

Resets all curves to 0.0

reset_pose_to_initial(type_filter) None

Resets the current pose of a filtered lost if elements to the initial / ref pose.

Parameters

type_filter (RigElementType) –

send_auto_key_event(element, offset_in_seconds=0.000000, asynchronous=True) None

Sends an autokey event from the hierarchy to the world

Parameters
  • element (RigElementKey) – The element to send the autokey for

  • offset_in_seconds (float) – The time offset in seconds

  • asynchronous (bool) – If set to true the event will go on a thread safe queue

set_control_offset_transform(key, transform, initial=False, affect_children=True, setup_undo=False, print_python_commands=False) None

Sets the offset transform for a given control element by key

Parameters
  • key (RigElementKey) – The key of the control element to set the offset transform for

  • transform (Transform) – The new offset transform value to set

  • initial (bool) – If true the initial value will be used

  • affect_children (bool) – If set to false children will not move (maintain global).

  • setup_undo (bool) – If true the transform stack will be setup for undo / redo

  • print_python_commands (bool) –

set_control_offset_transform_by_index(element_index, transform, initial=False, affect_children=True, setup_undo=False, print_python_commands=False) None

Sets the local offset transform for a given control element by index

Parameters
  • element_index (int32) – The index of the control element to set the offset transform for

  • transform (Transform) – The new local offset transform value to set

  • initial (bool) – If true the initial value will be used

  • affect_children (bool) – If set to false children will not move (maintain global).

  • setup_undo (bool) – If true the transform stack will be setup for undo / redo

  • print_python_commands (bool) –

set_control_settings(key, settings, setup_undo=False, force=False, print_python_commands=False) None

Sets the control settings for a given control element by key

Parameters
  • key (RigElementKey) – The key of the control element to set the settings for

  • settings (RigControlSettings) – The new control settings value to set

  • setup_undo (bool) – If true the transform stack will be setup for undo / redo

  • force (bool) –

  • print_python_commands (bool) –

set_control_settings_by_index(element_index, settings, setup_undo=False, force=False, print_python_commands=False) None

Sets the control settings for a given control element by index

Parameters
  • element_index (int32) – The index of the control element to set the settings for

  • settings (RigControlSettings) – The new control settings value to set

  • setup_undo (bool) – If true the transform stack will be setup for undo / redo

  • force (bool) –

  • print_python_commands (bool) –

set_control_shape_transform(key, transform, initial=False, setup_undo=False) None

Sets the shape transform for a given control element by key

Parameters
  • key (RigElementKey) – The key of the control element to set the shape transform for

  • transform (Transform) – The new shape transform value to set

  • initial (bool) – If true the initial value will be used

  • setup_undo (bool) – If true the transform stack will be setup for undo / redo

set_control_shape_transform_by_index(element_index, transform, initial=False, setup_undo=False) None

Sets the local shape transform for a given control element by index

Parameters
  • element_index (int32) – The index of the control element to set the shape transform for

  • transform (Transform) – The new local shape transform value to set

  • initial (bool) – If true the initial value will be used

  • setup_undo (bool) – If true the transform stack will be setup for undo / redo

set_control_value(key, value, value_type=RigControlValueType.CURRENT, setup_undo=False, print_python_commands=False) None

Sets a control’s current value given its key

Parameters
  • key (RigElementKey) – The key of the element to set the current value for

  • value (RigControlValue) – The value to set on the control

  • value_type (RigControlValueType) – The type of value to set

  • setup_undo (bool) – If true the transform stack will be setup for undo / redo

  • print_python_commands (bool) –

set_control_value_by_index(element_index, value, value_type=RigControlValueType.CURRENT, setup_undo=False, print_python_commands=False) None

Sets a control’s current value given its index

Parameters
  • element_index (int32) – The index of the element to set the current value for

  • value (RigControlValue) – The value to set on the control

  • value_type (RigControlValueType) – The type of value to set

  • setup_undo (bool) – If true the transform stack will be setup for undo / redo

  • print_python_commands (bool) –

set_control_visibility(key, visibility) None

Sets a control’s current visibility based on a key

Parameters
  • key (RigElementKey) – The key of the element to set the visibility for

  • visibility (bool) – The visibility to set on the control

set_control_visibility_by_index(element_index, visibility) None

Sets a control’s current visibility based on a key

Parameters
  • element_index (int32) – The index of the element to set the visibility for

  • visibility (bool) – The visibility to set on the control

set_curve_value(key, value, setup_undo=False) None

Sets a curve’s value given its key

Parameters
  • key (RigElementKey) – The key of the element to set the value for

  • value (float) – The value to set on the curve

  • setup_undo (bool) – If true the transform stack will be setup for undo / redo

set_curve_value_by_index(element_index, value, setup_undo=False) None

Sets a curve’s value given its index

Parameters
  • element_index (int32) – The index of the element to set the value for

  • value (float) – The value to set on the curve

  • setup_undo (bool) – If true the transform stack will be setup for undo / redo

set_global_transform(key, transform, initial=False, affect_children=True, setup_undo=False) None

Sets the global current or initial transform for a given key.

Parameters
  • key (RigElementKey) – The key to set the transform for

  • transform (Transform) – The new transform value to set

  • initial (bool) – If true the initial transform will be used

  • affect_children (bool) – If set to false children will not move (maintain global).

  • setup_undo (bool) – If true the transform stack will be setup for undo / redo

set_global_transform_by_index(element_index, transform, initial=False, affect_children=True, setup_undo=False) None

Sets the global current or initial transform for a given element index.

Parameters
  • element_index (int32) – The index of the element to set the transform for

  • transform (Transform) – The new transform value to set

  • initial (bool) – If true the initial transform will be used

  • affect_children (bool) – If set to false children will not move (maintain global).

  • setup_undo (bool) – If true the transform stack will be setup for undo / redo

set_local_transform(key, transform, initial=False, affect_children=True, setup_undo=False, print_python_commands=False) None

Sets the local current or initial transform for a given key.

Parameters
  • key (RigElementKey) – The key to set the transform for

  • transform (Transform) – The new transform value to set

  • initial (bool) – If true the initial transform will be used

  • affect_children (bool) – If set to false children will not move (maintain global).

  • setup_undo (bool) – If true the transform stack will be setup for undo / redo

  • print_python_commands (bool) –

set_local_transform_by_index(element_index, transform, initial=False, affect_children=True, setup_undo=False, print_python_commands=False) None

Sets the local current or initial transform for a given element index.

Parameters
  • element_index (int32) – The index of the element to set the transform for

  • transform (Transform) – The new transform value to set

  • initial (bool) – If true the initial transform will be used

  • affect_children (bool) – If set to false children will not move (maintain global).

  • setup_undo (bool) – If true the transform stack will be setup for undo / redo

  • print_python_commands (bool) –

set_parent_weight(child, parent, weight, initial=False, affect_children=True) bool

Sets the weight of a parent below a multi parent element

Parameters
  • child (RigElementKey) – The key of the multi parented element

  • parent (RigElementKey) – The key of the parent to look up the weight for

  • weight (RigElementWeight) – The new weight to set for the parent

  • initial (bool) – If true the initial weights will be used

  • affect_children (bool) – If set to false children will not move (maintain global).

Returns

Returns true if changing the weight was successful

Return type

bool

set_parent_weight_array(child, weights, initial=False, affect_children=True) bool

Sets the all of the weights of the parents of a multi parent element

Parameters
  • child (RigElementKey) – The key of the multi parented element

  • weights (Array(RigElementWeight)) – The new weights to set for the parents

  • initial (bool) – If true the initial weights will be used

  • affect_children (bool) – If set to false children will not move (maintain global).

Returns

Returns true if changing the weight was successful

Return type

bool

set_pose(pose) None

Sets the current / initial pose of the hierarchy

Parameters

pose (RigPose) – The pose to set on the hierarchy

sort_keys(keys)

Sorts the input key list by traversing the hierarchy

Parameters

keys (Array(RigElementKey)) – The keys to sort

Returns

The sorted keys

Return type

Array(RigElementKey)

switch_to_default_parent(child, initial=False, affect_children=True) bool

Switches a multi parent element to its first parent

Parameters
  • child (RigElementKey) – The key of the multi parented element

  • initial (bool) – If true the initial weights will be used

  • affect_children (bool) – If set to false children will not move (maintain global).

Returns

Returns true if changing the weight was successful

Return type

bool

switch_to_parent(child, parent, initial=False, affect_children=True) bool

Switches a multi parent element to a single parent. This sets the new parent’s weight to 1.0 and disables weights for all other potential parents.

Parameters
  • child (RigElementKey) – The key of the multi parented element

  • parent (RigElementKey) – The key of the parent to look up the weight for

  • initial (bool) – If true the initial weights will be used

  • affect_children (bool) – If set to false children will not move (maintain global).

Returns

Returns true if changing the weight was successful

Return type

bool

switch_to_world_space(child, initial=False, affect_children=True) bool

Switches a multi parent element to world space. This injects a world space reference.

Parameters
  • child (RigElementKey) – The key of the multi parented element

  • initial (bool) – If true the initial weights will be used

  • affect_children (bool) – If set to false children will not move (maintain global).

Returns

Returns true if changing the weight was successful

Return type

bool