Difference between revisions of "IC Python API:RLPy RISkeletonComponent"

From Reallusion Wiki!
Jump to: navigation, search
(Created page with "{{TOC}} {{Parent|IC_Python_API:RL_Python_Modules|Modules}} ==Inheritance== This class inherits public member functions from: *RLPy.RIBase ==Detai...")
 
m
 
Line 1: Line 1:
 
{{TOC}}
 
{{TOC}}
 
{{Parent|IC_Python_API:RL_Python_Modules|Modules}}
 
{{Parent|IC_Python_API:RL_Python_Modules|Modules}}
==Inheritance==
+
{{last_modified}}
This class inherits public member functions from:
+
 
*[[IC_Python_API:RLPy_RIBase|RLPy.RIBase]]
+
== Description ==
==Detailed Description==
+
 
This class is the interface to the bone system in the scene.
+
[[File:Rlpy_riskeletoncomponent_01.png|frame|left|Motion bones are responsible for retargeting motion between different characters of different sizes and proportions.]]
<syntaxhighlight lang="Python">
+
 
avatars = RLPy.RGlobal.GetAvatars()
+
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 [[IC_Python_API:RLPy_RIAvatar|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.
bone = avatars[0].GetSkeletonComponent()
+
 
print(bone.GetClip(0))
+
=== Inheritance ===
+
 
# get selected bone
+
[[IC_Python_API:RLPy_RIBase|RIBase]]> [[IC_Python_API:RLPy_RISkeletonComponent|RISkeletonComponent]]
selected_bones = bone.GetSelectedBones()
+
{{clear}}
print(len(selected_bones))
+
 
+
== Member Functions ==
# get root bone
+
 
root_bone = bone.GetRootBone()
+
=== GetClip ( self, uIndex ) ===
print(root_bone)
+
 
 +
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: [[IC_Python_API:RLPy_RIClip|RIClip]]  
 +
 
 +
==== Parameters ====
 +
:'''uIndex''' [IN] Index number for the Clip - integer
 +
 
 +
==== Returns ====
 +
:The newly copied animation clip object - [[IC_Python_API:RLPy_RIClip|RIClip]]
 +
 
 +
<syntaxhighlight lang="python" line='line'>
 +
# Get Clip
 +
skeleton_component = avatar.GetSkeletonComponent()
 +
print(skeleton_component.GetClip(0))
 
</syntaxhighlight>
 
</syntaxhighlight>
==Member Functions==
+
 
===GetClip===
+
=== GetClipCount ( self ) ===
<syntaxhighlight lang="Python">
+
 
RLPy.RISkeletonComponent.GetClip ( self, uIndex )
+
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: [[IC_Python_API:RLPy_RIClip|RIClip]]
 +
 
 +
==== Returns ====
 +
:The total number of clips in this skeleton component - integer
 +
 
 +
<syntaxhighlight lang="python" line='line'>
 +
# Get Clip Count
 +
skeleton_component = avatar.GetSkeletonComponent()
 +
print(skeleton_component.GetClipCount())
 
</syntaxhighlight>
 
</syntaxhighlight>
Get clip of the bone.
 
====Parameters====
 
<div style="margin-left: 2em;">
 
  
'''uIndex''' [IN] Index of the clip - int
+
=== GetMotionBones ( self ) ===
</div>
+
 
====Returns====
+
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.
<div style="margin-left: 2em;">Pointer to the clip - RLPy.RIClip
+
 
</div>
+
See also: [[IC_Python_API:RLPy_RINode|RINode]]
-----
+
 
===GetClipCount===
+
==== Returns ====
<syntaxhighlight lang="Python">
+
:All of the motion bone nodes - [[IC_Python_API:RLPy_RINode|RINode]] list
RLPy.RISkeletonComponent.GetClipCount ( self )
+
 
 +
<syntaxhighlight lang="python" line='line'>
 +
# Get Motion Bones
 +
skeleton_component = avatar.GetSkeletonComponent()
 +
motion_bones = skeleton_component.GetMotionBones()
 +
print(len(motion_bones))
 
</syntaxhighlight>
 
</syntaxhighlight>
Get number of clips.
+
 
====Returns====
+
=== GetRootBone ( self ) ===
<div style="margin-left: 2em;">Number of clips - int
+
 
</div>
+
Get the root bone of this skeleton component.
-----
+
 
===GetMotionBones===
+
See also: [[IC_Python_API:RLPy_RINode|RINode]]
<syntaxhighlight lang="Python">
+
 
RLPy.RISkeletonComponent.GetMotionBones ( self )
+
==== Returns ====
 +
:The root bone - [[IC_Python_API:RLPy_RINode|RINode]]
 +
 
 +
<syntaxhighlight lang="python" line='line'>
 +
# Get Motion Bones
 +
skeleton_component = avatar.GetSkeletonComponent()
 +
root_bone = skeleton_component.GetRootBone()
 +
print(root_bone.GetName())
 
</syntaxhighlight>
 
</syntaxhighlight>
Get motion bones of the object.
+
 
====Returns====
+
=== GetSkinBones ( self ) ===
<div style="margin-left: 2em;">Motion bone nodes - list
+
 
</div>
+
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.
-----
+
 
===GetRootBone===
+
See also: [[IC_Python_API:RLPy_RINode|RINode]]
<syntaxhighlight lang="Python">
+
 
RLPy.RISkeletonComponent.GetRootBone ( self )
+
==== Returns ====
 +
:All of the skin bone nodes - [[IC_Python_API:RLPy_RINode|RINode]] list
 +
 
 +
<syntaxhighlight lang="python" line='line'>
 +
# Get Motion Bones
 +
skeleton_component = avatar.GetSkeletonComponent()
 +
motion_bones = skeleton_component.GetSkinBones()
 +
print(len(motion_bones))
 
</syntaxhighlight>
 
</syntaxhighlight>
Get root bone.
+
 
====Returns====
+
=== GetSelectedBones ( self ) ===
<div style="margin-left: 2em;">Pointer to root bone - RLPy.RINode
+
 
</div>
+
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.
-----
+
 
===GetSelectedBones===
+
==== Returns ====
<syntaxhighlight lang="Python">
+
:All of the currently selected bones - [[IC_Python_API:RLPy_RINode|RINode]] list
RLPy.RISkeletonComponent.GetSelectedBones ( self )
+
 
 +
<syntaxhighlight lang="python" line='line'>
 +
# Get Motion Bones
 +
skeleton_component = avatar.GetSkeletonComponent()
 +
selected_bones = skeleton_component.GetSelectedBones()
 +
print(len(selected_bones))
 
</syntaxhighlight>
 
</syntaxhighlight>
Get selected bone.
+
 
====Returns====
+
=== GetRootPositionRetargetingRatio ( self ) ===
<div style="margin-left: 2em;">Selected bones - list
+
 
</div>
+
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.
-----
+
 
===GetSkinBones===
+
==== Returns ====
<syntaxhighlight lang="Python">
+
:The motion and skin bone root position ratio - [[IC_Python_API:RLPy_RVector3|RVector3]]
RLPy.RISkeletonComponent.GetSkinBones ( self )
+
 
 +
<syntaxhighlight lang="python" line='line'>
 +
# Get Motion Bones
 +
skeleton_component = avatar.GetSkeletonComponent()
 +
xyz_ratio = skeleton_component.GetRootPositionRetargetingRatio()
 +
print(xyz_ratio.x)
 +
print(xyz_ratio.y)
 +
print(xyz_ratio.z)
 
</syntaxhighlight>
 
</syntaxhighlight>
Get skin bones of avatar.
 
====Returns====
 
<div style="margin-left: 2em;">Skin bone nodes - list
 
</div>
 

Latest revision as of 20:33, 29 April 2020

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)