MPxFluidEmitterNode Class Reference
[OpenMayaFX - API module for effects]

#include <MPxFluidEmitterNode.h>
Inheritance diagram for MPxFluidEmitterNode:
Inheritance graph
[legend]
Collaboration diagram for MPxFluidEmitterNode:
Collaboration graph
[legend]

List of all members.


Detailed Description

Base class for user defined particle emitters.

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

Examples:

simpleFluidEmitter.h.


Public Member Functions

  MPxFluidEmitterNode ()
virtual  ~MPxFluidEmitterNode ()
virtual MPxNode::Type  type () const
virtual MStatus  compute (const MPlug &plug, MDataBlock &dataBlock)
virtual MStatus  fluidEmitter (const MObject &fluidObj, const MMatrix &worldMatrix, int plugIndex)
double  fluidDensityEmission (MDataBlock &block)
double  fluidHeatEmission (MDataBlock &block)
double  fluidFuelEmission (MDataBlock &block)
bool  fluidEmitColor (MDataBlock &block)
MColor  fluidColor (MDataBlock &block)
double  fluidDropoff (MDataBlock &block)
double  turbulence (MDataBlock &block)
bool  fluidJitter (MDataBlock &block)

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

Constructor & Destructor Documentation

MPxFluidEmitterNode::MPxFluidEmitterNode (  ) 

Class constructor.

MPxFluidEmitterNode::~MPxFluidEmitterNode (  )  [virtual]

The class destructor.


Member Function Documentation

MPxNode::Type MPxFluidEmitterNode::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 MPxFluidEmitterNode::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]  plug  plug representing the attribute that needs to be recomputed
[in]  dataBlock  data block containing storage for the node's attributes
Returns:
Status code
Status Codes:

Reimplemented from MPxEmitterNode.

Examples:

MStatus MPxFluidEmitterNode::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]  fluidObj  the fluid object into which the emitter is emitting.
[in]  worldMatrix  object to world transformation matrix for the fluid
[in]  plugIndex  the 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 MPxFluidEmitterNode::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]  block  data block containing storage for the node's attributes
Returns:
The fluid density emission rate for the fluid emitter.

double MPxFluidEmitterNode::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]  block  data block containing storage for the node's attributes
Returns:
The fluid heat emission rate for the fluid emitter.

double MPxFluidEmitterNode::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]  block  data block containing storage for the node's attributes
Returns:
The fluid fuel emission rate for the fluid emitter.

bool MPxFluidEmitterNode::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]  block  data block containing storage for the node's attributes
Returns:
true if the emitter should emit color into the fluid, false otherwise.

MColor MPxFluidEmitterNode::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]  block  data block containing storage for the node's attributes
Returns:
The color that should be emitted into the fluid.

double MPxFluidEmitterNode::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]  block  data block containing storage for the node's attributes
Returns:
The dropoff rate for the fluid emitter.

double MPxFluidEmitterNode::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]  block  data block containing storage for the node's attributes
Returns:
The turbulence value for the fluid emitter.

bool MPxFluidEmitterNode::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]  block  data block containing storage for the node's attributes
Returns:
true if jitter should be applied to the emission behavior, false otherwise.

Autodesk® Maya® 2011 © 1997-2010 Autodesk, Inc. All rights reserved. Generated with doxygen 1.5.6