Any way to automatically set transform override of rigify widget to be the org bone?

Hi all,

I’m currently trying to wrap my head around which parameters can be kept from the metarig->rig generation. One thing that’s been annoying me, is the fact that there seems to be no way to automatically set the widget transform override to the ORG bone (just like the super.finger does) without doing it manually (or via a python script) after rig generation.
This is important, because I like to use bone constraints and drivers to control several bones in specific ways. The issue being that, without the transform override, the widget of the bone being controlled by the driver or constraint will not follow it, unlike the rest of the widgets whose bones are parented to that one.
Here’s a video that shows the problem in more detail.

Watch how the ORG-bone moves via the copy location constraint, but the widget that controls it does not.
Is there any one to do this from the metarig menu using the super.copy, or do I need to use the raw.copy for that - and in that case, how do I ensure that the correct ORG, MCH and widgets are created in that case?


Well, I can create myself a temporary answer for this exact scenario. If you have this problem, then you can use the following script that I whipped up.

Since this only becomes a problem for super.copy bones with bone constraints and drivers affecting the org bones - the script will only look for super.copy bones with constraints (since drivers can’t affect the widget location unless in a constraint to begin with).

import bpy

Requirements: Must be in Object mode, and have both the metarig and rig selected.
The rig itself must be the active selected object
rig    = bpy.context.active_object
if bpy.context.selected_objects[0] == bpy.context.active_object:
    meta   = bpy.context.selected_objects[1]
elif bpy.context.selected_objects[1] == bpy.context.active_object:
    meta   = bpy.context.selected_objects[0]

print('rig is set to:' + str(rig))
print('metarig is set to:' + str(meta))

meta_pb = meta.pose.bones
rig_pb  = rig.pose.bones
meta_cb = []

for pb in meta_pb:
    if len(pb.constraints.items())>0 and pb.rigify_type == 'basic.super_copy':

for wgt in meta_cb:
        rig_pb[wgt].custom_shape_transform = rig_pb["ORG-"+wgt] 
        print("set Override Transform of: " + wgt + " --> " + "ORG-" + wgt)
        print('Bone not found for widget - skipping')

If anyone knows if there’s a way to do this locally in rigify, then I’d still love to hear about it!

Thanks a lot ! I wonder why there is little material on this, it seems like something any rigify custom rig maker can run into.
I have super.copy bones with copy location constraints on them. I was looking for a way to move my constraints from org to ctrl bones and didn’t know about the transform override trick.
The script works fine. Have you found a better way since then?

Here’s another method that I think is cleaner explained by RiggingDojo:

We discussed our options in the comments section there. Basically your script only addresses the visual aspect, while using raw instead of super bones addresses the issue from its root and in some cases it’s easier to setup and cleaner.