IC Python API:RLPy RIMorphComponent

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

Description

This class can edit morph animation keys and retrieve morph weights on a target Avatar or Prop. A specific mesh name must be provided for the functions of this class, because every mesh can carry multiple morph targets. This class can only be used with RIProp and RIAvatar.

Inheritance

RIBase > RIMorphComponent 

Member Functions

AddKey ( self, strMeshName, strMorphName, kTime, fWeight, bSendEvent, bPauseAP )

See also: RTime, RStatus, GetWeight

Parameters

strMeshName [IN] Mesh name - string
strMorphName [IN] Name of a morph applied to the mesh - string
kTime [IN] Point in time for applying the key - RTime
fWeight [IN] The weight for the morph key - float
bSendEvent [IN] Whether the key creation will broadcast an application-level event - bool
bPauseAP [IN] Whether the key creation will pause the application - bool

Return

Success - RLPy.RStatus.Success
Failure - RLPy.RStatus.Failure
1 avatar_list = RLPy.RScene.GetAvatars()
2 morph_component = avatar_list[0].GetMorphComponent()
3 result = morph_component.AddKey( "your_mesh_name", "your_morph_name", RLPy.RTime(67), 0.5, False, False )

GetMorphNames ( self, strMeshName )

Get all the morph target names for a given mesh on this morph component.

See also: RIAvatar

Parameters

strMeshName [IN] Name for the mesh with morphs applied - string

Returns

List of names for all of the morphs applied to the mesh - string list

1 avatar_list = RLPy.RScene.GetAvatars()
2 morph_component = avatar_list[0].GetMorphComponent()
3 morph_names = morph_component.GetMorphNames("your_mesh_name")
4 for _name in morph_names:
5     print(_name)

GetWeight ( self, strMeshName, strMorphName, kTime, fWeight )

Get the morph target weight for a given mesh and morph name at the requested time on this morph component.

See also: AddKey, RTime, RStatus

Parameters

strMeshName [IN] Name of the mesh that contains the morph target - string
strMorphName [IN] Name of a morph target for retrieving the morph weight at a specified time - string
kTime [IN] Point in time for retrieving the morph weight value - RTime
fWeight [OUT] Return the morph weight for the mesh morph target - float

Return

Success - RLPy.RStatus.Success
Failure - RLPy.RStatus.Failure
1 avatar_list = RLPy.RScene.GetAvatars()
2 morph_component = avatar_list[0].GetMorphComponent()
3 f_ret_weight = 0
4 return_list = morph_component.GetWeight( "your_mesh_name", "your_morph_name", RLPy.RTime(67), f_ret_weight )
5 f_ret_weight = return_list[1]
6 print(f_ret_weight) # is 0.5

RemoveAllKeys ( self, strMeshName, strMorphName )

Remove all morph keys for a given mesh and morph name on this morph component.

See also: AddKey, RStatus

Parameters

strMeshName [IN] Mesh name for morph key deletion - string
strMorphName [IN] Morph name for morph key deletion - string

Return

Success - RLPy.RStatus.Success
Failure - RLPy.RStatus.Failure
1 avatar_list = RLPy.RScene.GetAvatars()
2 morph_component = avatar_list[0].GetMorphComponent()
3 result = morph_component.RemoveAllKeys("your_mesh_name", "your_morph_name")