Blender Material Assign Problems

Hi all, so I’ve imported a scene from 3ds Max and there’s a bunch of Material ID problems which I assume Blender treats 3ds Max’s or Maya’s Object ID’s as Material ID’s because for example in Max an Object “Trees” has a material “mat_trees” and Object “Buildings” has material “mat_buildings”, but in Blender for some reason both the Trees and Buildings use material ID “mat_trees” + there’s a bunch of material ID’s out of nowhere.

Anyway what I am trying to do is to delete all of those useless material/object ID’s and simply assign a new material to my selection/collection/objects etc.

How I could do this? CTRL+L ( Link Materials ) won’t work before all the useless ID’s aren’t deleted and I don’t know how to delete them besides doing it manually and selecting each object and spamming the little “-” button.

Here’s another problem when trying to delete the materials from the “Blender File” view:


Those “Empty” materials cause the exact same issue as the random material ID’s.

I am not sure if this is possible without a script. If anybody knows I would like to know as well:

import bpy

Sel = bpy.context.selected_objects

for i in Sel:
    
    if i.type == "MESH":
        if (len(i.material_slots)) > 1:
            i.data.materials.clear()
1 Like

Thanks, that will do! :slight_smile:

Lumpengnom’s answer is the best solution, but for completeness, there’s this button which might prove handy:

But you’ll have to do each object one by one.

1 Like

I have a little set of scripts I use for this sort of thing.

One of the options will clear slots on all selected objects, (make sure one object is active, that is, last selected).
Video: https://www.youtube.com/watch?v=PluD2_Si6Eo

1 Like

Apparently there’s built-in plugin called “Material Utilities” which can also do this and more and works more like Max, C4D or Maya.

I don’t understand Blender devs sometimes. This is one of the must have and absolutely necessary functionality of any 3D Package and they’re like “let’s just hide it from the users”. Same as features like CTRL+Shift+T to assign PBR textures ( with Wrangler enabled ).

1 Like

Alas, I tried this and it still only does it for the active object, not all selected objects, at least in 3.5