Difference between revisions of "IC Python API:RLPy RIParticle"

From Reallusion Wiki!
Jump to: navigation, search
(Created page with "{{TOC}} {{Parent|IC_Python_API:RL_Python_Modules|Modules}} ==Inheritance== This class inherits public member functions from: *RLPy.RIObject *...")
(No difference)

Revision as of 01:42, 28 March 2019

Main article: Modules.

Inheritance

This class inherits public member functions from:

Detailed Description

( Experimental Class ) This class is the interface to particles in the scene. It provides methods to access various parts of a particle such as emit, transformation, etc. All methods of this class are implemented by

the system.
particle = RLPy.RScene.FindObject( RLPy.EObjectType_Particle, "Robot bomb" )

# set transform key
control = particle.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)

# set emit key
particle.SetEmit(RLPy.RTime(100), True)
RLPy.RGlobal.SetTime(RLPy.RTime( 100 ))
print(particle.GetEmit()) # return True


prop2 = RLPy.RScene.FindObject(RLPy.EObjectType_Prop, "Box2")
# set Parent
result = particle.SetParent(prop2)
result = particle.SetParent(None) #detach from parent

# link to & unlink
result = particle.LinkTo(prop2, RLPy.RTime(0))
result = particle.UnLink(RLPy.RTime(0))

# set name
particle.SetName( "new_name" )

#get bound
ret_max = RLPy.RVector3()
ret_center = RLPy.RVector3()
ret_min = RLPy.RVector3()
ret = particle.GetBounds( ret_max, ret_center, ret_min )
print(ret)

#get pivot
ret_pos = RLPy.RVector3()
ret_rot = RLPy.RVector3()
particle.GetPivot( ret_pos, ret_rot )
print(ret)

#clone object
clone_particle = particle.Clone()
print( clone_particle )

#is selected
RLPy.RScene.SelectObject(particle)
print(particle.IsSelected()) #True

Operators

This class supports the following operators:

Member Operation Syntax Description Example
__eq__ Equality a == b If the values of two operands are equal, then the condition becomes true. (a == b) is not true.

Member Functions

GetEmit

RLPy.RIParticle.GetEmit ( self )

Get current emit state of the particle.

Returns

The emit on/off state - bool

SetEmit

RLPy.RIParticle.SetEmit ( self, kTime, bOn )

Set the emit state of the particle.

Parameters

kTime [IN] Specifies the time to set - RLPy.RTime

bOn [IN] The emit on/off state - bool

Return Values

RLPy.RStatus.Success Success

RLPy.RStatus.Failure Fail