3
3
from ...utils import strip_org , make_deformer_name , connected_children_names , make_mechanism_name
4
4
from ...utils import create_circle_widget , create_widget
5
5
from ...utils import MetarigError , align_bone_x_axis
6
+ from ...utils import layout_layer_selection_ui
6
7
from rna_prop_ui import rna_idprop_ui_prop_get
7
8
8
9
script = """
@@ -20,6 +21,11 @@ def __init__(self, obj, bone_name, params):
20
21
self .org_bones = [bone_name ] + connected_children_names (obj , bone_name )
21
22
self .params = params
22
23
24
+ if params .tweak_extra_layers :
25
+ self .tweak_layers = list (params .tweak_layers )
26
+ else :
27
+ self .tweak_layers = None
28
+
23
29
if len (self .org_bones ) <= 1 :
24
30
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 )))
25
31
@@ -303,6 +309,9 @@ def generate(self):
303
309
# Assigning shapes to control bones
304
310
create_circle_widget (self .obj , ctrl , radius = 0.3 , head_tail = 0.5 )
305
311
312
+ if self .tweak_layers :
313
+ pb [ctrl ].bone .layers = self .tweak_layers
314
+
306
315
# Create ctrl master widget
307
316
w = create_widget (self .obj , master_name )
308
317
if w is not None :
@@ -321,6 +330,9 @@ def generate(self):
321
330
# Create tip control widget
322
331
create_circle_widget (self .obj , tip_name , radius = 0.3 , head_tail = 0.0 )
323
332
333
+ if self .tweak_layers :
334
+ pb [tip_name ].bone .layers = self .tweak_layers
335
+
324
336
# Create UI
325
337
controls_string = ", " .join (
326
338
["'" + x + "'" for x in ctrl_chain ]
@@ -336,6 +348,19 @@ def add_parameters(params):
336
348
('-X' , '-X manual' , '' ), ('-Y' , '-Y manual' , '' ), ('-Z' , '-Z manual' , '' )]
337
349
params .primary_rotation_axis = bpy .props .EnumProperty (items = items , name = "Primary Rotation Axis" , default = 'automatic' )
338
350
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
+
339
364
340
365
def parameters_ui (layout , params ):
341
366
""" Create the ui for the rig parameters.
@@ -344,6 +369,7 @@ def parameters_ui(layout, params):
344
369
r .label (text = "Bend rotation axis:" )
345
370
r .prop (params , "primary_rotation_axis" , text = "" )
346
371
372
+ layout_layer_selection_ui (layout , params , "tweak_extra_layers" , "tweak_layers" )
347
373
348
374
def create_sample (obj ):
349
375
# generated by rigify.utils.write_metarig
0 commit comments