From 0faef9b39d677bbafc7ef0fb7b3330df3aee8c89 Mon Sep 17 00:00:00 2001 From: Oleksii Pelykh Date: Thu, 18 Jun 2020 14:32:27 +0200 Subject: [PATCH] Export composed textures as JPEG unless PNG is required --- .../blender/exp/gltf2_blender_gather_image.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_image.py b/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_image.py index d1d4d2b90..1252c3843 100644 --- a/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_image.py +++ b/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_image.py @@ -1,4 +1,4 @@ -# Copyright 2018-2019 The glTF-Blender-IO authors. +# Copyright 2018-2020 The glTF-Blender-IO authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -101,9 +101,14 @@ def __gather_mime_type(sockets_or_slots, export_image, export_settings): if export_settings["gltf_image_format"] == "AUTO": image = export_image.blender_image() - if image is not None and __is_blender_image_a_jpeg(image): - return "image/jpeg" - return "image/png" + if image is not None: + return "image/jpeg" if __is_blender_image_a_jpeg(image) else "image/png" + for fill in export_image.fills.values(): + if not isinstance(fill, FillImage): + continue + if not __is_blender_image_a_jpeg(fill.image): + return "image/png" + return "image/jpeg" elif export_settings["gltf_image_format"] == "JPEG": return "image/jpeg"