The particleObjectExt Interface is exposed in Particle Flow Source Classes.
Properties:
<PF_Source>.particleIndex : index : Read|Write|Validated by Range: 1 to 100000000
Get/Set the current particle index.
<PF_Source>.particleID : index : Read|Write|Validated by Range: 1 to 100000000
Get/Set the current particle ID.
<PF_Source>.particleAge : time : Read|Write|Validated by Range: 0f to 625000f
Get/Set the current particle Age.
<PF_Source>.particleGroupTime : time : Read|Write|Validated by Range: 0f to 625000f
Get/Set the current particle Group Time.
<PF_Source>.particlePosition : point3 : Read|Write
Get/Set the current particle position.
<PF_Source>.particleSpeed : point3 : Read|Write
Get/Set the current particle speed.
<PF_Source>.particleOrientation : point3 : Read|Write
Get/Set the current particle orientation.
<PF_Source>.particleSpin : angleAxis : Read|Write
Get/Set the current particle spin.
<PF_Source>.particleScale : float : Read|Write|Validated by Range: 0.0 to 1e+009
Get/Set the size of the current particle.
<PF_Source>.particleScaleXYZ : point3 : Read|Write
Get/Set the Scale of the current particle as Point3 value.
<PF_Source>.particleTM : matrix3 : Read|Write
Get/Set the Transformation Matrix of the current particle.
<PF_Source>.particleSelected : bool : Read|Write
Get/Set the Selected state of the current particle
<PF_Source>.particleShape : mesh : Read|Write
Get/Set the current particle’s mesh.
EXAMPLES AND RESULTS:
|
--Create a default PF Source in the Scene from the Create Tab.
--Get the Source by name to test the Interface Properties:
pf = $'PF Source 01'
--> $PF_Source:PF Source 01 @ [2.536594,-48.031052,0.000000]
--Get the curren particle's index
pf.particleIndex
--> 1
--Change the particle index. Any subsequent
--properties will be from particle 2
pf.particleIndex = 2
--> 2
--Check to make sure it worked...
pf.particleIndex
--> 2
--Get the Particle ID of particle 2
pf.particleID
--> 0
--Get the Particle Age on frame 0
--This is a newborn particle, age is 0!
pf.particleAge
--> 0f
--Now change the scene time to frame 10...
sliderTime = 10
--> 10
--...and get the Age again -
--10 frames later, the Age is 9.7 frames!
pf.particleAge
--> 9.7f
--Check whether particle 2 is selected -
--No, it is not
pf.particleSelected
--> false
--Change to Modify panel
max modify mode
--> OK
--Change to Particle sub-object level
subObjectLevel = 1
--> 1
--Select Particle 2 - one particle
--should turn red in the viewport
pf.particleSelected = true
--> true
--Get the particle position
pf.particlePosition
--> [12.1301,-40.7149,-96.9697]
--You can change it -
--The Particle should move there...
pf.particlePosition = [10.0,-10.0,-40.0]
--> [10,-10,-40]
--Get the Speed of particle 2
pf.particleSpeed
--> [0,0,-0.0625]
--Get the Orientation of particle 2
pf.particleOrientation
--> [-2.75317,-1.18547,-0.402363]
--Get the Spin of particle 2
pf.particleSpin
--> (angleAxis 0 [1,0,0])
--Get the size of the particle
pf.particleScale
--> 16.3299
--Get the Scale of the particle
pf.particleScaleXYZ
--> [1,1,1]
--Get the complete TM of the particle
pf.particleTM
--> (matrix3 [0.345842,-0.147184,0.926677] [-0.0394943,-0.989029,-0.142347] [0.937461,0.0126313,-0.34786] [12.1301,-40.7149,-96.9697])
--Get the Shape as TriMesh.
msh = pf.particleShape
--> TriMesh
--Take a look at the number of vertices
msh.numverts
--> 4
--...and the number of faces
msh.numfaces
--> 4
--Why not take a look at the actual TriMesh?
--Create a new empty Editable Mesh
new_mesh = Editable_mesh()
--> $Editable_Mesh:Object01 @ [0.000000,0.000000,0.000000]
--Assign the shape snapshot to the mesh
new_mesh.mesh = msh
--> TriMesh
--And finally update all caches of the Emesh to see the result:
update new_mesh
--> OK
|
Methods:
<void><PF_Source>.updateParticles <node>particleSystem <time>time
Forces a particle update at the specified time.
<integer><PF_Source>.numParticles()
Returns the number of particles.
<integer><PF_Source>.numParticlesGenerated()
Returns the number of generated particles.
<void><PF_Source>.setEveryStepUpdateScriptLine <string>script
Sets the script string to be executed on every update step.
<void><PF_Source>.setEveryStepUpdateScriptFile <filename>fileName
Sets the script file to be executed on every update step.
<void><PF_Source>.setFinalStepUpdateScriptLine <string>script
Sets the script string to be executed at the final update step.
<void><PF_Source>.setFinalStepUpdateScriptFile <filename>fileName
Sets the script file to be executed at the final update step.
<time><PF_Source>.getUpdateTime()
Returns the current update time.
<void><PF_Source>.getUpdateInterval <&time>timeStart <&time>timeEnd
timeStart is In and Out parameter
timeEnd is In and Out parameter
Returns the update interval in the two by-reference variables.
<index><PF_Source>.getParticleID <index>particleIndex
Returns the particle ID of the indexed particle.
<bool><PF_Source>.hasParticleID <index>particleBornIndex <&index>particleIndex
particleIndex is In and Out parameter
Returns true if a particle with the specified particle birth ID exists. Returns the actual particle
index in the specified by-reference variable.
<node><PF_Source>.getParticleGroup <index>particleIndex
Returns the particle group node of the indexed particle.
<index><PF_Source>.getParticleIndex <index>particleBornIndex
Returns the particle index of the particle with the specified birth index.
<time><PF_Source>.getParticleAge <index>particleIndex
Returns the particle Age of the indexed particle.
<time><PF_Source>.getParticleAgeByID <index>particleID
Returns the particle Age of the particle specified by particle ID.
<void><PF_Source>.setParticleAge <index>particleIndex <time>age
Sets the particle age of the specified indexed particle to the specified age value.
<void><PF_Source>.setParticleAgeByID <index>particleID <time>age
Sets the particle age of the particle specified by ID to the specified age value.
<time><PF_Source>.getParticleLifeSpan <index>particleIndex
Returns the life span time of the specified indexed particle.
<time><PF_Source>.getParticleLifeSpanByID <index>particleID
Returns the life span time of the particle specified by ID.
<void><PF_Source>.setParticleLifeSpan <index>particleIndex <time>lifeSpan
Sets the life span time of the indexed particle to the specified lifeSpan value.
<void><PF_Source>.setParticleLifeSpanByID <index>particleID <time>lifeSpan
Sets the life span time of the particle specified by ID to the specified lifeSpan
value.
<time><PF_Source>.getParticleGroupTime <index>particleIndex
Returns the Group Time of the indexed particle.
<time><PF_Source>.getParticleGroupTimeByID <index>particleID
Returns the Group Time of the particle specified by ID.
<void><PF_Source>.setParticleGroupTime <index>particleIndex <time>age
Sets the Group Time of the indexed particle to the specified age value.
<void><PF_Source>.setParticleGroupTimeByID <index>particleID <time>age
Sets the Group Time of the particle specified by ID to the specified age value.
<point3><PF_Source>.getParticlePosition <index>particleIndex
Returns the position of the indexed particle.
<point3><PF_Source>.getParticlePositionByID <index>particleID
Returns the position of the particle specified by ID.
<void><PF_Source>.setParticlePosition <index>particleIndex <point3>position
Sets the position of the indexed particle to the specified Point3 value.
<void><PF_Source>.setParticlePositionByID <index>particleID <point3>position
Sets the position of the particle specified by ID to the specified Point3 value.
<point3><PF_Source>.getParticleSpeed <index>particleIndex
Returns the speed of the indexed particle as Point3 value.
<point3><PF_Source>.getParticleSpeedByID <index>particleID
Returns the speed of the particle specified by ID as Point3 value.
<void><PF_Source>.setParticleSpeed <index>particleIndex <point3>speed
Sets the speed of the indexed particle to the specified Point3 value.
<void><PF_Source>.setParticleSpeedByID <index>particleID <point3>speed
Sets the speed of the particle specified by ID to the specified Point3 value.
<point3><PF_Source>.getParticleOrientation <index>particleIndex
Returns the orientation of the indexed particle as Point3 value.
<point3><PF_Source>.getParticleOrientationByID <index>particleID
Returns the orientation of the particle specified by ID as Point3 value.
<void><PF_Source>.setParticleOrientation <index>particleIndex <point3>orientation
Sets the orientation of the indexed particle to the specified Point3 value.
<void><PF_Source>.setParticleOrientationByID <index>particleID <point3>orientation
Sets the orientation of the particle specified by ID to the specified Point3 value.
<angleAxis><PF_Source>.getParticleSpin <index>particleIndex
Returns the Spin of the indexed particle as angleAxis value.
<angleAxis><PF_Source>.getParticleSpinByID <index>particleID
Returns the Spin of the particle specified by ID as angleAxis value.
<void><PF_Source>.setParticleSpin <index>particleIndex <angleAxis>spin
Sets the Spin of the indexed particle to the specified AngleAxis value.
<void><PF_Source>.setParticleSpinByID <index>particleID <angleAxis>spin
Sets the Spin of the particle specified by ID to the specified angleAxis value.
<float><PF_Source>.getParticleScale <index>particleIndex
Returns the size of the indexed particle as Float value.
<float><PF_Source>.getParticleScaleByID <index>particleID
Returns the size of the particle specified by ID as Float value.
<void><PF_Source>.setParticleScale <index>particleIndex <float>scale
Sets the size of the indexed particle to the specified Float value.
<void><PF_Source>.setParticleScaleByID <index>particleID <float>scale
Sets the size of the particle specified by ID to the specified Float value.
<point3><PF_Source>.getParticleScaleXYZ <index>particleIndex
Returns the Scale of the indexed particle as a Point3 value.
<point3><PF_Source>.getParticleScaleXYZByID <index>particleID
Returns the Scale of the particle specified by ID as a Point3 value.
<void><PF_Source>.setParticleScaleXYZ <index>particleIndex <point3>scaleXYZ
Sets the Scale of the indexed particle to the specified Point3 value.
<void><PF_Source>.setParticleScaleXYZByID <index>particleID <point3>scaleXYZ
Sets the Scale of the particle specified by ID to the specified Point3 value.
<matrix3><PF_Source>.getParticleTM <index>particleIndex
Returns the Transformation Matrix of the inexed particle.
<matrix3><PF_Source>.getParticleTMByID <index>particleID
Returns the Transformation Matrix of the particle specified by ID.
<void><PF_Source>.setParticleTM <index>particleIndex <matrix3>TM
Sets the Transformation Matrix of the indexed particle.
<void><PF_Source>.setParticleTMByID <index>particleID <matrix3>TM
Sets the Transformation Matrix of the particle specified by ID.
<bool><PF_Source>.getParticleSelected <index>particleIndex
Returns the selected state of the indexed particle.
<bool><PF_Source>.getParticleSelectedByID <index>particleID
Returns the selected state of the particle specified by ID.
<void><PF_Source>.setParticleSelected <index>particleIndex <bool>selected
Sets the selected state of the indexed particle.
<void><PF_Source>.setParticleSelectedByID <index>particleID <bool>selected
Sets the selected state of the particle specified by ID.
<mesh><PF_Source>.getParticleShape <index>particleIndex
Returns the shape of the indexed particle as mesh value.
<mesh><PF_Source>.getParticleShapeByID <index>particleID
Returns the shape of the particle specified by ID as mesh value.
<void><PF_Source>.setParticleShape <index>particleIndex <mesh>shape
Sets the shape of the indexed particle to the specified mesh value.
<void><PF_Source>.setParticleShapeByID <index>particleID <mesh>shape
Sets the shape of the particle specified by ID to the specified mesh value.
<void><PF_Source>.setShapeForAllParticles <mesh>shape
Sets the shape of all particles to the specified mesh value.
EXAMPLES AND RESULTS:
|
--Create a new Particle Flow Source in the Viewport,
--then get it by name from the scene
pf = $'PF Source 01'
--> $PF_Source:PF Source 01 @ [2.536594,-48.031052,0.000000]
--Set the scene time to frame 10
sliderTime = 10
--> 10
--Update the particles at time 10
pf.updateParticles pf 10f
--> OK
--Get total number of particles at current time
pf.numParticles()
--> 34
--Get the total number of particles generated up to the current time
pf.numParticlesGenerated()
--> 34
--Get the particles update time
pf.getUpdateTime()
--> 10f
--Initialize two user variables to 0
ts = te = 0
--> 0
--Set scene time to frame 10
sliderTime = 10f
--> 10f
--Get the update interval into the variables passed by reference
pf.getUpdateInterval &ts &te
--> OK
--Check the start time
ts
--> 9f
--Check the end time
te
--> 10f
pf.getParticleID 34--Get the particle ID of the 34th particle
--> 34
--Try to get the 35th particle.
--There are only 34 particles, so ID is 0
pf.getParticleID 35
--> 0
--Initialize a variable to pass by reference
idx = 0
--> 0
--Check if there is particle with ID 34 -
--Yes, there is one
pf.hasParticleID 34 &idx
--> true
--and its index is 34
idx
--> 34
--Check the same about particle ID 35 -
--no, there is none
pf.hasParticleID 35 &idx
--> false
--Get the Particle Group node
pf.getParticleGroup 2
--> $Particle_Group:PF Source 01->Event 01 @ [0.000000,0.000000,0.000000]
--Get the index of particle 34
pf.getParticleIndex 34
--> 34
--Get the index of particle 35
--No such particle ID, index is 0
pf.getParticleIndex 35
--> 0
--Get the particle age of particle 2
pf.getParticleAge 2
--> 9.7f
--Get the particle age of particle ID 2 -
--It is the same particle!
pf.getParticleAgeByID 2
--> 9.7f
--Get the particle age of particle 34
--It was born later, age is smaller
pf.getParticleAge 34
--> 9f
--Set age of particle 2 to 5 frames
pf.setParticleAge 2 5f
--> OK
--Check to see if it worked - It did!
pf.getParticleAge 2
--> 5f
--Get the life span of particle 2
--Who wants to live forever? This one!
pf.getParticleLifeSpan 2
--> 1.34218e+007f
--Change the life span of particle 2
pf.setParticleLifeSpan 2 10f
--> OK
--Check again - it changed!
pf.getParticleLifeSpan 2
--> 10f
--Get the Group Time of Particle 2
pf.getParticleGroupTime 2
--> 0f
--Set the Particle Group Time to 10
pf.setParticleGroupTime 2 10f
--> OK
--Get the time again - it was set!
pf.getParticleGroupTime 2
--> 10f
--Let’s change the mesh of particle 2 to a Geosphere
gs = (geosphere radius:5).mesh
--> TriMesh
--Change the Display to Geometry
pf.Event_01.Display_01.Type = 6
--> 6
--Set the particle mesh
--One particle should become a Geosphere!
pf.setParticleShape 2 gs
--> OK
--Get the mesh of a teapot
tp = (teapot radius:5).mesh
--> TriMesh
--and assign to all particles - they should turn into teapots!
--IT’S TEA TIME!
pf.setShapeForAllParticles tp
--> OK
|
This Interface is available in:
PF_Source : GeometryClass
ParticleGroup : GeometryClass