diff options
author | Julien Duroure <julien.duroure@gmail.com> | 2020-11-30 20:45:29 +0300 |
---|---|---|
committer | Julien Duroure <julien.duroure@gmail.com> | 2020-11-30 20:45:29 +0300 |
commit | 5f2cb885abb90e5c0c44c3ff699502d2bc14fca9 (patch) | |
tree | dcad84b0fb6594a49571db31b9be0ea2c4a6944e /io_scene_gltf2/blender/exp/gltf2_blender_gather_materials_pbr_metallic_roughness.py | |
parent | ce3a7fc885a0a26c570e8f4a9f9de8a0806cab01 (diff) |
glTF exporter: fix export when texture is used only for alpha
Diffstat (limited to 'io_scene_gltf2/blender/exp/gltf2_blender_gather_materials_pbr_metallic_roughness.py')
-rwxr-xr-x | io_scene_gltf2/blender/exp/gltf2_blender_gather_materials_pbr_metallic_roughness.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_gather_materials_pbr_metallic_roughness.py b/io_scene_gltf2/blender/exp/gltf2_blender_gather_materials_pbr_metallic_roughness.py index a6a28fc4..5b3c1bc6 100755 --- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_materials_pbr_metallic_roughness.py +++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_materials_pbr_metallic_roughness.py @@ -81,12 +81,16 @@ def __gather_base_color_texture(blender_material, export_settings): base_color_socket = gltf2_blender_get.get_socket_old(blender_material, "BaseColor") alpha_socket = gltf2_blender_get.get_socket(blender_material, "Alpha") - if alpha_socket is not None and alpha_socket.is_linked: - inputs = (base_color_socket, alpha_socket, ) - else: - inputs = (base_color_socket,) - return gltf2_blender_gather_texture_info.gather_texture_info(base_color_socket, inputs, export_settings) + # keep sockets that have some texture : color and/or alpha + inputs = tuple( + socket for socket in [base_color_socket, alpha_socket] + if socket is not None and __has_image_node_from_socket(socket) + ) + if not inputs: + return None + + return gltf2_blender_gather_texture_info.gather_texture_info(inputs[0], inputs, export_settings) def __gather_extensions(blender_material, export_settings): |