Difference between revisions of "IC Python API:RLPy RIMorphComponent"
From Reallusion Wiki!
Chuck (RL) (Talk | contribs) (Created page with "{{TOC}} {{Parent|IC_Python_API:RL_Python_Modules|Modules}} ==Inheritance== This class inherits public member functions from: *RLPy.RIBase ==Detai...") |
Chuck (RL) (Talk | contribs) m |
||
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 == | |
− | + | ||
− | == | + | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | 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 [[IC_Python_API:RLPy_RIProp|RIProp]] and [[IC_Python_API:RLPy_RIAvatar|RIAvatar]]. | |
− | + | === Inheritance === | |
− | + | [[IC_Python_API:RLPy_RIBase|RIBase]] > [[IC_Python_API:RLPy_RIMorphComponent|RIMorphComponent]] | |
− | + | == Member Functions == | |
− | + | === AddKey ( self, strMeshName, strMorphName, kTime, fWeight, bSendEvent, bPauseAP ) === | |
− | + | See also: [[IC_Python_API:RLPy_RTime|RTime]], [[IC_Python_API:RLPy_RStatus|RStatus]], [[#GetWeight ( self, strMeshName, strMorphName, kTime, fWeight )|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 - [[IC_Python_API:RLPy_RTime|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 |
− | + | ||
− | <syntaxhighlight lang=" | + | <syntaxhighlight lang="python" line='line'> |
− | RLPy. | + | avatar_list = RLPy.RScene.GetAvatars() |
+ | morph_component = avatar_list[0].GetMorphComponent() | ||
+ | result = morph_component.AddKey( "your_mesh_name", "your_morph_name", RLPy.RTime(67), 0.5, False, False ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
− | |||
− | |||
− | |||
− | + | === GetMorphNames ( self, strMeshName ) === | |
− | + | ||
− | === | + | |
− | + | ||
− | ''' | + | Get all the morph target names for a given mesh on this morph component. |
− | + | ||
− | + | See also: [[IC_Python_API:RLPy_RIAvatar|RIAvatar]] | |
− | === | + | |
− | <syntaxhighlight lang=" | + | ==== Parameters ==== |
− | RLPy. | + | :'''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 | ||
+ | |||
+ | <syntaxhighlight lang="python" line='line'> | ||
+ | avatar_list = RLPy.RScene.GetAvatars() | ||
+ | morph_component = avatar_list[0].GetMorphComponent() | ||
+ | morph_names = morph_component.GetMorphNames("your_mesh_name") | ||
+ | for _name in morph_names: | ||
+ | print(_name) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
− | |||
− | |||
− | |||
− | + | === 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 ( self, strMeshName, strMorphName, kTime, fWeight, bSendEvent, bPauseAP )|AddKey]], [[IC_Python_API:RLPy_RTime|RTime]], [[IC_Python_API:RLPy_RStatus|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 - [[IC_Python_API:RLPy_RTime|RTime]] | |
+ | :'''fWeight''' [OUT] Return the morph weight for the mesh morph target - float | ||
− | + | ==== Return ==== | |
+ | :Success - RLPy.RStatus.Success | ||
+ | :Failure - RLPy.RStatus.Failure | ||
− | '' | + | <syntaxhighlight lang="python" line='line'> |
− | + | avatar_list = RLPy.RScene.GetAvatars() | |
− | + | morph_component = avatar_list[0].GetMorphComponent() | |
− | = | + | f_ret_weight = 0 |
− | + | return_list = morph_component.GetWeight( "your_mesh_name", "your_morph_name", RLPy.RTime(67), f_ret_weight ) | |
− | RLPy. | + | f_ret_weight = return_list[1] |
+ | print(f_ret_weight) # is 0.5 | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
− | |||
− | |||
− | |||
− | + | === RemoveAllKeys ( self, strMeshName, strMorphName ) === | |
− | + | Remove all morph keys for a given mesh and morph name on this morph component. | |
− | + | ||
− | + | ||
− | + | ||
− | + | See also: [[#AddKey ( self, strMeshName, strMorphName, kTime, fWeight, bSendEvent, bPauseAP )|AddKey]], [[IC_Python_API:RLPy_RStatus|RStatus]] | |
− | '''RLPy.RStatus.Failure'' | + | ==== 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 | ||
+ | |||
+ | <syntaxhighlight lang="python" line='line'> | ||
+ | avatar_list = RLPy.RScene.GetAvatars() | ||
+ | morph_component = avatar_list[0].GetMorphComponent() | ||
+ | result = morph_component.RemoveAllKeys("your_mesh_name", "your_morph_name") | ||
+ | </syntaxhighlight> |
Latest revision as of 23:24, 15 April 2020
- Main article: Modules.
- Last modified: 04/15/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.
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")