How can I change one property on across multiple materials?

Hello, I am wondering if there is a way to make one change and have it applied to all (or selected) materials in my model.

Specifically, after importing my model, a setting has been applied to my “Normal” in every material which is causing an undesired effect.

If I delete the Normal input, or change its strength to 0, it seems to fix the issue. See attached. I have many materials, so it would be great if there is a way to avoid doing manually for each one.

I believe similar solutions have been found to change emission strength using a script, I tried to adapt it but it didn’t work on all the other materials.

Would anyone be able to suggest a way to do this, or have a look at my script (first time trying this.)

example script, for a different paramter:

import bpy
for mat in bpy.data.materials:
if not mat.use_nodes:
continue
for n in mat.node_tree.nodes:
if n.type == ‘BSDF_PRINCIPLED’:
n.inputs[“Emission Strength”].default_value = 0

my version that didn’t work:
import bpy
for mat in bpy.data.materials:
if not mat.use_nodes:
continue
for n in mat.node_tree.nodes:
if n.type == ‘Normal/Map’:
n.inputs[“Strength”].default_value = 0

Thank you!

I believe the type should be ‘NORMAL_MAP’

1 Like

Thanks, but unfortunately that doesn’t work.

What does it say (or do)?

Nothing. It appears to run it it without errors, but nothing happens.

I think I need the script to go into the ‘Normal’ sub-menu under ‘Principled BSDF’ and select ‘Link’>‘Remove’ but I have no idea how to script that. I get in my earlier example I am changing a default value to ‘0’ but maybe I am trying to do something more complicated here.

hmmm, this worked for me: sets all Normal Map “Strenght” inputs to 0. It’s the same thing that you had though

import bpy

## list of all materials with nodes... because there might be those without
mats = [m for m in bpy.data.materials if m.use_nodes]

print("mats: ") ## print appropriate mat names into System Console (for debugging purposes)
for m in mats:
    for n in m.node_tree.nodes:
        ## if node type is Normal Map
        if n.type == 'NORMAL_MAP':
            print(m.name)
            n.inputs["Strength"].default_value = 0

I’ve no idea how to remove a node completely, Blender Python Docs should have this info. Somewhere…

1 Like

Your script totally worked! Thank you sooo much!
I’ll study your script and brush up on scripting. Am now motivated to learn!