API Guide > Dependency graph plug-ins >

# MPxNode and its derived classes

The MPxNode class is the parent class from which the other functionally-specific MPx classes are defined. These derived classes possess specific knowledge corresponding to their functional area for integrating your class into Maya. For example, the MPxLocator class knows that it must draw itself in different colors depending on whether it is selected or not. Each parent class defines a set of attributes which Maya expects and can automatically connect to when your subclass is used in a scene. The compute() method that you will define with your subclass can use these attributes as desired. Refer to the manual pages for the various MPx parent classes for a listing and description of the predefined attributes.

The MPxManipContainer (see Chapter 7, "Manipulators") and MPxSurfaceShape classes (see Chapter 8, "Shapes") are complex classes which require more in depth descriptions.

MPxLocatorNode

This parent class is a DAG node which allows you to draw three dimensional graphical elements in the Maya scene. The elements are associated with a location in the scene which can be manipulated using the standard Maya manipulators.

This class can be used for defining entities which have a location in space but no explicit shape, such as a new type of light source, a destination point for the behavior of some other entity, or a construction location for a shape not yet created. The graphical elements drawn by the locator are not rendered. The MPxLocator class itself draws a default graphic, but a draw() method is provided which can be implemented in your subclass to perform more specialized drawing.

MPxDeformerNode

This class allows you to take an input geometry shape and deform it. Maya requires a special protocol for performing deformations, and provides a few special methods which you implement.

The first is the deform() method. The actual deformation does not take place in the compute() method of deformer nodes but through an internal mechanism which calls the deform() method.

Two other methods, accessoryAttribute() and accessoryNodeSetup() are also defined by the parent class. Accessories are the geometry shapes that you select and manipulate to affect the deformation. This can be a set of wireframe lines, a set of NURBS curves, or any other geometry you desire which can intuitively convey the function of your deformer and affect useful deformations.

Accessories are not required by deformers. Your deformer can function solely based on the predefined input attributes of the MPxDeformerNode class and/or any other attributes you define for your subclass. In this case, simply do not implement the two accessory methods.

MPxIkSolverNode

Inverse Kinematics (IK) describes a class of algorithms for animating linkages of rigid bodies based on a set of goals and constraints placed on the linkage. An IK solver is a mathematical procedure for finding a set of rotations and offsets for the links in order to satisfy the goals and constraints.

Solvers can be tailored for different types of linkages or to behave a certain way, such as minimizing the motion of certain joints or keeping certain joint angles between certain ranges. Maya defines a set of solvers which can be used in different situations.

The MPxIkSolverNode allows you to write your own solver and use it on linkages you build in Maya. As with the MPxDeformerNode class, the real computation of the node is not done in the compute() method, but in the doSolve() method. There are several other methods which must be defined when subclassing a new solver. Refer to the MPxIkSolverNode manual page for a description of these methods.

MPxFieldNode

This class lets you define your own dynamic field to affect other geometry in the scene. This node follows the normal dependency graph rules of evaluation in that the work of the node is done in the compute() method.

MPxEmitterNode

Emitters are nodes which emit particles in to a Maya scene. Different emitters emit particles in different ways, such as emitting only in one direction, emitting slowly, or emitting randomly from the surface of a sphere. Once the particle is emitted, it is no longer controlled by the emitter node. The MPxEmitterNode class lets you define the behavior of how particles are emitted. The node follows the normal dependency graph rules of evaluation in that the work of the node is done in the compute() method.

MPxSpringNode

Springs are forces which interact between two endpoints which have mass. Maya defines a default spring force which follows a traditional mathematical model of springs. You can define a new behavior for applying a force between two points in a scene by subclassing from MPxSpringNode. The predefined attributes supply all of the standard spring constants as well as the positions and masses of the endpoints. The work of the node is done through the applySpringLaw() method instead of the compute() method.

MPxObjectSet

This class can be used to implement new kinds of sets within Maya that can have selectable/manipulatable components and behave in a similar manner to the objectSet node included in Maya.

MPxHwShaderNode

MPxHwShaderNode allows the creation of user-defined hwShaders. A hwShader is a node which takes any number of input geometries, deforms them and places the output into the output geometry attribute.

MPxTransform

MPxTransform allows the creation of user defined transform nodes. User defined transform nodes can introduce new transform types or change the transformation order. They are designed to be an extension of the standard Maya transform node and include all of the normal transform attributes. Standard behaviors such as limit enforcement and attribute locking are managed by this class, but may be overridden in derived classes. Although it is not a node, the MPxTransformationMatrix class is used in conjunction with MPxTransform to add custom transformation matrices to Maya.

MPxFluidEmitterNode

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

MPxImagePlane

MPxImagePlane allows the creation of new types of image plane nodes. Non-standard image data in the image plane or behavioral changes to this node can be modified using this class.

MPxParticleAttributeMappingNode

MPxParticleAttributeMapperNode is the parent class of all user-defined, per particle, attribute mapping nodes. This class allows a plug-in to define the behavior of a new "arrayMapper" node which is commonly used by particles for coloring particles from a texture node.

MPxConstraint

MPxConstraint is the parent class of all user defined constraint nodes. This class works with the MPxConstraintCommand to provide default Maya constraint functionality.