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 16:14:16 +0300
committerJulien Duroure <julien.duroure@gmail.com>2022-02-12 16:14:16 +0300
commit38956097e34c48e984d229553e1d2b9dab9599b3 (patch)
tree318dd10ab559877feab1cfaf1e6a96dfee938d8c /io_scene_gltf2/blender/exp/gltf2_blender_gather_materials.py
parent0508df3751345a454d2d82a0e10fa4b38d1dae16 (diff)
glTF: Merge master
Diffstat (limited to 'io_scene_gltf2/blender/exp/gltf2_blender_gather_materials.py')
-rwxr-xr-xio_scene_gltf2/blender/exp/gltf2_blender_gather_materials.py13
1 files changed, 10 insertions, 3 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 b116abc5..7f413450 100755
--- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_materials.py
+++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_materials.py
@@ -120,7 +120,10 @@ def __gather_emissive_factor(blender_material, export_settings):
if emissive_socket is None:
emissive_socket = gltf2_blender_get.get_socket_old(blender_material, "EmissiveFactor")
if isinstance(emissive_socket, bpy.types.NodeSocket):
- factor = gltf2_blender_get.get_factor_from_socket(emissive_socket, kind='RGB')
+ if export_settings['gltf_image_format'] != "NONE":
+ factor = gltf2_blender_get.get_factor_from_socket(emissive_socket, kind='RGB')
+ else:
+ factor = gltf2_blender_get.get_const_from_default_value_socket(emissive_socket, kind='RGB')
if factor is None and emissive_socket.is_linked:
# In glTF, the default emissiveFactor is all zeros, so if an emission texture is connected,
@@ -279,7 +282,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
@@ -289,7 +294,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.