Is there a method, e.g., python script or add-on, to identify objects and/or mesh that do not have an assigned material? Something that works with > 2.9. There are old scripts on the internet, e.g., 2.8, but they don't work with latest blender.


1 Answer 1

import bpy

for object in bpy.data.objects:
    if object.type == 'MESH':
        found = False
        if object.material_slots:
            for slot in object.material_slots:
                if slot.material:
                    found = True
        if not found:

This script will print the name of any object that is a mesh but has no materials assigned. It should work for any version of Blender since 2.8. You can replace the print with whatever you want to do with the objects, of course.

If an object has no material_slots then obviously it has no assigned materials. But, as pointed out in a comment, it could have material_slots and they could all be empty. So we look for the first material slot that has a material assigned.

  • $\begingroup$ This will identify an object with no material slots. I want to identify an object whose mesh, or just a portion of its mesh, does not have an assigned material, even if there are material slots assigned. $\endgroup$
    – G Lap
    May 11, 2022 at 7:05
  • $\begingroup$ @GLap I've added the loop for checking existing material slots. $\endgroup$ May 11, 2022 at 16:00

You must log in to answer this question.

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