IC Python API:RLPy RISkeletonComponent

From Reallusion Wiki!
Jump to: navigation, search
Main article: Modules.
Last modified: 04/29/2020

Description

Motion bones are responsible for retargeting motion between different characters of different sizes and proportions.

This class is mainly used to get all the bones, skeleton states, and animation clips inside an object. If the control object of this component is RIAvatar, then the motion bones will be retrieved. For other objects, the skin bones will be returned. For avatars, the motion bones will be present mainly for retargeting purchases, which are also responsible for driving the skin bones.

Inheritance

RIBase> RISkeletonComponent

Member Functions

GetClip ( self, uIndex )

Get the clip on the current object at the specified index. Currently, only works for body motion clips on the timeline for avatars and animation tracks for other object types. If the current object does not have a clip or if the index exceeds the number of existing clips then return None.

See also: RIClip

Parameters

uIndex [IN] Index number for the Clip - integer

Returns

The newly copied animation clip object - RIClip
1 # Get Clip
2 skeleton_component = avatar.GetSkeletonComponent()
3 print(skeleton_component.GetClip(0))

GetClipCount ( self )

Get the total clip count for the current object. Currently, only works for body motion clips on the timeline for avatars and animation tracks for other object types. If a clip does not exist then return 0.

See also: RIClip

Returns

The total number of clips in this skeleton component - integer
1 # Get Clip Count
2 skeleton_component = avatar.GetSkeletonComponent()
3 print(skeleton_component.GetClipCount())

GetMotionBones ( self )

Get all of the motion bones for the current object. Currently, this function is only supported for avatars. Retargeting is applied to the motion bones, which is a unified skeleton for various characters. Motion bones are also responsible for driving skin bones.

See also: RINode

Returns

All of the motion bone nodes - RINode list
1 # Get Motion Bones
2 skeleton_component = avatar.GetSkeletonComponent()
3 motion_bones = skeleton_component.GetMotionBones()
4 print(len(motion_bones))

GetRootBone ( self )

Get the root bone of this skeleton component.

See also: RINode

Returns

The root bone - RINode
1 # Get Motion Bones
2 skeleton_component = avatar.GetSkeletonComponent()
3 root_bone = skeleton_component.GetRootBone()
4 print(root_bone.GetName())

GetSkinBones ( self )

Get the skin bones for the current object. Skin bones are the counterparts to the mesh skin, if this object is an avatar then the motion bones will drive the skin bones.

See also: RINode

Returns

All of the skin bone nodes - RINode list
1 # Get Motion Bones
2 skeleton_component = avatar.GetSkeletonComponent()
3 motion_bones = skeleton_component.GetSkinBones()
4 print(len(motion_bones))

GetSelectedBones ( self )

Get all of the selected bones on the current object. If no bones are selected for the current character, then an empty list is returned.

Returns

All of the currently selected bones - RINode list
1 # Get Motion Bones
2 skeleton_component = avatar.GetSkeletonComponent()
3 selected_bones = skeleton_component.GetSelectedBones()
4 print(len(selected_bones))

GetRootPositionRetargetingRatio ( self )

If the current object has motion bone retargeting, then get the position ratio (x, y, z) between the MotionRoot and SkinBoneRoot. If the current object is a prop then retargeting is not supported and (0, 0, 0) will be returned.

Returns

The motion and skin bone root position ratio - RVector3
1 # Get Motion Bones
2 skeleton_component = avatar.GetSkeletonComponent()
3 xyz_ratio = skeleton_component.GetRootPositionRetargetingRatio()
4 print(xyz_ratio.x)
5 print(xyz_ratio.y)
6 print(xyz_ratio.z)