Hello
Help me with adwice, please
I need reconnect all Principled BSDF 's “Base Colors” inputs to “Emission” inputs
For all selected objects and for all material slots of this objects
This is my test scene
reconnector.blend (194.0 KB)
Thank you
This is what i wanto to get
bentraje
(bentraje)
January 23, 2020, 10:32am
2
Hi @brothermechanic
Here are some proforma code in removing and adding connections.
import bpy
mat = bpy.data.materials.get('material_name')
mat.use_nodes = True # If not already enabled.
node_tree = mat.node_tree
node_list = node_tree.nodes
# Remove Connection
bsdf = node_list.get("Principled BSDF")
input_list = bsdf.inputs["Parameter Name"].links
for link in input_list:
node_tree.links.remove(link)
# Add Connection
node_A = node_list.get("Node A Name")
node_B = node_list.get("Node B Name")
node_tree.links.new(node_A.inputs["InputName"], node_B.outputs["OutputName"]
1 Like