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 *...")
 
m
Line 1: Line 1:
 
{{TOC}}
 
{{TOC}}
 
{{Parent|IC_Python_API:RL_Python_Modules|Modules}}
 
{{Parent|IC_Python_API:RL_Python_Modules|Modules}}
==Inheritance==
+
{{last_modified}}
This class inherits public member functions from:
+
 
*[[IC_Python_API:RLPy_RIObject|RLPy.RIObject]]
+
== Description ==
*[[IC_Python_API:RLPy_RIBase|RLPy.RIBase]]
+
 
==Detailed 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.
<span style="background:#ffcccc">( Experimental Class )</span> This class is the interface to particles in the scene.
+
 
It provides methods to access various parts of a particle such as
+
=== Inheritance ===
emit, transformation, etc. All methods of this class are implemented by
+
 
the system. <syntaxhighlight lang="Python">
+
*[[IC_Python_API:RLPy_RIBase|RIBase]] > [[IC_Python_API:RLPy_RIObject|RIObject]] > '''RIParticle'''.
 +
 
 +
<syntaxhighlight lang="Python">
 
particle = RLPy.RScene.FindObject( RLPy.EObjectType_Particle, "Robot bomb" )
 
particle = RLPy.RScene.FindObject( RLPy.EObjectType_Particle, "Robot bomb" )
+
 
# set transform key
 
# set transform key
 
control = particle.GetControl("Transform")
 
control = particle.GetControl("Transform")
Line 19: Line 21:
 
transform.T().z = 100.0
 
transform.T().z = 100.0
 
control.SetValue(RLPy.RTime(0), transform)
 
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
 
# set Parent
result = particle.SetParent(prop2)
+
parent_prop = RLPy.RScene.FindObject(RLPy.EObjectType_Prop, "Box")
 +
result = particle.SetParent(parent_prop)
 
result = particle.SetParent(None) #detach from parent
 
result = particle.SetParent(None) #detach from parent
  
# link to & unlink
+
# link to & unlink
result = particle.LinkTo(prop2, RLPy.RTime(0))
+
result = particle.LinkTo(parent_prop, RLPy.RTime(0))
 
result = particle.UnLink(RLPy.RTime(0))
 
result = particle.UnLink(RLPy.RTime(0))
  
 
# set name
 
# set name
 
particle.SetName( "new_name" )
 
particle.SetName( "new_name" )
 
 
#get bound
 
#get bound
 
ret_max = RLPy.RVector3()
 
ret_max = RLPy.RVector3()
Line 43: Line 38:
 
ret_min = RLPy.RVector3()
 
ret_min = RLPy.RVector3()
 
ret = particle.GetBounds( ret_max, ret_center, ret_min )
 
ret = particle.GetBounds( ret_max, ret_center, ret_min )
print(ret)
+
print(ret_pos.x)
 
+
 
#get pivot
 
#get pivot
 
ret_pos = RLPy.RVector3()
 
ret_pos = RLPy.RVector3()
 
ret_rot = RLPy.RVector3()
 
ret_rot = RLPy.RVector3()
 
particle.GetPivot( ret_pos, ret_rot )
 
particle.GetPivot( ret_pos, ret_rot )
print(ret)
+
print(ret_pos.x)
 
+
 
#clone object
 
#clone object
 
clone_particle = particle.Clone()
 
clone_particle = particle.Clone()
 
print( clone_particle )
 
print( clone_particle )
 
 
#is selected
 
#is selected
 
RLPy.RScene.SelectObject(particle)
 
RLPy.RScene.SelectObject(particle)
 
print(particle.IsSelected()) #True
 
print(particle.IsSelected()) #True
 
</syntaxhighlight>
 
</syntaxhighlight>
==Operators==
+
 
This class supports the following operators:
+
== Member Functions ==
{| class="wikitable"
+
 
!Member
+
=== GetEmit ( self ) ===
!Operation
+
 
!Syntax
+
Get the particle system's emission status.
!Description
+
 
!Example
+
See Also: [[#SetEmit ( self, kTime, bOn )|SetEmit]]
|-
+
 
! scope="row"|__eq__
+
==== Returns ====
|Equality
+
:'''True''' if the particle system is emitting, else '''False''' - bool
|a == b
+
 
|If the values of two operands are equal, then the condition becomes true.
+
|(a == b) is not true.
+
|}
+
==Member Functions==
+
===GetEmit===
+
 
<syntaxhighlight lang="Python">
 
<syntaxhighlight lang="Python">
RLPy.RIParticle.GetEmit ( self )
+
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())
 
</syntaxhighlight>
 
</syntaxhighlight>
Get current emit state of the particle.
 
====Returns====
 
<div style="margin-left: 2em;">The emit on/off state - bool
 
</div>
 
-----
 
===SetEmit===
 
<syntaxhighlight lang="Python">
 
RLPy.RIParticle.SetEmit ( self, kTime, bOn )
 
</syntaxhighlight>
 
Set the emit state of the particle.
 
====Parameters====
 
<div style="margin-left: 2em;">
 
  
'''kTime''' [IN] Specifies the time to set - RLPy.RTime
+
=== SetEmit ( self, kTime, bOn ) ===
  
'''bOn''' [IN] The emit on/off state - bool
+
Set the particle system on or off at a given point in time by setting the Emit key.
</div>
+
====Return Values====
+
<div style="margin-left: 2em;">
+
  
'''RLPy.RStatus.Success''' Success
+
See Also: [[#GetEmit ( self )|GetEmit]]
  
'''RLPy.RStatus.Failure''' Fail
+
==== Parameters ====
</div>
+
:'''kTime''' [IN] On / off point in time - [[IC_Python_API:RLPy_RTime|RTime]]
 +
:'''bOn''' [IN] Set the particle on or off - bool
 +
 
 +
==== Returns ====
 +
:Success - RLPy.RStatus.Success
 +
:Failure - RLPy.RStatus.Failure
 +
 
 +
<syntaxhighlight lang="Python">
 +
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())
 +
</syntaxhighlight>

Revision as of 02:15, 6 April 2020

Main article: Modules.
Last modified: 04/6/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

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())