unreal.IKRetargeterController

class unreal.IKRetargeterController(outer: Object | None = None, name: Name | str = 'None')

Bases: Object

A stateless singleton (1-per-asset) class used to make modifications to a UIKRetargeter asset. Use UIKRetargeter.GetController() to get the controller for the asset you want to modify.

C++ Source:

  • Plugin: IKRig

  • Module: IKRigEditor

  • File: IKRetargeterController.h

add_default_ops() None

Automatically add basic retargeting operations Adds these ops in the following order: Pelvis Motion, FK Chains, IK Chains, IK Solve and Root Motion If any of these ops are already present, they will not be re-added.

add_retarget_op(ik_retarget_op_type) int32

Add a new retarget op of the given type to the bottom of the stack. Returns the stack index.

Parameters:

ik_retarget_op_type (str)

Return type:

int32

assign_ik_rig_to_all_ops(source_or_target, ik_rig) None

Force all ops to use the assigned IK Rig and update their chain mappings. NOTE: some ops may not reference an IK Rig at all; the exact behavior is op-dependent

Parameters:
auto_align_all_bones(source_or_target, method=RetargetAutoAlignMethod.CHAIN_TO_CHAIN) None

Automatically align all bones in mapped chains and store in the current retarget pose.

Parameters:
auto_align_bones(bones_to_align, method, source_or_target) None

Automatically align an array of bones and store in the current retarget pose.

Parameters:
  • bones_to_align (Array[Name]) – The array of bone names to align; bones not in mapped chains are ignored

  • method (RetargetAutoAlignMethod) – The method to use for automatic alignment

  • source_or_target (RetargetSourceOrTarget) – Specifies whether to align bones in the source or target skeleton

auto_map_chains(auto_map_type, force_remap, op_name='None') None

Use string comparision to find “best” Source chain to map to each Target chain or clear the mappings

Parameters:
  • auto_map_type (AutoMapChainType) – an enum specifying the type of mapping to perform (ie, Exact, Fuzzy or Clear)

  • force_remap (bool) – if false, will only remap those mappings that unset/None

  • op_name (Name) – if specified, will auto-map only the chain mapping in the specified op, otherwise applies to all ops

create_retarget_pose(new_pose_name, source_or_target) Name

Add new retarget pose.

Parameters:
  • new_pose_name (Name) – The name to assign to the new retarget pose

  • source_or_target (RetargetSourceOrTarget) – Specifies whether the pose applies to the source or target skeleton

Returns:

The name of the newly created retarget pose

Return type:

Name

duplicate_retarget_pose(pose_to_duplicate, new_name, source_or_target) Name

Duplicate a retarget pose.

Parameters:
  • pose_to_duplicate (Name) – The name of the retarget pose to duplicate

  • new_name (Name) – The name to assign to the duplicated pose

  • source_or_target (RetargetSourceOrTarget) – Specifies whether the pose belongs to the source or target skeleton

Returns:

The name of the new duplicated pose, or NAME_None if PoseToDuplicate is not found

Return type:

Name

get_all_chain_settings() Array[RetargetChainSettings]

Get All Chain Settings

Return type:

Array[RetargetChainSettings]

get_all_target_ik_rigs() Array[IKRigDefinition]

Get all target IK Rigs referenced by all ops

Returns:

an array of all target IK Rig assets associated with all the ops in the stack

Return type:

Array[IKRigDefinition]

classmethod get_controller(retargeter_asset) IKRetargeterController

Get the controller for the given retargeter asset

Parameters:

retargeter_asset (IKRetargeter) – an IK Retarget asset

Returns:

the controller with an API for modifying the given retarget asset

Return type:

IKRetargeterController

get_current_retarget_pose(source_or_target) IKRetargetPose

Get the current retarget pose.

Parameters:

source_or_target (RetargetSourceOrTarget) – Specifies whether to retrieve the pose from the source or target skeleton

Returns:

A reference to the current retarget pose data

Return type:

IKRetargetPose

get_current_retarget_pose_name(source_or_target) Name

Get the name of the current retarget pose.

Parameters:

source_or_target (RetargetSourceOrTarget) – Specifies whether to retrieve the pose from the source or target skeleton

Returns:

The name of the current retarget pose

Return type:

Name

get_global_settings() RetargetGlobalSettings

Get Global Settings

Return type:

RetargetGlobalSettings

get_ik_rig(source_or_target) IKRigDefinition

Get either source or target IK Rig

Parameters:

source_or_target (RetargetSourceOrTarget) – an enum specifying either “Source” or “Target”

Returns:

the IK Rig asset associated with either the Source or Target of the IK Retargeter

Return type:

IKRigDefinition

get_index_of_op_by_name(op_name) int32

Get the index of an op.

Parameters:

op_name (Name) – the name of the op to get the index of

Returns:

the integer index of the op in the stack or -1 if op not found.

Return type:

int32

get_num_retarget_ops() int32

Get the number of Ops in the stack.

Returns:

int, the number of ops

Return type:

int32

get_op_controller(op_index) IKRetargetOpControllerBase

