[Blender] select object without material

python - April 27, 2017 - 13:36
  ne sélectionne que les objets qui n''ont aucun material appliqué
#import the blender python module
import bpy

#deselect all objects
bpy.ops.object.select_all(action=''DESELECT'')

#looking through all objects
for obj in bpy.data.objects:
    #if the object is a mesh and not a lamp or camera etc.
    if obj.type == ''MESH'':
        #looking through every material slot
        for slot in obj.material_slots:
            #if there''s no material slot
            if slot.material == None:
                #select the object
                obj.select = True