[Bf-extensions-cvs] [8b555809] blender-v2.91-release: Rigify: fix raw_copy not being able to find bones produced by legacy rigs.
Alexander Gavrilov
noreply at git.blender.org
Tue Nov 10 17:26:15 CET 2020
Commit: 8b555809bb31d7bfa929681f396d9a836f7e8acc
Author: Alexander Gavrilov
Date: Tue Nov 10 19:24:07 2020 +0300
Branches: blender-v2.91-release
https://developer.blender.org/rBA8b555809bb31d7bfa929681f396d9a836f7e8acc
Rigify: fix raw_copy not being able to find bones produced by legacy rigs.
In 2.90 derived bone lookup was tightened to fix certain issues when
bone names use the .001 suffixes by using explicit data about which
bone is derived from which one. Unfortunately, legacy rigs don't
provide that info, so add a special case using matching by name.
Also fix incorrect error reporting method name.
===================================================================
M rigify/rigs/basic/raw_copy.py
M rigify/utils/naming.py
===================================================================
diff --git a/rigify/rigs/basic/raw_copy.py b/rigify/rigs/basic/raw_copy.py
index afea51fc..5e7c0978 100644
--- a/rigify/rigs/basic/raw_copy.py
+++ b/rigify/rigs/basic/raw_copy.py
@@ -68,14 +68,14 @@ class RelinkConstraintsMixin:
if len(specs) == 1:
specs = repeat(specs[0])
elif len(specs) != len(con.targets):
- self.report_error("Constraint {} actually has {} targets", con.name, len(con.targets))
+ self.raise_error("Constraint {} actually has {} targets", con.name, len(con.targets))
for tgt, spec in zip(con.targets, specs):
tgt.subtarget = self.find_relink_target(spec, tgt.subtarget)
else:
if len(specs) > 1:
- self.report_error("Only the Armature constraint can have multiple '@' targets: {}", con.name)
+ self.raise_error("Only the Armature constraint can have multiple '@' targets: {}", con.name)
con.subtarget = self.find_relink_target(specs[0], con.subtarget)
@@ -88,11 +88,11 @@ class RelinkConstraintsMixin:
if not result:
result = choose_derived_bone(self.generator, old_target, spec.lower(), by_owner=False)
if not result:
- self.report_error("Cannot find derived {} bone of bone '{}' for relinking", spec, old_target)
+ self.raise_error("Cannot find derived {} bone of bone '{}' for relinking", spec, old_target)
return result
else:
if spec not in self.obj.pose.bones:
- self.report_error("Cannot find bone '{}' for relinking", spec)
+ self.raise_error("Cannot find bone '{}' for relinking", spec)
return spec
diff --git a/rigify/utils/naming.py b/rigify/utils/naming.py
index 0339e523..415dddaf 100644
--- a/rigify/utils/naming.py
+++ b/rigify/utils/naming.py
@@ -314,4 +314,12 @@ def choose_derived_bone(generator, original, subtype, *, by_owner=True, recursiv
if len(matching) > 0:
return matching[0]
+ # Try matching bones created by legacy rigs just by name - there is no origin data
+ from ..base_generate import LegacyRig
+
+ if isinstance(generator.bone_owners.get(direct), LegacyRig):
+ if not by_owner or generator.bone_owners.get(original) is generator.bone_owners[direct]:
+ assert direct in bones
+ return direct
+
return None
More information about the Bf-extensions-cvs
mailing list