I would like to creat a material with python but I'm missing some commands.
The target material should look like this:
The script I'm writing should be able to access the two values in front of the math node, and the RGB values in the RGB node.
The command(s) I'm missing are the following:
the command to add a node in the material / node editor
the command to remove a node in the material / node editor
the command to link link an imput and an output
the datapath to the values I listed before
Thanks in advance
AliSot2000
Edit
I've just found another problem: I understand now how to add, remove and link nodes but I don't now how to 'call' them.
In this setup I have two 'Value-Nodes'. How can I refere to those? I'mean ShaderNodeValue won't do because I have two of them.
My current script looks like this:
#Test script for material
bpy.context.scene.render.engine = 'CYCLES'
import bpy
import math
bpy.ops.mesh.primitive_cube_add()
bpy.data.materials.new(name='Testmaterial')
bpy.context.active_object.data.materials.append(bpy.data.materials['Testmaterial'])
#So I can access it via .active_material
bpy.context.object.active_material.use_nodes = True
Now I would like to remove the Diffuse BSDF, add the MixShader and then link the shader output with the shader imput from Material Output.
the process of adding should be:
bpy.context.object.active_material.node_tree.nodes.new('ShaderNodeMixShader')
I think if I get how to do this the other commands should just be 'copy and paste'