C++ API Reference
MPxEmitterNode Class Reference

Base class for user defined particle emitters. More...

#include <MPxEmitterNode.h>

+ Inheritance diagram for MPxEmitterNode:

Public Types

enum  MEmitterType {
  kDirectional = 0, kOmni, kSurface, kCurve,
  kVolume
}
 Types of emitters. More...
 
- Public Types inherited from MPxNode
enum  Type {
  kDependNode, kLocatorNode, kDeformerNode, kManipContainer,
  kSurfaceShape, kFieldNode, kEmitterNode, kSpringNode,
  kIkSolverNode, kHardwareShader, kHwShaderNode, kTransformNode,
  kObjectSet, kFluidEmitterNode, kImagePlaneNode, kParticleAttributeMapperNode,
  kCameraSetNode, kConstraintNode, kManipulatorNode, kMotionPathNode,
  kClientDeviceNode, kThreadedDeviceNode, kAssembly, kSkinCluster,
  kGeometryFilter, kBlendShape, kLast
}
 Defines the type of node. More...
 
enum  SchedulingType {
  kParallel, kSerial, kGloballySerial, kUntrusted ,
  kDefaultScheduling = kSerial, kSerialize = kSerial, kGloballySerialize = kGloballySerial
}
 Defines the degree of parallelism of a node. More...
 

Public Member Functions

 MPxEmitterNode ()
 Class constructor.
 
 ~MPxEmitterNode () override
 The class destructor.
 
MPxNode::Type type () const override
 This method returns the type of the node. More...
 
MStatus compute (const MPlug &plug, MDataBlock &dataBlock) override
 This method should be overridden in user defined nodes. More...
 
virtual void draw (M3dView &view, const MDagPath &path, M3dView::DisplayStyle style, M3dView::DisplayStatus)
 Overriding this method allows the drawing of custom geometry using standard OpenGL calls. More...
 
MEmitterType getEmitterType (MDataBlock &block)
 Retrieves the type of the emitter, determined by the "emitterType" attribute value. More...
 
MObject getOwnerShape ()
 If the emitter is a emitting from an object, this method returns the shape node for the object. More...
 
MTime getCurrentTime (MDataBlock &block)
 Intended to be called from within the emitter's compute() method, this method returns the time at which the emitter is currently being evaluated. More...
 
MTime getStartTime (int plugIndex, MDataBlock &block)
 Intended to be called from within the emitter's compute() method, this method returns the start times for each particle system or fluid into which the emitter is emitting. More...
 
MTime getDeltaTime (int plugIndex, MDataBlock &block)
 Intended to be called from within the emitter's compute() method, this method returns the width of the time interval represented by the current emitter evaluation. More...
 
int getRandomSeed (int plugIndex, MDataBlock &block)
 Intended to be called from within the emitter's compute() method, this method returns the random seed for a specified emission target (particle system or fluid shape into which the emitter is emitting). More...
 
void getRandomState (int plugIndex, MDataBlock &block)
 Intended to be called from within the emitter's compute() method, this method copies the emitter node attribute representing the current random state for a particular emitter target into a local variable on the emitter object, to facilitate efficient random number generation using the randgen() method. More...
 
void setRandomState (int plugIndex, MDataBlock &block)
 Intended to be called from within the emitter's compute() method, this method copies the emitter node class random state data member onto the emitter node's random state attribute. More...
 
void resetRandomState (int plugIndex, MDataBlock &block)
 Intended to be called from within the emitter's compute() method, this method resets the emitter's random state data member. More...
 
double randgen ()
 Intended to be called from within the emitter's compute() method, this method generates a double-precision random number in the rand [0,1]. More...
 
double getRate (MDataBlock &block)
 Intended to be called from within the emitter's compute() method, this method retrieves the "rate" attribute value common to all particle and fluid emitters. More...
 
double getMinDistance (MDataBlock &block)
 Intended to be called from within the emitter's compute() method, this method retrieves the "minDistance" attribute value common to all particle and fluid emitters. More...
 
double getMaxDistance (MDataBlock &block)
 Intended to be called from within the emitter's compute() method, this method retrieves the "maxDistance" attribute value common to all particle and fluid emitters. More...
 
MPoint getWorldPosition ()
 Returns the worldspace coordinates of the emitter. More...
 
