Not link applink group node if not sure where to link it

This commit is contained in:
Kalle-Samuli Riihikoski 2018-12-07 11:13:00 +02:00
parent ec5d4c9a37
commit 0e9032d677
1 changed files with 12 additions and 4 deletions

View File

@ -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'):