diff options
author | Julien Duroure <julien.duroure@gmail.com> | 2020-09-17 20:00:16 +0300 |
---|---|---|
committer | Julien Duroure <julien.duroure@gmail.com> | 2020-09-17 20:00:24 +0300 |
commit | 9db2451888a5f5a67d3d3d0fc2a967c208a3a801 (patch) | |
tree | 238533f0cdd2b4b287b96f54ed6c43a7dc0a1e8e /io_scene_gltf2/blender/exp/gltf2_blender_gather_materials_pbr_metallic_roughness.py | |
parent | ec4ad081e564781230e3a9b31ef48f1f8fb71899 (diff) |
glTF exporter: fix UVMap export when ORM are using different maps
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 | 45 |
1 files changed, 23 insertions, 22 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 d0cf4517..a89b0ca1 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 @@ -90,7 +90,7 @@ def __gather_base_color_texture(blender_material, export_settings): else: inputs = (base_color_socket,) - return gltf2_blender_gather_texture_info.gather_texture_info(inputs, export_settings) + return gltf2_blender_gather_texture_info.gather_texture_info(base_color_socket, inputs, export_settings) def __gather_extensions(blender_material, export_settings): @@ -115,28 +115,29 @@ def __gather_metallic_factor(blender_material, export_settings): def __gather_metallic_roughness_texture(blender_material, orm_texture, export_settings): - if orm_texture is not None: - texture_input = orm_texture + metallic_socket = gltf2_blender_get.get_socket(blender_material, "Metallic") + roughness_socket = gltf2_blender_get.get_socket(blender_material, "Roughness") + + hasMetal = metallic_socket is not None and __has_image_node_from_socket(metallic_socket) + hasRough = roughness_socket is not None and __has_image_node_from_socket(roughness_socket) + + if not hasMetal and not hasRough: + metallic_roughness = gltf2_blender_get.get_socket_old(blender_material, "MetallicRoughness") + if metallic_roughness is None or not __has_image_node_from_socket(metallic_roughness): + return None + texture_input = (metallic_roughness,) + elif not hasMetal: + texture_input = (roughness_socket,) + elif not hasRough: + texture_input = (metallic_socket,) else: - metallic_socket = gltf2_blender_get.get_socket(blender_material, "Metallic") - roughness_socket = gltf2_blender_get.get_socket(blender_material, "Roughness") - - hasMetal = metallic_socket is not None and __has_image_node_from_socket(metallic_socket) - hasRough = roughness_socket is not None and __has_image_node_from_socket(roughness_socket) - - if not hasMetal and not hasRough: - metallic_roughness = gltf2_blender_get.get_socket_old(blender_material, "MetallicRoughness") - if metallic_roughness is None or not __has_image_node_from_socket(metallic_roughness): - return None - texture_input = (metallic_roughness,) - elif not hasMetal: - texture_input = (roughness_socket,) - elif not hasRough: - texture_input = (metallic_socket,) - else: - texture_input = (metallic_socket, roughness_socket) - - return gltf2_blender_gather_texture_info.gather_texture_info(texture_input, export_settings) + texture_input = (metallic_socket, roughness_socket) + + return gltf2_blender_gather_texture_info.gather_texture_info( + texture_input[0], + orm_texture or texture_input, + export_settings, + ) def __gather_roughness_factor(blender_material, export_settings): |