- Main Page
- Related Pages
- Modules
- Classes
- Examples

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Protected Member Functions

# MFnInstancer Class Reference

# OpenMayaFX - API module for effects | FunctionSet classes

Search for all occurrences

## Detailed Description

Particle Instancer object access class.

Class for obtaining information about a particle instancer node.

Examples:

  instancerListCmd.cpp.

`#include <MFnInstancer.h>`

Inheritance diagram for MFnInstancer:
[legend]

List of all members.

## Public Member Functions
virtual MFn::Type | type () const
| Function set type.
virtual | ~MFnInstancer ()
| Destructor.
| MFnInstancer ()
| Default constructor.
| MFnInstancer (MObject &object, MStatus *ReturnStatus=NULL)
| Constructor.
| MFnInstancer (const MDagPath &object, MStatus *ret=NULL)
| Constructor.
int | particleCount () const
| Returns the number of particles feeding the active instancer.
int | instancesForParticle (int p, MDagPathArray &paths, MMatrix &instancerMatrix, MStatus *ReturnStatus=NULL) const
| Returns the DAG paths and instancer matrix for all instances generated by a specified particle.
MStatus | allInstances (MDagPathArray &paths, MMatrixArray &matrices, MIntArray &particlePathStartIndices, MIntArray &pathIndices) const
| Returns information about all instances generated by a particular particle instancer node.
| MFnInstancer (const MObject &object, MStatus *ret=NULL)
| Constructor.
## Protected Member Functions
virtual const char * | className () const
| Class name. Search for all occurrences

## Constructor & Destructor Documentation

~MFnInstancer | ( |  | ) | `[virtual]`

Destructor.

Class destructor.

MFnInstancer | ( | MObject & | object,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  |

Constructor.

Class constructor that initializes the function set to the given MObject.

Parameters:

  [in] | object | The MObject to attach the function set to
  [out] | ReturnStatus | the return status

Status Codes:
  - MS::kSuccess if the function set is successfully attached
  - MS::kInvalidParameter if the MObject does not represent a valid Maya object or if the function set is not allowed to attach to this MObject

MFnInstancer | ( | const MDagPath & | object,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  |

Constructor.

Class constructor that initializes the function set to the given constant MDagPath object.

Parameters:

  [in] | object | The const MDagPath to attach the function set to
  [out] | ReturnStatus | The return status

Status Codes:
  - MS::kSuccess if the function set is successfully attached
  - MS::kInvalidParameter if the MObject does not represent a valid Maya object or if the function set is not allowed to attach to this MObject

MFnInstancer | ( | const MObject & | object,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  |

Constructor.

Class constructor that initializes the function set to the given MObject.

Parameters:

  [in] | object | The MObject to attach the function set to
  [out] | ReturnStatus | the return status

Status Codes:
  - MS::kSuccess if the function set is successfully attached
  - MS::kInvalidParameter if the MObject does not represent a valid Maya object or if the function set is not allowed to attach to this MObject

## Member Function Documentation

MFn::Type type | ( |  | ) | const `[virtual]`

Search for all occurrences

Function set type.

Return the class type : MFn::kInstancer.

Reimplemented from MFnDagNode.

int particleCount | ( |  | ) | const

Search for all occurrences

Returns the number of particles feeding the active instancer.

Returns:
  See description.

int instancesForParticle | ( | int | p,
|  | MDagPathArray & | paths,
|  | MMatrix & | instancerMatrix,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  | const

Search for all occurrences

Returns the DAG paths and instancer matrix for all instances generated by a specified particle.

Parameters:

  [in] | p | The index of the particle being queried.
  [out] | paths | Visible DAG paths generated by particle p
  [out] | instancerMatrix | The transformation matrix that the instancer applies to the instanced paths to produce the final particle-instanced geometry. The final world matrix of each instance can be constructed by premultiplying the path's inclusive world matrix by this matrix.
  [out] | ReturnStatus | status code

Returns:
  The number of visible paths instanced for the given particle. It is possible for no paths to be instanced for a particular particle. Note that in order to use this method, the MDagPath must be used in the constructor.

Status Codes:
  - MS::kSuccess Success
  - MS::kInvalidParameter Invalid particle index or program state

MStatus allInstances | ( | MDagPathArray & | paths,
|  | MMatrixArray & | matrices,
|  | MIntArray & | particlePathStartIndices,
|  | MIntArray & | pathIndices
| ) |  | const

Search for all occurrences

Returns information about all instances generated by a particular particle instancer node.

Since many particles will typically instance similar sets of paths, the information is returned in a compact representation. An array of paths is returned, representing the unique set of paths that are instanced by any particle in the system. For each particle, the routine returns a set of indices into this path array to illustrate the paths instanced at that particle. The index arrays for all particles are concatenated together, so a "start index" array is used to indicate which is the first entry in the index array for each particle. For each particle, the routine also returns the transformation matrix applied to that particle's instanced paths to generate the final particle instance transformations.

Parameters:

  [out] | paths | Receives the unique set of paths instanced by any particle in the system.
  [out] | matrices | For each particle p, matrices[p] receives the matrix that the instancer applies to the paths instanced under that particle to generate the final instance transformations.
  [out] | particlePathStartIndices | Receives indices into the pathIndices array indicating where the block of indices for each particle begins. The size of this array is always one more than the number of particles in the system. For particle p, the number of paths instanced under that particle is particlePathStartIndices[p+1]-particlePathStartIndices[p]. If this number is 0, then no visible paths are instanced under that particle. So, the set pathIndices[particlePathStartIndices[p]...particlePathStartIndices[p+1]-1] gives the indices into the paths array of the visible paths instanced under particle p.
  [out] | pathIndices | Receives indices into the paths array describing the visible paths instanced under each particle. The array is a sequence of variable-sized blocks, one per particle (since each particle in the system can instance a different number of paths). The particlePathStartIndices array determines where in this array to find the path indices for a particular particle.

Returns:
  - MS::kSuccess Success
  - MS::kInvalidParameter Invalid parameter passed for object - Node is not accessible, does not exist or is not a valid DAG Node

MFnInstancer MFnInstancer MFnInstancer MFnInstancer MFnInstancer MFnInstancer MFnInstancer MFnInstancer MFnInstancer MFnInstancer
MFnInstancer MFnInstancer MFnInstancer MFnInstancer MFnInstancer MFnInstancer MFnInstancer MFnInstancer MFnInstancer MFnInstancer