Difference between revisions of "IC8 Python API:RLPy RIObject"
Chuck (RL) (Talk | contribs) (Created page with "{{TOC}} {{Parent|IC_8_Python_API:Modules|iC8 Modules}} {{last_modified}} ==Description== This class is used to access the bone node parameters in a character skeleton or obj...") |
Chuck (RL) (Talk | contribs) m |
||
Line 1: | Line 1: | ||
{{TOC}} | {{TOC}} | ||
{{Parent|IC_8_Python_API:Modules|iC8 Modules}} | {{Parent|IC_8_Python_API:Modules|iC8 Modules}} | ||
− | {{ | + | {{Modified}} |
==Description== | ==Description== |
Latest revision as of 19:33, 3 January 2023
Contents
- 1 Description
- 2 Class Methods
- 2.1 RLPy.RIObject.AlignTo(self, spTargetObject, eAlignAxis, bAlignToPivot)
- 2.2 RLPy.RIObject.Clone(self)
- 2.3 RLPy.RIObject.DeleteMesh(self, spMesh)
- 2.4 RLPy.RIObject.FollowPath(self, spPath, kAppTime)
- 2.5 RLPy.RIObject.GetBounds(self, kMaxPoint, kCenterPoint, kMinPoint)
- 2.6 RLPy.RIObject.GetControl(self, strKey)
- 2.7 RLPy.RIObject.GetDataBlock(self, strId)
- 2.8 RLPy.RIObject.GetID(self)
- 2.9 RLPy.RIObject.GetLinkedObject(self, kTime)
- 2.10 RLPy.RIObject.GetMeshes(self, bAll = True)
- 2.11 RLPy.RIObject.GetMeshNames(self, bAll = True)
- 2.12 RLPy.RIObject.GetName(self)
- 2.13 RLPy.RIObject.GetPivot(self, kPosition, kOrientation)
- 2.14 RLPy.RIObject.GetType(self)
- 2.15 RLPy.RIObject.IsSelected(self)
- 2.16 RLPy.RIObject.IsStatic(self)
- 2.17 RLPy.RIObject.LinkTo(self, spTargetObject, eAlignType, kTime)
- 2.18 RLPy.RIObject.LocalTransform(self)
- 2.19 RLPy.RIObject.ReleasePath(self, kTime)
- 2.20 RLPy.RIObject.RemoveDataBlock(self, strId)
- 2.21 RLPy.RIObject.RemoveLinkKey(self, kTime)
- 2.22 RLPy.RIObject.SetDataBlock(self, strId, spDataBlock)
- 2.23 RLPy.RIObject.SetName(self, strName)
- 2.24 RLPy.RIObject.SetParent(self, args)
- 2.25 RLPy.RIObject.SetStatic(self, bStatic)
- 2.26 RLPy.RIObject.UnLink(self, kTime)
- 2.27 RLPy.RIObject.Update(self)
- 2.28 RLPy.RIObject.WorldTransform(self)
- Main article: iC8 Modules.
- Last modified: 01/3/2023
Description
This class is used to access the bone node parameters in a character skeleton or object. Retrievable parameters include name, ID, parent node, list of child nodes, and more. Use Update to get the world-transform values of the bone node for the current point in time.
Class Methods
RLPy.RIObject.AlignTo(self, spTargetObject, eAlignAxis, bAlignToPivot)
Attach object to another object with align axis.
Experimental API
Parameters
- spTargetObject[IN] Attach target object - RLPy.RIObject
- eAlignAxis[IN] Attach object with align axis - RLPy.EAlignAxis
- RLPy.EAlignAxis_INVALID
- RLPy.EAlignAxis_X_AXIS
- RLPy.EAlignAxis_Y_AXIS
- RLPy.EAlignAxis_Z_AXIS
- RLPy.EAlignAxis_ROTATE_AXIZ
- bAlignToPivot[IN] Align object pivot or align object world bound center - bool
Returns
- RLPy.RStatus.Success - Succeed
- RLPy.RStatus.Failure - Fail
1 # No example
RLPy.RIObject.Clone(self)
Clones the object original and returns the clone.
Experimental API
Returns
clonedobject.
1 # No example
RLPy.RIObject.DeleteMesh(self, spMesh)
Delete the mesh of the object.
Parameters
- spMesh[IN] the mesh want to delete - RLPy.RIMesh
Returns
- RLPy.RStatus.Success - Succeed
- RLPy.RStatus.Failure - Fail
1 # No example
RLPy.RIObject.FollowPath(self, spPath, kAppTime)
Experimental API
Parameters
- spPath[IN]Path you want to set.
- kTime[IN] Time of following path.
Returns
- RLPy.RStatus.Success - Succeed
- RLPy.RStatus.Failure - Fail
1 # No example
RLPy.RIObject.GetBounds(self, kMaxPoint, kCenterPoint, kMinPoint)
Get world bound of this object.
Experimental API
Parameters
kMaxPoint[OUT] The maximal point of the box - RLPy.RVector3f kCenterPoint[OUT] The center of the bounding box - RLPy.RVector3f kMinPoint[OUT] The minimal point of the box - RLPy.RVector3f
Returns
- RLPy.RStatus.Success - Succeed
- RLPy.RStatus.Failure - Fail
1 # No example
RLPy.RIObject.GetControl(self, strKey)
Get control of the object.
Parameters
- strKey[IN] Key of the controller, allowing use "Transform" to retrieve the transform control of the Transform track, use "PathPosition" to retrieve the float control of Path position track, and use "PathOffset" to retrieve the transform control of the Path Offset track, - string
Returns
The specified control - RLPy.RControl
1 # No example
RLPy.RIObject.GetDataBlock(self, strId)
Provide object to get data block.
Experimental API
Parameters
- strId[IN] DataBlock Id - string
Returns
data block - RLPy. RDataBlock
1 # No example
RLPy.RIObject.GetID(self)
Get unique id of the object.
Returns
object id - int
1 # Get root bone node
2 avatar_list = RLPy.RScene.GetAvatars()
3 avatar = avatar_list[0]
4 skeleton_component = avatar.GetSkeletonComponent()
5 bone_node = skeleton_component.GetRootBone()
6
7 # Get root bone ID
8 bone_id = bone_node.GetID()
9 print(bone_id)
RLPy.RIObject.GetLinkedObject(self, kTime)
Get linked object by time.
Experimental API
Parameters
- kTime[IN] Time to get the linked object - RLPy.RLTime
Returns
Linkedobject or Linked Node. If it's null, there are no linked object.
1 # No example
RLPy.RIObject.GetMeshes(self, bAll = True)
Get all meshed of the object.
Parameters
- bAllChild[IN] bAll=true will get all meshes including child nodes.
Returns
mesh object list - list
1 # No example
RLPy.RIObject.GetMeshNames(self, bAll = True)
Get all mesh names of the object.
Parameters
- bAllChild[IN] bAll=true will get all meshes including child nodes.
Returns
mesh name list - string
1 # No example
RLPy.RIObject.GetName(self)
Get name of the object.
Returns
object name - string
1 # Get root bone node
2 avatar_list = RLPy.RScene.GetAvatars()
3 avatar = avatar_list[0]
4 skeleton_component = avatar.GetSkeletonComponent()
5 bone_node = skeleton_component.GetRootBone()
6
7 # Get root bone name
8 bone_name = bone_node.GetName()
9 print(bone_name)
RLPy.RIObject.GetPivot(self, kPosition, kOrientation)
Get this object's pivot.
Experimental API
Parameters
kPosition[OUT] current pivot position - RLPy.RVector3f kOrientation[OUT] current pivot orientation - RLPy.RVector3f
Returns
- RLPy.RStatus.Success - Succeed
- RLPy.RStatus.Failure - Fail
1 # No example
RLPy.RIObject.GetType(self)
Get object type of the object.
Returns
object type - RLPy.EObjectType
- RLPy.EObjectType_Object
- RLPy.EObjectType_Avatar
- RLPy.EObjectType_Hair
- RLPy.EObjectType_Cloth
- RLPy.EObjectType_Accessory
- RLPy.EObjectType_Prop
- RLPy.EObjectType_Camera
- RLPy.EObjectType_Particle
- RLPy.EObjectType_Light
- RLPy.EObjectType_SpotLight
- RLPy.EObjectType_PointLight
- RLPy.EObjectType_DirectionalLight
- RLPy.EObjectType_PopcornFX
- RLPy.EObjectType_Path
- RLPy.EObjectType_Sky
1 # No example
RLPy.RIObject.IsSelected(self)
A Boolean value indicating whether the object is in the selected state.
Experimental API
Returns
selectedor not
1 # No example
RLPy.RIObject.IsStatic(self)
Get animation status of the object.
Experimental API
Returns
trueStatic object without any animation falseKinetic object with animation
1 # No example
RLPy.RIObject.LinkTo(self, spTargetObject, eAlignType, kTime)
Simultaneously move or rotate link target object and this object.
Experimental API
Parameters
- spTargetObject[IN] Link target object - RLPy.RIObject
- eAlignType[IN] Link object align type - RLPy.ELinkObjectAlignType
- RLPy.ELinkObjectAlignType_None
- RLPy.ELinkObjectAlignType_Position
- RLPy.ELinkObjectAlignType_Position_And_Rotation
- kTime[IN] Time of link - RLPy.RLTime
Returns
- RLPy.RStatus.Success - Succeed
- RLPy.RStatus.Failure - Fail
1 # No example
RLPy.RIObject.LocalTransform(self)
Get local transform of the object.
Experimental API
Returns
object transform - RLPy.RTransformf
1 # Get root bone node
2 avatar_list = RLPy.RScene.GetAvatars()
3 avatar = avatar_list[0]
4 skeleton_component = avatar.GetSkeletonComponent()
5 bone_node = skeleton_component.GetRootBone()
6
7 # Get root bone local transform
8 local_transform = bone_node.LocalTransform()
9 print(local_transform)
RLPy.RIObject.ReleasePath(self, kTime)
Release path key from object.
Experimental API
Parameters
- kTime[IN] Time of release path - RLPy.RLTime
Returns
- RLPy.RStatus.Success - Succeed
- RLPy.RStatus.Failure - Fail
1 # No example
RLPy.RIObject.RemoveDataBlock(self, strId)
Remove data block from object.
Experimental API
Parameters
- strId[IN] DataBlock Id - string
Returns
- RLPy.RStatus.Success - Succeed
- RLPy.RStatus.Failure - Fail
1 # No example
RLPy.RIObject.RemoveLinkKey(self, kTime)
Remove link key from object.
Experimental API
Parameters
- kTime[IN] Time of remove link key - RLPy.RLTime
Returns
- RLPy.RStatus.Success - Succeed
- RLPy.RStatus.Failure - Fail
1 # No example
RLPy.RIObject.SetDataBlock(self, strId, spDataBlock)
Provide object to store data through data block.
Experimental API
Parameters
- strId[IN] DataBlock Id - string
- spDataBlock[IN] Store data - RLPy.RDataBlock
Returns
- RLPy.RStatus.Success - Succeed
- RLPy.RStatus.Failure - Fail
1 # No example
RLPy.RIObject.SetName(self, strName)
Set object's name.
Experimental API
Parameters
- strName[IN] object name - string
Returns
- RLPy.RStatus.Success - Succeed
- RLPy.RStatus.Failure - Fail
1 # No example
RLPy.RIObject.SetParent(self, args)
Experimental API
Parameters
- spParent[IN] If parent is null, this object will restore default parent - RLPy.RINode
Returns
RStatus - RLPy.RStatus
1 # No example
RLPy.RIObject.SetStatic(self, bStatic)
Set animation status of the object.
Experimental API
Returns
- bStatic[IN]Make the object stationary
- RLPy.RStatus.Success - Succeed
- RLPy.RStatus.Failure - Fail
1 # No example
RLPy.RIObject.UnLink(self, kTime)
Unlink object of time.
Experimental API
Parameters
- kTime[IN] Time of unlink - RLPy.RLTime
Returns
- RLPy.RStatus.Success - Succeed
- RLPy.RStatus.Failure - Fail
1 # No example
RLPy.RIObject.Update(self)
In iClone's 3D animation world, it works based on adding keys, so when you add a key, you need to call Update function when you need to update the key value to the object.
Experimental API
1 # Get root bone node
2 avatar_list = RLPy.RScene.GetAvatars()
3 avatar = avatar_list[0]
4 skeleton_component = avatar.GetSkeletonComponent()
5 bone_node = skeleton_component.GetRootBone()
6
7 # Get root bone child node world transform rotation x-axis value
8 motion_bones = skeleton_component.GetMotionBones()
9 child = motion_bones[1]
10 child_world = child.WorldTransform()
11 child_rot_x = child_world.R().x
12
13 # Set float control rotation x-axis value
14 RLPy.RGlobal.SetTime(RLPy.RTime(0))
15 animation_clip = skeleton_component.GetClip(0)
16 root_control = animation_clip.GetControl("Layer", root)
17 data_block = root_control.GetDataBlock()
18 float_control_rotate_x = data_block.GetControl("Rotation/RotationX")
19 float_control_rotate_x.SetValue(RLPy.RGlobal.GetTime(), math.radians(60))
20
21 # Update root bone with float control
22 bone_node.Update()
23
24 # Get root bone child node world transform rotation x-axis value after updated
25 new_child_world = child.WorldTransform()
26 after_update_child_rot_x = new_child_world.R().x
RLPy.RIObject.WorldTransform(self)
Get world transform of the object.
Experimental API
Returns
object transform - RLPy.RTransformf
1 # Get root bone node
2 avatar_list = RLPy.RScene.GetAvatars()
3 avatar = avatar_list[0]
4 skeleton_component = avatar.GetSkeletonComponent()
5 bone_node = skeleton_component.GetRootBone()
6
7 # Get root bone world transform
8 world_transform = bone_node.WorldTransform()
9 print(world_transform)