diff --git a/rigify/rigs/faces/super_face.py b/rigify/rigs/faces/super_face.py index f945a85563fbe4b240f6b4c478ac82fbe9dcff17..e3617695668911346317ac7bf6335971d9501587 100644 --- a/rigify/rigs/faces/super_face.py +++ b/rigify/rigs/faces/super_face.py @@ -4,6 +4,7 @@ from ...utils import copy_bone, flip_bone from ...utils import org, strip_org, make_deformer_name, connected_children_names, make_mechanism_name from ...utils import create_widget from ...utils.mechanism import make_property +from ...utils.layers import ControlLayersOption from ..widgets import create_face_widget, create_eye_widget, create_eyes_widget, create_ear_widget, create_jaw_widget, create_teeth_widget @@ -1029,69 +1030,15 @@ def add_parameters(params): """ # Setting up extra layers for the tweak bones - params.primary_layers_extra = bpy.props.BoolProperty( - name="primary_layers_extra", - default=True, - description="" - ) - params.primary_layers = bpy.props.BoolVectorProperty( - size=32, - description="Layers for the primary controls to be on", - default=tuple([i == 1 for i in range(0, 32)]) - ) - params.secondary_layers_extra = bpy.props.BoolProperty( - name="secondary_layers_extra", - default=True, - description="" - ) - params.secondary_layers = bpy.props.BoolVectorProperty( - size=32, - description="Layers for the secondary controls to be on", - default=tuple([i == 1 for i in range(0, 32)]) - ) + ControlLayersOption.FACE_PRIMARY.add_parameters(params) + ControlLayersOption.FACE_SECONDARY.add_parameters(params) def parameters_ui(layout, params): """ Create the ui for the rig parameters.""" - layers = ["primary_layers", "secondary_layers"] - - bone_layers = bpy.context.active_pose_bone.bone.layers[:] - - for layer in layers: - r = layout.row() - r.prop( params, layer + "_extra" ) - r.active = getattr( params, layer + "_extra" ) - - col = r.column(align=True) - row = col.row(align=True) - for i in range(8): - icon = "NONE" - if bone_layers[i]: - icon = "LAYER_ACTIVE" - row.prop(params, layer, index=i, toggle=True, text="", icon=icon) - - row = col.row(align=True) - for i in range(16, 24): - icon = "NONE" - if bone_layers[i]: - icon = "LAYER_ACTIVE" - row.prop(params, layer, index=i, toggle=True, text="", icon=icon) - - col = r.column(align=True) - row = col.row(align=True) - - for i in range(8, 16): - icon = "NONE" - if bone_layers[i]: - icon = "LAYER_ACTIVE" - row.prop(params, layer, index=i, toggle=True, text="", icon=icon) - - row = col.row(align=True) - for i in range(24, 32): - icon = "NONE" - if bone_layers[i]: - icon = "LAYER_ACTIVE" - row.prop(params, layer, index=i, toggle=True, text="", icon=icon) + + ControlLayersOption.FACE_PRIMARY.parameters_ui(layout, params) + ControlLayersOption.FACE_SECONDARY.parameters_ui(layout, params) def create_sample(obj): diff --git a/rigify/utils/layers.py b/rigify/utils/layers.py index 7d85cd4dbacc3041ec421985e35911c0e412841a..52deeac0f3652c54e582325a8236ec83df074fb0 100644 --- a/rigify/utils/layers.py +++ b/rigify/utils/layers.py @@ -137,3 +137,7 @@ class ControlLayersOption: ControlLayersOption.FK = ControlLayersOption('fk', description="Layers for the FK controls to be on") ControlLayersOption.TWEAK = ControlLayersOption('tweak', description="Layers for the tweak controls to be on") + +# Layer parameters used by the super_face rig. +ControlLayersOption.FACE_PRIMARY = ControlLayersOption('primary', description="Layers for the primary controls to be on") +ControlLayersOption.FACE_SECONDARY = ControlLayersOption('secondary', description="Layers for the secondary controls to be on")