Created
July 21, 2016 00:24
-
-
Save EricTRocks/2604affe7b273e6f5d6ae1d16e920f6a to your computer and use it in GitHub Desktop.
Updates selected Maya joint's bind pose Credit to Ryan Porter (yantor3d)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Credit to Ryan Porter (yantor3d) | |
from maya import cmds | |
for jnt in cmds.ls(sl=True, type="joint"): | |
matrixPlugs = cmds.listConnections(jnt + ".worldMatrix", type="skinCluster", p=True) or [] | |
for mp in matrixPlugs: | |
bindPreMatrixPlug = mp.replace('matrix', 'bindPreMatrix') | |
if cmds.listConnections(bindPreMatrixPlug, s=True, d=False): | |
continue | |
print cmds.listConnections(bindPreMatrixPlug, s=True) | |
wim = cmds.getAttr(jnt + ".worldInverseMatrix") | |
cmds.setAttr(bindPreMatrixPlug, *wim, type="matrix") | |
cmds.skinCluster('skinCluster1', edit=True, recacheBindMatrices=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment