From cc5a87adb839c9d93679ad540b8aab65f0483059 Mon Sep 17 00:00:00 2001 From: Swann Date: Wed, 3 Mar 2021 11:00:47 +0100 Subject: [PATCH] fix: prevent matrix_parent_inverse from being reset by loading parents only if its necessary --- multi_user/bl_types/bl_object.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/multi_user/bl_types/bl_object.py b/multi_user/bl_types/bl_object.py index b68b24d..d7dde74 100644 --- a/multi_user/bl_types/bl_object.py +++ b/multi_user/bl_types/bl_object.py @@ -300,8 +300,14 @@ class BlObject(BlDatablock): if 'display' in data: loader.load(target.display, data['display']) - # Parent - if 'parent' not in data and target.parent: + # Parenting + parent_id = data.get('parent_id') + if parent_id: + parent = bpy.data.objects[parent_id] + # Avoid reloading + if target.parent != parent and parent is not None: + target.parent = parent + elif target.parent: target.parent = None # Pose @@ -371,10 +377,6 @@ class BlObject(BlDatablock): dumper.include_filter = [ "name", "rotation_mode", - "parent", - "parent_type", - "track_axis", - "up_axis", "data", "library", "empty_display_type", @@ -419,6 +421,10 @@ class BlObject(BlDatablock): if self.is_library: return data + # PARENTING + if instance.parent: + data['parent_id'] = instance.parent.name + # MODIFIERS if hasattr(instance, 'modifiers'): data["modifiers"] = {} @@ -561,6 +567,9 @@ class BlObject(BlDatablock): if self.is_library: deps.append(self.instance.library) + if self.instance.parent : + deps.append(self.instance.parent) + if self.instance.instance_type == 'COLLECTION': # TODO: uuid based deps.append(self.instance.instance_collection)