Skip to content

Commit bd1fd4f

Browse files
committed
New rig_types
2 parents b791dff + ca71ff2 commit bd1fd4f

18 files changed

+4825
-436
lines changed

__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,6 @@ def register():
301301

302302
bpy.types.PoseBone.rigify_type = bpy.props.StringProperty(name="Rigify Type", description="Rig type for this bone")
303303
bpy.types.PoseBone.rigify_parameters = bpy.props.PointerProperty(type=RigifyParameters)
304-
bpy.types.PoseBone.rigify_glue = bpy.props.StringProperty(name="Rigify Glue", description="Defines influence between controls")
305304

306305
bpy.types.Armature.rigify_colors = bpy.props.CollectionProperty(type=RigifyColorSet)
307306

@@ -396,7 +395,6 @@ def update_mode(self, context):
396395
def unregister():
397396
del bpy.types.PoseBone.rigify_type
398397
del bpy.types.PoseBone.rigify_parameters
399-
del bpy.types.PoseBone.rigify_glue
400398

401399
IDStore = bpy.types.WindowManager
402400
del IDStore.rigify_collection

generate.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@ def generate_rig(context, metarig):
351351
if scripts is not None:
352352
ui_scripts += [scripts[0]]
353353
t.tick("Generate rigs: ")
354+
354355
except Exception as e:
355356
# Cleanup if something goes wrong
356357
print("Rigify: failed to generate rig.")
@@ -524,6 +525,15 @@ def generate_rig(context, metarig):
524525
ctrl = obj.game.controllers[-1]
525526
ctrl.text = bpy.data.texts[script.name]
526527

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")
527537

528538
t.tick("The rest: ")
529539
#----------------------------------

rigs/experimental/base_rig.py

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
import bpy
2+
3+
4+
class BaseRig(object):
5+
6+
def __init__(self, obj, bone_name, params):
7+
"""
8+
Rig Base class the bones struct is a dict with 'org' as a list and 'def' 'mch' and 'ctrl' dicts
9+
ctrls mchs and defs must be organized in groups. If your Rig Class has just one group you can call it all_ctrls
10+
:param obj:
11+
:param bone_name:
12+
:param params:
13+
"""
14+
15+
self.obj = obj
16+
self.params = params
17+
self.bones = dict()
18+
self.bones['org'] = [bone_name]
19+
self.base_bone = bone_name
20+
21+
# Get all the recursive ORG children of the base bone BUT the rig_type trees
22+
for edit_bone in self.obj.data.edit_bones[bone_name].children:
23+
if self.obj.pose.bones[edit_bone.name].rigify_type != "":
24+
continue
25+
else:
26+
self.bones['org'].append(edit_bone.name)
27+
for child in edit_bone.children_recursive:
28+
self.bones['org'].append(child.name)
29+
30+
self.bones['ctrl'] = dict()
31+
self.bones['mch'] = dict()
32+
self.bones['def'] = dict()
33+
34+
def orient_org_bones(self):
35+
"""
36+
This function re-orients org bones so that created bones are properly aligned and cns can work
37+
:return:
38+
"""
39+
pass
40+
41+
def create_mch(self):
42+
pass
43+
44+
def create_def(self):
45+
pass
46+
47+
def create_controls(self):
48+
pass
49+
50+
def create_widgets(self):
51+
pass
52+
53+
def make_constraints(self):
54+
pass
55+
56+
def parent_bones(self):
57+
pass
58+
59+
def generate(self):
60+
pass
61+
62+
def flatten(self, bones):
63+
"""
64+
Flattens a bones dictionary
65+
:param bones:
66+
:return:
67+
:rtype: list
68+
"""
69+
70+
all_bones = []
71+
72+
if isinstance(bones, dict):
73+
for key in bones:
74+
all_bones.extend(self.flatten(bones[key]))
75+
return all_bones
76+
else:
77+
return bones
78+
79+
def get_all_ctrls(self):
80+
return self.flatten(self.bones['ctrl'])
81+
82+
@staticmethod
83+
def add_parameters(params):
84+
"""
85+
This method add more parameters to params
86+
:param params: rigify_parameters of a pose_bone
87+
:return:
88+
"""
89+
90+
pass
91+
92+
@staticmethod
93+
def parameters_ui(layout, params):
94+
"""
95+
This method draws the UI of the rigify_parameters defined on the pose_bone
96+
:param layout:
97+
:param params:
98+
:return:
99+
"""
100+
101+
pass

0 commit comments

Comments
 (0)