class MItInstancer

Jump to documentation

Particle iterator. (OpenMaya) (OpenMaya.py)

public members:

MItInstancer ()
virtual ~MItInstancer ()
MStatus reset ()
MStatus next ()
MStatus nextParticle ()
MStatus nextInstancer ()
bool isDone () const
MObject instancer () const
MDagPath instancerPath () const
MDagPath path ()
MMatrix matrix ()
MUintPtrSz instancerId () const
unsigned int particleId () const
unsigned int pathId () const

Documentation

Iterate over all nodes in the dependency graph.

Description

Maya's Particle Replacement aka Particle Instancing feature allows geometry to be instanced and those instances transformed using particles. More precisely, particles are replaced by arbitrary DAG nodes which maya be transforms with many shapes under them, and multiple DAG paths to those shapes.

The Instancer Iterator Class (MItInstancer) provides methods for iterating over all the dag paths to the shapes created in the scene by the replacement of particles by dag nodes.

When particles are being replaced by a shape node there will be one dag path corresponding with each particle. If, say, particles are instead being replaced by a transform with five shape nodes somewhere underneath it, then this iterator will visit five paths for every particle. Dag-instancing is also respected: if the given dag node has two child transforms each of which is a path to one shape underneath them, then this iterator will visit two paths. In other words, this iterator does not distinguish between paths resulting from a multiplicity of actual shapes and paths resulting from DAG-instances of individual shapes: all appear as different paths for the current particle.

A simple usage might look like:

MItInstancer it; while( ! it.isDone() ) { MDagPath path = it.path(); MString label = path.fullPathName(); MGlobal::displayInfo( label ); it.next(); }

Functions

MItInstancer:: MItInstancer ()

Description

Constructs a dag-path-to-replaced-particle Iterator and resets it See reset() for more information.

Arguments

  • None.

MItInstancer:: ~MItInstancer ()

Description

Class destructor. Arguments

  • None.

MStatus MItInstancer:: reset ()

Description

Moves the iterator to the first dag-path to the first replaced-particle in the scene. If none exist, then isDone() will be immediately true.

Arguments

  • None.

Return Value

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MItInstancer:: next ()

Description

Advances the iterator to the next replaced-particle dag-path in the scene. Calling reset(), then repeatedly calling this method until isDone() becomes true is equivalent to the following loop structure:

For every instancer For every particle For every dagPath connected to this instancer

Arguments

  • None.

Return Value

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MItInstancer:: nextParticle ()

Description

Advances the iterator to the next replaced-particle in the scene, skipping over any remaining dag-paths associated with the current replaced-particle.

If there are no more particles associated with the current instancer then the iterator will advance to the next instancer in order to point at the next particle.

Arguments

  • None.

Return Value

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MItInstancer:: nextInstancer ()

Description

Advances the iterator to the next instancer in the scene, skipping over any remaining particles associated with the current instancer.

Arguments

  • None.

Return Value

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

bool MItInstancer:: isDone () const

Description

Returns true if the iteration is finished, i.e. there are no more dag-paths to replaced-particles in the scene.

Arguments

  • None.

Return Value

  • true There are no more items to iterate over.
  • false There are more items in the iteration.

MDagPath MItInstancer:: instancerPath () const

Description

Returns the full DAG path to the instancer that generated the current particle instance.

A NULL path will be returned if there is no current instancer being iterated

Arguments

  • None.

Return Value

  • See description.

MDagPath MItInstancer:: path ()

Description

Returns the replaced-particle dag-path which the iterator is currently pointing to. Each path is to a shape. If the particle is replaced by a shape directly then there will be only one path per particle. If a particle is replaced by a transform with many child shapes then each one of those shapes will have a path. Amongst the paths corresponding to a given particle there may be multiple paths to multiple shapes. If there is no such path, a null path will be returned.

Arguments

  • None.

Return Value

  • See description.

MMatrix MItInstancer:: matrix ()

Description

Returns the transformation matrix represented by the current path. If there is no such path, identity matrix will be returned.

Arguments

  • None.

Return Value

  • See description.

MUintPtrSz MItInstancer:: instancerId () const

Description

Returns a unique identifier for the current instancer. Collectively, this id together with the particle id and the path id uniquely identify a "replaced particle".

Arguments

  • None.

Return Value

  • See description.

unsigned int MItInstancer:: particleId () const

Description

Returns a unique identifier for the current particle. Collectively, this id together with the instancer id and the path id uniquely identify a "replaced particle".

Arguments

  • None.

Return Value

  • See description.

unsigned int MItInstancer:: pathId () const

Description

Returns a unique identifier for the current path. Collectively, this id together with the instancer id and the particle id uniquely identify a "replaced particle".

Arguments

  • None.

Return Value

  • See description.

MObject MItInstancer:: instancer () const

Description

Returns the current instancer node as an MObject.

Arguments

  • None.

Return Value

  • See description.

This class has no child classes.


Autodesk® Maya® 8.0 © 1997-2006 Autodesk, Inc. All rights reserved. doc++ Copyright