Get a controller to get/set the settings for a given op in the stack NOTE: the returned UIKRetargetOpControllerBase* should be cast to the type specific to your op to get full functionality for that op.

Parameters:

op_index (int32)

Returns:

a pointer to the base op controller UClass or null if the op was not found

Return type:

IKRetargetOpControllerBase

get_op_name(op_index) Name

Get the name of the op at the given index in the stack.

Parameters:

op_index (int32) – the index of the op to get the name of

Returns:

the name of the op or None if the index was invalid

Return type:

Name

get_parent_op_by_name(op_name) Name

Get the name of the parent op for the given op.

Parameters:

op_name (Name) – the name of the op to get the parent of

Returns:

the name of the parent op or None if the op was not found or did not have a parent

Return type:

Name

get_preview_mesh(source_or_target) SkeletalMesh

Get the preview skeletal mesh

Parameters:

source_or_target (RetargetSourceOrTarget) – an enum specifying either “Source” or “Target”

Returns:

the skeletal mesh asset currently being used as a preview mesh

Return type:

SkeletalMesh

get_retarget_chain_settings(target_chain_name) TargetChainSettings

Get Retarget Chain Settings

Parameters:

target_chain_name (Name)

Return type:

TargetChainSettings

get_retarget_op_enabled(retarget_op_index) bool

Get enabled status of the given Op.

Parameters:

retarget_op_index (int32) – the index of the op to get the enabled state for

Returns:

true if op is enabled, false if op is disabled or not found

Return type:

bool

get_retarget_poses(source_or_target) Map[Name, IKRetargetPose]

Get access to array of retarget poses.

Parameters:

source_or_target (RetargetSourceOrTarget) – Specifies whether to retrieve poses from the source or target skeleton

Returns:

A reference to the map of retarget pose names to their pose data

Return type:

Map[Name, IKRetargetPose]

get_root_offset_in_retarget_pose(source_or_target) Vector

Get the translation offset on the retarget pelvis bone for the current retarget pose.

Parameters:

source_or_target (RetargetSourceOrTarget) – Specifies whether the pelvis bone belongs to the source or target skeleton

Returns:

The vector representing the translation offset of the pelvis bone

Return type:

Vector

get_root_settings() TargetRootSettings

Get Root Settings

Return type:

TargetRootSettings

get_rotation_offset_for_retarget_pose_bone(bone_name, source_or_target) Quat

Get a delta rotation for a given bone in the current retarget pose.

Parameters:
  • bone_name (Name) – The name of the bone to retrieve the rotation offset for

  • source_or_target (RetargetSourceOrTarget) – Specifies whether the bone belongs to the source or target skeleton

Returns:

The quaternion representing the rotation offset for the specified bone

Return type:

Quat

get_source_chain(target_chain_name, op_name='None') Name

Get the name of the source chain mapped to a given target chain (the chain animation is copied FROM).

Parameters:
  • target_chain_name (Name) – the name of the target retarget chain to get a mapping for

  • op_name (Name) – if specified, will get the source chain for that op (otherwise gets the first chain mapping in the op stack)

Returns:

the name of the source chain mapped to the given target chain (or None if not mapped)

Return type:

Name

get_target_ik_rig_for_op(op_name) IKRigDefinition

Get the target IK Rig associated with the given Op. May be different than the default IK Rig. NOTE: all ops use the global SOURCE IK rig, but each op may use its own custom TARGET IK Rig. NOTE: not all ops maintain their own target IK Rig in which case this function returns nullptr NOTE: some ops may refer to the target IK Rig used by their parent op. In that case, this function returns the parent Op’s IK Rig.

Parameters:

op_name (Name) – the name of the retarget op

Returns:

the IK Rig assset associated with this op

Return type:

IKRigDefinition

move_retarget_op_in_stack(op_to_move_index, target_index) bool

Move the retarget op at the given index to the target index. NOTE: due to constraints on execution order, the actual index may differ from what is requested InOpToMoveIndex: the index of the op to be moved InTargetIndex: the index where the op should be moved to

Parameters:
  • op_to_move_index (int32)

  • target_index (int32)

Return type:

bool

remove_all_ops() bool

Remove all ops in the stack.

Returns:

true if any ops were removed, false otherwise

Return type:

bool

remove_retarget_op(op_index) bool

Remove the retarget op at the given stack index NOTE: if this op is a parent, all it’s children will be removed as well

Parameters:

op_index (int32)

Returns:

true if op was found and removed, false otherwise

Return type:

bool

remove_retarget_pose(pose_to_remove, source_or_target) bool

Remove a retarget pose.

Parameters:
  • pose_to_remove (Name) – The name of the retarget pose to remove

  • source_or_target (RetargetSourceOrTarget) – Specifies whether the pose belongs to the source or target skeleton

Returns:

True if the pose was found and successfully removed, false otherwise

Return type:

bool

rename_retarget_pose(old_pose_name, new_pose_name, source_or_target) bool

Rename current retarget pose.

