[Bf-extensions-cvs] [2c08beb9] master: glTF exporter: Fix T65622 Check if texture has a valid image

Julien Duroure noreply at git.blender.org
Sat Aug 3 07:11:14 CEST 2019


Commit: 2c08beb9690cf533badb5535830424a22bf635c9
Author: Julien Duroure
Date:   Sat Aug 3 07:08:14 2019 +0200
Branches: master
https://developer.blender.org/rBA2c08beb9690cf533badb5535830424a22bf635c9

glTF exporter: Fix T65622 Check if texture has a valid image

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

M	io_scene_gltf2/__init__.py
M	io_scene_gltf2/blender/exp/gltf2_blender_gather_material_normal_texture_info_class.py
M	io_scene_gltf2/blender/exp/gltf2_blender_gather_material_occlusion_texture_info_class.py
M	io_scene_gltf2/blender/exp/gltf2_blender_gather_texture_info.py

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

diff --git a/io_scene_gltf2/__init__.py b/io_scene_gltf2/__init__.py
index f85502f9..9ce2d9da 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, Norbert Nopper, Urs Hanselmann, Moritz Becher, Benjamin Schmithüsen, Jim Eckerlein, and many external contributors',
-    "version": (0, 9, 36),
+    "version": (0, 9, 37),
     'blender': (2, 80, 0),
     'location': 'File > Import-Export',
     'description': 'Import-Export as glTF 2.0',
@@ -595,3 +595,4 @@ def unregister():
     # remove from the export / import menu
     bpy.types.TOPBAR_MT_file_export.remove(menu_func_export)
     bpy.types.TOPBAR_MT_file_import.remove(menu_func_import)
+
diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_gather_material_normal_texture_info_class.py b/io_scene_gltf2/blender/exp/gltf2_blender_gather_material_normal_texture_info_class.py
index 03692f7b..a2480787 100755
--- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_material_normal_texture_info_class.py
+++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_material_normal_texture_info_class.py
@@ -38,6 +38,9 @@ def gather_material_normal_texture_info_class(blender_shader_sockets_or_texture_
         tex_coord=__gather_tex_coord(blender_shader_sockets_or_texture_slots, export_settings)
     )
 
+    if texture_info.index is None:
+        return None
+
     return texture_info
 
 
@@ -135,5 +138,7 @@ def __get_tex_from_socket(socket):
         gltf2_blender_search_node_tree.FilterByType(bpy.types.ShaderNodeTexImage))
     if not result:
         return None
+    if result[0].shader_node.image is None:
+        return None
     return result[0]
 
diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_gather_material_occlusion_texture_info_class.py b/io_scene_gltf2/blender/exp/gltf2_blender_gather_material_occlusion_texture_info_class.py
index c9c70e42..6fb543c0 100755
--- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_material_occlusion_texture_info_class.py
+++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_material_occlusion_texture_info_class.py
@@ -35,6 +35,9 @@ def gather_material_occlusion_texture_info_class(blender_shader_sockets_or_textu
         tex_coord=__gather_tex_coord(blender_shader_sockets_or_texture_slots, export_settings)
     )
 
+    if texture_info.index is None:
+        return None
+
     return texture_info
 
 
@@ -109,5 +112,7 @@ def __get_tex_from_socket(socket):
         gltf2_blender_search_node_tree.FilterByType(bpy.types.ShaderNodeTexImage))
     if not result:
         return None
+    if result[0].shader_node.image is None:
+        return None
     return result[0]
 
diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_gather_texture_info.py b/io_scene_gltf2/blender/exp/gltf2_blender_gather_texture_info.py
index 9a30f238..9a713062 100755
--- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_texture_info.py
+++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_texture_info.py
@@ -132,5 +132,7 @@ def __get_tex_from_socket(socket):
         gltf2_blender_search_node_tree.FilterByType(bpy.types.ShaderNodeTexImage))
     if not result:
         return None
+    if result[0].shader_node.image is None:
+        return None
     return result[0]



More information about the Bf-extensions-cvs mailing list