IC8 Python API:RLPy RIObject

From Reallusion Wiki!
Jump to: navigation, search

Contents

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)