Public Member Functions | Static Public Member Functions | Static Public Attributes

MPxFieldNode Class Reference

This reference page is linked to from the following overview topics: Parent class descriptions.


Search for all occurrences

Detailed Description

Base class for user defined fields.

MPxFieldNode allows the creation and manipulation of dependency graph nodes representing fields. This is the top level of a hierarchy of field node function sets. It permits manipulation of the attributes common to all types of fields.

Examples:

dynExprField.h, and torusField.h.

#include <MPxFieldNode.h>

Inheritance diagram for MPxFieldNode:
Inheritance graph
[legend]

List of all members.

Public Member Functions

  MPxFieldNode ()
  Class constructor.
virtual  ~MPxFieldNode ()
  The class destructor.
virtual MPxNode::Type  type () const
  This method returns the type of the node.
virtual MStatus  compute (const MPlug &plug, MDataBlock &dataBlock)
  This method should be overridden in user defined nodes.
virtual MStatus  getForceAtPoint (const MVectorArray &point, const MVectorArray &velocity, const MDoubleArray &mass, MVectorArray &force, double deltaTime)
  This method is not required to be overridden, it is only necessary for compatibility with the MFnField function set.
virtual MStatus  iconSizeAndOrigin (GLuint &width, GLuint &height, GLuint &xbo, GLuint &ybo)
  Define the size and the origin of the field's icon.
virtual MStatus  iconBitmap (GLubyte *bitmap)
  Define the bitmap for the field's icon.
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.
virtual double  falloffCurve (const double param, MStatus *ReturnStatus=NULL)
  Returns the falloff at the given parameter value.
virtual bool  isFalloffCurveConstantOne (MStatus *ReturnStatus=NULL)
  Returns true if the falloffCurve is a constant one (default) or false if not.

Static Public Member Functions

static const char *  className ()
  Returns the name of this class.

Static Public Attributes

static MObject  mMagnitude
  magnitude attribute
static MObject  mAttenuation
  attenuation attribute
static MObject  mMaxDistance
  maximum distance attribute
static MObject  mUseMaxDistance
  flag for maximum distance attribute
static MObject  mApplyPerVertex
  flag for per vertex attribute
static MObject  mInputData
  input attribute compound, multi
static MObject  mInputPositions
  child attribute, multi
static MObject  mInputVelocities
  child attribute, multi
static MObject  mInputMass
  child attribute, multi
static MObject  mDeltaTime
  child attribute
static MObject  mInputForce
  forces input attribute, multi
static MObject  mOutputForce
  forces output attribute, multi
static MObject  mOwnerCentroidX
  X component of mOwnerCentroid.
static MObject  mOwnerCentroidY
  Y component of mOwnerCentroid.
static MObject  mOwnerCentroidZ
  Z component of mOwnerCentroid.
static MObject  mOwnerCentroid
  owner centroid attribute
static MObject  mOwnerPosData
  owner position attribute, multi
static MObject  mOwnerVelData
  owner velocity attribute, multi
static MObject  mWorldMatrix
  world matrix attribute
static MObject  mInputPPData
  Attribute for input pp data from particleShape.
static MObject  mOwnerPPData
  Attribute for input pp data from owner particleShape.

Member Function Documentation

MPxNode::Type type ( ) const [virtual]

This method returns the type of the node.

This method should not be overridden by the user. It will return MPxNode::kFieldNode.

Returns:
The type of node
Status Codes:

Reimplemented from MPxNode.

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] 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 MPxNode.

Examples:
dynExprField.h, and torusField.h.
MStatus getForceAtPoint ( const MVectorArray point,
const MVectorArray velocity,
const MDoubleArray mass,
MVectorArray force,
double  deltaTime 
) [virtual]

This method is not required to be overridden, it is only necessary for compatibility with the MFnField function set.

Compute the force of a field on an array of points, given their position, velocity, and mass.

This method uses MVectorArray to represent the positions of a point.

Parameters:
[in] point array of positions for each point.
[in] velocity array of velocities for each point. If the length of the velocity array is 0, a velocity of 0.0 is assumed for all the points. Note the velocity array is a requirement for the Air and Drag fields to compute forces.
[in] mass array of mass values for each point. If the length of the mass array is 0, a mass of 1.0 is assumed for all the points.
[out] force output array of forces applied to each point. If the length of the force array supplied is 0, the array is automatically resized. If the contents of the force array contains data, the computed force is added to the supplied data. This can be useful to accumulate forces of multiple fields.
[in] deltaTime time increment in seconds
Returns:
Status code
Status Codes:
Examples:
torusField.h.
MStatus iconSizeAndOrigin ( GLuint &  width,
GLuint &  height,
GLuint &  xbo,
GLuint &  ybo 
) [virtual]

Define the size and the origin of the field's icon.

Maya calls this method to determine the size and origin of the icon you wish your field to use. Overriding this method is optional.

The arguments have the same meaning as defined in OpenGL's glBitmap method.

Parameters:
[out] width the width of the icon in pixels. It needs to be a multiple of 32 on windows and a multiple of 16 on any other platform.
[out] height the height of the icon in pixels. It needs to be a multiple of 32 on windows and a multiple of 16 on any other platform.
[out] xbo the origin of the icon in x direction.
[out] ybo the origin of the icon in y direction.
Returns:
Status code
Status Codes:
Examples:
dynExprField.h, and torusField.h.
MStatus iconBitmap ( GLubyte *  bitmap ) [virtual]

Define the bitmap for the field's icon.

Maya calls this method to get the bitmap for the icon you wish your field to use. Overriding this method is optional, but if you do override it then you must also override iconSizeAndOrigin().

Parameters:
[out] bitmap Bitmap for the field's icon, in the format expected by OpenGL's glBitmap() function. The storage pointed to by this parameter will have already been allocated by Maya according to the values returned by iconSizeAndOrigin().
Returns:
Status code
Status Codes:
Examples:
dynExprField.h, and torusField.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] view 3D view that is being drawn into
[in] path to this node in the DAG
[in] style style to draw object in
Examples:
torusField.h.
double falloffCurve ( const double  param,
MStatus ReturnStatus = NULL 
) [virtual]

Returns the falloff at the given parameter value.

Parameters:
[in] param Parameter value in the range [0.0, 1.0]
[out] ReturnStatus Status code
Returns:
The falloff value at the given the param.
Status Codes:
bool isFalloffCurveConstantOne ( MStatus ReturnStatus = NULL ) [virtual]

Returns true if the falloffCurve is a constant one (default) or false if not.

Parameters:
[out] ReturnStatus Status code
Returns:
true if the falloff curve is a constant one, false otherwise
Status Codes:
const char * className ( ) [static]

Returns the name of this class.

Returns:
The name of this class.

Reimplemented from MPxNode.


MPxFieldNode MPxFieldNode MPxFieldNode MPxFieldNode MPxFieldNode MPxFieldNode MPxFieldNode MPxFieldNode MPxFieldNode MPxFieldNode
MPxFieldNode MPxFieldNode MPxFieldNode MPxFieldNode MPxFieldNode MPxFieldNode MPxFieldNode MPxFieldNode MPxFieldNode MPxFieldNode