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

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]]
+
==Detailed Description==
+
RIMorphComponent.
+
<span style="background:#ffcccc">( Experimental Class )</span> <syntaxhighlight lang="Python">
+
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 )
+
+
f_ret_weight = 0
+
return_list = morph_component.GetWeight( "your_mesh_name", "your_morph_name", RLPy.RTime(67), f_ret_weight )
+
f_ret_weight = return_list[1]
+
print(f_ret_weight) # is 0.5
+
+
result = morph_component.RemoveAllKeys("your_mesh_name", "your_morph_name")
+
  
morph_names = morph_component.GetMorphNames("your_mesh_name")
+
== Description ==
</syntaxhighlight>
+
==Member Functions==
+
===AddKey===
+
<syntaxhighlight lang="Python">
+
RLPy.RIMorphComponent.AddKey ( self, strMeshName, strMorphName, kTime, fWeight, bSendEvent, bPauseAP )
+
</syntaxhighlight>
+
Add a morph key by morph name.
+
<span style="background:#ffcccc">( Experimental API )</span>
+
====Parameters====
+
<div style="margin-left: 2em;">
+
  
'''strMeshName''' [IN] The name of mesh - string
+
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]].
  
'''strMorphName''' [IN] The name of morph target for the specified mesh name - string
+
=== Inheritance ===
  
'''kTime''' [IN] The time at which to add the key - RLPy.RTime
+
[[IC_Python_API:RLPy_RIBase|RIBase]] > [[IC_Python_API:RLPy_RIMorphComponent|RIMorphComponent]]  
  
'''fWeight''' [IN] The weight for morph target - float
+
== Member Functions ==
  
'''bSendEvent''' [IN] send event after add key - bool
+
=== AddKey ( self, strMeshName, strMorphName, kTime, fWeight, bSendEvent, bPauseAP ) ===
  
'''bPauseAP''' [IN] pause AP after add key - bool
+
See also: [[IC_Python_API:RLPy_RTime|RTime]], [[IC_Python_API:RLPy_RStatus|RStatus]], [[#GetWeight ( self, strMeshName, strMorphName, kTime, fWeight )|GetWeight]]
</div>
+
====Return Values====
+
<div style="margin-left: 2em;">
+
  
'''RLPy.RStatus.Success''' Success
+
==== 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
  
'''RLPy.RStatus.Failure''' Fail
+
==== Return ====
</div>
+
:Success - RLPy.RStatus.Success
-----
+
:Failure - RLPy.RStatus.Failure
===GetMorphNames===
+
 
<syntaxhighlight lang="Python">
+
<syntaxhighlight lang="python" line='line'>
RLPy.RIMorphComponent.GetMorphNames ( self, strMeshName )
+
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>
Get all morph target names from mesh.
 
<span style="background:#ffcccc">( Experimental API )</span>
 
====Parameters====
 
<div style="margin-left: 2em;">
 
  
'''strMeshName''' [IN] The name of mesh - string
+
=== GetMorphNames ( self, strMeshName ) ===
</div>
+
====Return Values====
+
<div style="margin-left: 2em;">
+
  
'''names''' of morph
+
Get all the morph target names for a given mesh on this morph component.
</div>
+
 
-----
+
See also: [[IC_Python_API:RLPy_RIAvatar|RIAvatar]]
===GetWeight===
+
 
<syntaxhighlight lang="Python">
+
==== Parameters ====
RLPy.RIMorphComponent.GetWeight ( self, strMeshName, strMorphName, kTime, fWeight )
+
:'''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>
Get a morph target weight from morph animation.
 
<span style="background:#ffcccc">( Experimental API )</span>
 
====Parameters====
 
<div style="margin-left: 2em;">
 
  
'''strMeshName''' [IN] The name of mesh - string
+
=== GetWeight ( self, strMeshName, strMorphName, kTime, fWeight ) ===
  
'''strMorphName''' [IN] The name of morph target for the specified mesh name - string
+
Get the morph target weight for a given mesh and morph name at the requested time on this morph component.
  
'''kTime''' [IN] The time at which to get the weight - RLPy.RTime
+
See also: [[#AddKey ( self, strMeshName, strMorphName, kTime, fWeight, bSendEvent, bPauseAP )|AddKey]], [[IC_Python_API:RLPy_RTime|RTime]], [[IC_Python_API:RLPy_RStatus|RStatus]]
  
'''fWeight''' [OUT] Returns the weight value for the specified morph name - float
+
==== Parameters ====
</div>
+
:'''strMeshName''' [IN] Name of the mesh that contains the morph target - string
====Return Values====
+
:'''strMorphName''' [IN] Name of a morph target for retrieving the morph weight at a specified time - string
<div style="margin-left: 2em;">
+
:'''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
  
'''RLPy.RStatus.Success''' Success
+
==== Return ====
 +
:Success - RLPy.RStatus.Success
 +
:Failure - RLPy.RStatus.Failure
  
'''RLPy.RStatus.Failure''' Fail
+
<syntaxhighlight lang="python" line='line'>
</div>
+
avatar_list = RLPy.RScene.GetAvatars()
-----
+
morph_component = avatar_list[0].GetMorphComponent()
===RemoveAllKeys===
+
f_ret_weight = 0
<syntaxhighlight lang="Python">
+
return_list = morph_component.GetWeight( "your_mesh_name", "your_morph_name", RLPy.RTime(67), f_ret_weight )
RLPy.RIMorphComponent.RemoveAllKeys ( self, strMeshName, strMorphName )
+
f_ret_weight = return_list[1]
 +
print(f_ret_weight) # is 0.5
 
</syntaxhighlight>
 
</syntaxhighlight>
Removes all keys by morph name.
 
<span style="background:#ffcccc">( Experimental API )</span>
 
====Parameters====
 
<div style="margin-left: 2em;">
 
  
'''strMeshName''' [IN] The name of mesh - string
+
=== RemoveAllKeys ( self, strMeshName, strMorphName ) ===
  
'''strMorphName''' [IN] The name of morph target - string
+
Remove all morph keys for a given mesh and morph name on this morph component.
</div>
+
====Return Values====
+
<div style="margin-left: 2em;">
+
  
'''RLPy.RStatus.Success''' Success
+
See also: [[#AddKey ( self, strMeshName, strMorphName, kTime, fWeight, bSendEvent, bPauseAP )|AddKey]], [[IC_Python_API:RLPy_RStatus|RStatus]]
  
'''RLPy.RStatus.Failure''' Fail
+
==== Parameters ====
</div>
+
:'''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.

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