How to iterate through all materials and mute certain type of node?

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 ? :stuck_out_tongue:

import bpy

# set to False to unmute
mute_state = True

for mat in
    for node in mat.node_tree.nodes:
        if node.type in ["BEVEL", "AMBIENT_OCCLUSION"]:
            node.mute = mute_state
1 Like

I knew just a couple of loops will be needed, just didn’t know how to start :slight_smile:
Thank you for complete solution!

1 Like

Welcome :slight_smile:

In that case a good solution is :

  • Set one of the Blender windows as a console
  • Type
  • Hit CTRL + SPACE BAR for autocomplete.

Then it’s about logic …
You will see that, yes there is this materials in
Then type 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 =[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 :[0].node_tree.nodes[0].mute well, you understand the structure, and you are ready to set the loop ! :smiley:

See you :slight_smile: ++