AgeArray (ParticleCollection)
Description
Returns the age of each specified particle as a one-dimensional Array of Integers (Particle.IDs).
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.SetAgeArray( MyIDArray, MyAgeArrayToSet )'.
C# Syntax
// get accessor Object ParticleCollection.get_AgeArray( Object in_vParticleIDArray ); // set accessor ParticleCollection.set_AgeArray( Object in_vParticleIDArray, Object out_pvAgeArray );
Parameters
|
Parameter |
Type |
Description |
|
ParticleIDArray |
Array of Particle.IDs. Default Value: If missing, all particles are accessed. |
Examples
JScript 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 Python version of this example, see ParticleCollection.AgeLimitArray. */ // Set up a scene with a particle cloud using a disc emitter NewScene( null, false ); CreateParticleCloud( "", "Disc" ); // Simulate particle emission up to frame 5 for ( var i=0; i<4; i++ ) { NextFrame(); } // Get the particle collection from the cloud var cloud = Dictionary.GetObject( "cloud" ); var pcoll = cloud.Particles; // Get the ages of each particle in the collection var allAges = pcoll.AgeArray.toArray(); Application.LogMessage( "Old ages: " + allAges.join("\t") ); // Get the particle IDs and then build a new list of every other ID var allIDs = pcoll.IDArray.toArray(); var subsetIDs = new Array(); for ( var j=0; j<allIDs.length; j+=2 ) { subsetIDs.push( allIDs[j] ); } // Get the age limit arrays for this group of particles var newAges = pcoll.AgeLimitArray(subsetIDs).toArray(); // Reset the selected particles to their age limit pcoll.AgeArray(subsetIDs) = newAges; // Print out the ages again allAges = pcoll.AgeArray.toArray(); Application.LogMessage( "New ages: " + allAges.join("\t") ); // 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