-
-
Save MaxSteven/9cbdb9cce0aa878253de5150dabe251e to your computer and use it in GitHub Desktop.
Invert BlendShape weights
This file contains hidden or 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
| from maya import cmds | |
| import pymel.core as pm | |
| sel = pm.ls(selection=True) | |
| print sel[0] | |
| blends = sel[0].getShape().inputs(type='blendShape') | |
| if len(blends) < 1: | |
| print "No blend shapes on this node!" | |
| else: | |
| vertexCount = pm.polyEvaluate(sel[0], vertex=True) | |
| weights = blends[0].inputTarget[0].baseWeights.get() | |
| newWeights = [1.0 - x for x in weights] | |
| for i, wt in enumerate(weights): | |
| blends[0].inputTarget[0].baseWeights[i].set(newWeights[i]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment