I have difficulties trying to select a bunch of object by part of their materialname. eg. i've got some objects and 2 of them have a material that contains the word "text". In the end I want to parent these object to an empty and then move them to a hidden layer.
i've tried the following code, but this gives errors.
textmat = [mat for mat in bpy.data.materials if fnmatch.fnmatchcase(mat.material, "*text*")] obj = bpy.data.objects for ob in obj: if ob.type == 'MESH': for m in ob.material_slots: if m.material == textmat: ob.select = False
i'm obviously doing something wrong, but my python skills are still limited