I would like to find and mute (or unmute) all ‘Bevel’ and ‘AO’ nodes used in all materials.
What would be the best approach to make it quickly? Didn’t find anything useful among existing threads.
Well, what about using Python ?
import bpy
# set to False to unmute
mute_state = True
for mat in bpy.data.materials:
for node in mat.node_tree.nodes:
if node.type in ["BEVEL", "AMBIENT_OCCLUSION"]:
node.mute = mute_state
I knew just a couple of loops will be needed, just didn’t know how to start
Thank you for complete solution!
Welcome
In that case a good solution is :
- Set one of the Blender windows as a console
- Type
bpy.data.
- Hit
CTRL
+SPACE BAR
for autocomplete.
Then it’s about logic …
You will see that, yes there is this materials
in bpy.data
Then type bpy.data.materials.
and hit auto complete again :
There are keys
, and values
, it looks like a collection, to be looped on.
Let’s have a look on the first element :
Try to do mat = bpy.data.materials[0]
and you get the first material.
Then again, type mat.
and again auto complete :
etc … etc …
Basically, step by step, you will reach all the datas you want to modify.
And when you reach the step :
bpy.data.materials[0].node_tree.nodes[0].mute
well, you understand the structure, and you are ready to set the loop !
See you ++
Tricotou