Difference between revisions of "IC Python API:RLPy RIClip"
Chuck (RL) (Talk | contribs) m (Chuck (RL) moved page IC Python API:RLPy RlClip to IC Python API:RLPy RIClip) |
Chuck (RL) (Talk | contribs) m |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{TOC}} | {{TOC}} | ||
{{Parent|IC_Python_API:RL_Python_Modules|Modules}} | {{Parent|IC_Python_API:RL_Python_Modules|Modules}} | ||
− | == | + | {{last_modified}} |
− | + | ||
− | + | == Description == | |
− | == | + | |
− | + | [[File:Rlpy_riclip_img_01.png|left|frame|Animation keys reside in clips.]] | |
− | <syntaxhighlight lang=" | + | |
+ | An animation clip representes a sequence of connected motions. Different types of animations can be derived from composing clips and applying various clip operations. Animation clips are recorded for each character bone node or a scene object itself. One can access an animation clip's transform control via [[IC_Python_API:RLPy_RIClip|RIClip]], to facilitate subsequent key operations. | ||
+ | |||
+ | === Inheritance === | ||
+ | |||
+ | [[IC_Python_API:RLPy_RIBase|RIBase]] > [[IC_Python_API:RLPy_RIClip|RIClip]] {{clear}} | ||
+ | |||
+ | == Member Functions == | ||
+ | |||
+ | === GetControl ( self, strKey, spNode ) === | ||
+ | |||
+ | Get the transform control for a character's bone node or scene object according to the clip index. At the present, only "Layer" is supported as the clip key. If the character's skeleton bone node or the scene object does not have a clip or if the clip index is larger than the total number of clips, return '''None'''. | ||
+ | |||
+ | ==== Parameters ==== | ||
+ | :'''strKey''' [IN] Name for the clip key, currently only "Layer" is supported - string | ||
+ | :'''spNode''' [IN] Character skeleton bone node or the scene object node - [[IC_Python_API:RLPy_RIBase|RIBase]] | ||
+ | |||
+ | ==== Returns ==== | ||
+ | The transform control on a character's skeleton bone node or scene object. - [[IC_Python_API:RLPy_RControl|RControl]] | ||
+ | |||
+ | <syntaxhighlight lang="python" line='line'> | ||
+ | # Get skeleton component | ||
avatar_list = RLPy.RScene.GetAvatars() | avatar_list = RLPy.RScene.GetAvatars() | ||
avatar = avatar_list[0] | avatar = avatar_list[0] | ||
bone = avatar.GetSkeletonComponent() | bone = avatar.GetSkeletonComponent() | ||
− | + | ||
− | + | # Get transform control from bone root | |
− | # | + | clip_index = 1 |
− | + | clip = bone.GetClip(clip_index) | |
− | + | transform_control = clip.GetControl("Layer", bone.GetRootBone()) | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | == | + | |
− | === | + | === GetLength ( self ) === |
− | <syntaxhighlight lang=" | + | |
− | RLPy. | + | Get the length of this clip. If this clip does not contain a key then return RTime(0). |
+ | |||
+ | ==== Returns ==== | ||
+ | The length of this clip - [[IC_Python_API:RLPy_RTime|RTime]] | ||
+ | |||
+ | <syntaxhighlight lang="python" line='line'> | ||
+ | # Get skeleton component | ||
+ | avatar_list = RLPy.RScene.GetAvatars() | ||
+ | avatar = avatar_list[0] | ||
+ | bone = avatar.GetSkeletonComponent() | ||
+ | |||
+ | # Get clip length | ||
+ | clip_index = 1 | ||
+ | clip = bone.GetClip(clip_index) | ||
+ | clip_len = clip.GetLength() | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
− | |||
− | |||
− | ''' | + | === SetLength ( self, kLength ) === |
− | + | ||
− | ==== | + | Set the length of this clip. |
− | + | ||
− | < | + | ==== Parameters ==== |
− | + | :'''kLength''' [IN] The desired clip length - [[IC_Python_API:RLPy_RTime|RTime]] | |
− | === | + | |
− | + | ==== Return ==== | |
− | RLPy. | + | :Success - RLPy.RStatus.Success |
+ | :Failure - RLPy.RStatus.Failure | ||
+ | |||
+ | <syntaxhighlight lang="python" line='line'> | ||
+ | # Get skeleton component | ||
+ | avatar_list = RLPy.RScene.GetAvatars() | ||
+ | avatar = avatar_list[0] | ||
+ | bone = avatar.GetSkeletonComponent() | ||
+ | |||
+ | # Set clip length | ||
+ | clip_index = 1 | ||
+ | clip = bone.GetClip(clip_index) | ||
+ | clip_len = RLPy.RTime(2000) | ||
+ | clip.SetLength(clip_len) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
− | |||
− | |||
− | + | === GetLastKeyTime ( self ) === | |
− | + | Get the final key time on a scene object clip. | |
− | + | ||
− | ====Returns==== | + | ==== Returns ==== |
− | + | Time of the final key - [[IC_Python_API:RLPy_RTime|RTime]] | |
− | + | ||
− | + | <syntaxhighlight lang="python" line='line'> | |
− | + | # Get skeleton component | |
− | <syntaxhighlight lang=" | + | avatar_list = RLPy.RScene.GetAvatars() |
− | RLPy. | + | avatar = avatar_list[0] |
− | + | bone = avatar.GetSkeletonComponent() | |
− | Get | + | |
− | = | + | # Get last key time |
− | + | clip_index = 1 | |
− | + | clip = bone.GetClip(clip_index) | |
− | + | last_key_time = clip.GetLastKeyTime() | |
− | = | + | |
− | + | ||
− | + | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | '''kSceneTime''' [IN] | + | === SceneTimeToClipTime ( self, kSceneTime ) === |
− | + | ||
− | ====Returns==== | + | Convert a point in time within the scene to clip time. If a given object does not have a clip or if the clip index exceeds the total number of clips, then return scene time instead. |
− | + | ||
− | < | + | See Also: [[#ClipTimeToSceneTime ( self, kClipTime )|ClipTimeToSceneTime]] |
− | + | ||
− | === | + | ==== Parameters ==== |
− | + | :'''kSceneTime''' [IN] Project scene time - [[IC_Python_API:RLPy_RTime|RTime]] | |
− | RLPy. | + | |
+ | ==== Returns ==== | ||
+ | Clip time at the corresponding scene time - [[IC_Python_API:RLPy_RTime|RTime]] | ||
+ | |||
+ | <syntaxhighlight lang="python" line='line'> | ||
+ | # Get skeleton component | ||
+ | avatar_list = RLPy.RScene.GetAvatars() | ||
+ | avatar = avatar_list[0] | ||
+ | bone = avatar.GetSkeletonComponent() | ||
+ | |||
+ | # Scene time to clip time | ||
+ | clip_index = 1 | ||
+ | clip = bone.GetClip(clip_index) | ||
+ | scene_time = RLPy.RTime(13000) | ||
+ | clip_time = clip.SceneTimeToClipTime(scene_time) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
− | |||
− | |||
− | + | === ClipTimeToSceneTime ( self, kClipTime ) === | |
− | + | ||
− | ==== | + | |
− | + | ||
− | + | Convert a point in time within this clip to scene time. If a given object does not have a clip or if the clip index exceeds the total number of clips, then return the clip time instead. | |
− | ''' | + | See Also: [[#SceneTimeToClipTime ( self, kSceneTime )|SceneTimeToClipTime]] |
− | </ | + | |
+ | ==== Parameters ==== | ||
+ | :'''kClipTime''' [IN] Clip time - [[IC_Python_API:RLPy_RTime|RTime]] | ||
+ | |||
+ | ==== Returns ==== | ||
+ | Clip time converted to scene time - [[IC_Python_API:RLPy_RTime|RTime]] | ||
+ | |||
+ | <syntaxhighlight lang="python" line='line'> | ||
+ | # Get skeleton component | ||
+ | avatar_list = RLPy.RScene.GetAvatars() | ||
+ | avatar = avatar_list[0] | ||
+ | bone = avatar.GetSkeletonComponent() | ||
+ | |||
+ | # Clip time to scene time | ||
+ | clip_index = 1 | ||
+ | clip = bone.GetClip(clip_index) | ||
+ | clip_time = RLPy.RTime(2000) | ||
+ | scene_time = clip.ClipTimeToSceneTime(clip_time) | ||
+ | </syntaxhighlight> |
Latest revision as of 18:25, 15 April 2020
- Main article: Modules.
- Last modified: 04/15/2020
Description
An animation clip representes a sequence of connected motions. Different types of animations can be derived from composing clips and applying various clip operations. Animation clips are recorded for each character bone node or a scene object itself. One can access an animation clip's transform control via RIClip, to facilitate subsequent key operations.
Inheritance
RIBase > RIClipMember Functions
GetControl ( self, strKey, spNode )
Get the transform control for a character's bone node or scene object according to the clip index. At the present, only "Layer" is supported as the clip key. If the character's skeleton bone node or the scene object does not have a clip or if the clip index is larger than the total number of clips, return None.
Parameters
- strKey [IN] Name for the clip key, currently only "Layer" is supported - string
- spNode [IN] Character skeleton bone node or the scene object node - RIBase
Returns
The transform control on a character's skeleton bone node or scene object. - RControl
1 # Get skeleton component
2 avatar_list = RLPy.RScene.GetAvatars()
3 avatar = avatar_list[0]
4 bone = avatar.GetSkeletonComponent()
5
6 # Get transform control from bone root
7 clip_index = 1
8 clip = bone.GetClip(clip_index)
9 transform_control = clip.GetControl("Layer", bone.GetRootBone())
GetLength ( self )
Get the length of this clip. If this clip does not contain a key then return RTime(0).
Returns
The length of this clip - RTime
1 # Get skeleton component
2 avatar_list = RLPy.RScene.GetAvatars()
3 avatar = avatar_list[0]
4 bone = avatar.GetSkeletonComponent()
5
6 # Get clip length
7 clip_index = 1
8 clip = bone.GetClip(clip_index)
9 clip_len = clip.GetLength()
SetLength ( self, kLength )
Set the length of this clip.
Parameters
- kLength [IN] The desired clip length - RTime
Return
- Success - RLPy.RStatus.Success
- Failure - RLPy.RStatus.Failure
1 # Get skeleton component
2 avatar_list = RLPy.RScene.GetAvatars()
3 avatar = avatar_list[0]
4 bone = avatar.GetSkeletonComponent()
5
6 # Set clip length
7 clip_index = 1
8 clip = bone.GetClip(clip_index)
9 clip_len = RLPy.RTime(2000)
10 clip.SetLength(clip_len)
GetLastKeyTime ( self )
Get the final key time on a scene object clip.
Returns
Time of the final key - RTime
1 # Get skeleton component
2 avatar_list = RLPy.RScene.GetAvatars()
3 avatar = avatar_list[0]
4 bone = avatar.GetSkeletonComponent()
5
6 # Get last key time
7 clip_index = 1
8 clip = bone.GetClip(clip_index)
9 last_key_time = clip.GetLastKeyTime()
SceneTimeToClipTime ( self, kSceneTime )
Convert a point in time within the scene to clip time. If a given object does not have a clip or if the clip index exceeds the total number of clips, then return scene time instead.
See Also: ClipTimeToSceneTime
Parameters
- kSceneTime [IN] Project scene time - RTime
Returns
Clip time at the corresponding scene time - RTime
1 # Get skeleton component
2 avatar_list = RLPy.RScene.GetAvatars()
3 avatar = avatar_list[0]
4 bone = avatar.GetSkeletonComponent()
5
6 # Scene time to clip time
7 clip_index = 1
8 clip = bone.GetClip(clip_index)
9 scene_time = RLPy.RTime(13000)
10 clip_time = clip.SceneTimeToClipTime(scene_time)
ClipTimeToSceneTime ( self, kClipTime )
Convert a point in time within this clip to scene time. If a given object does not have a clip or if the clip index exceeds the total number of clips, then return the clip time instead.
See Also: SceneTimeToClipTime
Parameters
- kClipTime [IN] Clip time - RTime
Returns
Clip time converted to scene time - RTime
1 # Get skeleton component
2 avatar_list = RLPy.RScene.GetAvatars()
3 avatar = avatar_list[0]
4 bone = avatar.GetSkeletonComponent()
5
6 # Clip time to scene time
7 clip_index = 1
8 clip = bone.GetClip(clip_index)
9 clip_time = RLPy.RTime(2000)
10 scene_time = clip.ClipTimeToSceneTime(clip_time)