Parameters:
  • old_pose_name (Name) – The current name of the retarget pose to rename

  • new_pose_name (Name) – The new name to assign to the retarget pose

  • source_or_target (RetargetSourceOrTarget) – Specifies whether the pose belongs to the source or target skeleton

Returns:

True if the pose was found and successfully renamed, false otherwise

Return type:

bool

reset_chain_settings_in_all_ops(target_chain_name) None

Tell each op to reset any settings associated with this chain

Parameters:

target_chain_name (Name)

reset_chain_settings_to_default(target_chain_name, op_name) None

Reset the settings for the given chain in the given op back to the defaults.

Parameters:
  • target_chain_name (Name) – the name of the chain

  • op_name (Name) – the name of the op containing the chain settings

reset_retarget_pose(pose_to_reset, bones_to_reset, source_or_target) None

Reset a retarget pose for the specified bones.

Parameters:
  • pose_to_reset (Name) – The name of the retarget pose to reset

  • bones_to_reset (Array[Name]) – The array of bone names to reset; if empty, resets all bones to the reference pose

  • source_or_target (RetargetSourceOrTarget) – Specifies whether the pose belongs to the source or target skeleton

run_op_initial_setup(op_index) None

Force the op to run the initial setup. This is normally run when an Op is added through the editor UI. NOTE: ops may not have custom initial setup routines; the exact behavior is op-dependent

Parameters:

op_index (int32) – the index of the op to run setup on

set_current_retarget_pose(current_pose, source_or_target) bool

Change which retarget pose is used by the retargeter at runtime.

Parameters:
  • current_pose (Name) – The name of the retarget pose to set as current

  • source_or_target (RetargetSourceOrTarget) – Specifies whether the pose applies to the source or target skeleton

Returns:

True if the current pose was successfully set, false otherwise

Return type:

bool

set_global_settings(global_settings) None

Set Global Settings

Parameters:

global_settings (RetargetGlobalSettings)

set_ik_rig(source_or_target, ik_rig) None

Set the IK Rig to use as the source or target (to copy animation FROM/TO)

Parameters:
set_op_name(name, op_index) Name

Set the name of the op at the given index in the stack.

Parameters:
  • name (Name) – the new name to use

  • op_index (int32) – the index of the op to be renamed

Returns:

the new name of the op (after it’s made unique)

Return type:

Name

set_parent_op_by_name(child_op_name, parent_op_name) bool

Set the name of the op to parent this op to Children ops are forced to execute before their parent

Parameters:
  • child_op_name (Name) – the op to be parented

  • parent_op_name (Name) – the name of the op to parent to

Returns:

true if both parent and child were found, and the parent relationship was allowed

Return type:

bool

set_preview_mesh(source_or_target, preview_mesh) None

Set the preview skeletal mesh for either source or target

Parameters:
  • source_or_target (RetargetSourceOrTarget) – an enum specifying either “Source” or “Target”

  • preview_mesh (SkeletalMesh) – a skeletal mesh asset to use as the preview mesh in the retarget editor (may be used on other meshes at runtime)

set_retarget_chain_settings(target_chain_name, settings) bool

Set Retarget Chain Settings

Parameters:
Return type:

bool

set_retarget_op_enabled(retarget_op_index, is_enabled) bool

Toggle an op on/off.

Parameters:
  • retarget_op_index (int32) – the index of the op to modify

  • is_enabled (bool) – if true, turns the op On, else Off

Returns:

true if op was found at index

Return type:

bool

set_root_offset_in_retarget_pose(translation_offset, source_or_target) None

Set the translation offset on the retarget pelvis bone for the current retarget pose.

Parameters:
  • translation_offset (Vector) – The vector representing the translation offset to apply to the pelvis bone

  • source_or_target (RetargetSourceOrTarget) – Specifies whether the pelvis bone belongs to the source or target skeleton

set_root_settings(root_settings) None

Set Root Settings

Parameters:

root_settings (TargetRootSettings)

set_rotation_offset_for_retarget_pose_bone(bone_name, rotation_offset, skeleton_mode) None

Set a delta rotation for a given bone in the current retarget pose.

Parameters:
  • bone_name (Name) – The name of the bone to apply the rotation offset to

  • rotation_offset (Quat) – The quaternion representing the rotation offset to apply

  • skeleton_mode (RetargetSourceOrTarget) – Specifies whether the bone belongs to the source or target skeleton

set_source_chain(source_chain_name, target_chain_name, op_name='None') bool

Assign a source chain to the given target chain. Animation will be copied from the source to the target.

Parameters:
  • source_chain_name (Name) – the name of the source retarget chain to assign

  • target_chain_name (Name) – the name of the target chain to map

  • op_name (Name) – if specified, will set the source chain only for that op (otherwise applies to all ops with a chain mapping)

Return type:

bool

snap_bone_to_ground(reference_bone, source_or_target) None

Moves the entire skeleton vertically until the specified bone is the same height off the ground as in the reference pose.

Parameters:
  • reference_bone (Name) – The name of the bone to use as a reference for ground snapping

  • source_or_target (RetargetSourceOrTarget) – Specifies whether the skeleton belongs to the source or target