AgeLimitArray (ParticleCollection)

Description

Returns or sets particle lifespans as a one-dimensional Array of Integers.

Note: This property uses an optional input argument, which must be handled specially in Python. If you need to specify a particle array, use 'Get' or 'Set' prefixed to the property name and use method-style syntax. For example, 'MyParticleCollection.SetAgeLimitArray( MyIDArray, MyAgeLimitArray )'

C# Syntax

// get accessor
Object ParticleCollection.get_AgeLimitArray( Object in_vParticleIDArray );

// set accessor
ParticleCollection.set_AgeLimitArray( Object in_vParticleIDArray, Object out_pvAgeLimitArray );

Parameters

Parameter

Type

Description

ParticleIDArray

Array

Array of Particle.IDs.

Default Value: If missing, all particles are accessed.

Examples

Python Example

#
# This example demonstrates how to use the AgeArray, IDArray, and
# AgeLimitArray properties on the ParticleCollection by showing
# how you can create a subset of the current particle ids in order
# to reset the ages of those particles using the AgeArray property
# 
# For the VBScript version of this example, see ParticleCollection.IDArray.
# For the JScript version of this example, see ParticleCollection.AgeArray.
#

# Set up a scene with a particle cloud using a disc emitter
Application.NewScene( "", 0 )
Application.CreateParticleCloud( "", "Disc" )

# Simulate particle emission up to frame 5
i=0
while i < 4 :
   Application.NextFrame()
   i = i + 1

# Get the particle collection from the cloud
cloud = Application.Dictionary.GetObject( "cloud" )
pcoll = cloud.Particles

# Get the ages of each particle in the collection
safeAges = pcoll.AgeArray
allAges = "Old ages: "
for age in safeAges :
   allAges = allAges + "\t" + str(age)

Application.LogMessage( allAges )

# Get the particle IDs and then build a new list of every other ID
allIDs = pcoll.IDArray
subsetIDs = []
j=0
while j < len(allIDs) :
   subsetIDs.append( allIDs[j] )
   j = j + 2

# Get the age limit arrays for this group of particles 
# Notice for Python the 'Get' prefix and method syntax must be used
newAges = pcoll.GetAgeLimitArray(subsetIDs)

# Reset the selected particles to their age limit
# Notice for Python the 'Set' prefix and method syntax must be used
pcoll.SetAgeArray( subsetIDs, newAges )

# Print out the ages again
safeAges = pcoll.AgeArray
allAges = "New ages: "
for age in safeAges :
   allAges = allAges + "\t" + str(age)

Application.LogMessage( allAges )


# Expected result:
#INFO : Old ages:  4 4 3 2 2 1 1  0
#INFO : New ages:  29 4 29 2 29 1 29 0


Autodesk Softimage v7.5