fix: image uuid error

This commit is contained in:
Swann
2020-09-18 15:58:43 +02:00
parent 47a0efef27
commit d8a94e3f5e

View File

@ -44,11 +44,20 @@ format_to_ext = {
}
def dump_image(image):
class BlImage(BlDatablock):
bl_id = "images"
bl_class = bpy.types.Image
bl_delay_refresh = 1
bl_delay_apply = 1
bl_automatic_push = True
bl_check_common = False
bl_icon = 'IMAGE_DATA'
def dump_image(self, image):
pixels = None
if image.source == "GENERATED" or image.packed_file is not None:
prefs = utils.get_preferences()
img_name = f"{image.uuid}.{format_to_ext[image.file_format]}"
img_name = f"{self.uuid}.{format_to_ext[image.file_format]}"
# Cache the image on the disk
image.filepath_raw = os.path.join(prefs.cache_directory, img_name)
@ -67,16 +76,6 @@ def dump_image(image):
raise ValueError()
return pixels
class BlImage(BlDatablock):
bl_id = "images"
bl_class = bpy.types.Image
bl_delay_refresh = 1
bl_delay_apply = 1
bl_automatic_push = True
bl_check_common = False
bl_icon = 'IMAGE_DATA'
def _construct(self, data):
return bpy.data.images.new(
name=data['name'],
@ -108,7 +107,7 @@ class BlImage(BlDatablock):
def _dump(self, instance=None):
assert(instance)
data = {}
data['pixels'] = dump_image(instance)
data['pixels'] = self.dump_image(instance)
dumper = Dumper()
dumper.depth = 2
dumper.include_filter = [