From 67fc19dae1aeb4c8a61c16927e3c8a7b3a211cbc Mon Sep 17 00:00:00 2001 From: Swann Date: Fri, 8 May 2020 15:11:18 +0200 Subject: [PATCH] fix: get hard reference back fix: image crash --- multi_user/bl_types/bl_datablock.py | 6 +++--- multi_user/bl_types/bl_image.py | 11 ++++++----- multi_user/libs/replication | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/multi_user/bl_types/bl_datablock.py b/multi_user/bl_types/bl_datablock.py index 293dc14..84ad307 100644 --- a/multi_user/bl_types/bl_datablock.py +++ b/multi_user/bl_types/bl_datablock.py @@ -109,10 +109,10 @@ class BlDatablock(ReplicatedDatablock): if instance and hasattr(instance, 'uuid'): instance.uuid = self.uuid - # self.diff_method = DIFF_BINARY + self.diff_method = DIFF_BINARY - @property - def instance(self): + + def _resolve(self): datablock_ref = None datablock_root = getattr(bpy.data, self.bl_id) datablock_ref = utils.find_from_attr('uuid', self.uuid, datablock_root) diff --git a/multi_user/bl_types/bl_image.py b/multi_user/bl_types/bl_image.py index e376063..daf96d1 100644 --- a/multi_user/bl_types/bl_image.py +++ b/multi_user/bl_types/bl_image.py @@ -19,14 +19,14 @@ import bpy import mathutils import os - +import logging from .. import utils from .dump_anything import Loader, Dumper from .bl_datablock import BlDatablock def dump_image(image): pixels = None - if image.source == "GENERATED": + if image.source == "GENERATED" or image.packed_file is not None: prefs = utils.get_preferences() img_name = f"{image.name}.png" @@ -35,9 +35,10 @@ def dump_image(image): os.makedirs(prefs.cache_directory, exist_ok=True) image.file_format = "PNG" image.save() + logging.info( image.filepath_raw ) if image.source == "FILE": - image_path = bpy.path.abspath(image.filepath_raw) + image_path = bpy.path.abspath(image.filepath_raw) image_directory = os.path.dirname(image_path) os.makedirs(image_directory, exist_ok=True) image.save() @@ -69,8 +70,8 @@ class BlImage(BlDatablock): img_name = f"{image.name}.png" - img_path = os.path.join(prefs.cache_directory, img_name) - + img_path = os.path.join(prefs.cache_directory,img_name) + os.makedirs(prefs.cache_directory, exist_ok=True) file = open(img_path, 'wb') file.write(data["pixels"]) file.close() diff --git a/multi_user/libs/replication b/multi_user/libs/replication index f9892c2..c926d0f 160000 --- a/multi_user/libs/replication +++ b/multi_user/libs/replication @@ -1 +1 @@ -Subproject commit f9892c2c8ced7ef3ff6ae2ef471b8c013f86fd19 +Subproject commit c926d0f758dbd4f10f5bd4b98c404cacc39371bb