IC Python API:RLPy RIClip

From Reallusion Wiki!
Revision as of 19:23, 15 April 2020 by Chuck (RL) (Talk | contribs)

Jump to: navigation, search
Main article: Modules.
Last modified: 04/15/2020

Description

Animation keys reside in clips.

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 > RIClip

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 - 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)