From 4c1df0f54ce02754b720d89c3bcf6f94361d5fcb Mon Sep 17 00:00:00 2001 From: Julien Duroure Date: Tue, 29 Mar 2022 17:45:51 +0200 Subject: glTF exporter: Fix transmission export --- io_scene_gltf2/__init__.py | 2 +- .../blender/exp/gltf2_blender_gather_materials.py | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/io_scene_gltf2/__init__.py b/io_scene_gltf2/__init__.py index 4ff7ff69..8a2e85f0 100755 --- a/io_scene_gltf2/__init__.py +++ b/io_scene_gltf2/__init__.py @@ -4,7 +4,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": (3, 2, 17), + "version": (3, 2, 18), 'blender': (3, 1, 0), 'location': 'File > Import-Export', 'description': 'Import-Export as glTF 2.0', 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 402e06fa..3805e9bd 100755 --- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_materials.py +++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_materials.py @@ -248,9 +248,10 @@ def __gather_extensions(blender_material, export_settings): # KHR_materials_transmission - transmission_extension = __gather_transmission_extension(blender_material, export_settings) + transmission_extension, use_actives_uvmap_transmission = __gather_transmission_extension(blender_material, export_settings) if transmission_extension: extensions["KHR_materials_transmission"] = transmission_extension + actives_uvmaps.extend(use_actives_uvmap_transmission) return extensions, actives_uvmaps if extensions else None @@ -429,17 +430,19 @@ def __gather_transmission_extension(blender_material, export_settings): transmission_extension['transmissionFactor'] = transmission_socket.default_value transmission_enabled = transmission_extension['transmissionFactor'] > 0 elif __has_image_node_from_socket(transmission_socket): - transmission_extension['transmissionFactor'] = 1 + transmission_extension['transmissionFactor'] = 1.0 has_transmission_texture = True transmission_enabled = True if not transmission_enabled: - return None + return None, None # Pack transmission channel (R). if has_transmission_texture: transmission_slots = (transmission_socket,) + use_actives_uvmaps = [] + if len(transmission_slots) > 0: combined_texture, use_active_uvmap = gltf2_blender_gather_texture_info.gather_texture_info( transmission_socket, @@ -448,8 +451,10 @@ def __gather_transmission_extension(blender_material, export_settings): ) if has_transmission_texture: transmission_extension['transmissionTexture'] = combined_texture + if use_active_uvmap: + use_actives_uvmaps.append("transmissionTexture") - return Extension('KHR_materials_transmission', transmission_extension, False), ["transmissionTexture"] if use_active_uvmap else [] + return Extension('KHR_materials_transmission', transmission_extension, False), use_actives_uvmaps def __gather_material_unlit(blender_material, active_uvmap_index, export_settings): -- cgit v1.2.3