exclude origchar's hierarchy from retargrelations

This commit is contained in:
Nathan
2026-02-19 14:18:39 -07:00
parent 20f81d0e1e
commit f069289890
2 changed files with 686 additions and 1 deletions
+3 -1
View File
@@ -437,7 +437,8 @@ def run_mig_bone_const(orig, rep, orig_to_rep):
def run_retarg_relatives(orig, rep, rep_descendants, orig_to_rep):
"""Retarget relations: parents, constraint targets, Armature modifiers to rep."""
"""Retarget relations: parents, constraint targets, Armature modifiers to rep. Skip objects in orig's hierarchy (linked collection)."""
orig_hierarchy = {orig} | descendants(orig)
candidates = set(rep_descendants)
for ob in bpy.data.objects:
if getattr(ob.parent, "name", None) == orig.name:
@@ -445,6 +446,7 @@ def run_retarg_relatives(orig, rep, rep_descendants, orig_to_rep):
for c in getattr(ob, "constraints", []):
if getattr(c, "target", None) == orig:
candidates.add(ob)
candidates -= orig_hierarchy
for ob in candidates:
if ob.parent == orig:
ob.parent = rep