I have an object that has 100+ materials, and the roughness in each material is set to 1, is there an easy way to set it to 0.5 with a script or smth?
-
$\begingroup$ just an advice for the future: you should have given us more infos about your material because i posted now just the "easiest" case. If you have more complicated material - you should have written that in your question. But you can open as many questions as you want. $\endgroup$– ChrisOct 3, 2022 at 15:45
1 Answer
you can do it like this:
import bpy
for eachSlot in bpy.data.objects["Cube"].material_slots:
eachSlot.material.node_tree.nodes["Principled BSDF"].inputs[9].default_value = 0.5
But....
Prerequisites are:
- all materials look like this:
you exchange "Cube" to the name of your object
Each slot must have an material which looks like 1)