Home Youtube GitHub

Extract facial rig controls


#1

Hi there

I have been working through your data centric videos to make a rig and i am almost done but I have hit a speedbump which i try to extract the controls for the eyes and lips.

I have corrected the ctl shapes and extracted them into the controllers_org group, but they are not extracting in the same world space as the rig controllers. Then, when i rebuild from the guides, the controls just build in their default positions and ignore the extracted control positions.


#2

I ran into the same problem! But instead of filing a bug, I just wrote a POST script to fix it.

I put each of these snippets after I import my eye rig and lip rig files.

import pymel.core as pm
from mgear import rigbits

### fix missing buffer controls. It doesn't do it automatically!
lipControls = [
    'lips_L_lowOuter_ctl',
    'lips_L_lowInner_ctl',
    'lips_C_lower_ctl',
    'lips_R_lowInner_ctl',
    'lips_R_lowOuter_ctl',
    'lips_L_corner_ctl',
    'lips_L_upOuter_ctl',
    'lips_L_upInner_ctl',
    'lips_C_upper_ctl',
    'lips_R_upInner_ctl',
    'lips_R_upOuter_ctl',
    'lips_R_corner_ctl',
    ]
for lipControl in lipControls:
    if pm.objExists(lipControl + '_controlBuffer'):
        oTarget = pm.PyNode(lipControl)
        oSource = pm.PyNode(lipControl + '_controlBuffer')
        rigbits.replaceShape(oSource, [oTarget])

# The {} is for string formatting the L and R sides.
eyeControls = [
    'eye_{}_aim_ctl',
    'eye_{}_inCorner_ctl',
    'eye_{}_lowInMid_ctl',
    'eye_{}_lowMid_ctl',
    'eye_{}_lowOutMid_ctl',
    'eye_{}_outCorner_ctl',
    'eye_{}_over_ctl',
    'eye_{}_upInMid_ctl',
    'eye_{}_upMid_ctl',
    'eye_{}_upOutMid_ctl',
    ]
for side in 'LR':
    for eyeControl in eyeControls:
        if pm.objExists(eyeControl.format(side) + '_controlBuffer'):
            oTarget = pm.PyNode(eyeControl.format(side))
            oSource = pm.PyNode(eyeControl.format(side) + '_controlBuffer')
            rigbits.replaceShape(oSource, [oTarget])

#3

Hello

yep that is how it works.
The reason for that is that is that the ctl update is done before the post custom steps are executed.

TIP: If you export the guide as a template and build from file. This will work, because the controls shapes are updated at the end. so will take in account the controls created in custom steps

Long explanation: The initial design was expecting that the control buffer already exist in the scene before create the component. So the component can pick the right shape at build time.
When the guide is exported because the control shape buffer doesn’t exist in the scene it will import all controls shapes at the end of all the custom steps.
I should have updated the old logic to do the same. but I didn’t because was not a priority and invested the time in other areas :stuck_out_tongue:

I hope this helps :wink:


#4

Cheers for both your help, works perfectly :grin: