IC8 Python API:RLPy RIPopcornFXObject

From Reallusion Wiki!
Jump to: navigation, search
Main article: iC8 Modules.
Last modified: 02/19/2023

Description

This class is the interface to PopcornFX object in the scene. It provides methods to access various parts of a PopcornFX object such as emit, loop, transformation, etc. All methods of this class are implemented internally.

Class Methods

RLPy.RIPopcornFXObject.AddAttributeKey(self, strName, kTime, kValue )

Add an attribute key to this PopcornFX object.

Experimental API

Parameters

kTime[IN] The time at which to add the key - RLPy.RLTime
kValue[IN] The value of the attribute must have four floating point numbers. The maximum and minimum values of each attribute are different - float

Returns

RLPy.RStatus.Success - Succeed
RLPy.RStatus.Failure - Fail
1 popcorn = RLPy.RScene.FindObject( RLPy.EObjectType_PopcornFX, "Trail Emitter" )
2 #Add attribute key
3 key_time = RLPy.RTime(67)
4 new_attr_value = (2,0,0,0) # must have four floating point numbers.
5 popcorn.AddAttributeKey(attr_name, key_time, new_attr_value)

RLPy.RIPopcornFXObject.ClearMeshSamplerTarget(self, strSamplerName )

Clear target object of Mesh Sample by name.

Experimental API

Parameters

strSamplerName[IN] sampler name - string

Returns

RLPy.RStatus.Success - Succeed
RLPy.RStatus.Failure - Fail
 1 popcorn = RLPy.RScene.FindObject( RLPy.EObjectType_PopcornFX, "Trail Emitter" )
 2 #Clear mesh sampler target
 3 mesh_sampler_names = popcorn.GetSamplerList(RLPy.EPopcornFxSamplerType_MESH)
 4 if len(mesh_sampler_names) > 0:
 5     sampler_name = mesh_sampler_names[0]
 6     prop = RLPy.RScene.FindObject(RLPy.EObjectType_Prop, "Box")
 7     ret = popcorn.SetMeshSamplerTarget(sampler_name, prop)
 8     if ret == RLPy.RStatus.Success:
 9         target = popcorn.GetMeshSamplerTarget(sampler_name)
10         if target != None:
11             print(target.GetID() == prop.GetID())  #True
12         ret = popcorn.ClearMeshSamplerTarget(sampler_name)
13         print(ret is RLPy.RStatus.Success)  #True

RLPy.RIPopcornFXObject.GetAttributeCount(self)

Get the number of all attributes of this Popcorn object.

Experimental API

Returns

Returns the number of attributes - int

1 popcorn = RLPy.RScene.FindObject( RLPy.EObjectType_PopcornFX, "Trail Emitter" )
2 #Get attribute count
3 attr_qty = popcorn.GetAttributeCount()
4 print(attr_qty)

RLPy.RIPopcornFXObject.GetAttributeName(self, nIndex )

Get attribute names by index.

Experimental API

Parameters

nIndex[IN] attribute index - int

Returns

Returns the attribute name - string

1 popcorn = RLPy.RScene.FindObject( RLPy.EObjectType_PopcornFX, "Trail Emitter" )
2 #Get the name of the 2nd attribute
3 attr_name = popcorn.GetAttributeName(2)
4 print(attr_name) #alignMode

RLPy.RIPopcornFXObject.GetAttributeValue(self, nIndex )

Get attribute value by index.

Experimental API

Parameters

nIndex[IN] attribute index - int

Returns

Returns the attribute value - float

1 popcorn = RLPy.RScene.FindObject( RLPy.EObjectType_PopcornFX, "Trail Emitter" )
2 #Get the value for the 3rd attribute
3 attr_value = popcorn.GetAttributeValue(3)
4 print(attr_value) #(0,0,0,0)

RLPy.RIPopcornFXObject.GetEmit(self)

Get current emit state of the particle.

Experimental API

Returns

Returns the emit on/off state - bool

1 popcorn = RLPy.RScene.FindObject( RLPy.EObjectType_PopcornFX, "Trail Emitter" )
2 print(popcorn.GetEmit())

RLPy.RIPopcornFXObject.GetEmitKeyCount(self)

Get the current number of emit keys.

Experimental API

Returns

Return keys count - int

1 # No example

RLPy.RIPopcornFXObject.GetLoopInterval(self)

Get the current popcorn object how many seconds per loop will be emit once.

Experimental API

Returns

Returns emission interval - float

1 popcorn = RLPy.RScene.FindObject( RLPy.EObjectType_PopcornFX, "Trail Emitter" )
2 #Get loop interval
3 print(popcorn.GetLoopInterval()) #5

RLPy.RIPopcornFXObject.GetMeshSamplerTarget(self, strSamplerName )

Get target of Mesh Sampler by name.

Experimental API

Parameters

strSamplerName[IN] sampler name - string

Returns

Return sampler target object - RLPy.RIObject

