[Bf-extensions-cvs] [2a4b6fc1] blender2.8: small update for notes to work all shaders.

Kalle-Samuli Riihikoski noreply at git.blender.org
Mon Oct 15 11:53:05 CEST 2018


Commit: 2a4b6fc1eae4f6f38cb516e3946adf340e2ace87
Author: Kalle-Samuli Riihikoski
Date:   Mon Oct 15 12:50:24 2018 +0300
Branches: blender2.8
https://developer.blender.org/rBA2a4b6fc1eae4f6f38cb516e3946adf340e2ace87

small update for notes to work all shaders.

===================================================================

M	io_coat3D/tex.py

===================================================================

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



More information about the Bf-extensions-cvs mailing list