fix: prevent circular dependencies

Related to #30.
This commit is contained in:
Swann Martinez
2019-11-07 18:42:16 +01:00
parent 8c340d83ac
commit 27e310bfbf
+5 -5
View File
@@ -20,13 +20,13 @@ def load_constraints(target, data):
utils.dump_anything.load(
target_constraint, data[constraint])
def get_collection_deps(collection):
def get_collection_deps(local_id, collection):
deps = []
for item in collection:
attributes = dir(item)
for attr in attributes:
attr_ref = getattr(item, attr)
if attr_ref and isinstance(attr_ref, bpy.types.Object):
if attr_ref and isinstance(attr_ref, bpy.types.Object) and attr_ref.uuid != local_id:
deps.append(attr_ref)
return deps
@@ -211,14 +211,14 @@ class BlObject(BlDatablock):
deps.append(self.pointer.library)
if hasattr(self.pointer, 'modifiers'):
deps.extend(get_collection_deps(self.pointer.modifiers))
deps.extend(get_collection_deps(self.uuid, self.pointer.modifiers))
if hasattr(self.pointer,'constraints'):
deps.extend(get_collection_deps(self.pointer.constraints))
deps.extend(get_collection_deps(self.uuid, self.pointer.constraints))
if hasattr(self.pointer,'pose') and self.pointer.pose:
for b in self.pointer.pose.bones:
deps.extend(get_collection_deps(b.constraints))
deps.extend(get_collection_deps(self.uuid, b.constraints))
if self.pointer.instance_type == 'COLLECTION':
# TODO: uuid based