Skip to content

Instantly share code, notes, and snippets.

@paulwinex
Created April 27, 2018 13:23
Show Gist options
  • Save paulwinex/845fd9a92943bb93a886a8c70c061d36 to your computer and use it in GitHub Desktop.
Save paulwinex/845fd9a92943bb93a886a8c70c061d36 to your computer and use it in GitHub Desktop.
from pymel.core import *
source, result = selected()
source = source.getShape()
bs = source.inMesh.inputs()[0]
for i in range(bs.getWeightCount()):
bs.setWeight(i, 0)
out_parent = createNode('transform', name=result.name()+'_blendShapes')
for i, name in enumerate(bs.getTarget()):
out_name = name.rsplit('|')[-1]
bs.setWeight(i, 1)
new = duplicate(result, ic=False)[0]
new.setParent(out_parent)
new.rename(out_name)
bs.setWeight(i, 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment