MPxFluidEmitterNode Class Reference

#include <MPxFluidEmitterNode.h>

Class Description

Base class for user defined particle emitters.

MPxFluidEmitterNode allows the creation and manipulation of dependency graph nodes representing fluid emitters.

+ Examples:
+ Inheritance diagram for MPxFluidEmitterNode:

Public Member Functions

 MPxFluidEmitterNode ()
 Class constructor.
 
virtual ~MPxFluidEmitterNode ()
 The class destructor.
 
virtual MPxNode::Type type () const
 This method returns the type of the node. More...
 
virtual MStatus compute (const MPlug &plug, MDataBlock &dataBlock)
 This method should be overridden in user defined nodes. More...
 
virtual MStatus fluidEmitter (const MObject &fluidObj, const MMatrix &worldMatrix, int plugIndex)
 This is the main method that plug-in fluid emitter nodes must override in order to emit into fluids. More...
 
double fluidDensityEmission (MDataBlock &block)
 Intended to be called from within the emitter's compute() method, this method retrieves the "fluidDensityEmission" attribute value common to all fluid emitters. More...
 
double fluidHeatEmission (MDataBlock &block)
 Intended to be called from within the emitter's compute() method, this method retrieves the "fluidHeatEmission" attribute value common to all fluid emitters. More...
 
double fluidFuelEmission (MDataBlock &block)
 Intended to be called from within the emitter's compute() method, this method retrieves the "fluidFuelEmission" attribute value common to all fluid emitters. More...
 
bool fluidEmitColor (MDataBlock &block)
 Intended to be called from within the emitter's compute() method, this method retrieves the "fluidEmitColor" attribute value common to all fluid emitters. More...
 
MColor fluidColor (MDataBlock &block)
 Intended to be called from within the emitter's compute() method, this method retrieves the "fluidColor" attribute value common to all fluid emitters. More...
 
double fluidDropoff (MDataBlock &block)
 Intended to be called from within the emitter's compute() method, this method retrieves the "fluidDropoff" attribute value common to all fluid emitters. More...
 
double turbulence (MDataBlock &block)
 Intended to be called from within the emitter's compute() method, this method retrieves the "turbulence" attribute value common to all fluid emitters. More...
 
bool fluidJitter (MDataBlock &block)
 Intended to be called from within the emitter's compute() method, this method retrieves the "fluidJitter" attribute value common to all fluid emitters. More...
 
- Public Member Functions inherited from MPxEmitterNode
 MPxEmitterNode ()
 Class constructor.
 
virtual ~MPxEmitterNode ()
 The class destructor.
 
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 getInternalValueInContext (const MPlug &plug, MDataHandle &dataHandle, MDGContext &ctx)
 This method is overridden by nodes that store attribute data in some internal format. More...
 
virtual bool setInternalValueInContext (const MPlug &plug, const MDataHandle &dataHandle, MDGContext &ctx)
 This method is overridden by nodes that store attribute data in some internal format. More...
 
virtual bool getInternalValue (const MPlug &plug, MDataHandle &dataHandle)
 This method is obsolete. More...
 
virtual bool setInternalValue (const MPlug &plug, const MDataHandle &dataHandle)
 This method is obsolete. More...
 
virtual int internalArrayCount (const MPlug &plug, const MDGContext &ctx) 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 &plug, const MPlug &otherPlug, 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 &plug, const MPlug &otherPlug, 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 MStatus connectionMade (const MPlug &plug, const MPlug &otherPlug, bool asSrc)
 This method gets called when connections are made to attributes of this node. More...
 
virtual MStatus connectionBroken (const MPlug &plug, const MPlug &otherPlug, bool asSrc)
 This method gets called when connections are broken with attributes of this node. More...
 
virtual MStatus dependsOn (const MPlug &plug, const MPlug &otherPlug, bool &depends) const
 This method may be overridden by the user defined node. More...
 
virtual bool isPassiveOutput (const MPlug &plug) 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 &plug, bool &isSaving)
 This method may be overridden by the user defined node. More...
 
virtual MPlug passThroughToOne (const MPlug &plug) 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 &plug, MPlugArray &plugArray) 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 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 &table, const MObject &attr) const
 Adds content info to the specified table from a file path attribute. More...
 
bool setExternalContentForFileAttr (const MObject &attr, const MExternalContentLocationTable &table)
 Sets content info in the specified attribute from the table. More...
 
virtual void setExternalContent (const MExternalContentLocationTable &table)
 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...
 

Static Public Member Functions

static const char * className ()
 Returns the name of this class. More...
 
- Static Public Member Functions inherited from MPxEmitterNode
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 const char * className ()
 Returns the name of this class. More...
 

Static Public Attributes

