IC8 Python API:RLPy RIProp

From Reallusion Wiki!
Revision as of 00:15, 3 February 2023 by Chuck (RL) (Talk | contribs) (Created page with "{{TOC}} {{Parent|IC_8_Python_API:Modules|iC8 Modules}} {{Modified}} ==Description== This class can be used to access basic information of prop objects and obtain the control...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Main article: iC8 Modules.
Last modified: 02/3/2023

Description

This class can be used to access basic information of prop objects and obtain the control or components of the prop to modify its the transform values and materials.

Class Methods

RLPy.RIProp.GetMaterialComponent(self)

Get material component of the object.

Returns

Pointer of the RIMaterialComponent object - RLPy.RIMaterialComponent

 1 prop = RLPy.RScene.FindObject(RLPy.EObjectType_Prop, "Box")
 2 # get component
 3 material_component = prop.GetMaterialComponent()
 4 mesh_list = prop.GetMeshNames()
 5 mesh_name = mesh_list[0]
 6 material_list = material_component.GetMaterialNames(mesh_name)
 7 material_name = material_list[0]
 8 
 9 # Modify material light - ambient channel
10 ambient_color = RLPy.RRgb.RED
11 
12 # Create Key
13 key = RLPy.RKey()
14 key.SetTime(RLPy.RTime(1200))
15 key.SetTransitionType(RLPy.ETransitionType_Linear)
16 key.SetTransitionStrength(50)
17 material_component.AddAmbientKey(key, mesh_name, material_name, ambient_color)
18 print(material_component.GetAmbientColor(mesh_name, material_name))

RLPy.RIProp.GetMorphComponent(self)

Get morph component of the object.

Returns

Pointer of the RIMorphComponent object - RLPy.RIMorphComponent

 1 prop = RLPy.RScene.FindObject(RLPy.EObjectType_Prop, "Box")
 2 # get component
 3 morph_component = prop.GetMorphComponent()
 4 result = morph_component.AddKey( "your_mesh_name", "your_morph_name", RLPy.RTime(67),  0.5, False, False )
 5  
 6 f_ret_weight = 0
 7 return_list = morph_component.GetWeight( "your_mesh_name", "your_morph_name", RLPy.RTime(67), f_ret_weight )
 8 f_ret_weight = return_list[1]
 9 print(f_ret_weight) # is 0.5
10  
11 result = morph_component.RemoveAllKeys("your_mesh_name", "your_morph_name")
12 morph_names = morph_component.GetMorphNames("your_mesh_name")

RLPy.RIProp.GetSkeletonComponent(self)

Get bone root of the object.

Returns

bone root - RLPy.RISkeletonComponent

 1 prop = RLPy.RScene.FindObject(RLPy.EObjectType_Prop, "Box")
 2 # get component
 3 bone = prop.GetSkeletonComponent()
 4 print(bone.GetClip(0))
 5  
 6 # get selected bone
 7 selected_bones = bone.GetSelectedBones()
 8 print(len(selected_bones))
 9  
10 # get root bone
11 root_bone = bone.GetRootBone()
12 print(root_bone)

RLPy.RIProp.IsDummy(self)

Check if prop state is dummy.

Experimental API

Returns

Boolvalue true if prop state is dummy; otherwise false.

1 prop = RLPy.RScene.FindObject(RLPy.EObjectType_Prop, "Box")
2 prop.SetDummy( True )
3 is_dummy = prop.IsDummy()
4 print( is_dummy )  #True

RLPy.RIProp.IsVisible(self, kTime )

Check if prop is visible.

Experimental API

Parameters

kTime[IN] Specifies the time to check if prop is visible - RLPy.RLTime

Returns

Boolvalue true if prop is visible; otherwise false.

1 # No example

RLPy.RIProp.SetDummy(self, bIsDummy )

Set the prop state whether its dummy or not.

Experimental API

Parameters

bIsDummy[IN] takes prop state as bool value : true or false - bool

Returns

RLPy.RStatus.Success - Succeed
RLPy.RStatus.Failure - Fail
1 prop = RLPy.RScene.FindObject(RLPy.EObjectType_Prop, "Box")
2 prop.SetDummy( True )
3 is_dummy = prop.IsDummy()
4 print( is_dummy )  #True

RLPy.RIProp.SetPivot(self, kPosition, kOrientation )

This function lets you re-position and re-orient the current object's pivot.

Experimental API

Parameters

kPosition[IN] pivot position - RLPy.RVector3f
kOrientation[IN] pivot orientation - RLPy.RVector3f

Returns

RLPy.RStatus.Success - Succeed
RLPy.RStatus.Failure - Fail
1 prop = RLPy.RScene.FindObject(RLPy.EObjectType_Prop, "Box")
2 #set pivot
3 pos = RLPy.RVector3( 10, 10, 10 )
4 rot = RLPy.RVector3( 0, 0, 0 )
5 ret = prop.SetPivot( pos, rot )
6 print(ret)

RLPy.RIProp.SetVisible(self, kTime, bVisible )

Experimental Function)Set visible status

Parameters

kTime[IN] Specifies the time to set visible - RLPy.RLTime
bVisible[IN] Visible status - bool

Returns

RLPy.RStatus.Success - Succeed
RLPy.RStatus.Failure - Fail
1 prop = RLPy.RScene.FindObject(RLPy.EObjectType_Prop, "Box")
2 ret = prop.SetVisible( RLPy.RTime( 67 ), false )
3 print(ret)