Pages

Sunday 20 May 2012

deformerWeights command

For many years Maya could only offer UV-based image weight exporter for deformer weight maps. It never was a favourite nor robust way to store this information. Therefore scripts like cometSaveWeights were made (often very slow with thousands of points). Some pipelines even used skinCluster API to write a plugin.
Now it seems Maya finally offers a better tool out of the box. I just tested again deformerWeights command which was added to Maya 2011 and didn`t quite work at that time, but looked very promising. But now testing it in latest Maya 2012 SP2 I was able to export and import skinCluster weights and blendShape target weights as well. Also, couple of options were added like -shape, which allows you to save all weights from all deformers from given shape (I didn`t test this one yet).
This command can be very useful if you don`t have your own tools for saving skin weights and even better if you want something for saving blendShape, cluster and other deformer weights. It saves all deformers in one unified XML format. And as a command it`s very easy to add to your scripts (MEL or python). Example:


cmds.deformerWeights ("clusterWeights.xml", ex=True, deformer="testCluster")

It also supports importing the weights using different methods. Apart from classic index-based, there is nearest and barycentric and over. With all the other options, this sounds like a weights exporter swiss knife! :)

No comments: