diff options
Diffstat (limited to 'io_scene_gltf2/blender')
-rwxr-xr-x | io_scene_gltf2/blender/exp/gltf2_blender_gather_image.py | 2 | ||||
-rwxr-xr-x | io_scene_gltf2/blender/exp/gltf2_blender_gather_materials_pbr_metallic_roughness.py | 14 |
2 files changed, 10 insertions, 6 deletions
diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_gather_image.py b/io_scene_gltf2/blender/exp/gltf2_blender_gather_image.py index 7c1fa861..bb7621ed 100755 --- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_image.py +++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_image.py @@ -182,7 +182,7 @@ def __get_image_data(sockets, export_settings) -> ExportImage: dst_chan = Channel.G elif socket.name == 'Occlusion': dst_chan = Channel.R - elif socket.name == 'Alpha' and len(sockets) > 1 and sockets[1] is not None: + elif socket.name == 'Alpha': dst_chan = Channel.A elif socket.name == 'Clearcoat': dst_chan = Channel.R 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): |