Modify node value in all materials with variable name? I'm trying to automate a process where I have to change a Value node for all materials starting with the prefix mb:. I've been messing with it, but I'm such a novice with Python that I'm stuck.
Looking at the console, I see that the code for changing the value of the node would be this:
bpy.data.materials[&quot;mb:o:150:27&quot;].node_tree.nodes[&quot;Value&quot;].outputs[0].default_value = 10
But my issue is that I don't know how I would apply the variable of mb: to the to string in the above line.
Is there any way to do this?
You want to iterate over all materials and check each material's name. IF it starts with 'mb:' then modify it.
import bpy 
for material in bpy.data.materials:
    if material.name.startswith(&quot;mb:&quot;):
        material.node_tree.nodes[&quot;Value&quot;].outputs[0].default_value = 10