1
1
import bpy
2
2
3
- from ...utils import make_constraints_from_string
3
+ from ...utils import make_constraints_from_string , make_deformer_name
4
+ from ...utils import strip_org , copy_bone
4
5
5
6
from .base_rig import BaseRig
6
7
@@ -64,6 +65,22 @@ def get_ctrls_by_position(self, position, groups=None, relative_error=0):
64
65
65
66
return bones_in_range
66
67
68
+ def create_def (self ):
69
+ """
70
+ If add_glue_def is True adds a DEF
71
+ :return:
72
+ """
73
+
74
+ if not self .params .add_glue_def :
75
+ return
76
+
77
+ bpy .ops .object .mode_set (mode = 'EDIT' )
78
+ edit_bones = self .obj .data .edit_bones
79
+
80
+ def_bone = make_deformer_name (strip_org (self .base_bone ))
81
+ def_bone = copy_bone (self .obj , self .base_bone , def_bone )
82
+ self .bones ['glue_def' ] = def_bone
83
+
67
84
def make_glue_constraints (self ):
68
85
69
86
bpy .ops .object .mode_set (mode = 'OBJECT' )
@@ -83,6 +100,29 @@ def make_glue_constraints(self):
83
100
make_constraints_from_string (owner_pb , target = self .obj , subtarget = head_ctrls [0 ],
84
101
fstring = self .params .glue_string )
85
102
103
+ if 'glue_def' in self .bones :
104
+ owner_pb = pose_bones [self .bones ['glue_def' ]]
105
+ make_constraints_from_string (owner_pb , target = self .obj , subtarget = head_ctrls [0 ],
106
+ fstring = "CL1.0WW0.0" )
107
+ make_constraints_from_string (owner_pb , target = self .obj , subtarget = tail_ctrls [0 ],
108
+ fstring = "DT1.0#ST1.0" )
109
+
110
+ def glue (self ):
111
+ """
112
+ Glue pass
113
+ :return:
114
+ """
115
+
116
+ self .create_def ()
117
+ self .make_glue_constraints ()
118
+
119
+ def generate (self ):
120
+ """
121
+ Glue bones generate must do nothing. Glue bones pass is meant to happen after all other rigs generated
122
+ :return:
123
+ """
124
+ return ["" ]
125
+
86
126
87
127
def create_sample (obj ):
88
128
# generated by rigify.utils.write_metarig
0 commit comments