From c28c92c1494cbe67a0d5b26e74ebbe82856e6a7a Mon Sep 17 00:00:00 2001 From: Julien Duroure <julien.duroure@gmail.com> Date: Tue, 24 May 2022 21:24:20 +0200 Subject: [PATCH] glTF: Replace Separate RGB shader node by new Separate Color node --- io_scene_gltf2/__init__.py | 4 ++-- .../blender/exp/gltf2_blender_gather_image.py | 8 ++++---- .../imp/gltf2_blender_KHR_materials_clearcoat.py | 8 ++++---- .../blender/imp/gltf2_blender_pbrMetallicRoughness.py | 10 +++++----- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/io_scene_gltf2/__init__.py b/io_scene_gltf2/__init__.py index ecef3e84c..edac58bd7 100755 --- a/io_scene_gltf2/__init__.py +++ b/io_scene_gltf2/__init__.py @@ -4,8 +4,8 @@ bl_info = { 'name': 'glTF 2.0 format', 'author': 'Julien Duroure, Scurest, Norbert Nopper, Urs Hanselmann, Moritz Becher, Benjamin SchmithĂĽsen, Jim Eckerlein, and many external contributors', - "version": (3, 3, 1), - 'blender': (3, 1, 0), + "version": (3, 3, 2), + 'blender': (3, 3, 0), 'location': 'File > Import-Export', 'description': 'Import-Export as glTF 2.0', 'warning': '', diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_gather_image.py b/io_scene_gltf2/blender/exp/gltf2_blender_gather_image.py index 7b9335cfd..0dfce9f9b 100755 --- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_image.py +++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_image.py @@ -193,11 +193,11 @@ def __get_image_data(sockets, export_settings) -> ExportImage: # rudimentarily try follow the node tree to find the correct image data. src_chan = Channel.R for elem in result.path: - if isinstance(elem.from_node, bpy.types.ShaderNodeSeparateRGB): + if isinstance(elem.from_node, bpy.types.ShaderNodeSeparateColor): src_chan = { - 'R': Channel.R, - 'G': Channel.G, - 'B': Channel.B, + 'Red': Channel.R, + 'Green': Channel.G, + 'Blue': Channel.B, }[elem.from_socket.name] if elem.from_socket.name == 'Alpha': src_chan = Channel.A 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 73232f14f..e34683f2d 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 @@ -39,10 +39,10 @@ def clearcoat(mh, location, clearcoat_socket): x -= 200 # Separate RGB - node = mh.node_tree.nodes.new('ShaderNodeSeparateRGB') + node = mh.node_tree.nodes.new('ShaderNodeSeparateColor') node.location = x - 150, y - 75 # Outputs - mh.node_tree.links.new(clearcoat_socket, node.outputs['R']) + mh.node_tree.links.new(clearcoat_socket, node.outputs['Red']) # Inputs clearcoat_socket = node.inputs[0] @@ -92,10 +92,10 @@ def clearcoat_roughness(mh, location, roughness_socket): x -= 200 # Separate RGB (roughness is in G) - node = mh.node_tree.nodes.new('ShaderNodeSeparateRGB') + node = mh.node_tree.nodes.new('ShaderNodeSeparateColor') node.location = x - 150, y - 75 # Outputs - mh.node_tree.links.new(roughness_socket, node.outputs['G']) + mh.node_tree.links.new(roughness_socket, node.outputs['Green']) # Inputs color_socket = node.inputs[0] diff --git a/io_scene_gltf2/blender/imp/gltf2_blender_pbrMetallicRoughness.py b/io_scene_gltf2/blender/imp/gltf2_blender_pbrMetallicRoughness.py index a5d10a7a0..4c32c35d4 100755 --- a/io_scene_gltf2/blender/imp/gltf2_blender_pbrMetallicRoughness.py +++ b/io_scene_gltf2/blender/imp/gltf2_blender_pbrMetallicRoughness.py @@ -363,11 +363,11 @@ def metallic_roughness(mh: MaterialHelper, location, metallic_socket, roughness_ x -= 200 # Separate RGB - node = mh.node_tree.nodes.new('ShaderNodeSeparateRGB') + node = mh.node_tree.nodes.new('ShaderNodeSeparateColor') node.location = x - 150, y - 75 # Outputs - mh.node_tree.links.new(metallic_socket, node.outputs['B']) - mh.node_tree.links.new(roughness_socket, node.outputs['G']) + mh.node_tree.links.new(metallic_socket, node.outputs['Blue']) + mh.node_tree.links.new(roughness_socket, node.outputs['Green']) # Inputs color_socket = node.inputs[0] @@ -447,10 +447,10 @@ def occlusion(mh: MaterialHelper, location, occlusion_socket): x -= 200 # Separate RGB - node = mh.node_tree.nodes.new('ShaderNodeSeparateRGB') + node = mh.node_tree.nodes.new('ShaderNodeSeparateColor') node.location = x - 150, y - 75 # Outputs - mh.node_tree.links.new(occlusion_socket, node.outputs['R']) + mh.node_tree.links.new(occlusion_socket, node.outputs['Red']) # Inputs color_socket = node.inputs[0] -- GitLab