MAXScript

MAXScript Editor Access

tyFlow objects have MAXScript interfaces which can be used to manipulate their editor windows.

  • [obj].editor_open(): opens the tyFlow editor GUI.

MAXScript Particle Access

Both tyFlow and tyCache objects have MAXScript interfaces which can be used to read particle data.

Preparing particles

  • [obj].updateParticles {frame}: prepares particle data for MAXScript access at a particular frame.

The updateParticles function of a tyFlow or tyCache object MUST be called prior to accessing particle data.

  • [obj].numParticles(): returns the number of particles at the prepared frame.

Individual particle data

Data for individual particles can be accessed with their index. Valid particle indices (for tyFlow/tyCache objects with at least 1 particle) range from 1 to [obj].numParticles().

Particle indices are 1-based, not 0-based!

  • [obj].getParticleID {index}: returns the unqiue ID for the specified particle index.

  • [obj].getParticleAge {index}: returns the age (in frames) for the specified particle index.

  • [obj].getParticleTM {index}: returns the transform for the specified particle index.

  • [obj].getParticlePosition {index}: returns the position for the specified particle index.

  • [obj].getParticleScale {index}: returns the scale for the specified particle index.

  • [obj].getParticleVelocity {index}: returns the velocity (in units per frame) for the specified particle index.

  • [obj].getParticleShapeMesh {index}: returns the trimesh for the specified particle index.

  • [obj].getParticleMatID {index}: returns the material ID override for the specified particle index.

A material ID override value of 0 means no override is assigned to the particle.

  • [obj].getParticleInstanceID {index}: returns the instance ID for the specified particle index.

  • [obj].getParticleSimGroups {index}: returns the simulation group bitflags for the specified particle index.

  • [obj].getParticleExportGroups {index}: returns the export group bitflags for the specified particle index.

Here is an example script, showing how to access particle transforms at frame 15, for a tyFlow object named “tyFlow001”:

tf = $tyFlow001
tf.updateParticles 15
numParticles = tf.numParticles()

for j in 1 to numParticles do
(
    tm = tf.getParticleTM j
)