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'):
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)

View File

@ -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()