From 97d4577285f5f7a75f663559a6a3ad6c692c087a Mon Sep 17 00:00:00 2001 From: Julien Duroure Date: Thu, 20 Jan 2022 18:30:28 +0100 Subject: glTF exporter: Better jpeg image detection --- io_scene_gltf2/__init__.py | 2 +- io_scene_gltf2/blender/exp/gltf2_blender_gather_image.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/io_scene_gltf2/__init__.py b/io_scene_gltf2/__init__.py index 3fbc9239..c8fa899b 100755 --- a/io_scene_gltf2/__init__.py +++ b/io_scene_gltf2/__init__.py @@ -15,7 +15,7 @@ bl_info = { 'name': 'glTF 2.0 format', 'author': 'Julien Duroure, Scurest, Norbert Nopper, Urs Hanselmann, Moritz Becher, Benjamin Schmithüsen, Jim Eckerlein, and many external contributors', - "version": (1, 8, 6), + "version": (1, 8, 7), 'blender': (3, 0, 0), 'location': 'File > Import-Export', 'description': 'Import-Export as glTF 2.0', diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_gather_image.py b/io_scene_gltf2/blender/exp/gltf2_blender_gather_image.py index 8e441f9c..baee02bd 100755 --- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_image.py +++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_image.py @@ -261,5 +261,8 @@ def __get_tex_from_socket(blender_shader_socket: bpy.types.NodeSocket, export_se def __is_blender_image_a_jpeg(image: bpy.types.Image) -> bool: if image.source != 'FILE': return False - path = image.filepath_raw.lower() - return path.endswith('.jpg') or path.endswith('.jpeg') or path.endswith('.jpe') + if image.filepath_raw == '' and image.packed_file: + return image.packed_file.data[:3] == b'\xff\xd8\xff' + else: + path = image.filepath_raw.lower() + return path.endswith('.jpg') or path.endswith('.jpeg') or path.endswith('.jpe') -- cgit v1.2.3