Merge branch '29-differential-revision' into develop

This commit is contained in:
Swann 2020-05-09 17:05:49 +02:00
commit 95524fa3e9
2 changed files with 9 additions and 8 deletions

View File

@ -109,10 +109,10 @@ class BlDatablock(ReplicatedDatablock):
if instance and hasattr(instance, 'uuid'): if instance and hasattr(instance, 'uuid'):
instance.uuid = self.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_ref = None
datablock_root = getattr(bpy.data, self.bl_id) datablock_root = getattr(bpy.data, self.bl_id)
datablock_ref = utils.find_from_attr('uuid', self.uuid, datablock_root) datablock_ref = utils.find_from_attr('uuid', self.uuid, datablock_root)

View File

@ -19,14 +19,14 @@
import bpy import bpy
import mathutils import mathutils
import os import os
import logging
from .. import utils from .. import utils
from .dump_anything import Loader, Dumper from .dump_anything import Loader, Dumper
from .bl_datablock import BlDatablock from .bl_datablock import BlDatablock
def dump_image(image): def dump_image(image):
pixels = None pixels = None
if image.source == "GENERATED": if image.source == "GENERATED" or image.packed_file is not None:
prefs = utils.get_preferences() prefs = utils.get_preferences()
img_name = f"{image.name}.png" img_name = f"{image.name}.png"
@ -35,9 +35,10 @@ def dump_image(image):
os.makedirs(prefs.cache_directory, exist_ok=True) os.makedirs(prefs.cache_directory, exist_ok=True)
image.file_format = "PNG" image.file_format = "PNG"
image.save() image.save()
logging.info( image.filepath_raw )
if image.source == "FILE": 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) image_directory = os.path.dirname(image_path)
os.makedirs(image_directory, exist_ok=True) os.makedirs(image_directory, exist_ok=True)
image.save() image.save()
@ -69,8 +70,8 @@ class BlImage(BlDatablock):
img_name = f"{image.name}.png" 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 = open(img_path, 'wb')
file.write(data["pixels"]) file.write(data["pixels"])
file.close() file.close()