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$
    – Chris
    Commented Oct 3, 2022 at 15:45

1 Answer 1


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


Prerequisites are:

  1. all materials look like this:

enter image description here

  1. you exchange "Cube" to the name of your object

  2. Each slot must have an material which looks like 1)


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .