A quick script I wrote that helps you copy blendshapes from a target mesh to only the selected vertices of another mesh, which is useful if you have models with identical faces but different bodies (that are a single object).
For example, if you want to copy a face blendshape from a character onto a copy of the character with identical face geometry but different body topology, you would :
- Duplicate the character with different body topology.
- Select the original blendshape mesh that you want to transfer to the duplicate.
- Shift select the vertices on the duplicate character that you want to be affected (such as all the head vertices).
- Run my script.
- Blendshape >> Add the result to your skinned character.
I’m unsure if there is a better way of doing this, but this script worked for a simple cartoon character.
import maya.cmds as cmds selection = cmds.ls(sl=True) if len(selection) > 0: targetMesh = selection[-1] affectedVertices = selection[0:-1] # Assume the rest of the selection is made of vertices affectedMesh = cmds.listRelatives(cmds.listRelatives(affectedVertices[0], p=True), p=True) vtxSet = cmds.sets(affectedVertices, v=True, n="SelectionSet") print cmds.sets(vtxSet, q=True) # Move to origin cmds.move(32, 0, 0, affectedMesh, ws=True) cmds.move(32, 0, 0, targetMesh, ws=True) # Select target mesh and affected vertices cmds.select(cl=True) cmds.select(targetMesh) cmds.select(vtxSet, add=True) cmds.transferAttributes(transferPositions=1, transferNormals=1, transferUVs=2, transferColors=0, sourceUvSpace="map1", sampleSpace=3, searchMethod=0, flipUVs=0, colorBorders=1) cmds.hide(targetMesh) cmds.select(cl=True) else: print "Select vertices to move and target mesh"