diff options
-rwxr-xr-x | io_scene_gltf2/__init__.py | 1 | ||||
-rwxr-xr-x | io_scene_gltf2/blender/exp/gltf2_blender_gather_materials.py | 9 |
2 files changed, 8 insertions, 2 deletions
diff --git a/io_scene_gltf2/__init__.py b/io_scene_gltf2/__init__.py index a67b62f6..c68e29eb 100755 --- a/io_scene_gltf2/__init__.py +++ b/io_scene_gltf2/__init__.py @@ -515,3 +515,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_materials.py b/io_scene_gltf2/blender/exp/gltf2_blender_gather_materials.py index 41bb7649..5fff246a 100755 --- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_materials.py +++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_materials.py @@ -103,8 +103,13 @@ def __gather_emissive_factor(blender_material, export_settings): emissive_socket = gltf2_blender_get.get_socket_or_texture_slot(blender_material, "Emissive") if emissive_socket is None: emissive_socket = gltf2_blender_get.get_socket_or_texture_slot_old(blender_material, "EmissiveFactor") - if isinstance(emissive_socket, bpy.types.NodeSocket) and not emissive_socket.is_linked: - return list(emissive_socket.default_value)[0:3] + if isinstance(emissive_socket, bpy.types.NodeSocket): + if emissive_socket.is_linked: + # In glTF, the default emissiveFactor is all zeros, so if an emission texture is connected, + # we have to manually set it to all ones. + return [1.0, 1.0, 1.0] + else: + return list(emissive_socket.default_value)[0:3] return None |