om2-IOSkinClusters


Disclaimer:
All code here is provided as is without support.
Use at your own risk! These posts assume you have some knowledge of import/running python script in maya. If Gifs/Images are not displaying in Chrome try a different browser.

K this has been a bit of an experiment.

Previously I was using a mix of om1 and om2 as per Hamish Mackenzies post here: http://www.macaronikazoo.com/?p=417

So this time around I wanted to gun for nothing but om2. Which mean’t taking a somewhat non standard approach.

It appears to be working, have tested this on various skins, and while comments are not on the ghpages static sites I’d love to hear how this is working for any one brave enough to test it.

Should be okay to throw it into the wild. I’ve condensed all the required functions from my lib into this post so everything should work directly from the below functions [thus avoiding the lib].

From the maya skinCluster docs:
“The weights for the skinCluster are stored in the multi-multi attribute called weightList[].weights[]. The first index of the multi is the index of the vertex. The second is the index of the influence object. The weights are in general stored sparsely, so if you weigh a vertex by two of the 50 influence objects, only two elements exist in the weights array for that vertex. The exception is that if data exists in the data block and is later set to zero by some operation, the zero-valued data remains in the data block until the file is saved. When the file is saved, the file save code determines that the value zero is the default data, which does not need to be saved. The next time the file is read, only the non-zero valued elements will exist in the skinCluster.”

Note: If you do copy paste from below, depenency will be simplejson!!