Skip to content
Snippets Groups Projects
Commit 152f5205 authored by Alexander Gavrilov's avatar Alexander Gavrilov
Browse files

Rigify: revert D8801 to restore dots marking layers of the active bone.

The built-in layer button UI only draws dots if the property
belongs to an Armature, as a special behavior hard-coded in C.

This returns to drawing the UI from Python but using cleaner code.
parent 814c3a69
No related branches found
No related tags found
No related merge requests found
...@@ -63,6 +63,24 @@ def set_bone_layers(bone, layers, combine=False): ...@@ -63,6 +63,24 @@ def set_bone_layers(bone, layers, combine=False):
# UI utilities # UI utilities
#============================================= #=============================================
def layout_layer_buttons(layout, params, option, active_layers):
"Draw a layer selection button UI with certain layers marked with dots."
outer = layout.row()
for x in [0, 8]:
col = outer.column(align=True)
for y in [0, 16]:
row = col.row(align=True)
for i in range(x+y, x+y+8):
row.prop(
params, option, index=i, toggle=True, text="",
icon="LAYER_ACTIVE" if active_layers[i] else "NONE"
)
class ControlLayersOption: class ControlLayersOption:
def __init__(self, name, toggle_name=None, toggle_default=True, description="Set of control layers"): def __init__(self, name, toggle_name=None, toggle_default=True, description="Set of control layers"):
self.name = name self.name = name
...@@ -131,8 +149,9 @@ class ControlLayersOption: ...@@ -131,8 +149,9 @@ class ControlLayersOption:
if not active: if not active:
return return
row = box.row(align=True) active_layers = bpy.context.active_pose_bone.bone.layers[:]
row.prop(params, self.layers_option, text="")
layout_layer_buttons(box, params, self.layers_option, active_layers)
ControlLayersOption.FK = ControlLayersOption('fk', description="Layers for the FK controls to be on") ControlLayersOption.FK = ControlLayersOption('fk', description="Layers for the FK controls to be on")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment