In order for you to write a custom dependency graph node, you must create a new class that derives from one of the base node classes described on this page. Depending on the purpose of the node you want to create, you can choose any of these options as your starting point.
MPxNode is the base class for all other dependency graph nodes. It defines a generic interface that is common to all nodes, including the virtual MPxNode::compute() method that you will need to implement in your own node class.
The Maya API offers several other base classes that derive from MPxNode, but that specialize it for use in a particular functional area (described below). Each parent class predefines a set of attributes and often additional class methods. When you use an instance of your custom node class in a scene, Maya recognizes which base class it derives from. It automatically treats your custom node in the same way as it treats other built-in nodes of the same type, and automatically connects to the expected attributes and methods. For example, every kind of locator node, which derives from the MPxLocator class, has built-in behavior for drawing itself in different colors depending on whether or not it is selected in the viewport. The compute() method that you implement in your subclass can make use of these predefined attributes as desired, in addition to whatever custom attributes you choose to add for the specific purposes of your node class.
Note that these various sub-classes may have different sets of virtual methods that you need to implement instead of or in addition to the compute() method inherited from MPxNode. See their class descriptions, examples and other documentation for details.
The MPxLocatorNode 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.
The MPxGeometryFilter 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 MPxGeometryFilter class and/or any other attributes you define for your subclass. In this case, simply do not implement the two accessory methods.
See also Writing a Deformer Node.
The MPxDeformerNode class specializes MPxGeometryFilter to handle per-vertex weight lists.
The MPxBlendShape class specializes MPxGeometryFilter to handle input targets and weights. Maya treats custom nodes that you derive from this class like the built-in blendShape node.
The MPxSkinCluster class specializes MPxGeometryFilter to handle per-vertex skin weights. Maya treats custom nodes that you derive from this class like the built-in skinCluster node.
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 reference for a description of these methods.
The MPxFieldNode 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.
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.
MPxFluidEmitterNode derives from MPxEmitterNode, and allows the creation and manipulation of dependency graph nodes representing fluid 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 fluid emitters.
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.
The MPxObjectSet 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 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. See also Writing a Hardware Shading Node.
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.
See also Writing a Custom Transform Node.
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.
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 is the parent class of all user defined constraint nodes. This class works with the MPxConstraintCommand to provide default Maya constraint functionality.
MPxManipulatorNode is the base class for a manipulator: a type of node that draws a visual representation of itself in the Maya viewport and accepts input from a user through direct interaction within the viewport. Maya provides several built-in types of manipulators, but if you want to create a new type of manipulator, you can create a new class that derives from MPxManipulatorNode and write virtual methods that determine how the manipulator is drawn and how it reacts to mouse events.
The MPxManipContainer class provides a base interface for an aggregator that interprets the input recorded by one or more base types of manipulator nodes, and that applies that input by changing attributes on other connected nodes. If you write a tool that needs to accept user input through a custom manipulator in the viewport, you can create a new class that derives from MPxManipContainer.
For more information on setting up custom manipulators for your plug-in, see Manipulators.
If you need to create a new kind of shape primitive, you will need to create a new class that derives from MPxSurfaceShape or MPxComponentShape, which will be used to represent instances of your geometry within the scene hierarchy and the dependency graph. There are also several other related classes that you will need to set up in order to control drawing, selection, etc. For more information on creating custom shapes, see Shapes.
This is the base class for scene assembly nodes. You can derive a new class from MPxAssembly if you need to extend Maya's scene assembly system. See the class description for details.
Maya treats custom nodes that you derive from this class like the built-in cameraSet node. You can derive a new class from MPxCameraSet if you need to customize the way Maya handles your camera layers for stereo viewing.
Maya treats custom nodes that you derive from this class like the built-in motionPath node. You can derive a new class from MPxMotionPathNode if you need to customize the way that Maya evaluates the input animation curve in order to computes and apply new position and orientation values to an animated object moving along a path. See the class description and the motionPathNode/motionPathNode.cpp example for details.
This is the base class for nodes that define a custom face triangulation algorithm for meshes. You can derive a new class from MPxPolyTrg if you need to change the way that Maya generates triangles from a given mesh face. See the class description for details.
MPxThreadedDeviceNode is the base class for nodes that start a secondary thread at the time the node is created, and that use the secondary thread to acquire data from a device. This allows input from the device to drive a Maya plug, even when Maya is not in playback mode. For details, see the class description and the built-in threadedDevice abstract node.
MPxClientDeviceNode specializes MPxThreadedDeviceNode for interacting with network devices that act as clients, such as data coming from a TCP socket. For details, see the class description and the built-in clientDevice abstract node.