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

From Reallusion Wiki!
Jump to: navigation, search
m
m
Line 5: Line 5:
 
== Description ==
 
== Description ==
  
This class can access the Particle Systems in the scene and perform particle related operations e.g. naming particle systems, transform emission point. Currently, this class only works for iClone's native particle system, therefore, not compatible with PopcornFX.
+
This class can access the particle systems in the scene and perform particle related operations e.g. naming particle systems, transform emission point. Currently, this class only works for iClone's native particle system, therefore, not compatible with PopcornFX.
  
 
=== Inheritance ===  
 
=== Inheritance ===  
  
*[[IC_Python_API:RLPy_RIBase|RIBase]] > [[IC_Python_API:RLPy_RIObject|RIObject]] > '''RIParticle'''.
+
[[IC_Python_API:RLPy_RIBase|RIBase]] > [[IC_Python_API:RLPy_RIObject|RIObject]] > [[IC_Python_API:RLPy_RIParticle|RIParticle]]
  
<syntaxhighlight lang="Python">
+
=== Examples ===
 +
 
 +
<syntaxhighlight lang="python">
 
particle = RLPy.RScene.FindObject( RLPy.EObjectType_Particle, "Robot bomb" )
 
particle = RLPy.RScene.FindObject( RLPy.EObjectType_Particle, "Robot bomb" )
 
   
 
   
Line 63: Line 65:
 
:'''True''' if the particle system is emitting, else '''False''' - bool
 
:'''True''' if the particle system is emitting, else '''False''' - bool
  
<syntaxhighlight lang="Python">
+
<syntaxhighlight lang="python">
 
particle = RLPy.RScene.FindObject( RLPy.EObjectType_Particle, "Robot bomb" )
 
particle = RLPy.RScene.FindObject( RLPy.EObjectType_Particle, "Robot bomb" )
 
if particle:
 
if particle:
Line 85: Line 87:
 
:Failure - RLPy.RStatus.Failure
 
:Failure - RLPy.RStatus.Failure
  
<syntaxhighlight lang="Python">
+
<syntaxhighlight lang="python">
 
particle = RLPy.RScene.FindObject( RLPy.EObjectType_Particle, "Robot bomb" )
 
particle = RLPy.RScene.FindObject( RLPy.EObjectType_Particle, "Robot bomb" )
 
if particle:
 
if particle:

Revision as of 00:51, 9 April 2020

Main article: Modules.
Last modified: 04/9/2020

Description

This class can access the particle systems in the scene and perform particle related operations e.g. naming particle systems, transform emission point. Currently, this class only works for iClone's native particle system, therefore, not compatible with PopcornFX.

Inheritance

RIBase > RIObject > RIParticle 

Examples

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 Parent
parent_prop = RLPy.RScene.FindObject(RLPy.EObjectType_Prop, "Box")
result = particle.SetParent(parent_prop)
result = particle.SetParent(None) #detach from parent

# link to &  unlink
result = particle.LinkTo(parent_prop, 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_pos.x)
#get pivot
ret_pos = RLPy.RVector3()
ret_rot = RLPy.RVector3()
particle.GetPivot( ret_pos, ret_rot )
print(ret_pos.x)
#clone object
clone_particle = particle.Clone()
print( clone_particle )
#is selected
RLPy.RScene.SelectObject(particle)
print(particle.IsSelected()) #True

Member Functions

GetEmit ( self )

Get the particle system's emission status.

See Also: SetEmit

Returns

True if the particle system is emitting, else False - bool
particle = RLPy.RScene.FindObject( RLPy.EObjectType_Particle, "Robot bomb" )
if particle:
    particle.SetEmit(RLPy.RTime(100), True)
    RLPy.RGlobal.SetTime(RLPy.RTime( 100 ))
    print(particle.GetEmit())

SetEmit ( self, kTime, bOn )

Set the particle system on or off at a given point in time by setting the Emit key.

See Also: GetEmit

Parameters

kTime [IN] On / off point in time - RTime
bOn [IN] Set the particle on or off - bool

Returns

Success - RLPy.RStatus.Success
Failure - RLPy.RStatus.Failure
particle = RLPy.RScene.FindObject( RLPy.EObjectType_Particle, "Robot bomb" )
if particle:
    particle.SetEmit(RLPy.RTime(100), True)
    RLPy.RGlobal.SetTime(RLPy.RTime( 100 ))
    print(particle.GetEmit())