From 6475b4fc08271cf6c098a533a92161b4b9734506 Mon Sep 17 00:00:00 2001 From: Swann Date: Mon, 24 Aug 2020 17:49:17 +0200 Subject: [PATCH] feat: collection insance offset support Related to #105 --- multi_user/bl_types/bl_collection.py | 17 +++++++++++++---- multi_user/operators.py | 5 +++++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/multi_user/bl_types/bl_collection.py b/multi_user/bl_types/bl_collection.py index 312906b..6b793a4 100644 --- a/multi_user/bl_types/bl_collection.py +++ b/multi_user/bl_types/bl_collection.py @@ -21,7 +21,7 @@ import mathutils from .. import utils from .bl_datablock import BlDatablock - +from .dump_anything import Loader, Dumper class BlCollection(BlDatablock): bl_id = "collections" @@ -45,8 +45,11 @@ class BlCollection(BlDatablock): return instance def _load_implementation(self, data, target): + loader = Loader() + loader.load(target,data) + # Load other meshes metadata - target.name = data["name"] + # target.name = data["name"] # Objects for object in data["objects"]: @@ -77,8 +80,14 @@ class BlCollection(BlDatablock): def _dump_implementation(self, data, instance=None): assert(instance) - data = {} - data['name'] = instance.name + + dumper = Dumper() + dumper.depth = 1 + dumper.include_filter = [ + "name", + "instance_offset" + ] + data = dumper.dump(instance) # dump objects collection_objects = [] diff --git a/multi_user/operators.py b/multi_user/operators.py index 8f9561e..c587e13 100644 --- a/multi_user/operators.py +++ b/multi_user/operators.py @@ -165,8 +165,13 @@ class SessionStartOperator(bpy.types.Operator): node_ref = client.get(node) if node_ref.state == FETCHED: node_ref.resolve() + + for node in client._graph.list_ordered(): + node_ref = client.get(node) + if node_ref.state == FETCHED: node_ref.apply() + # Launch drawing module if runtime_settings.enable_presence: presence.renderer.run()