4

I'm importing a FBX sequence from Anima Pro with several animated characters but all materials are interpreted as metallic. Every time I import a new fbx I have to manually change hundreds of materials and setting the metallic property to 0.

Is there a way to automatically change the properties of multiple materials on multiple objects?

Can this be done in a script?

denoise
  • 213
  • 1
  • 2
  • 14

2 Answers2

6

Try this. It affects all materials in the file.

import bpy
for mat in bpy.data.materials:
    if not mat.use_nodes:
        mat.metallic = 0
        continue
    for n in mat.node_tree.nodes:
        if n.type == 'BSDF_PRINCIPLED':
            n.inputs["Metallic"].default_value = 0
scurest
  • 10,349
  • 13
  • 31
5

thanks @scurest I managed to apply this only to the selected objects:

import bpy
for obj in bpy.context.selected_objects:
    for mat in obj.data.materials:
        if not mat.use_nodes:
            mat.metallic = 0
            continue
        for n in mat.node_tree.nodes:
            if n.type == 'BSDF_PRINCIPLED':
                n.inputs["Metallic"].default_value = 0
denoise
  • 213
  • 1
  • 2
  • 14