MMatrix getWorldMatrix ()
 Returns the matrix that maps from the emitter's local space coordinates to worldspace. More...
 
bool volumePrimitiveBoundingBox (MBoundingBox &box)
 For volume emitters, this method returns the object-space bounding box of the volume primitive associated with the emitter. More...
 
bool volumePrimitivePointInside (const MPoint &worldPoint, const MMatrix &emitterWorldMatrix)
 For volume emitters, this method determines whether a particular point in space lies within the volume defined by the emitter's volume primitive. More...
 
double volumePrimitiveDistanceFromAxis (const MPoint &worldPoint, const MMatrix &emitterWorldMatrix)
 For volume emitters, this method determines the distance from a particular point to the major axis of the volumetric primitive associated with the emitter. More...
 
bool hasValidEmission2dTexture (const MObject &texAttr, MStatus *status=NULL)
 Certain aspects of Maya's particle and fluid emitters can be textured using 2d textures. More...
 
MStatus evalEmission2dTexture (const MObject &texAttr, MDoubleArray &uCoords, MDoubleArray &vCoords, MVectorArray *resultColors, MDoubleArray *resultAlphas)
 If a supported 2d texture (see hasValidEmission2dTexture() method documentation) is connected to the given emitter attribute, this method can be called to evaluate that texture at a number of (u,v) texture coordinate values. More...
 
- Public Member Functions inherited from MPxNode
 MPxNode ()
 Constructor. More...
 
virtual ~MPxNode ()
 Destructor.
 
virtual void postConstructor ()
 Post constructor. More...
 
virtual bool getInternalValue (const MPlug &, MDataHandle &)
 This method is overridden by nodes that store attribute data in some internal format. More...
 
virtual bool setInternalValue (const MPlug &, const MDataHandle &)
 This method is overridden by nodes that store attribute data in some internal format. More...
 
virtual int internalArrayCount (const MPlug &) const
 This method is overridden by nodes that have internal array attributes which are not stored in Maya's datablock. More...
 
virtual void copyInternalData (MPxNode *)
 This method is overridden by nodes that store attribute data in some internal format. More...
 
virtual MStatus legalConnection (const MPlug &, const MPlug &, bool asSrc, bool &isLegal) const
 This method allows you to check for legal connections being made to attributes of this node. More...
 
virtual MStatus legalDisconnection (const MPlug &, const MPlug &, bool asSrc, bool &isLegal) const
 This method allows you to check for legal disconnections being made to attributes of this node. More...
 
virtual MStatus setDependentsDirty (const MPlug &plug, MPlugArray &plugArray)
 This method can be overridden in user defined nodes to specify which plugs should be set dirty based upon an input plug {plugBeingDirtied} which Maya is marking dirty. More...
 
virtual MStatus preEvaluation (const MDGContext &context, const MEvaluationNode &evaluationNode)
 Prepare a node's internal state for threaded evaluation. More...
 
virtual MStatus postEvaluation (const MDGContext &context, const MEvaluationNode &evaluationNode, PostEvaluationType evalType)
 Clean up node's internal state after threaded evaluation. More...
 
virtual SchedulingType schedulingType () const
 When overridden this method controls the degree of parallelism supported by the node during threaded evaluation. More...
 
virtual void getCacheSetup (const MEvaluationNode &, MNodeCacheDisablingInfo &, MNodeCacheSetupInfo &, MObjectArray &) const
 Provide node-specific setup info for the Cached Playback system. More...
 
virtual void configCache (const MEvaluationNode &, MCacheSchema &) const
 Defines the node's behavior when participating in Cached Playback. More...
 
