diff options
author | Kalle-Samuli Riihikoski <haikalle@gmail.com> | 2018-10-15 12:50:24 +0300 |
---|---|---|
committer | Kalle-Samuli Riihikoski <haikalle@gmail.com> | 2018-10-15 12:50:24 +0300 |
commit | 2a4b6fc1eae4f6f38cb516e3946adf340e2ace87 (patch) | |
tree | b679d15b16add2725c173160ee5e144b26e25ec9 /io_coat3D | |
parent | a97851a478eda5cd7da4aa4512129603ec8342d5 (diff) |
small update for notes to work all shaders.
Diffstat (limited to 'io_coat3D')
-rw-r--r-- | io_coat3D/tex.py | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/io_coat3D/tex.py b/io_coat3D/tex.py index 6026e493..d58b81f9 100644 --- a/io_coat3D/tex.py +++ b/io_coat3D/tex.py @@ -132,15 +132,19 @@ def createnodes(objekti,texcoat): #luo nodes palikat ja linkittaa tekstuurit nii act_material = group_tree notegroup = act_material.nodes.new('NodeGroupOutput') - main_mat = main_material.nodes['Material Output'] if(main_mat.inputs['Surface'].is_linked == True): glue_mat = main_mat.inputs['Surface'].links[0].from_node - input_color = glue_mat.inputs.find('Base Color') + if(glue_mat.inputs.find('Base Color') == -1): + input_color = glue_mat.inputs.find('Color') + else: + input_color = glue_mat.inputs.find('Base Color') input_index = 0 - + print('mitsa taalla', input_color) + print(bring_color) #Color - if(bring_color == True and glue_mat.inputs.find('Base Color') != -1 and texcoat['color'] != []): + if(bring_color == True and texcoat['color'] != []): + print('kkk') node = act_material.nodes.new('ShaderNodeTexImage') node.name = '3DC_color' if (texcoat['color']): @@ -166,15 +170,17 @@ def createnodes(objekti,texcoat): #luo nodes palikat ja linkittaa tekstuurit nii if (coat3D.creategroup): node.location = -400, 400 act_material.links.new(node.outputs[0], notegroup.inputs[input_index]) - main_material.links.new(applink_tree.outputs[input_index], glue_mat.inputs[input_color]) + if (input_color != -1): + main_material.links.new(applink_tree.outputs[input_index], glue_mat.inputs[input_color]) input_index += 1 else: node.location = -400,400 - act_material.links.new(node.outputs[0], glue_mat.inputs[input_color]) + if (input_color != -1): + act_material.links.new(node.outputs[0], glue_mat.inputs[input_color]) #Metalness - if(bring_metalness == True and glue_mat.inputs.find('Metallic') != -1 and texcoat['metalness'] != []): + if(bring_metalness == True and texcoat['metalness'] != []): node = act_material.nodes.new('ShaderNodeTexImage') node.name='3DC_metalness' input_color = glue_mat.inputs.find('Metallic') @@ -201,14 +207,16 @@ def createnodes(objekti,texcoat): #luo nodes palikat ja linkittaa tekstuurit nii if (coat3D.creategroup): node.location = -830, 160 act_material.links.new(node.outputs[0], notegroup.inputs[input_index]) - main_material.links.new(applink_tree.outputs[input_index], glue_mat.inputs[input_color]) - input_index += 1 + if (input_color != -1): + main_material.links.new(applink_tree.outputs[input_index], glue_mat.inputs[input_color]) + input_index += 1 else: node.location = -830, 160 - act_material.links.new(node.outputs[0], glue_mat.inputs[input_color]) + if (input_color != -1): + act_material.links.new(node.outputs[0], glue_mat.inputs[input_color]) #Roughness - if(bring_roughness == True and glue_mat.inputs.find('Roughness') != -1 and texcoat['rough'] != []): + if(bring_roughness == True and texcoat['rough'] != []): node = act_material.nodes.new('ShaderNodeTexImage') node.name='3DC_roughness' input_color = glue_mat.inputs.find('Roughness') @@ -235,14 +243,16 @@ def createnodes(objekti,texcoat): #luo nodes palikat ja linkittaa tekstuurit nii if (coat3D.creategroup): node.location = -550, 0 act_material.links.new(node.outputs[0], notegroup.inputs[input_index]) - main_material.links.new(applink_tree.outputs[input_index], glue_mat.inputs[input_color]) - input_index += 1 + if (input_color != -1): + main_material.links.new(applink_tree.outputs[input_index], glue_mat.inputs[input_color]) + input_index += 1 else: node.location = -550, 0 - act_material.links.new(node.outputs[0], glue_mat.inputs[input_color]) + if (input_color != -1): + act_material.links.new(node.outputs[0], glue_mat.inputs[input_color]) #Normal map - if(bring_normal == True and glue_mat.inputs.find('Normal') != -1 and texcoat['nmap'] != []): + if(bring_normal == True and texcoat['nmap'] != []): node = act_material.nodes.new('ShaderNodeTexImage') normal_node = act_material.nodes.new('ShaderNodeNormalMap') node.location = -600,-670 |