MPxFieldNode Class Reference

#include <MPxFieldNode.h>

Class 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:
+ Inheritance diagram for MPxFieldNode:

Public Member Functions

 MPxFieldNode ()
 Class constructor.
 
virtual ~MPxFieldNode ()
 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 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. More...
 
virtual MStatus iconSizeAndOrigin (GLuint &width, GLuint &height, GLuint &xbo, GLuint &ybo)
 Define the size and the origin of the field's icon. More...
 
virtual MStatus iconBitmap (GLubyte *bitmap)
 Define the bitmap for the field's icon. 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...
 
virtual double falloffCurve (const double param, MStatus *ReturnStatus=NULL)
 Returns the falloff at the given parameter value. More...
 
virtual bool isFalloffCurveConstantOne (MStatus *ReturnStatus=NULL)
 Returns true if the falloffCurve is a constant one (default) or false if not. 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 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 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.
 
- 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 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.

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

+ Examples:
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]pointarray of positions for each point.
[in]velocityarray 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]massarray 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]forceoutput 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]deltaTimetime increment in seconds
Returns
Status code
Status Codes:
+ Examples:
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]widththe 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]heightthe 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]xbothe origin of the icon in x direction.
[out]ybothe origin of the icon in y direction.
Returns
Status code
Status Codes:
+ Examples:
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]bitmapBitmap 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:
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:
double falloffCurve ( const double  param,
MStatus ReturnStatus = NULL 
)
virtual

Returns the falloff at the given parameter value.

Parameters
[in]paramParameter value in the range [0.0, 1.0]
[out]ReturnStatusStatus 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]ReturnStatusStatus 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.

The documentation for this class was generated from the following files:
  • MPxFieldNode.h
  • MPxFieldNode.cpp