[Bf-extensions-cvs] [97d45772] master: glTF exporter: Better jpeg image detection

Julien Duroure noreply at git.blender.org
Thu Jan 20 19:20:24 CET 2022


Commit: 97d4577285f5f7a75f663559a6a3ad6c692c087a
Author: Julien Duroure
Date:   Thu Jan 20 18:30:28 2022 +0100
Branches: master
https://developer.blender.org/rBA97d4577285f5f7a75f663559a6a3ad6c692c087a

glTF exporter: Better jpeg image detection

===================================================================

M	io_scene_gltf2/__init__.py
M	io_scene_gltf2/blender/exp/gltf2_blender_gather_image.py

===================================================================

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



More information about the Bf-extensions-cvs mailing list