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>2021-01-17 11:41:51 +0300
committerJulien Duroure <julien.duroure@gmail.com>2021-01-17 11:41:51 +0300
commitebdf1861dc568a9b4b92b29a9b8f7117ad1eec05 (patch)
treec3168caf4178413d066d480bb28e29f42fbaaf5e /io_scene_gltf2/blender/imp
parentd7f8d9a4f919894b23ee855d3b1a2327222de468 (diff)
glTF importer: Use Separate R node for clearcoat textures
Diffstat (limited to 'io_scene_gltf2/blender/imp')
-rw-r--r--io_scene_gltf2/blender/imp/gltf2_blender_KHR_materials_clearcoat.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/io_scene_gltf2/blender/imp/gltf2_blender_KHR_materials_clearcoat.py b/io_scene_gltf2/blender/imp/gltf2_blender_KHR_materials_clearcoat.py
index 611bffff..018fdb3b 100644
--- a/io_scene_gltf2/blender/imp/gltf2_blender_KHR_materials_clearcoat.py
+++ b/io_scene_gltf2/blender/imp/gltf2_blender_KHR_materials_clearcoat.py
@@ -16,7 +16,7 @@ from ...io.com.gltf2_io import TextureInfo, MaterialNormalTextureInfoClass
from .gltf2_blender_texture import texture
-# [Texture] => [Clearcoat Factor] =>
+# [Texture] => [Separate R] => [Clearcoat Factor] =>
def clearcoat(mh, location, clearcoat_socket):
x, y = location
try:
@@ -49,9 +49,15 @@ def clearcoat(mh, location, clearcoat_socket):
x -= 200
- # Clearcoat is in the R component; we don't need to separate it out
- # since hooking a color socket up to a value socket automatically gets
- # the R
+ # Separate RGB
+ node = mh.node_tree.nodes.new('ShaderNodeSeparateRGB')
+ node.location = x - 150, y - 75
+ # Outputs
+ mh.node_tree.links.new(clearcoat_socket, node.outputs['R'])
+ # Inputs
+ clearcoat_socket = node.inputs[0]
+
+ x -= 200
texture(
mh,