Pages

Sunday 31 October 2010

bindPreMatrix in skinCluster

this is little more advanced stuff for riggers. If you want to know more about this basic deformer, how it computes the deformation, watch this tutorial:

http://sunekempf.com/blog/wp-content/movies/bindPreMatrix/bindPreMatrix.html

I actually found it when I needed to make Reset SkinCluster Influence tool and I tried to set WorldMatrix to preBindMatrix. Which was wrong, it needs worldInverseMatrix and Sune`s tutorial helped me here.
And as the tool is so simple, I decided to post it here:

def resetInfluenceMatrices( skinCluster ):

'''
set bindPreMatrix the same as current worldInverseMatrix
for each influence of given skinCluster
'''

infs = mc.listConnections( skinCluster + '.matrix' )

for i, inf in enumerate( infs ):

m = mc.getAttr( inf + '.worldInverseMatrix' )
mc.setAttr( skinCluster + '.bindPreMatrix[' + str(i) + ']', m[0], m[1], m[2], m[3], m[4], m[5], m[6], m[7], m[8], m[9], m[10], m[11], m[12], m[13], m[14], m[15], typ= 'matrix' )

No comments: