4
$\begingroup$

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?

$\endgroup$

2 Answers 2

6
$\begingroup$

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
$\endgroup$
0
5
$\begingroup$

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
$\endgroup$

You must log in to answer this question.

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