Skip to content

Instantly share code, notes, and snippets.

@Onefabis
Last active February 8, 2019 20:36
Show Gist options
  • Save Onefabis/ffd35646f25f2dfc4f47e8affe2bd448 to your computer and use it in GitHub Desktop.
Save Onefabis/ffd35646f25f2dfc4f47e8affe2bd448 to your computer and use it in GitHub Desktop.
Quickly add tension map to your skinned mesh
sel = mc.ls( sl=1 )
if mc.ls( mc.listRelatives( sel[0], s=1 )[0], st=1 )[-1] == 'mesh':
if not mc.pluginInfo( 'tensionMap', q=11, l=1 ):
mc.loadPlugin( 'tensionMap' )
tensionMN = mc.createNode('tensionMap')
plug = mc.connectionInfo( sel[0] + '.inMesh', sourceFromDestination=1 )
if plug:
mc.connectAttr( plug, tensionMN + '.deform', f=1 )
mc.connectAttr( mc.listRelatives( sel[0], s=1 )[-1] + '.worldMesh[0]', tensionMN + '.orig', f=1 )
mc.connectAttr( tensionMN + '.out', sel[0] + '.inMesh', f=1 )
mc.polyOptions( sel[0], colorShadedDisplay=0 )
mc.polyOptions( sel[0], colorShadedDisplay=1 )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment