Difference between revisions of "IC Python API:RLPy RIFaceComponent"
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 is mainly used to set up the character's facial and head controls. [[IC_Python_API:RLPy_RIFaceComponent|RIFaceComponent]] data include 12 facial bones, 60 facial morphs and 24 custom morphs. You can open the details panel in the Face Puppet interface and press '''Ctrl+F2''' to display more detailed data. The numbered data in the front are the 60 morphs data, the next are 12 facial bones data, while the rest belong to the custom set. A few of the bones within the 12 facial bones have no effect. You can tell if it has no effect, therefore invalid, if the data name is marked "N/A". In addition, an expression clip needs to be set up in order to create expression keys. | |
− | head | + | |
− | + | ||
− | + | ||
− | + | ||
− | custom | + | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | === Inheritance === | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | [[IC_Python_API:RLPy_RIBase|RIBase]] > [[IC_Python_API:RLPy_RIFaceComponent|RIFaceComponent]] | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | == Member Functions == | |
− | + | ||
− | + | ||
− | + | ||
− | ==Member Functions== | + | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | === AddClip ( self, kTime, strName, kLength ) === | |
− | + | Create a new expression clip. | |
− | + | See Also: [[#GetKey ( self, kTime, kHead, kLeftEye, kRightEye, kMorph, kBone, kCustom, fStrength )|GetKey]], [[#AddEyeKey ( self, kTime, kLeftEye, kRightEye )|AddEyeKey]], [[#AddHeadKey ( self, kTime, kHead )|AddHeadKey]], [[#AddExpressionKey ( self, kTime, kMorph, kBone, kCustom, fStrength )|AddExpressionKey]] | |
− | + | ||
− | + | ||
− | + | ||
− | ''' | + | ==== Parameters ==== |
+ | :'''kTime''' [IN] Clip start time - [[IC_Python_API:RLPy_RTime|RTime]] | ||
+ | :'''strName''' [IN] Clip name - string | ||
+ | :'''kLength''' [IN] Clip length - [[IC_Python_API:RLPy_RTime|RTime]] | ||
− | + | ==== Return ==== | |
− | + | :Success - RLPy.RStatus.Success | |
− | + | :Failure - RLPy.RStatus.Failure | |
− | === | + | |
− | + | ||
− | RLPy. | + | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | '' | + | <syntaxhighlight lang="python" line='line'> |
+ | # Add Expression Clip | ||
+ | avatar_list = RLPy.RScene.GetAvatars() | ||
+ | avatar = avatar_list[0] | ||
+ | face_component = avatar.GetFaceComponent() | ||
− | + | result = face_component.AddClip(RLPy.RTime(0), "Clip", RLPy.RTime(10)) | |
+ | print(result) | ||
+ | </syntaxhighlight> | ||
− | + | === AddExpressionKey ( self, kTime, kMorph, kBone, kCustom, fStrength ) === | |
− | + | Create a new expression key at a given time. | |
− | + | See Also: [[#GetKey ( self, kTime, kHead, kLeftEye, kRightEye, kMorph, kBone, kCustom, fStrength )|GetKey]], [[#AddEyeKey ( self, kTime, kLeftEye, kRightEye )|AddEyeKey]], [[#AddHeadKey ( self, kTime, kHead )|AddHeadKey]] | |
− | + | ||
− | + | ||
− | + | ||
− | '''RLPy. | + | ==== Parameters ==== |
+ | :'''kTime''' [IN] Set the key time - [[IC_Python_API:RLPy_RTime|RTime]] | ||
+ | :'''kMorph''' [IN] Facial Morph 60 individual parameters - RLPy.FloatVector | ||
+ | :'''kCustom''' [IN] Custom 24 individual parameters - RLPy.FloatVector | ||
+ | :'''kBone''' [IN] Facial Bone 12 individual parameters - RLPy.FloatVector | ||
+ | :'''fStrength''' [IN] Facial part adjustment strength, 0 strength equals no effect - float [0.0,1.0] | ||
− | + | ==== Return ==== | |
− | < | + | :Success - RLPy.RStatus.Success |
− | + | :Failure - RLPy.RStatus.Failure | |
− | === | + | |
− | + | <syntaxhighlight lang="python" line='line'> | |
− | + | # Add Expression Key | |
+ | avatar_list = RLPy.RScene.GetAvatars() | ||
+ | avatar = avatar_list[0] | ||
+ | face_component = avatar.GetFaceComponent() | ||
+ | morph = RLPy.FloatVector() | ||
+ | bone = RLPy.FloatVector() | ||
+ | custom = RLPy.FloatVector() | ||
+ | morph.resize(60) | ||
+ | bone.resize(12) | ||
+ | custom.resize(24) | ||
+ | bone[9] = 0.5 | ||
+ | bone[10] = 0.5 | ||
+ | weight = 0.99 | ||
+ | face_component.AddExpressionKey( RLPy.RTime(0), morph, bone, custom, weight ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
− | |||
− | |||
− | |||
− | + | === AddEyeKey ( self, kTime, kLeftEye, kRightEye ) === | |
− | + | Move the eye vertically/horizontally. | |
− | + | See Also: [[#GetKey ( self, kTime, kHead, kLeftEye, kRightEye, kMorph, kBone, kCustom, fStrength )|GetKey]], [[#AddHeadKey ( self, kTime, kHead )|AddHeadKey]], [[#AddExpressionKey ( self, kTime, kMorph, kBone, kCustom, fStrength )|AddExpressionKey]] | |
− | + | ||
− | + | ||
− | + | ||
− | '''RLPy. | + | ==== Parameters ==== |
+ | :'''kTime''' [IN] Key time - [[IC_Python_API:RLPy_RTime|RTime]] | ||
+ | :'''kLeftEye''' [IN] Horiztonal and vertical movement of the left eye - RLPy.FloatVector [0.0,1.0] | ||
+ | :'''kRightEye''' [IN] Horiztonal and vertical movement of the right eye - RLPy.FloatVector [0.0,1.0] | ||
− | + | ==== Return ==== | |
− | + | :Success - RLPy.RStatus.Success | |
− | - | + | :Failure - RLPy.RStatus.Failure |
− | + | ||
− | <syntaxhighlight lang=" | + | <syntaxhighlight lang="python" line='line'> |
− | RLPy. | + | # Add Eye Key |
+ | avatar_list = RLPy.RScene.GetAvatars() | ||
+ | avatar = avatar_list[0] | ||
+ | face_component = avatar.GetFaceComponent() | ||
+ | eye_l = [ 0.2, 0.2 ] #[ Horizontal, Vertical ] | ||
+ | eye_r = [ 0.2, 0.2 ] #[ Horizontal, Vertical ] | ||
+ | result = face_component.AddEyeKey( RLPy.RTime( 0 ), eye_l, eye_r ) | ||
+ | print(result) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
− | |||
− | |||
− | |||
− | + | === AddHeadKey ( self, kTime, kHead ) === | |
− | + | Controls head rotations. | |
− | + | ||
− | + | ||
− | + | ||
− | + | See Also: [[#GetKey ( self, kTime, kHead, kLeftEye, kRightEye, kMorph, kBone, kCustom, fStrength )|GetKey]], [[#AddEyeKey ( self, kTime, kLeftEye, kRightEye )|AddEyeKey]], [[#AddExpressionKey ( self, kTime, kMorph, kBone, kCustom, fStrength )|AddExpressionKey]] | |
− | + | ==== Parameters ==== | |
− | + | :'''kTime''' [IN] Key time - [[IC_Python_API:RLPy_RTime|RTime]] | |
− | + | :'''kHead''' [IN] Horizontal and vertical tilt data for the head - float list [0.0,1.0] | |
− | === | + | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ==== Return ==== | |
+ | :Success - RLPy.RStatus.Success | ||
+ | :Failure - RLPy.RStatus.Failure | ||
− | '' | + | <syntaxhighlight lang="python" line='line'> |
+ | # Add Head Key | ||
+ | avatar_list = RLPy.RScene.GetAvatars() | ||
+ | avatar = avatar_list[0] | ||
+ | face_component = avatar.GetFaceComponent() | ||
+ | result = face_component.AddHeadKey( RLPy.RTime( 0 ), [ 0.1, 0.4, 0.8 ] ) | ||
+ | #[ Vertical, Horizontal, Tilt ] | ||
+ | print(result) | ||
+ | </syntaxhighlight> | ||
− | + | === GetKey ( self, kTime, kHead, kLeftEye, kRightEye, kMorph, kBone, kCustom, fStrength ) === | |
− | + | Get all key data for an expression. | |
− | + | See Also: [[#AddEyeKey ( self, kTime, kLeftEye, kRightEye )|AddEyeKey]], [[#AddHeadKey ( self, kTime, kHead )|AddHeadKey]], [[#AddExpressionKey ( self, kTime, kMorph, kBone, kCustom, fStrength )|AddExpressionKey]] | |
− | ''' | + | ==== Parameters ==== |
+ | :'''kTime''' [IN] Key time - [[IC_Python_API:RLPy_RTime|RTime]] | ||
+ | :'''kHead''' [OUT] Head horizontal and vertical tilt data - float list | ||
+ | :'''kLeftEye''' [OUT] Horiztonal and vertical movement of the left eye - RLPy.FloatVector [0.0,1.0] | ||
+ | :'''kRightEye''' [OUT] Horizontal and vertical movement of the right eye - RLPy.FloatVector [0.0,1.0] | ||
+ | :'''kMorph''' [IN] Facial Morph 60 parameter values - RLPy.FloatVector | ||
+ | :'''kCustom''' [IN] Custom 24 parameter values- RLPy.FloatVector | ||
+ | :'''kBone''' [IN] Facial Bone 12 parameter values - RLPy.FloatVector | ||
+ | :'''fStrength''' [IN] Face morph strength (0: no change) - float | ||
− | + | ==== Return ==== | |
+ | :Success - RLPy.RStatus.Success | ||
+ | :Failure - RLPy.RStatus.Failure | ||
− | '' | + | <syntaxhighlight lang="python" line='line'> |
− | + | # Get facial Key | |
− | ==== | + | avatar_list = RLPy.RScene.GetAvatars() |
− | + | avatar = avatar_list[0] | |
− | + | face_component = avatar.GetFaceComponent() | |
− | + | # Get current facial key | |
− | + | head = RLPy.FloatVector() # reference variable | |
− | + | left_eye = RLPy.FloatVector() | |
− | </ | + | right_eye = RLPy.FloatVector() |
+ | morph = RLPy.FloatVector() | ||
+ | custom = RLPy.FloatVector() | ||
+ | bone = RLPy.FloatVector() | ||
+ | weight = 0.0 | ||
+ | result = face_component.GetKey(time, head, left_eye, right_eye, morph, custom, bone, weight) | ||
+ | print(result[0]) # RStatus: result[0] | ||
+ | print(result[1]) # weight: result[1] | ||
+ | print(head) # head weight | ||
+ | print(left_eye) # left eye weight | ||
+ | print(right_eye) # right eye weight | ||
+ | print(morph) # morph weight | ||
+ | print(custom) # custom weight | ||
+ | print(bone) # bone weight | ||
+ | </syntaxhighlight> |
Latest revision as of 00:54, 21 April 2020
Contents
- 1 Description
- 2 Member Functions
- Main article: Modules.
- Last modified: 04/21/2020
Description
This class is mainly used to set up the character's facial and head controls. RIFaceComponent data include 12 facial bones, 60 facial morphs and 24 custom morphs. You can open the details panel in the Face Puppet interface and press Ctrl+F2 to display more detailed data. The numbered data in the front are the 60 morphs data, the next are 12 facial bones data, while the rest belong to the custom set. A few of the bones within the 12 facial bones have no effect. You can tell if it has no effect, therefore invalid, if the data name is marked "N/A". In addition, an expression clip needs to be set up in order to create expression keys.
Inheritance
RIBase > RIFaceComponent
Member Functions
AddClip ( self, kTime, strName, kLength )
Create a new expression clip.
See Also: GetKey, AddEyeKey, AddHeadKey, AddExpressionKey
Parameters
Return
- Success - RLPy.RStatus.Success
- Failure - RLPy.RStatus.Failure
1 # Add Expression Clip
2 avatar_list = RLPy.RScene.GetAvatars()
3 avatar = avatar_list[0]
4 face_component = avatar.GetFaceComponent()
5
6 result = face_component.AddClip(RLPy.RTime(0), "Clip", RLPy.RTime(10))
7 print(result)
AddExpressionKey ( self, kTime, kMorph, kBone, kCustom, fStrength )
Create a new expression key at a given time.
See Also: GetKey, AddEyeKey, AddHeadKey
Parameters
- kTime [IN] Set the key time - RTime
- kMorph [IN] Facial Morph 60 individual parameters - RLPy.FloatVector
- kCustom [IN] Custom 24 individual parameters - RLPy.FloatVector
- kBone [IN] Facial Bone 12 individual parameters - RLPy.FloatVector
- fStrength [IN] Facial part adjustment strength, 0 strength equals no effect - float [0.0,1.0]
Return
- Success - RLPy.RStatus.Success
- Failure - RLPy.RStatus.Failure
1 # Add Expression Key
2 avatar_list = RLPy.RScene.GetAvatars()
3 avatar = avatar_list[0]
4 face_component = avatar.GetFaceComponent()
5 morph = RLPy.FloatVector()
6 bone = RLPy.FloatVector()
7 custom = RLPy.FloatVector()
8 morph.resize(60)
9 bone.resize(12)
10 custom.resize(24)
11 bone[9] = 0.5
12 bone[10] = 0.5
13 weight = 0.99
14 face_component.AddExpressionKey( RLPy.RTime(0), morph, bone, custom, weight )
AddEyeKey ( self, kTime, kLeftEye, kRightEye )
Move the eye vertically/horizontally.
See Also: GetKey, AddHeadKey, AddExpressionKey
Parameters
- kTime [IN] Key time - RTime
- kLeftEye [IN] Horiztonal and vertical movement of the left eye - RLPy.FloatVector [0.0,1.0]
- kRightEye [IN] Horiztonal and vertical movement of the right eye - RLPy.FloatVector [0.0,1.0]
Return
- Success - RLPy.RStatus.Success
- Failure - RLPy.RStatus.Failure
1 # Add Eye Key
2 avatar_list = RLPy.RScene.GetAvatars()
3 avatar = avatar_list[0]
4 face_component = avatar.GetFaceComponent()
5 eye_l = [ 0.2, 0.2 ] #[ Horizontal, Vertical ]
6 eye_r = [ 0.2, 0.2 ] #[ Horizontal, Vertical ]
7 result = face_component.AddEyeKey( RLPy.RTime( 0 ), eye_l, eye_r )
8 print(result)
AddHeadKey ( self, kTime, kHead )
Controls head rotations.
See Also: GetKey, AddEyeKey, AddExpressionKey
Parameters
- kTime [IN] Key time - RTime
- kHead [IN] Horizontal and vertical tilt data for the head - float list [0.0,1.0]
Return
- Success - RLPy.RStatus.Success
- Failure - RLPy.RStatus.Failure
1 # Add Head Key
2 avatar_list = RLPy.RScene.GetAvatars()
3 avatar = avatar_list[0]
4 face_component = avatar.GetFaceComponent()
5 result = face_component.AddHeadKey( RLPy.RTime( 0 ), [ 0.1, 0.4, 0.8 ] )
6 #[ Vertical, Horizontal, Tilt ]
7 print(result)
GetKey ( self, kTime, kHead, kLeftEye, kRightEye, kMorph, kBone, kCustom, fStrength )
Get all key data for an expression.
See Also: AddEyeKey, AddHeadKey, AddExpressionKey
Parameters
- kTime [IN] Key time - RTime
- kHead [OUT] Head horizontal and vertical tilt data - float list
- kLeftEye [OUT] Horiztonal and vertical movement of the left eye - RLPy.FloatVector [0.0,1.0]
- kRightEye [OUT] Horizontal and vertical movement of the right eye - RLPy.FloatVector [0.0,1.0]
- kMorph [IN] Facial Morph 60 parameter values - RLPy.FloatVector
- kCustom [IN] Custom 24 parameter values- RLPy.FloatVector
- kBone [IN] Facial Bone 12 parameter values - RLPy.FloatVector
- fStrength [IN] Face morph strength (0: no change) - float
Return
- Success - RLPy.RStatus.Success
- Failure - RLPy.RStatus.Failure
1 # Get facial Key
2 avatar_list = RLPy.RScene.GetAvatars()
3 avatar = avatar_list[0]
4 face_component = avatar.GetFaceComponent()
5 # Get current facial key
6 head = RLPy.FloatVector() # reference variable
7 left_eye = RLPy.FloatVector()
8 right_eye = RLPy.FloatVector()
9 morph = RLPy.FloatVector()
10 custom = RLPy.FloatVector()
11 bone = RLPy.FloatVector()
12 weight = 0.0
13 result = face_component.GetKey(time, head, left_eye, right_eye, morph, custom, bone, weight)
14 print(result[0]) # RStatus: result[0]
15 print(result[1]) # weight: result[1]
16 print(head) # head weight
17 print(left_eye) # left eye weight
18 print(right_eye) # right eye weight
19 print(morph) # morph weight
20 print(custom) # custom weight
21 print(bone) # bone weight