diff options
author | Julien Duroure <julien.duroure@gmail.com> | 2018-12-18 23:31:29 +0300 |
---|---|---|
committer | Julien Duroure <julien.duroure@gmail.com> | 2018-12-18 23:31:29 +0300 |
commit | bf867f50228505710c51eb7d76832415c36d9f74 (patch) | |
tree | 0bff37b29027c65fd0dcd9f333772c2619f80532 /io_scene_gltf2/blender/exp/gltf2_blender_gather_materials_pbr_metallic_roughness.py | |
parent | 9aa6c8058b32675b2636632d6735f66baf6300b1 (diff) |
glTF exporter: various fixes & enhancement
* Fix some Yup conversions
* reading material from glTF node group material if exists
* Fix normal export
* Round transforms near 0 and 1
* Fix exporting from Edit mode
* Various image format management
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 | 10 |
1 files changed, 10 insertions, 0 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 16b991f0..2a6315bf 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 @@ -46,6 +46,8 @@ def __gather_base_color_factor(blender_material, export_settings): base_color_socket = gltf2_blender_get.get_socket_or_texture_slot(blender_material, "Base Color") if base_color_socket is None: base_color_socket = gltf2_blender_get.get_socket_or_texture_slot(blender_material, "BaseColor") + if base_color_socket is None: + base_color_socket = gltf2_blender_get.get_socket_or_texture_slot_old(blender_material, "BaseColorFactor") if isinstance(base_color_socket, bpy.types.NodeSocket) and not base_color_socket.is_linked: return list(base_color_socket.default_value) return None @@ -54,6 +56,8 @@ def __gather_base_color_texture(blender_material, export_settings): base_color_socket = gltf2_blender_get.get_socket_or_texture_slot(blender_material, "Base Color") if base_color_socket is None: base_color_socket = gltf2_blender_get.get_socket_or_texture_slot(blender_material, "BaseColor") + if base_color_socket is None: + base_color_socket = gltf2_blender_get.get_socket_or_texture_slot_old(blender_material, "BaseColor") return gltf2_blender_gather_texture_info.gather_texture_info((base_color_socket,), export_settings) @@ -67,6 +71,8 @@ def __gather_extras(blender_material, export_settings): def __gather_metallic_factor(blender_material, export_settings): metallic_socket = gltf2_blender_get.get_socket_or_texture_slot(blender_material, "Metallic") + if metallic_socket is None: + metallic_socket = gltf2_blender_get.get_socket_or_texture_slot_old(blender_material, "MetallicFactor") if isinstance(metallic_socket, bpy.types.NodeSocket) and not metallic_socket.is_linked: return metallic_socket.default_value return None @@ -78,6 +84,8 @@ def __gather_metallic_roughness_texture(blender_material, export_settings): if metallic_socket is None and roughness_socket is None: metallic_roughness = gltf2_blender_get.get_socket_or_texture_slot(blender_material, "MetallicRoughness") + if metallic_roughness is None: + metallic_roughness = gltf2_blender_get.get_socket_or_texture_slot_old(blender_material, "MetallicRoughness") texture_input = (metallic_roughness,) else: texture_input = (metallic_socket, roughness_socket) @@ -87,6 +95,8 @@ def __gather_metallic_roughness_texture(blender_material, export_settings): def __gather_roughness_factor(blender_material, export_settings): roughness_socket = gltf2_blender_get.get_socket_or_texture_slot(blender_material, "Roughness") + if roughness_socket is None: + roughness_socket = gltf2_blender_get.get_socket_or_texture_slot_old(blender_material, "RoughnessFactor") if isinstance(roughness_socket, bpy.types.NodeSocket) and not roughness_socket.is_linked: return roughness_socket.default_value return None |