static MObject mFluidDensityEmission
 density emission rate attribute
 
static MObject mFluidHeatEmission
 heat emission rate attribute
 
static MObject mFluidFuelEmission
 fuel emission rate attribute
 
static MObject mEmitFluidColor
 color emission toggle attribute
 
static MObject mFluidColor
 emission color attribute
 
static MObject mFluidColorR
 emission red color channel attribute
 
static MObject mFluidColorG
 emission green color channel attribute
 
static MObject mFluidColorB
 emission blue color channel attribute
 
static MObject mFluidDropoff
 emission dropoff attribute
 
static MObject mTurbulence
 emission turbulence attribute
 
static MObject mFluidJitter
 emission jitter attribute
 
static MObject mEmissionFunction
 emission function attribute
 
- Static Public Attributes inherited from MPxEmitterNode
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

- Public Types inherited from MPxEmitterNode
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
}
 Defines the degree of parallelism of a node. More...
 
- Protected Member Functions inherited from MPxNode
virtual MDataBlock forceCache (MDGContext &ctx=MDGContext::fsNormal)
 USE _forceCache() IN SCRIPT. More...
 
virtual void setMPSafe (bool flag)
 USE _setMPSafe() 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...
 

Member Function Documentation

MPxNode::Type type ( ) const
virtual

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

Reimplemented from MPxEmitterNode.

MStatus compute ( const MPlug plug,
MDataBlock dataBlock 
)
virtual

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:

Reimplemented from MPxEmitterNode.

+ Examples:
MStatus fluidEmitter ( const MObject fluidObj,
const MMatrix worldMatrix,
int  plugIndex 
)
virtual

This is the main method that plug-in fluid emitter nodes must override in order to emit into fluids.

When an emitter is attached to a fluid, at every evaluation step the fluid will call this method on the emitter. The method receives a fluid object into which to emit, the index of the fluid in the array of fluid targets for this emitter, and the worldspace matrix of the fluid. The emitter should query its attributes to determine how much density, heat, color, and/or fuel to emit into the fluid, then call the MFnFluid::emitIntoArrays() method to actually add the necessary quantities to the fluid.

Returning MS::kUnknownParameter from this method will cause Maya to execute the default fluid emitter's emission behavior.

Parameters
[in]fluidObjthe fluid object into which the emitter is emitting.
[in]worldMatrixobject to world transformation matrix for the fluid
[in]plugIndexthe index of the fluid in the array of emission targets for this emitter. Pass this value to the random number stream generation routines in MPxEmitterNode.
Returns
Status code
Status Codes:
  • MS::kSuccess Return kSuccess to indicate that the plug-in node successfully performed the emission step.
  • MS::kUnknownParameter Return kUnknownParameter to tell Maya to execute the standard internal fluid emitter behavior for this time step.
+ Examples:
double fluidDensityEmission ( MDataBlock block)

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

This indicates the amount of fluid material to be emitted per second, and it is modulated by the emitter's "rate" attribute value.

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

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

This indicates the amount of heat to be emitted per second, and it is modulated by the emitter's "rate" attribute value.

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

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

This indicates the amount of fuel to be emitted per second, and it is modulated by the emitter's "rate" attribute value.

Parameters
[in]blockdata block containing storage for the node's attributes
Returns
The fluid fuel emission rate for the fluid emitter.
bool fluidEmitColor ( MDataBlock block)

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

This indicates whether or not the emitter should emit color into the fluid.

Parameters
[in]blockdata block containing storage for the node's attributes
Returns
true if the emitter should emit color into the fluid, false otherwise.
MColor fluidColor ( MDataBlock block)

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

This specifies the color to be added to the fluid.

Parameters
[in]blockdata block containing storage for the node's attributes
Returns
The color that should be emitted into the fluid.
double fluidDropoff ( MDataBlock block)

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

This specifies the the speed with which fluid emission drops off with increasing distance from the emitter, with higher values meaning faster dropoff.

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

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

This specifies the amount of turbulence that should be applied to the emitter's output.

Parameters
[in]blockdata block containing storage for the node's attributes
Returns
The turbulence value for the fluid emitter.
bool fluidJitter ( MDataBlock block)

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

This specifies how the voxel grid should be sampled for emission. Without jitter, the grid is sampled only at voxel centers, but with jitter enabled, each voxel is sampled at a random location. The fluid emitter is responsible for implementing this behavior. It is recommended that the random stream methods on MPxEmitterNode be used to implement repeatable randomized behavior in this area.

Parameters
[in]blockdata block containing storage for the node's attributes
Returns
true if jitter should be applied to the emission behavior, false otherwise.
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:
  • MPxFluidEmitterNode.h
  • MPxFluidEmitterNode.cpp