diff options
author | Julien Duroure <julien.duroure@gmail.com> | 2019-11-09 12:56:01 +0300 |
---|---|---|
committer | Julien Duroure <julien.duroure@gmail.com> | 2019-11-09 12:56:01 +0300 |
commit | 74a8fb2aa8f983a573cd35be1c883c8701c88093 (patch) | |
tree | 24620b43e7093a202af59080c52cb72ba74e531d /io_scene_gltf2/blender/imp/gltf2_blender_pbrMetallicRoughness.py | |
parent | eb4085f1dc1522debb6bd490c3002fd0e22e6149 (diff) |
glTF importer: use vertexcolor node instead of attributenode
Diffstat (limited to 'io_scene_gltf2/blender/imp/gltf2_blender_pbrMetallicRoughness.py')
-rwxr-xr-x | io_scene_gltf2/blender/imp/gltf2_blender_pbrMetallicRoughness.py | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/io_scene_gltf2/blender/imp/gltf2_blender_pbrMetallicRoughness.py b/io_scene_gltf2/blender/imp/gltf2_blender_pbrMetallicRoughness.py index af529090..081d8356 100755 --- a/io_scene_gltf2/blender/imp/gltf2_blender_pbrMetallicRoughness.py +++ b/io_scene_gltf2/blender/imp/gltf2_blender_pbrMetallicRoughness.py @@ -72,9 +72,9 @@ class BlenderPbr(): else: # Create attribute node to get COLOR_0 data - attribute_node = node_tree.nodes.new('ShaderNodeAttribute') - attribute_node.attribute_name = 'COLOR_0' - attribute_node.location = -500, 0 + vertexcolor_node = node_tree.nodes.new('ShaderNodeVertexColor') + vertexcolor_node.layer_name = 'COLOR_0' + vertexcolor_node.location = -500, 0 if nodetype == "principled": # TODO : currently set metallic & specular in same way @@ -86,7 +86,7 @@ class BlenderPbr(): rgb_node.blend_type = 'MULTIPLY' rgb_node.inputs['Fac'].default_value = 1.0 rgb_node.inputs['Color1'].default_value = pypbr.base_color_factor - node_tree.links.new(rgb_node.inputs['Color2'], attribute_node.outputs[0]) + node_tree.links.new(rgb_node.inputs['Color2'], vertexcolor_node.outputs[0]) node_tree.links.new(main_node.inputs[0], rgb_node.outputs[0]) elif pypbr.color_type == gltf.TEXTURE_FACTOR: @@ -95,8 +95,8 @@ class BlenderPbr(): if vertex_color: # TODO tree locations # Create attribute / separate / math nodes - attribute_node = node_tree.nodes.new('ShaderNodeAttribute') - attribute_node.attribute_name = 'COLOR_0' + vertexcolor_node = node_tree.nodes.new('ShaderNodeVertexColor') + vertexcolor_node.layer_name = 'COLOR_0' vc_mult_node = node_tree.nodes.new('ShaderNodeMixRGB') vc_mult_node.blend_type = 'MULTIPLY' @@ -148,7 +148,7 @@ class BlenderPbr(): # Create links if vertex_color: - node_tree.links.new(vc_mult_node.inputs[2], attribute_node.outputs[0]) + node_tree.links.new(vc_mult_node.inputs[2], vertexcolor_node.outputs[0]) node_tree.links.new(vc_mult_node.inputs[1], mult_node.outputs[0]) node_tree.links.new(main_node.inputs[0], vc_mult_node.outputs[0]) @@ -167,9 +167,9 @@ class BlenderPbr(): # TODO alpha ? if vertex_color: # Create attribute / separate / math nodes - attribute_node = node_tree.nodes.new('ShaderNodeAttribute') - attribute_node.attribute_name = 'COLOR_0' - attribute_node.location = -2000, 250 + vertexcolor_node = node_tree.nodes.new('ShaderNodeVertexColor') + vertexcolor_node.layer_name = 'COLOR_0' + vertexcolor_node.location = -2000, 250 vc_mult_node = node_tree.nodes.new('ShaderNodeMixRGB') vc_mult_node.blend_type = 'MULTIPLY' @@ -217,7 +217,7 @@ class BlenderPbr(): # Create links if vertex_color: - node_tree.links.new(vc_mult_node.inputs[2], attribute_node.outputs[0]) + node_tree.links.new(vc_mult_node.inputs[2], vertexcolor_node.outputs[0]) node_tree.links.new(vc_mult_node.inputs[1], text_node.outputs[0]) node_tree.links.new(main_node.inputs[0], vc_mult_node.outputs[0]) |