Home Youtube GitHub

Extract facial rig controls


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.


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 = [
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 = [
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])



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:


Cheers for both your help, works perfectly :grin: