def resetSkinnedJoints(joints):
""" Reset skin deformation for selected joint(s) """
for joint in joints:
# Get connected skinCluster nodes
skinClusterPlugs = mc.listConnections(joint + ".worldMatrix[0]", type="skinCluster", p=1)
if skinClusterPlugs:
# for each skinCluster connection
for skinClstPlug in skinClusterPlugs:
index = skinClstPlug[ skinClstPlug.index("[")+1 : -1 ]
skinCluster = skinClstPlug[ : skinClstPlug.index(".") ]
curInvMat = mc.getAttr(joint + ".worldInverseMatrix")
mc.setAttr( skinCluster + ".bindPreMatrix[{0}]".format(index), type="matrix", *curInvMat )
else:
print "No skinCluster attached to {0}".format(joint)
16 September, 2012
Resetting skin deformation for joints
There are times when you need to update the bind transforms for joints after applying the skinCluster deformer. Maya provides a tool called "Move Skinned Joints Tool" for doing the same. It works great if you want to move joints that are not constrained. But if you want to move a skinned joint that is constrained to a surface this tool does not work well. Here is a small function that will reset skin deformation for given skinned joints. First move/rotate all the skinned joints in desired position then run this function. This will reset the skinned mesh to its non-deformed state while keeping the joints in place.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment