diff options
author | Kalle-Samuli Riihikoski <haikalle@gmail.com> | 2018-12-07 12:13:00 +0300 |
---|---|---|
committer | Kalle-Samuli Riihikoski <haikalle@gmail.com> | 2018-12-07 12:13:00 +0300 |
commit | 0e9032d6776f77800498b50b76f80e91c36c0270 (patch) | |
tree | c4b4b280b31593667cb857e91363548712cbffec /io_coat3D/tex.py | |
parent | ec5d4c9a379f688f5350d42649fecf4023e4a805 (diff) |
Not link applink group node if not sure where to link it
Diffstat (limited to 'io_coat3D/tex.py')
-rw-r--r-- | io_coat3D/tex.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/io_coat3D/tex.py b/io_coat3D/tex.py index 1ebe21ca..4973bd4f 100644 --- a/io_coat3D/tex.py +++ b/io_coat3D/tex.py @@ -146,7 +146,7 @@ def createnodes(active_mat,texcoat): #luo nodes palikat ja linkittaa tekstuurit group_tree.outputs.new("NodeSocketColor", "Color") group_tree.outputs.new("NodeSocketColor", "Metallic") group_tree.outputs.new("NodeSocketColor", "Roughness") - group_tree.outputs.new("NodeSocketColor", "Normal map") + group_tree.outputs.new("NodeSocketVector", "Normal map") applink_tree = act_material.nodes.new('ShaderNodeGroup') applink_tree.name = '3DC_Applink' applink_tree.node_tree = group_tree @@ -165,8 +165,6 @@ def createnodes(active_mat,texcoat): #luo nodes palikat ja linkittaa tekstuurit if(index == 1): break - - if(out_mat.inputs['Surface'].is_linked == True): main_mat = out_mat.inputs['Surface'].links[0].from_node if(main_mat.inputs.find('Base Color') == -1): @@ -201,7 +199,11 @@ def createnodes(active_mat,texcoat): #luo nodes palikat ja linkittaa tekstuurit act_material.links.new(node.outputs[0], curvenode.inputs[1]) if(coat3D.creategroup): act_material.links.new(huenode.outputs[0], notegroup.inputs[0]) - main_material.links.new(applink_tree.outputs[0],main_mat.inputs[input_color]) + if(main_mat.type != 'MIX_SHADER'): + main_material.links.new(applink_tree.outputs[0],main_mat.inputs[input_color]) + else: + location = main_mat.location + applink_tree.location = main_mat.location[0], main_mat.location[1] + 200 else: act_material.links.new(huenode.outputs[0], main_mat.inputs[input_color]) node.location = -990, 530 @@ -232,6 +234,9 @@ def createnodes(active_mat,texcoat): #luo nodes palikat ja linkittaa tekstuurit huenode = act_material.nodes.new('ShaderNodeHueSaturation') huenode.name = '3DC_HueSaturation' + act_material.links.new(curvenode.outputs[0], huenode.inputs[4]) + act_material.links.new(node.outputs[0], curvenode.inputs[1]) + if (coat3D.creategroup): act_material.links.new(huenode.outputs[0], notegroup.inputs[1]) if (main_mat.type == 'BSDF_PRINCIPLED'): @@ -269,6 +274,9 @@ def createnodes(active_mat,texcoat): #luo nodes palikat ja linkittaa tekstuurit huenode = act_material.nodes.new('ShaderNodeHueSaturation') huenode.name = '3DC_HueSaturation' + act_material.links.new(curvenode.outputs[0], huenode.inputs[4]) + act_material.links.new(node.outputs[0], curvenode.inputs[1]) + if (coat3D.creategroup): act_material.links.new(huenode.outputs[0], notegroup.inputs[2]) if(main_mat.type == 'BSDF_PRINCIPLED'): |