virtual MTimeRange transformInvalidationRange (const MPlug &source, const MTimeRange &input) const
 Override this method to register this node as an Invalidation-Range-Transformation kernel (IRT kernel) An IRT kernel node will change the invalidation time range for its downstream nodes For example, Dynamics-solver will transform invalidation time range [a,b] to [a,+inf) And Clip-Time-Editor will send out the invalidation range for each of the clip [a,b] to ( [t0+a,t0+b] U [t1+a,t1+b] U [t2+a,t2+b] U ... More...
 
bool hasInvalidationRangeTransformation () const
 Checks if this MPxNode derived node overrides the MPxNode::transformInvalidationRange method.
 
virtual MStatus connectionMade (const MPlug &, const MPlug &, bool asSrc)
 This method gets called when connections are made to attributes of this node. More...
 
virtual MStatus connectionBroken (const MPlug &, const MPlug &, bool asSrc)
 This method gets called when connections are broken with attributes of this node. More...
 
virtual MStatus dependsOn (const MPlug &, const MPlug &, bool &depends) const
 This method may be overridden by the user defined node. More...
 
virtual bool isPassiveOutput (const MPlug &) const
 This method may be overridden by the user defined node if it wants to provide output attributes which do not prevent value modifications to the destination attribute. More...
 
virtual MStatus shouldSave (const MPlug &, bool &isSaving)
 This method may be overridden by the user defined node. More...
 
virtual MPlug passThroughToOne (const MPlug &) const
 This method may be overridden by nodes that have a one-to-one relationship between an input attribute and a corresponding output attribute. More...
 
virtual bool passThroughToMany (const MPlug &, MPlugArray &) const
 This method is overridden by nodes that want to control the traversal behavior of some Maya search algorithms which traverse the history/future of shape nodes looking for directly related nodes. More...
 
virtual bool isAbstractClass () const
 Override this class to return true if this node is an abstract node. More...
 
virtual bool isTrackingTopology () const
 Override this class to return true if this node wants to track topology. More...
 
virtual MStringArray getFilesToArchive (bool shortName=false, bool unresolvedName=false, bool markCouldBeImageSequence=false) const
 Use this method to return all external files used by this node. More...
 
virtual void getExternalContent (MExternalContentInfoTable &table) const
 Returns the external content (files) that this node depends on. More...
 
bool addExternalContentForFileAttr (MExternalContentInfoTable &, const MObject &attr) const
 Adds content info to the specified table from a file path attribute. More...
 
bool setExternalContentForFileAttr (const MObject &attr, const MExternalContentLocationTable &)
 Sets content info in the specified attribute from the table. More...
 
virtual void setExternalContent (const MExternalContentLocationTable &)
 Changes the location of external content in batch. More...
 
virtual MTypeId typeId () const
 Returns the TYPEID of this node. More...
 
virtual MString typeName () const
 Returns the type name of this node. More...
 
virtual MString name () const
 Returns the name of this particular instance of this class. More...
 
virtual MObject thisMObject () const
 Returns the MObject associated with this user defined node. More...
 
virtual MStatus setExistWithoutInConnections (bool flag)
 This method specifies whether or not the node can exist without input connections. More...
 
virtual bool existWithoutInConnections (MStatus *ReturnStatus=NULL) const
 Determines whether or not this node can exist without input connections. More...
 
virtual MStatus setExistWithoutOutConnections (bool flag)
 This method specifies whether or not the node can exist without output connections. More...
 
virtual bool existWithoutOutConnections (MStatus *ReturnStatus=NULL) const
 Determines whether or not this node can exist without output connections. More...
 
void _setMPSafe (bool isMPSafe)
 This method is obsolete. More...
 
MDataBlock _forceCache (const MDGContext &)
 This method is obsolete. More...
 
virtual bool getInternalValueInContext (const MPlug &, MDataHandle &, MDGContext &)
 This method is obsolete. More...
 
virtual bool setInternalValueInContext (const MPlug &, const MDataHandle &, MDGContext &)
 This method is obsolete. More...
 
virtual int internalArrayCount (const MPlug &, const MDGContext &) const
 This method is obsolete. More...
 

Static Public Member Functions

static const char * className ()
 Returns the name of this class. More...
 
- Static Public Member Functions inherited from MPxNode
static MStatus addAttribute (const MObject &attr)
 This method adds a new attribute to a user defined node type during the type's initialization. More...
 
static MStatus inheritAttributesFrom (const MString &parentClassName)
 This method allows a class of plugin node to inherit all of the attributes of a second class of plugin node. More...
 
static MStatus attributeAffects (const MObject &whenChanges, const MObject &isAffected)
 This method specifies that a particular input attribute affects a specific output attribute. More...
 
static MStatus attributeAffects (const MObject &whenChanges, const MObject &isAffected, bool affectsTopology)
 This method is an extension to the other version of the attributeAffects method. More...
 
static const char * className ()
 Returns the name of this class. More...
 

Static Public Attributes

static MObject mEmitterType
 emitter type attribute
 
static MObject mRate
 rate attribute
 
static MObject mSpeed
 speed attribute
 
static MObject mDirection
 direction attribute
 
static MObject mDirectionX
 X component of mDirection.
 
static MObject mDirectionY
 Y component of mDirection.
 
static MObject mDirectionZ
 Z component of mDirection.
 
static MObject mOwnerPosData
 owner postion attribute, multi
 
static MObject mOwnerVelData
 owner velocity attribute, multi
 
static MObject mOwnerCentroid
 owner centroid attribute
 
static MObject mOwnerCentroidX
 X component of mOwnerCentroid.
 
static MObject mOwnerCentroidY
 Y component of mOwnerCentroid.
 
static MObject mOwnerCentroidZ
 Z component of mOwnerCentroid.
 
static MObject mSweptGeometry
 input swept geometry attribute
 
static MObject mWorldMatrix
 world matrix attribute
 
static MObject mStartTime
 start time attribute
 
static MObject mDeltaTime
 delta time attribute
 
static MObject mIsFull
 flag for maximum count attribute
 
static MObject mInheritFactor
 inherit factor attribute
 
static MObject mSeed
 random seed attribute
 
static MObject mRandState
 random state attribute
 
static MObject mCurrentTime
 current time attribute
 
static MObject mOutput
 output particle attribute, multi
 
static MObject mMinDistance
 min distance attribute
 
static MObject mMaxDistance
 max distance attribute
 
- Static Public Attributes inherited from MPxNode
static MObject message
 message attribute
 
static MObject isHistoricallyInteresting
 is historically interesting attribute
 
static MObject caching
 caching attribute
 
static MObject state
 state attribute
 
static MObject frozen
 frozen attribute
 

Additional Inherited Members

- Protected Member Functions inherited from MPxNode
virtual MDataBlock forceCache ()
 USE _forceCache() IN SCRIPT. More...
 
virtual MStatus setDoNotWrite (bool flag)
 USE _setDoNotWrite() IN SCRIPT. More...
 
virtual bool doNotWrite (MStatus *ReturnStatus=NULL) const
 USE _doNotWrite() IN SCRIPT. More...
 
virtual void setMPSafe (bool isMPSafe)
 This method is obsolete. More...
 
virtual MDataBlock forceCache (const MDGContext &)
 This method is obsolete. More...
 

Detailed Description

Base class for user defined particle emitters.

MPxEmitterNode allows the creation and manipulation of dependency graph nodes representing particle emitters.

Examples:
ownerEmitter/ownerEmitter.h, simpleEmitter/simpleEmitter.h, and sweptEmitter/sweptEmitter.h.

Member Enumeration Documentation

Types of emitters.

Enumerator
kDirectional 

 

kOmni 

 

kSurface 

 

kCurve 

 

kVolume 

 

Member Function Documentation

MPxNode::Type type ( ) const
overridevirtual

This method returns the type of the node.

It should not be overridden by the user. It will return MPxNode::kEmitterNode.

Returns
The type of node
Status Codes:
  • MS::kSuccess The undo was successful
  • MS::kFailure This method is not undoable

Reimplemented from MPxNode.

Reimplemented in MPxFluidEmitterNode.

MStatus compute ( const MPlug plug,
MDataBlock dataBlock 
)
overridevirtual

This method should be overridden in user defined nodes.

Recompute the given output based on the nodes inputs. The plug represents the data value that needs to be recomputed, and the data block holds the storage for all of the node's attributes.

The MDataBlock will provide smart handles for reading and writing this node's attribute values. Only these values should be used when performing computations.

When evaluating the dependency graph, Maya will first call the compute method for this node. If the plug that is provided to the compute indicates that that the attribute was defined by the Maya parent node, the compute method should return MS::kUnknownParameter. When this occurs, Maya will call the internal Maya node from which the user-defined node is derived to compute the plug's value.

This means that a user defined node does not need to be concerned with computing inherited output attributes. However, if desired, these can be safely recomputed by this method to change the behaviour of the node.

Parameters
[in]plugplug representing the attribute that needs to be recomputed
[in]dataBlockdata block containing storage for the node's attributes
Returns
Status code
Status Codes:
  • MS::kSuccess Compute was successful
  • MS::kFailure Compute failed

Reimplemented from MPxNode.

Reimplemented in MPxFluidEmitterNode.

Examples:
ownerEmitter/ownerEmitter.h, simpleEmitter/simpleEmitter.h, and sweptEmitter/sweptEmitter.h.
void draw ( M3dView view,
const MDagPath path,
M3dView::DisplayStyle  style,
M3dView::DisplayStatus   
)
virtual

Overriding this method allows the drawing of custom geometry using standard OpenGL calls.

The OpenGL state should be left in the same state that it was in previously. The OpenGL routine glPushAttrib may be used to make this easier.

When this routine is called, the following conditions may be assumed:

  • the correct transform matrix will be loaded for the node, so the geometry should be drawn in local space
  • the correct default color will be set for wire frame drawing given the object's state (eg active, dormant, etc.)
  • the object is not invisible or hidden
  • if the object has a bounding box, then the bounding box is at least partially in the frustum

As a convenience, this draw method will also be used by OpenGL's selection mechanism to determine whether this object gets selected by a particular mouse event. The user does not need to write a separate selection routine.

Parameters
[in]view3D view that is being drawn into
[in]pathto this node in the DAG
[in]stylestyle to draw object in
Examples:
simpleEmitter/simpleEmitter.h.
MPxEmitterNode::MEmitterType getEmitterType ( MDataBlock block)

Retrieves the type of the emitter, determined by the "emitterType" attribute value.

This is intended to be called from within the emitter's compute() method, in order to decide how the emitter should behave when evaluated.

Parameters
[in]blockdata block containing storage for the node's attributes
Returns
An MEmitterType value representing the type of emitter (directional, omni, surface, curve, or volume)
MObject getOwnerShape ( )

If the emitter is a emitting from an object, this method returns the shape node for the object.

Returns
An MObject representing the "owner" of this emitter (ie the object being emitted from, or kNullObj if the emitter is not emitting from an object.
MTime getCurrentTime ( MDataBlock block)

Intended to be called from within the emitter's compute() method, this method returns the time at which the emitter is currently being evaluated.

This is equivalent to querying the "currentTime" attribute on the emitter.

Parameters
[in]blockdata block containing storage for the node's attributes
Returns
The time at which the emitter is being evaluated.
MTime getStartTime ( int  plugIndex,
MDataBlock block 
)

Intended to be called from within the emitter's compute() method, this method returns the start times for each particle system or fluid into which the emitter is emitting.

Each of these "targets" is identified by an index value corresponding to the order in which they are connected to the emitter. The start time value gives the time at which the given target is to start receiving particles or fluid. If the current time is less than the start time for a target, then nothing should be emitted into that target in the current evaluation. This value is taken by evaluating an element of the emitter node's "startTime" array attribute.

Parameters
[in]plugIndexidentifies which emitter target's start time is to be evaluated.
[in]blockdata block containing storage for the node's attributes
Returns
The start time for the specified target, ie the time at which the emitter is to start emitting into that target.
MTime getDeltaTime ( int  plugIndex,
MDataBlock block 
)

Intended to be called from within the emitter's compute() method, this method returns the width of the time interval represented by the current emitter evaluation.

Usually emitter emission rates are given as rates per second, so by converting this deltaTime value to seconds, plugin emitters can determine how many particles or how much fluid to emit in the current evaluation. This value is taken from the emitter's "deltaTime" attribute value, and can vary between different emitter targets (particle systems or fluid shapes into which the emitter is emitting), due to potential differences in oversampling settings. The "plugIndex" parameter indicates which target's time delta is being evaluated.

Parameters
[in]plugIndexidentifies which emitter target's time delta is to be evaluated.
[in]blockdata block containing storage for the node's attributes
Returns
The time delta for the current emitter evaluation on the specified target.
int getRandomSeed ( int  plugIndex,
MDataBlock block 
)

Intended to be called from within the emitter's compute() method, this method returns the random seed for a specified emission target (particle system or fluid shape into which the emitter is emitting).

This seed value is set on the target itself, and should be used to ensure that any randomized emission behavior is repeatable when animations are played back repeatedly. The resetRandomState() method uses this value (see its documentation for details on how to implement repeatable randomized behaviour in emitters). This value is obtained by evaluating an element of the emitter's "seed" array attribute.

Parameters
[in]plugIndexidentifies which emitter target's random seed is to be evaluated.
[in]blockdata block containing storage for the node's attributes
Returns
The random seed value for the specified target.
void getRandomState ( int  plugIndex,
MDataBlock block 
)

Intended to be called from within the emitter's compute() method, this method copies the emitter node attribute representing the current random state for a particular emitter target into a local variable on the emitter object, to facilitate efficient random number generation using the randgen() method.

See the documentation for resetRandomState() for a description of how to use this method in conjunction with the other random stream methods of this class.

There is only one local random state data member, so care should be taken not to inadvertently overwrite this member by calling getRandomState() on one target before setRandomState() has been called on a previously-evaluated target.

Parameters
[in]plugIndexidentifies which emitter target's random state is to be copied to the local random state data member.
[in]blockdata block containing storage for the node's attributes
void setRandomState ( int  plugIndex,
MDataBlock block 
)

Intended to be called from within the emitter's compute() method, this method copies the emitter node class random state data member onto the emitter node's random state attribute.

See the documentation for resetRandomState() for a description of how to use this method in conjunction with the other random stream methods of this class.

There is only one local random state data member, so care should be taken not to inadvertently write the wrong random state value to the attribute by calling setRandomState() on a target before getRandomState() has been called for that target.

Parameters
[in]plugIndexidentifies which emitter target's random state is to be written from the local random state data member.
[in]blockdata block containing storage for the node's attributes
void resetRandomState ( int  plugIndex,
MDataBlock block 
)

Intended to be called from within the emitter's compute() method, this method resets the emitter's random state data member.

To implement repeatable randomized emitter behavior, the following steps should be followed:

  • When the current time is less than the start time, call resetRandomState(). This sets the emitter's random state to an initial value determined by the random seed for the given target. This initializes both the emitter's randomState attribute and a random state data member on the emitter class.
  • When the emitter needs to emit either particles or fluid in a compute() call, first call the getRandomState() method. This copies the emitter's current random state from its randomState attribute into the data member on the emitter class.
  • Over the course of the compute() method, when a random value is required, call randgen(). This generates a random value using the random state data member value, which is then incremented.
  • When the emitter is finished emitting, call the setRandomState() method to set the random state data member's value back onto the random state attribute for the node. This way, the next evaluation of the emitter will pick up where the previous one left off in the random sequence.

This way, the emitter gets a repeatable stream of random numbers that is independent of the order of evaluation of the various emitter targets. Persistence is achieved by storing the random state on emitter attributes between evaluations, and efficiency is achieved by using a local random state variable during evaluations.

Parameters
[in]plugIndexidentifies which emitter target's random state is to be reset.
[in]blockdata block containing storage for the node's attributes
double randgen ( )

Intended to be called from within the emitter's compute() method, this method generates a double-precision random number in the rand [0,1].

The emitter object's random state data member is used to generate the random number, and will be updated after the number is generated. To generate a stream of random numbers for a particular target, ensure that getRandomState() is called before calling randgen(), and that setRandomState() is called after all the random numbers have been generated. See the documentation for resetRandomState() for a description of how to use this method in conjunction with the other random stream methods of this class.

Returns
A double-precision random number between 0 and 1.
double getRate ( MDataBlock block)

Intended to be called from within the emitter's compute() method, this method retrieves the "rate" attribute value common to all particle and fluid emitters.

For particle emitters, this indicates the number of particles to be emitted per second. For fluid emitters, this value is usually used as a multiplier applied to the emission rates for various fluid grids such as density, temperature, etc.

Parameters
[in]blockdata block containing storage for the node's attributes
Returns
The emission rate for the emitter.
double getMinDistance ( MDataBlock block)

Intended to be called from within the emitter's compute() method, this method retrieves the "minDistance" attribute value common to all particle and fluid emitters.

This value indicates the minimum distance from the emitter center at which fluid or particles will be emitted.

Parameters
[in]blockdata block containing storage for the node's attributes
Returns
The minimum emission distance for the emitter.
double getMaxDistance ( MDataBlock block)

Intended to be called from within the emitter's compute() method, this method retrieves the "maxDistance" attribute value common to all particle and fluid emitters.

This value indicates the maximum distance from the emitter center at which fluid or particles will be emitted.

Parameters
[in]blockdata block containing storage for the node's attributes
Returns
The maximum emission distance for the emitter.
MPoint getWorldPosition ( )

Returns the worldspace coordinates of the emitter.

For curve, surface, and volume emitters, this returns the worldspace coordinates of the center of the emitter's local space. For point emitters, this value usually corresponds to the position of the emitter object itself.

Returns
The worldspace coordinates of the center of the emitter's local space.
Examples:
ownerEmitter/ownerEmitter.h, and simpleEmitter/simpleEmitter.h.
MMatrix getWorldMatrix ( )

Returns the matrix that maps from the emitter's local space coordinates to worldspace.

Returns
Emitter's object to world space transformation matrix.
bool volumePrimitiveBoundingBox ( MBoundingBox box)

For volume emitters, this method returns the object-space bounding box of the volume primitive associated with the emitter.

Parameters
[out]boxreceives the object space bounding box for the emission volume primitive.
Returns
true if the emitter has an associated volume primitive, false otherwise.
bool volumePrimitivePointInside ( const MPoint worldPoint,
const MMatrix emitterWorldMatrix 
)

For volume emitters, this method determines whether a particular point in space lies within the volume defined by the emitter's volume primitive.

Parameters
[in]worldPointworldspace coordinates of the point to be tested.
[in]emitterWorldMatrixobject to worldspace matrix for the emitter, which can be obtained using the MPxEmitterNode::getWorldMatrix() method.
Returns
true if the point lies inside the emitter's volume primitive, false otherwise.
double volumePrimitiveDistanceFromAxis ( const MPoint worldPoint,
const MMatrix emitterWorldMatrix 
)

For volume emitters, this method determines the distance from a particular point to the major axis of the volumetric primitive associated with the emitter.

For fluid emitters, this distance can be used to implement simple emission dropoff behavior.

Parameters
[in]worldPointworldspace coordinates of the point to be tested.
[in]emitterWorldMatrixobject to worldspace matrix for the emitter, which can be obtained using the MPxEmitterNode::getWorldMatrix() method.
Returns
The distance from the point to the major axis of the emitter's volume primitive.
bool hasValidEmission2dTexture ( const MObject texAttr,
MStatus status = NULL 
)

Certain aspects of Maya's particle and fluid emitters can be textured using 2d textures.

For example, surface particle emitters can use a 2d texture to modulate the emission rate over the surface. For these purposes, only a subset of Maya's textures are supported, namely the default 2d textures (bulge, checker, cloth, file, fluid texture 2d, fractal, grid, mountain, movie, noise, ocean, ramp, water). No other nodes are supported. This method takes an attribute on an emitter, and determines if there is a supported texture connected to it. If the texture is supported, then the evalEmission2dTexture() method can be called to evaluate the texture at various (u,v) coordinate values.

Parameters
[in]texAttrattribute to be tested for a valid texture connection.
[out]statusstatus code.
Status Codes:
  • MS::kSuccess The connected texture was successfully examined.
  • MS::kUnknownParameter There was no node connected to the specified attribute.
Returns
true if the node connected to the specified emitter attribute is a texture that can be evaluated using the evalEmission2dTexture() method, false otherwise.
MStatus evalEmission2dTexture ( const MObject texAttr,
MDoubleArray uCoords,
MDoubleArray vCoords,
MVectorArray resultColors,
MDoubleArray resultAlphas 
)

If a supported 2d texture (see hasValidEmission2dTexture() method documentation) is connected to the given emitter attribute, this method can be called to evaluate that texture at a number of (u,v) texture coordinate values.

Parameters
[in]texAttrattribute whose connected texture is to be evaluated.
[in]uCoordsarray of u coordinate values
[in]vCoordsarray of v coordinate values
[out]resultColorsif non-NULL, receives the result of the connected texture's outColor attribute, evaluated at all the (u,v) coordinates given by the uCoords and vCoords arrays.
[out]resultAlphasif non-NULL, receives the outAlpha values evaluated from the texture at these same points.
Status Codes:
  • MS::kSuccess The connected texture was successfully evaluated
  • MS::kUnknownParameter There was no texture, or an unsupported texture connected to the specified attribute, so textured values could not be evaluated.
const char * className ( )
static

Returns the name of this class.

Returns
The name of this class.

The documentation for this class was generated from the following files: