Difference between revisions of "IC Python API:RLPy RIAvatar"
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.RIObject *...") |
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}} | ||
− | ==Inheritance== | + | {{last_modified}} |
+ | |||
+ | == Description == | ||
+ | |||
+ | 這個類別主要是場景上角色物件的類別,它提供訪問該對象所有組件的方法,例如 : [[IC_Python_API:RLPy_RISkeletonComponent|RISkeletonComponent]], [[IC_Python_API:RLPy_RIVisemeComponent|RIVisemeComponent]], RIFaceComponent.......等,藉由取得相關組件後,便可進行該類操作以及控制。 | ||
+ | |||
+ | === Inheritance === | ||
+ | |||
This class inherits public member functions from: | This class inherits public member functions from: | ||
+ | |||
*[[IC_Python_API:RLPy_RIObject|RLPy.RIObject]] | *[[IC_Python_API:RLPy_RIObject|RLPy.RIObject]] | ||
− | + | ||
− | == | + | === Examples === |
− | + | ||
− | + | <syntaxhighlight lang="Python"> | |
− | + | ||
− | + | ||
avatar = RLPy.RScene.FindObject( RLPy.EObjectType_Avatar, "Jade" ) | avatar = RLPy.RScene.FindObject( RLPy.EObjectType_Avatar, "Jade" ) | ||
− | # set name | + | # set the name of the character |
avatar.SetName("new_name") | avatar.SetName("new_name") | ||
− | # | + | # Get the name of the character |
avatar_name = avatar.GetName() | avatar_name = avatar.GetName() | ||
print(avatar_name) # Jade | print(avatar_name) # Jade | ||
− | # | + | # Set a Transform key |
control = avatar.GetControl("Transform") | control = avatar.GetControl("Transform") | ||
transform = RLPy.RTransform.IDENTITY | transform = RLPy.RTransform.IDENTITY | ||
Line 26: | Line 32: | ||
transform.T().z = 100.0 | transform.T().z = 100.0 | ||
control.SetValue(RLPy.RTime(0), transform) | control.SetValue(RLPy.RTime(0), transform) | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | # Link and unlink to other objects; iClone Avatar can't set Parent | ||
prop2 = RLPy.RScene.FindObject(RLPy.EObjectType_Prop, "Box2") | prop2 = RLPy.RScene.FindObject(RLPy.EObjectType_Prop, "Box2") | ||
− | |||
− | |||
− | |||
result = avatar.LinkTo(prop2, RLPy.RTime(0)) | result = avatar.LinkTo(prop2, RLPy.RTime(0)) | ||
result = avatar.UnLink(RLPy.RTime(0)) | result = avatar.UnLink(RLPy.RTime(0)) | ||
− | # | + | # Get the bounds |
ret_max = RLPy.RVector3() | ret_max = RLPy.RVector3() | ||
ret_center = RLPy.RVector3() | ret_center = RLPy.RVector3() | ||
Line 48: | Line 45: | ||
print(ret) | print(ret) | ||
− | # | + | # Get the pivot point |
ret_pos = RLPy.RVector3() | ret_pos = RLPy.RVector3() | ||
ret_rot = RLPy.RVector3() | ret_rot = RLPy.RVector3() | ||
Line 54: | Line 51: | ||
print(ret) | print(ret) | ||
− | # | + | # Clone the character |
clone_avatar = avatar.Clone() | clone_avatar = avatar.Clone() | ||
print( clone_avatar ) | print( clone_avatar ) | ||
− | # | + | # Check character selection |
RLPy.RScene.SelectObject(avatar) | RLPy.RScene.SelectObject(avatar) | ||
print(avatar.IsSelected()) #True | print(avatar.IsSelected()) #True | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | == | + | |
− | + | == Member Functions == | |
− | + | ||
− | + | === SetVisible (self, kTime, bVisible ) === | |
− | + | ||
− | + | Set a visibility key by a given time. | |
− | + | ||
− | + | ==== Parameters ==== | |
− | + | :'''kTime''' [IN] Time at which to change visibility - [[IC_Python_API:RLPy_RTime|RTime]] | |
− | + | :'''bVisible''' [IN] Visibility status - bool | |
− | + | ||
− | + | ==== Returns ==== | |
− | + | :Success - RLPy.RStatus.Success | |
− | + | :Failure - RLPy.RStatus.Failure | |
− | + | ||
− | == | + | |
− | === | + | |
<syntaxhighlight lang="Python"> | <syntaxhighlight lang="Python"> | ||
− | RLPy. | + | avatar_list = RLPy.RScene.GetAvatars() |
+ | avatar = avatar_list[0] | ||
+ | avatar.SetVisible(RLPy.RTime(0), True) | ||
+ | avatar.SetVisible(RLPy.RTime(10), False) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | Get | + | |
− | + | === GetSkeletonComponent (self) === | |
− | ====Returns==== | + | |
− | + | Get the character's Skeleton Component, used for retrieving the entire skeleton. | |
− | + | ||
− | + | See Also: [[IC_Python_API:RLPy_RISkeletonComponent|RISkeletonComponent]] | |
− | + | ||
+ | ==== Returns ==== | ||
+ | :Pointer to the Skeleton Component object - [[IC_Python_API:RLPy_RISkeletonComponent|RISkeletonComponent]] | ||
+ | |||
<syntaxhighlight lang="Python"> | <syntaxhighlight lang="Python"> | ||
− | RLPy. | + | avatar_list = RLPy.RScene.GetAvatars() |
+ | avatar = avatar_list[0] | ||
+ | skeleton_component = avatar.GetSkeletonComponent() | ||
+ | print(type(_component).__name__) | ||
+ | print(skeleton.GetClipCount()) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | Get | + | |
− | ====Returns==== | + | === GetVisemeComponent (self) === |
− | + | ||
− | + | Get the character's Viseme Component, which provides operations related to lip-syncing. | |
− | + | ||
− | + | See Also: [[IC_Python_API:RLPy_RIVisemeComponent|RIVisemeComponent]] | |
+ | |||
+ | ==== Returns ==== | ||
+ | :Pointer to the Viseme Component object - [[IC_Python_API:RLPy_RIVisemeComponent|RIVisemeComponent]] | ||
+ | |||
<syntaxhighlight lang="Python"> | <syntaxhighlight lang="Python"> | ||
− | RLPy. | + | avatar_list = RLPy.RScene.GetAvatars() |
+ | avatar = avatar_list[0] | ||
+ | viseme_component = avatar.GetVisemeComponent() | ||
+ | print(type(viseme_component).__name__) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | Get | + | |
− | ====Returns==== | + | === GetMorphComponent (self) === |
− | + | ||
− | + | Get the character's Morph Component, used to edit Morph Animation Keys or retrieve the current morph weighting. | |
− | + | ||
− | + | See Also: [[IC_Python_API:RLPy_RIMorphComponent|RIMorphComponent]] | |
+ | |||
+ | ==== Returns ==== | ||
+ | :Pointer to the Morph Component object - [[IC_Python_API:RLPy_RIMorphComponent|RIMorphComponent]] | ||
+ | |||
<syntaxhighlight lang="Python"> | <syntaxhighlight lang="Python"> | ||
− | RLPy. | + | avatar_list = RLPy.RScene.GetAvatars() |
+ | avatar = avatar_list[0] | ||
+ | morph_component = avatar.GetMorphComponent() | ||
+ | print(type(morph_component).__name__) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | Get | + | |
− | ====Returns==== | + | === GetMaterialComponent (self) === |
− | + | ||
− | + | Get the character's Material Component, used for setting material related parameter values. | |
− | + | ||
− | + | See Also: [[IC_Python_API:RLPy_RIMaterialComponent|RIMaterialComponent]] | |
+ | |||
+ | ==== Returns ==== | ||
+ | :Pointer to the Material Component object - [[IC_Python_API:RLPy_RIMaterialComponent|RIMaterialComponent]] | ||
+ | |||
<syntaxhighlight lang="Python"> | <syntaxhighlight lang="Python"> | ||
− | RLPy. | + | avatar_list = RLPy.RScene.GetAvatars() |
+ | avatar = avatar_list[0] | ||
+ | material_component = avatar.GetMaterialComponent() | ||
+ | print(type(material_component).__name__) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | Get | + | |
− | ====Returns==== | + | === GetHikEffectorComponent (self) === |
− | + | ||
− | + | Get the character's HIK Effector Component, used for controlling and managing the IK skeleton. | |
− | + | ||
− | + | See Also: [[IC_Python_API:RLPy_RIHikEffectorComponent|RIHikEffectorComponent]] | |
+ | |||
+ | ==== Returns ==== | ||
+ | :Pointer to the HIK Effector Component object - [[IC_Python_API:RLPy_RIHikEffectorComponent|RIHikEffectorComponent]] | ||
+ | |||
<syntaxhighlight lang="Python"> | <syntaxhighlight lang="Python"> | ||
− | RLPy. | + | avatar_list = RLPy.RScene.GetAvatars() |
+ | avatar = avatar_list[0] | ||
+ | material_component = avatar.GetMaterialComponent() | ||
+ | print(type(material_component).__name__) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | Get | + | |
− | ====Returns==== | + | === GetFaceComponent (self) === |
− | + | ||
− | + | Get the Face Component for the character. Face Component is used to control the facial and head settings for the character. | |
− | + | ||
− | + | See Also: [[IC_Python_API:RLPy_RIFaceComponent|RIFaceComponent]] | |
+ | |||
+ | ==== Returns ==== | ||
+ | :Pointer to the Face Component object - [[IC_Python_API:RLPy_RIFaceComponent|RIFaceComponent]] | ||
+ | |||
<syntaxhighlight lang="Python"> | <syntaxhighlight lang="Python"> | ||
− | RLPy. | + | avatar_list = RLPy.RScene.GetAvatars() |
+ | avatar = avatar_list[0] | ||
+ | face_component = avatar.GetFaceComponent() | ||
+ | print(type(face_component).__name__) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
− | |||
− | |||
− | + | === GetGeneration (self) === | |
− | + | Get the CC avatar standard generation for the character. | |
− | + | ||
− | + | ||
− | + | ||
− | + | *RLPy.EAvatarGeneration_None = 0 | |
+ | *RLPy.EAvatarGeneration_CC_G1_Avatar = 1 | ||
+ | *RLPy.EAvatarGeneration_CC_G3_Avatar = 2 | ||
+ | *RLPy.EAvatarGeneration_CC_Game_Base_One = 3 | ||
+ | *RLPy.EAvatarGeneration_CC_Game_Base_Multi = 4 | ||
− | + | ==== Returns ==== | |
− | </ | + | :Character Creator Avatar generation - enum |
+ | |||
+ | <syntaxhighlight lang="Python"> | ||
+ | avatar_list = RLPy.RScene.GetAvatars() | ||
+ | avatar = avatar_list[0] | ||
+ | avatar_generation = avatar.GetGeneration() | ||
+ | print(avatar_generation) | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | === GetAvatarType (self) === | ||
+ | |||
+ | Get the character's avatar type. | ||
+ | |||
+ | *RLPy.EAvatarType_None = 0 | ||
+ | *RLPy.EAvatarType_Standard = 1 | ||
+ | *RLPy.EAvatarType_NonStandard = 2 | ||
+ | *RLPy.EAvatarType_NonHuman = 3 | ||
+ | *RLPy.EAvatarType_StandardSeries = 4 | ||
+ | *RLPy.EAvatarType_All = 5 | ||
+ | |||
+ | ==== Returns ==== | ||
+ | :Avatar Type - enum | ||
+ | |||
+ | <syntaxhighlight lang="Python"> | ||
+ | avatar_list = RLPy.RScene.GetAvatars() | ||
+ | avatar = avatar_list[0] | ||
+ | avatr_type = avatar.GetAvatarType() | ||
+ | print(avatr_type == RLPy.EAvatarType_StandardSeries) | ||
+ | </syntaxhighlight> |
Revision as of 19:22, 5 April 2020
Contents
- 1 Description
- 2 Member Functions
- Main article: Modules.
- Last modified: 04/5/2020
Description
這個類別主要是場景上角色物件的類別,它提供訪問該對象所有組件的方法,例如 : RISkeletonComponent, RIVisemeComponent, RIFaceComponent.......等,藉由取得相關組件後,便可進行該類操作以及控制。
Inheritance
This class inherits public member functions from:
Examples
avatar = RLPy.RScene.FindObject( RLPy.EObjectType_Avatar, "Jade" )
# set the name of the character
avatar.SetName("new_name")
# Get the name of the character
avatar_name = avatar.GetName()
print(avatar_name) # Jade
# Set a Transform key
control = avatar.GetControl("Transform")
transform = RLPy.RTransform.IDENTITY
transform.T().x = 100.0
transform.T().y = 100.0
transform.T().z = 100.0
control.SetValue(RLPy.RTime(0), transform)
# Link and unlink to other objects; iClone Avatar can't set Parent
prop2 = RLPy.RScene.FindObject(RLPy.EObjectType_Prop, "Box2")
result = avatar.LinkTo(prop2, RLPy.RTime(0))
result = avatar.UnLink(RLPy.RTime(0))
# Get the bounds
ret_max = RLPy.RVector3()
ret_center = RLPy.RVector3()
ret_min = RLPy.RVector3()
ret = avatar.GetBounds( ret_max, ret_center, ret_min )
print(ret)
# Get the pivot point
ret_pos = RLPy.RVector3()
ret_rot = RLPy.RVector3()
avatar.GetPivot( ret_pos, ret_rot )
print(ret)
# Clone the character
clone_avatar = avatar.Clone()
print( clone_avatar )
# Check character selection
RLPy.RScene.SelectObject(avatar)
print(avatar.IsSelected()) #True
Member Functions
SetVisible (self, kTime, bVisible )
Set a visibility key by a given time.
Parameters
- kTime [IN] Time at which to change visibility - RTime
- bVisible [IN] Visibility status - bool
Returns
- Success - RLPy.RStatus.Success
- Failure - RLPy.RStatus.Failure
avatar_list = RLPy.RScene.GetAvatars()
avatar = avatar_list[0]
avatar.SetVisible(RLPy.RTime(0), True)
avatar.SetVisible(RLPy.RTime(10), False)
GetSkeletonComponent (self)
Get the character's Skeleton Component, used for retrieving the entire skeleton.
See Also: RISkeletonComponent
Returns
- Pointer to the Skeleton Component object - RISkeletonComponent
avatar_list = RLPy.RScene.GetAvatars()
avatar = avatar_list[0]
skeleton_component = avatar.GetSkeletonComponent()
print(type(_component).__name__)
print(skeleton.GetClipCount())
GetVisemeComponent (self)
Get the character's Viseme Component, which provides operations related to lip-syncing.
See Also: RIVisemeComponent
Returns
- Pointer to the Viseme Component object - RIVisemeComponent
avatar_list = RLPy.RScene.GetAvatars()
avatar = avatar_list[0]
viseme_component = avatar.GetVisemeComponent()
print(type(viseme_component).__name__)
GetMorphComponent (self)
Get the character's Morph Component, used to edit Morph Animation Keys or retrieve the current morph weighting.
See Also: RIMorphComponent
Returns
- Pointer to the Morph Component object - RIMorphComponent
avatar_list = RLPy.RScene.GetAvatars()
avatar = avatar_list[0]
morph_component = avatar.GetMorphComponent()
print(type(morph_component).__name__)
GetMaterialComponent (self)
Get the character's Material Component, used for setting material related parameter values.
See Also: RIMaterialComponent
Returns
- Pointer to the Material Component object - RIMaterialComponent
avatar_list = RLPy.RScene.GetAvatars()
avatar = avatar_list[0]
material_component = avatar.GetMaterialComponent()
print(type(material_component).__name__)
GetHikEffectorComponent (self)
Get the character's HIK Effector Component, used for controlling and managing the IK skeleton.
See Also: RIHikEffectorComponent
Returns
- Pointer to the HIK Effector Component object - RIHikEffectorComponent
avatar_list = RLPy.RScene.GetAvatars()
avatar = avatar_list[0]
material_component = avatar.GetMaterialComponent()
print(type(material_component).__name__)
GetFaceComponent (self)
Get the Face Component for the character. Face Component is used to control the facial and head settings for the character.
See Also: RIFaceComponent
Returns
- Pointer to the Face Component object - RIFaceComponent
avatar_list = RLPy.RScene.GetAvatars()
avatar = avatar_list[0]
face_component = avatar.GetFaceComponent()
print(type(face_component).__name__)
GetGeneration (self)
Get the CC avatar standard generation for the character.
- RLPy.EAvatarGeneration_None = 0
- RLPy.EAvatarGeneration_CC_G1_Avatar = 1
- RLPy.EAvatarGeneration_CC_G3_Avatar = 2
- RLPy.EAvatarGeneration_CC_Game_Base_One = 3
- RLPy.EAvatarGeneration_CC_Game_Base_Multi = 4
Returns
- Character Creator Avatar generation - enum
avatar_list = RLPy.RScene.GetAvatars()
avatar = avatar_list[0]
avatar_generation = avatar.GetGeneration()
print(avatar_generation)
GetAvatarType (self)
Get the character's avatar type.
- RLPy.EAvatarType_None = 0
- RLPy.EAvatarType_Standard = 1
- RLPy.EAvatarType_NonStandard = 2
- RLPy.EAvatarType_NonHuman = 3
- RLPy.EAvatarType_StandardSeries = 4
- RLPy.EAvatarType_All = 5
Returns
- Avatar Type - enum
avatar_list = RLPy.RScene.GetAvatars()
avatar = avatar_list[0]
avatr_type = avatar.GetAvatarType()
print(avatr_type == RLPy.EAvatarType_StandardSeries)