Hi all,
Trying to create a material with pyhon and I can’t seem to connect the nodes as I want. Here’s my code:
new_mat = bpy.data.materials.new(name = "code_mat")
new_mat.use_nodes = True
new_mat.node_tree.nodes.new(type="ShaderNodeMix")
new_mat.node_tree.nodes["Mix"].data_type='RGBA'
new_mat.node_tree.nodes["Mix"].location[0] = -200
new_mat.node_tree.nodes["Mix"].location[1] = 200
new_mat.node_tree.links.new(new_mat.node_tree.nodes["Mix"].outputs['Result'], new_mat.node_tree.nodes["Principled BSDF"].inputs['Base Color'])
Basically trying to connect the result of a mix shader node to the principled BSDF base color input.
I did look this up and found this thread but I can’t see where I am going wrong…
Thanks for any help,
Randy