glTF exporter: fix export when texture is used only for alpha
This commit is contained in:
parent
ce3a7fc885
commit
5f2cb885ab
|
@ -15,7 +15,7 @@
|
|||
bl_info = {
|
||||
'name': 'glTF 2.0 format',
|
||||
'author': 'Julien Duroure, Scurest, Norbert Nopper, Urs Hanselmann, Moritz Becher, Benjamin Schmithüsen, Jim Eckerlein, and many external contributors',
|
||||
"version": (1, 5, 2),
|
||||
"version": (1, 5, 3),
|
||||
'blender': (2, 91, 0),
|
||||
'location': 'File > Import-Export',
|
||||
'description': 'Import-Export as glTF 2.0',
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue