[Bf-extensions-cvs] [c172be1c] master: glTF exporter: fix crash trying to export area lights (not supported)

Julien Duroure noreply at git.blender.org
Sat Nov 23 08:32:59 CET 2019


Commit: c172be1c93a6f583e29b5f0b2473c59673670b5d
Author: Julien Duroure
Date:   Sat Nov 23 08:32:18 2019 +0100
Branches: master
https://developer.blender.org/rBAc172be1c93a6f583e29b5f0b2473c59673670b5d

glTF exporter: fix crash trying to export area lights (not supported)

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

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

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

diff --git a/io_scene_gltf2/__init__.py b/io_scene_gltf2/__init__.py
index 0d8a517d..1de1ed62 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": (1, 1, 11),
+    "version": (1, 1, 12),
     'blender': (2, 81, 6),
     'location': 'File > Import-Export',
     'description': 'Import-Export as glTF 2.0',
diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_gather_nodes.py b/io_scene_gltf2/blender/exp/gltf2_blender_gather_nodes.py
index 43a6e5d1..cccfbd9d 100755
--- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_nodes.py
+++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_nodes.py
@@ -74,7 +74,8 @@ def __gather_node(blender_object, blender_scene, export_settings):
         node.translation, node.rotation, node.scale = __gather_trans_rot_scale(blender_object, export_settings)
 
     if export_settings[gltf2_blender_export_keys.YUP]:
-        if blender_object.type == 'LIGHT' and export_settings[gltf2_blender_export_keys.LIGHTS]:
+        # Checking node.extensions is making sure that the type of lamp is managed, and will be exported
+        if blender_object.type == 'LIGHT' and export_settings[gltf2_blender_export_keys.LIGHTS] and node.extensions:
             correction_node = __get_correction_node(blender_object, export_settings)
             correction_node.extensions = {"KHR_lights_punctual": node.extensions["KHR_lights_punctual"]}
             del node.extensions["KHR_lights_punctual"]



More information about the Bf-extensions-cvs mailing list