Home Youtube GitHub

Copy Shapes from body unto clothes?


#1

I love the fact that Mgear has the copy skin feature. I’m wondering what’s the workflow If I add Shapes to my body, how do I transfer that to my clothes or eye brows which are separate Geo from my main mesh? I cant help but think there must be a way to do this that I don’t know of?
@chrislesage


#2

Hi Ross,

hehe yep. This is what I do, assuming you have shapes on your head:

  1. Wrap deform your eyebrows to your head.
  2. Turn on each blendshape on the head, one at a time, and duplicate the eyebrows.
  3. Use those duplicates as blendshapes.

Here is a script I wrote that does step #2 for you. You’ll end up with a group of shapes with the same names as the blendshapes.

(If your blendshapes are connected or locked, this script won’t work.)

import pymel.core as pm

# SNIPPET: Duplicate blendshapes FOR MULTIPLE OBJECTS
# 1. Wrap deform your objects to an object with blendshapes
# 2. Put the name of the blendshape on this line:
oBlend = pm.PyNode('Body_blendshapes')

# 3. Select the wrapped geometry you want to generate blendshapes for, and run this script.

for geoCopy in pm.selected():
    # Do NOT duplicate smoothed meshes! It can get very heavy!
    try: geoCopy.displaySmoothMesh.set(0)
    except: pass
    prefix = geoCopy.name().split(':')[-1]
    oGroup = pm.group(n='blendshape_copies_{}'.format(prefix), em=True)
    for j, eachShape in enumerate(oBlend.w):
        try: eachShape.set(0)
        except: pass
    for j, eachShape in enumerate(oBlend.w):
        try:
            shapeName = eachShape.getAlias()
            eachShape.set(1)
            oDup = pm.duplicate(geoCopy, n=shapeName)[0]
            pm.parent(oDup, oGroup)
            oDup.rename(shapeName)
            eachShape.set(0)
        except:
            continue

#3

Thanks, awesome!. But the script only creates an empty group for me. Am I doing something wrong?


#4

Am I doing something wrong?

What are you doing?

Also, did you read the instructions inside the script?


#5

Yeah, I read and did everything, will send you a video when I get a chance.


#6

Are your blendshapes already connected to the controllers? The script tries to set them on and off again. If they are connected, they can’t do that, and it will just skip those shapes.


#7

Check this out from the guys at Ziva Dynamics