Created
September 20, 2016 03:43
-
-
Save EricTRocks/88545fe7cbfec9957b6a84660f7b93a8 to your computer and use it in GitHub Desktop.
Invert BlendShape weights
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
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