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
diff options
context:
space:
mode:
authorAlexander Gavrilov <angavrilov@gmail.com>2020-06-29 20:19:52 +0300
committerAlexander Gavrilov <angavrilov@gmail.com>2020-06-29 20:19:52 +0300
commitda8877fa8b295afba5a986bc710b862777fcfba3 (patch)
tree2bad3f4fe9ff8870def4ef02ce773ad85fa8a5a8 /rigify/base_rig.py
parentdb23ff3d34415a3aae1c8bd775de2db8af22d5c7 (diff)
Fix T78193 (Rigify): use bone history tracking to find derived DEF bones.
It is not really safe to assume that by swapping ORG to DEF you will get a deform bone derived from the given ORG bone. The new base rig API already tracks copying of bones, so polish it up and use here. Note however that this tracking doesn't work with bones created without self.copy_bone, e.g. by legacy rigs.
Diffstat (limited to 'rigify/base_rig.py')
-rw-r--r--rigify/base_rig.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/rigify/base_rig.py b/rigify/base_rig.py
index c4ddc128..056c2785 100644
--- a/rigify/base_rig.py
+++ b/rigify/base_rig.py
@@ -18,6 +18,8 @@
# <pep8 compliant>
+import collections
+
from .utils.errors import RaiseErrorMixin
from .utils.bones import BoneDict, BoneUtilityMixin
from .utils.mechanism import MechanismUtilityMixin
@@ -190,11 +192,15 @@ class BaseRig(GenerateCallbackHost, RaiseErrorMixin, BoneUtilityMixin, Mechanism
self.rigify_child_bones = set()
# Bones created by the rig (mapped to original names)
self.rigify_new_bones = dict()
+ self.rigify_derived_bones = collections.defaultdict(set)
def register_new_bone(self, new_name, old_name=None):
"""Registers this rig as the owner of this new bone."""
self.rigify_new_bones[new_name] = old_name
self.generator.bone_owners[new_name] = self
+ if old_name:
+ self.rigify_derived_bones[old_name].add(new_name)
+ self.generator.derived_bones[old_name].add(new_name)
###########################################################
# Bone ownership