33from ...utils import strip_org , make_deformer_name , connected_children_names , make_mechanism_name
44from ...utils import create_circle_widget , create_widget
55from ...utils import MetarigError , align_bone_x_axis
6+ from ...utils import layout_layer_selection_ui
67from rna_prop_ui import rna_idprop_ui_prop_get
78
89script = """
@@ -20,6 +21,11 @@ def __init__(self, obj, bone_name, params):
2021 self .org_bones = [bone_name ] + connected_children_names (obj , bone_name )
2122 self .params = params
2223
24+ if params .tweak_extra_layers :
25+ self .tweak_layers = list (params .tweak_layers )
26+ else :
27+ self .tweak_layers = None
28+
2329 if len (self .org_bones ) <= 1 :
2430 raise MetarigError ("RIGIFY ERROR: Bone '%s': listen bro, that finger rig jusaint put tugetha rite. A little hint, use more than one bone!!" % (strip_org (bone_name )))
2531
@@ -303,6 +309,9 @@ def generate(self):
303309 # Assigning shapes to control bones
304310 create_circle_widget (self .obj , ctrl , radius = 0.3 , head_tail = 0.5 )
305311
312+ if self .tweak_layers :
313+ pb [ctrl ].bone .layers = self .tweak_layers
314+
306315 # Create ctrl master widget
307316 w = create_widget (self .obj , master_name )
308317 if w is not None :
@@ -321,6 +330,9 @@ def generate(self):
321330 # Create tip control widget
322331 create_circle_widget (self .obj , tip_name , radius = 0.3 , head_tail = 0.0 )
323332
333+ if self .tweak_layers :
334+ pb [tip_name ].bone .layers = self .tweak_layers
335+
324336 # Create UI
325337 controls_string = ", " .join (
326338 ["'" + x + "'" for x in ctrl_chain ]
@@ -336,6 +348,19 @@ def add_parameters(params):
336348 ('-X' , '-X manual' , '' ), ('-Y' , '-Y manual' , '' ), ('-Z' , '-Z manual' , '' )]
337349 params .primary_rotation_axis = bpy .props .EnumProperty (items = items , name = "Primary Rotation Axis" , default = 'automatic' )
338350
351+ # Setting up extra tweak layers
352+ params .tweak_extra_layers = bpy .props .BoolProperty (
353+ name = "tweak_extra_layers" ,
354+ default = False ,
355+ description = ""
356+ )
357+
358+ params .tweak_layers = bpy .props .BoolVectorProperty (
359+ size = 32 ,
360+ description = "Layers for the tweak controls to be on" ,
361+ default = tuple ([i == 1 for i in range (0 , 32 )])
362+ )
363+
339364
340365def parameters_ui (layout , params ):
341366 """ Create the ui for the rig parameters.
@@ -344,6 +369,7 @@ def parameters_ui(layout, params):
344369 r .label (text = "Bend rotation axis:" )
345370 r .prop (params , "primary_rotation_axis" , text = "" )
346371
372+ layout_layer_selection_ui (layout , params , "tweak_extra_layers" , "tweak_layers" )
347373
348374def create_sample (obj ):
349375 # generated by rigify.utils.write_metarig
0 commit comments