C++ API Reference
MDynamicsUtil Class Reference

Utility class for Maya dynamics. More...

#include <MDynamicsUtil.h>

Static Public Member Functions

static bool hasValidDynamics2dTexture (const MObject &node, const MObject &texAttr, MStatus *status=NULL)
 Certain aspects of Maya's dynamics can be textured using 2d textures. More...
 
static MStatus evalDynamics2dTexture (const MObject &node, const MObject &texAttr, MDoubleArray &uCoords, MDoubleArray &vCoords, MVectorArray *resultColors, MDoubleArray *resultAlphas)
 If a supported 2d texture (see hasValidDynamics2dTexture() method documentation) is connected to the specified attribute, this method can be called to evaluate that texture at a number of (u,v) texture coordinate values. More...
 
static bool inRunup ()
 Is Maya's dynamics system currently doing a runup? More...
 
static bool runupIfRequired ()
 If the dynamics runup prefs are set, do a runup. More...
 
static bool addNodeTypeToRunup (const MString &nodeTypeName)
 Add this node to the list of nodes participating in runup. More...
 
static bool removeNodeTypeFromRunup (const MString &nodeTypeName)
 Remove this node from the list of nodes participating in runup. More...
 

Detailed Description

Utility class for Maya dynamics.

MDynamicsUtil provides utility methods related to Maya dynamics (eg. particles and fluids).

Member Function Documentation

bool hasValidDynamics2dTexture ( const MObject node,
const MObject texAttr,
MStatus status = NULL 
)
static

Certain aspects of Maya's dynamics 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 and determines if there is a supported texture connected to it. If the texture is supported, then the evalDynamics2dTexture() method can be called to evaluate the texture at various (u,v) coordinate values.

Parameters
[in]nodenode to be tested for a valid texture connection.
[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 attribute is a texture that can be evaluated using the evalDynamics2dTexture() method, false otherwise.
Examples:
particleAttrNode/particleAttrNode.cpp.
MStatus evalDynamics2dTexture ( const MObject node,
const MObject texAttr,
MDoubleArray uCoords,
MDoubleArray vCoords,
MVectorArray resultColors,
MDoubleArray resultAlphas 
)
static

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

Parameters
[in]nodenode whose connected texture is to be evaluated.
[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.
Examples:
particleAttrNode/particleAttrNode.cpp.
bool inRunup ( )
static

Is Maya's dynamics system currently doing a runup?

Returns
true if in runup, false otherwise.
bool runupIfRequired ( )
static

If the dynamics runup prefs are set, do a runup.

Returns
true if the prefs indicated that runup was on, false otherwise.
bool addNodeTypeToRunup ( const MString nodeTypeName)
static

Add this node to the list of nodes participating in runup.

The node should respond to timeChanged and delayedTimeChangedRunup messages, or have a forceDynamics attribute. The node should have lastEvalTime and lastCacheTime attributes to determine whether runup is needed. Optionally the node may have a boolean checkForRunup attribute that when false will fully disable runup checking.

Parameters
[in]nodeTypeNamenode type to be included in runup.
Returns
true if the node was added to the list, false if it was already on the list
bool removeNodeTypeFromRunup ( const MString nodeTypeName)
static

Remove this node from the list of nodes participating in runup.

Parameters
[in]nodeTypeNamenode type to be removed from runup.
Returns
true if the node was removed from the list, false if it was not on the list to start with

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