1
$\begingroup$

I have a rig generated from Rigify that also has a lot of manually added elements (drivers, etc.) added after the fact. I'd like to add a new bone layer to the N-panel's "Rig Layers" tab, but I can't afford to regenerate the rig (I'll lose too much work). Is there a way to add a new bone layer to the "Rig Layers" tab?

$\endgroup$

1 Answer 1

2
$\begingroup$

custom rigify buttons

The Rigify buttons in the N-panel are created by the Rig UI Script. You can define its name ("rig_ui.py") in the Object Data Properties tab, in the Rigify > Advanced section when you have selected the metarig armature.

The Re-Generate Rig button creates this script taking into account the layers specified in Rigify > Advanced > Layer Names.

extension of rig_ui.py

Knowing this, you can modify the rig_ui.py script without regenerating the rig.

Switch to the Scripting workspace and select the rig_ui.py script from the dropdown menu. Now look for the draw function at the very end of the file ( def draw(self, context):). There you can add the lines for the custom layer buttons.

For example to create a button for bone layer 19 called "Robe" and layer 20 called "Cloak" add these three lines:

row = col.row()
row.prop(context.active_object.data, 'layers', index=19, toggle=True, text='Robe')
row.prop(context.active_object.data, 'layers', index=20, toggle=True, text='Cloak')

Don't forget to run the script with the "play" button to see your custom Rigify buttons in the N-panel.

$\endgroup$
1
  • $\begingroup$ I completely forgot I asked this and eventually found this exact solution on my own, just with some more of a headache. Wish I had seen this answer sooner--it's perfect. Thanks so much! $\endgroup$
    – Legoman
    Commented Aug 20, 2022 at 3:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .