Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Duroure <julien.duroure@gmail.com>2022-02-12 15:35:51 +0300
committerJulien Duroure <julien.duroure@gmail.com>2022-02-12 15:35:51 +0300
commitdc2d9b0864daf6805c89632004f8c98c91cc311b (patch)
treecca94ecd0440a926ecdf052c9823ee418452d051 /io_scene_gltf2/blender/exp/gltf2_blender_gather_materials.py
parent963a9847f2624052206aa6e84cf3023b3ed5429a (diff)
glTF exporter: manage factors for Clearcoat extension
Diffstat (limited to 'io_scene_gltf2/blender/exp/gltf2_blender_gather_materials.py')
-rwxr-xr-xio_scene_gltf2/blender/exp/gltf2_blender_gather_materials.py8
1 files changed, 6 insertions, 2 deletions
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 6bd7834b..a15f0f8d 100755
--- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_materials.py
+++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_materials.py
@@ -273,7 +273,9 @@ def __gather_clearcoat_extension(blender_material, export_settings):
clearcoat_extension['clearcoatFactor'] = clearcoat_socket.default_value
clearcoat_enabled = clearcoat_extension['clearcoatFactor'] > 0
elif __has_image_node_from_socket(clearcoat_socket):
- clearcoat_extension['clearcoatFactor'] = 1
+ fac = gltf2_blender_get.get_factor_from_socket(clearcoat_socket, kind='VALUE')
+ # default value in glTF is 0.0, but if there is a texture without factor, use 1
+ clearcoat_extension['clearcoatFactor'] = fac if fac != None else 1.0
has_clearcoat_texture = True
clearcoat_enabled = True
@@ -283,7 +285,9 @@ def __gather_clearcoat_extension(blender_material, export_settings):
if isinstance(clearcoat_roughness_socket, bpy.types.NodeSocket) and not clearcoat_roughness_socket.is_linked:
clearcoat_extension['clearcoatRoughnessFactor'] = clearcoat_roughness_socket.default_value
elif __has_image_node_from_socket(clearcoat_roughness_socket):
- clearcoat_extension['clearcoatRoughnessFactor'] = 1
+ fac = gltf2_blender_get.get_factor_from_socket(clearcoat_roughness_socket, kind='VALUE')
+ # default value in glTF is 0.0, but if there is a texture without factor, use 1
+ clearcoat_extension['clearcoatRoughnessFactor'] = fac if fac != None else 1.0
has_clearcoat_roughness_texture = True
# Pack clearcoat (R) and clearcoatRoughness (G) channels.