Skip to content

Commit f43da6c

Browse files
committed
glue_bones fix: glue pass must act after "special bones" bones are put on forbidden layers (last 4) otherwise they get misinterpreted as ctrls. generate.py though, assigns use_deform to DEFs before layering and puts DEF on their layer after ORGs. So glue_bone must do cns after layering is done, AND generate its DEF _with_ layering and use_deform
1 parent 5183e90 commit f43da6c

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

generate.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -352,15 +352,6 @@ def generate_rig(context, metarig):
352352
ui_scripts += [scripts[0]]
353353
t.tick("Generate rigs: ")
354354

355-
# # Do final gluing
356-
for rig in rigs:
357-
if hasattr(rig, "glue"):
358-
# update glue_bone rigs
359-
bpy.ops.object.mode_set(mode='EDIT')
360-
rig = rig.__class__(rig.obj, rig.base_bone, rig.params)
361-
362-
rig.glue()
363-
t.tick("Glue pass")
364355
except Exception as e:
365356
# Cleanup if something goes wrong
366357
print("Rigify: failed to generate rig.")
@@ -534,6 +525,16 @@ def generate_rig(context, metarig):
534525
ctrl = obj.game.controllers[-1]
535526
ctrl.text = bpy.data.texts[script.name]
536527

528+
# Do final gluing
529+
for rig in rigs:
530+
if hasattr(rig, "glue"):
531+
# update glue_bone rigs
532+
bpy.ops.object.mode_set(mode='EDIT')
533+
rig = rig.__class__(rig.obj, rig.base_bone, rig.params)
534+
535+
rig.glue()
536+
t.tick("Glue pass")
537+
537538
t.tick("The rest: ")
538539
#----------------------------------
539540
# Deconfigure

rigs/experimental/glue_bone.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ def create_def(self):
8181
def_bone = copy_bone(self.obj, self.base_bone, def_bone)
8282
self.bones['glue_def'] = def_bone
8383

84+
DEF_LAYER = [n == 29 for n in range(0, 32)]
85+
edit_bones[def_bone].layers = DEF_LAYER
86+
edit_bones[def_bone].use_deform = True
87+
8488
def make_glue_constraints(self):
8589

8690
bpy.ops.object.mode_set(mode='OBJECT')

0 commit comments

Comments
 (0)