Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/rigify
diff options
context:
space:
mode:
authorAlexander Gavrilov <angavrilov@gmail.com>2020-12-08 14:47:21 +0300
committerAlexander Gavrilov <angavrilov@gmail.com>2020-12-08 18:04:09 +0300
commit2687cca6c373d8e0e47c39c5382d643ea02b8745 (patch)
tree0e1f6220c468a65252a2b86af7a322ebedfe174b /rigify
parentb0361dcaac3034cde90a5c146e3ef3f07d226da9 (diff)
Rigify: move constraints to control and deform bones in super_copy.
Use DEF: or CTRL: prefix on constraint names to move them during relink.
Diffstat (limited to 'rigify')
-rw-r--r--rigify/rigs/basic/raw_copy.py11
-rw-r--r--rigify/rigs/basic/super_copy.py12
2 files changed, 23 insertions, 0 deletions
diff --git a/rigify/rigs/basic/raw_copy.py b/rigify/rigs/basic/raw_copy.py
index 44c10a6c..407241cb 100644
--- a/rigify/rigs/basic/raw_copy.py
+++ b/rigify/rigs/basic/raw_copy.py
@@ -62,6 +62,17 @@ class RelinkConstraintsMixin:
self.relink_constraint(con, [''])
+ def relink_move_constraints(self, from_bone, to_bone, *, prefix=''):
+ if self.params.relink_constraints:
+ src = self.get_bone(from_bone).constraints
+ dest = self.get_bone(to_bone).constraints
+
+ for con in list(src):
+ if con.name.startswith(prefix):
+ dest.copy(con)
+ src.remove(con)
+
+
def relink_bone_parent(self, bone_name):
if self.params.relink_constraints:
self.generator.disable_auto_parent(bone_name)
diff --git a/rigify/rigs/basic/super_copy.py b/rigify/rigs/basic/super_copy.py
index dcff41fe..e2f70842 100644
--- a/rigify/rigs/basic/super_copy.py
+++ b/rigify/rigs/basic/super_copy.py
@@ -86,9 +86,14 @@ class Rig(BaseRig, RelinkConstraintsMixin):
self.relink_bone_constraints(bones.org)
if self.make_control:
+ self.relink_move_constraints(bones.org, bones.ctrl, prefix='CTRL:')
+
# Constrain the original bone.
self.make_constraint(bones.org, 'COPY_TRANSFORMS', bones.ctrl, insert_index=0)
+ if self.make_deform:
+ self.relink_move_constraints(bones.org, bones.deform, prefix='DEF:')
+
def generate_widgets(self):
bones = self.bones
@@ -151,6 +156,13 @@ class Rig(BaseRig, RelinkConstraintsMixin):
self.add_relink_constraints_ui(layout, params)
+ if params.relink_constraints and (params.make_control or params.make_deform):
+ col = layout.column()
+ if params.make_control:
+ col.label(text="'CTRL:...' constraints are moved to the control bone.", icon='INFO')
+ if params.make_deform:
+ col.label(text="'DEF:...' constraints are moved to the deform bone.", icon='INFO')
+
def create_sample(obj):
""" Create a sample metarig for this rig type.