From 27e310bfbfda3332d6523b2a6ba9f01a89f58714 Mon Sep 17 00:00:00 2001 From: Swann Martinez Date: Thu, 7 Nov 2019 18:42:16 +0100 Subject: [PATCH] fix: prevent circular dependencies Related to #30. --- multi_user/bl_types/bl_object.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/multi_user/bl_types/bl_object.py b/multi_user/bl_types/bl_object.py index c36760a..4b714e0 100644 --- a/multi_user/bl_types/bl_object.py +++ b/multi_user/bl_types/bl_object.py @@ -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