1 popcorn = RLPy.RScene.FindObject( RLPy.EObjectType_PopcornFX, "Trail Emitter" )
2 #Get sampler target
3 mesh_sampler_names = popcorn.GetSamplerList(RLPy.EPopcornFxSamplerType_MESH)
4 if len(mesh_sampler_names) > 0:
5     sampler_name = mesh_sampler_names[0]
6     prop = RLPy.RScene.FindObject(RLPy.EObjectType_Prop, "Box")
7     ret = popcorn.SetMeshSamplerTarget(sampler_name, prop)
8     if ret == RLPy.RStatus.Success:
9         target = popcorn.GetMeshSamplerTarget(sampler_name)

RLPy.RIPopcornFXObject.GetSamplerList(self, eType )

Get the Sampler list of this object based on the type.

Experimental API

Parameters

eType[IN] sampler type - RLPy.EPopcornFxSamplerType
  • RLPy.EPopcornFxSamplerType_MESH
  • RLPy.EPopcornFxSamplerType_IMAGE
  • RLPy.EPopcornFxSamplerType_SOUND
  • RLPy.EPopcornFxSamplerType_TEXT
  • RLPy.EPopcornFxSamplerType_PATH
  • RLPy.EPopcornFxSamplerType_CURVE

Returns

Return all sampler names of this type - string

1 popcorn = RLPy.RScene.FindObject( RLPy.EObjectType_PopcornFX, "Trail Emitter" )
2 #Get sampler list
3 mesh_sampler_names = popcorn.GetSamplerList(RLPy.EPopcornFxSamplerType_MESH)

RLPy.RIPopcornFXObject.IsLoop(self)

Set this popcorn object to enable loop emit or disable loop mode.

Experimental API

Parameters

bLoop[IN] Loop mode or not.
fEmissionInterval[IN] the number of seconds between each loop.

Returns

RLPy.RStatus.Success - Succeed
RLPy.RStatus.Failure - Fail
1 popcorn = RLPy.RScene.FindObject( RLPy.EObjectType_PopcornFX, "Trail Emitter" )
2 print(popcorn.IsLoop())

RLPy.RIPopcornFXObject.RemoveEmitKeys(self)

Remove all emit keys of this Popcorn object.

Experimental API

Returns

RLPy.RStatus.Success - Succeed
RLPy.RStatus.Failure - Fail
1 popcorn = RLPy.RScene.FindObject( RLPy.EObjectType_PopcornFX, "Trail Emitter" )
2 #Remove all emit keys
3 popcorn.RemoveEmitKeys()

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

Set the emit state of the particle.

Experimental API

Parameters

kTime[IN] Specifies the time to set - RLPy.RLTime
bOn[IN] The emit on/off state - bool

Returns

RLPy.RStatus.Success - Succeed
RLPy.RStatus.Failure - Fail
1 popcorn = RLPy.RScene.FindObject( RLPy.EObjectType_PopcornFX, "Trail Emitter" )
2 popcorn.SetEmit(RLPy.RTime(100), True)

RLPy.RIPopcornFXObject.SetLoop(self, bLoop )

Set this popcorn object to enable loop emit or disable loop mode.

Experimental API

Parameters

bLoop[IN] Loop mode or not - bool

Returns

RLPy.RStatus.Success - Succeed
RLPy.RStatus.Failure - Fail
1 popcorn = RLPy.RScene.FindObject( RLPy.EObjectType_PopcornFX, "Trail Emitter" )
2 popcorn.SetLoop(True)

RLPy.RIPopcornFXObject.SetLoopInterval(self, fEmissionInterval )

Set every second interval to emit.

Experimental API

Parameters

fEmissionInterval[IN] the number of seconds between each loop - float

Returns

RLPy.RStatus.Success - Succeed
RLPy.RStatus.Failure - Fail
1 popcorn = RLPy.RScene.FindObject( RLPy.EObjectType_PopcornFX, "Trail Emitter" )
2 #Set loop interval
3 popcorn.SetLoop(True)
4 popcorn.SetLoopInterval(5)

RLPy.RIPopcornFXObject.SetMeshSamplerTarget(self, strSamplerName, spObject )

Set target object of Mesh Sample by name.

Experimental API

Parameters

strSamplerName[IN] sampler name - string
spObject[IN] sampler target object - RLPy.RIObject

Returns

RLPy.RStatus.Success - Succeed
RLPy.RStatus.Failure - Fail
1 popcorn = RLPy.RScene.FindObject( RLPy.EObjectType_PopcornFX, "Trail Emitter" )
2 #Set sampler target
3 mesh_sampler_names = popcorn.GetSamplerList(RLPy.EPopcornFxSamplerType_MESH)
4 if len(mesh_sampler_names) > 0:
5     sampler_name = mesh_sampler_names[0]
6     prop = RLPy.RScene.FindObject(RLPy.EObjectType_Prop, "Box")
7     ret = popcorn.SetMeshSamplerTarget(sampler_name, prop)