[Bf-extensions-cvs] [ca90ba2b] blender2.8: glTF importer: Check that there are nodes

Julien Duroure noreply at git.blender.org
Sun Nov 25 08:04:45 CET 2018


Commit: ca90ba2b753a846158d0723dfcb0c6eb1fae3288
Author: Julien Duroure
Date:   Sun Nov 25 08:02:48 2018 +0100
Branches: blender2.8
https://developer.blender.org/rBAca90ba2b753a846158d0723dfcb0c6eb1fae3288

glTF importer: Check that there are nodes

Something is wrong in file if there are no nodes,
but this check avoid the addon to crash

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

M	io_scene_gltf2/blender/imp/gltf2_blender_gltf.py

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

diff --git a/io_scene_gltf2/blender/imp/gltf2_blender_gltf.py b/io_scene_gltf2/blender/imp/gltf2_blender_gltf.py
index 9f8a3584..0c819f9c 100755
--- a/io_scene_gltf2/blender/imp/gltf2_blender_gltf.py
+++ b/io_scene_gltf2/blender/imp/gltf2_blender_gltf.py
@@ -152,6 +152,10 @@ class BlenderGlTF():
                     if 'glossinessFactor' not in material.extensions['KHR_materials_pbrSpecularGlossiness'].keys():
                         material.extensions['KHR_materials_pbrSpecularGlossiness']['glossinessFactor'] = 1.0
 
+        if gltf.data.nodes is None:
+            # Something is wrong in file, there is no nodes
+            return
+
         for node_idx, node in enumerate(gltf.data.nodes):
 
             # skin management



More information about the Bf-extensions-cvs mailing list