Paintable Attributes on Custom Deformer Node

Paintable

To create a custom deformer node in Maya, you would need to derive from MPxDeformerNode, and the documentation says to not override the compute() method unless required since the deform() method is called by the MPxDeformerNode's compute() method.

There is few exception to that recommendation. Exceptions are namely:

  • Your node's deformation algorithm depends on the geometry type, which is not available in the deform() method,
  • Your node's deformation algorithm requires computing all of the output geometries simultaneously,

So if you node deformation algorithm depends on the input geometry type, which is not available in the deform() method, or your node's deformation algorithm requires computing all of the output geometries simultaneously, you have to implement the compute() method as well.

The devkit splatDeformer sample is a good example as its deformation algorithm requires to know the geometry type.

Note that in case you implement your own compute() method, you will tell Maya not to call deform anymore – so remember to write your node code accordingly.

Yellow-painting
If you already have an attribute in the deformer’s implementation, which you want to make paintable, you can call MEL command "makePaintable" like this:

     makePaintable -attrType "multiFloat" -sm "deformer" "fStretch" "paintStretchGrowShrink";

"paintStretchGrowShrink" being the attribute name in that example.

One thing to emphasize is in order to make an attribute paintable, it has to be a multi of multis. The multi attribute has to have a parent which is also a multi. The first level multi attribute is to record per vertex values, and the parent multi attribute is necessary to store values for multiple shapes.

 


Comments

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading