[Bf-extensions-cvs] [3f91b7f6] master: glTF exporter: fix export of unlit materials
Julien Duroure
noreply at git.blender.org
Thu Feb 21 22:09:19 CET 2019
Commit: 3f91b7f68083a221c8b222860f749a85c0c810ce
Author: Julien Duroure
Date: Thu Feb 21 22:08:58 2019 +0100
Branches: master
https://developer.blender.org/rBA3f91b7f68083a221c8b222860f749a85c0c810ce
glTF exporter: fix export of unlit materials
===================================================================
M io_scene_gltf2/blender/exp/gltf2_blender_export.py
===================================================================
diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_export.py b/io_scene_gltf2/blender/exp/gltf2_blender_export.py
index f3e4a469..071b4884 100755
--- a/io_scene_gltf2/blender/exp/gltf2_blender_export.py
+++ b/io_scene_gltf2/blender/exp/gltf2_blender_export.py
@@ -92,11 +92,7 @@ def __fix_json(obj):
if isinstance(obj, dict):
fixed = {}
for key, value in obj.items():
- if value is None:
- continue
- elif isinstance(value, dict) and len(value) == 0:
- continue
- elif isinstance(value, list) and len(value) == 0:
+ if not __should_include_json_value(key, value):
continue
fixed[key] = __fix_json(value)
elif isinstance(obj, list):
@@ -110,6 +106,20 @@ def __fix_json(obj):
return fixed
+def __should_include_json_value(key, value):
+ allowed_empty_collections = ["KHR_materials_unlit"]
+
+ if value is None:
+ return False
+ elif __is_empty_collection(value) and key not in allowed_empty_collections:
+ return False
+ return True
+
+
+def __is_empty_collection(value):
+ return (isinstance(value, dict) or isinstance(value, list)) and len(value) == 0
+
+
def __write_file(json, buffer, export_settings):
try:
gltf2_io_export.save_gltf(
More information about the Bf-extensions-cvs
mailing list