Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
How can you select faces from a material index in edit mode through Python?
index = 2 # required index
bpy.ops.object.mode_set(mode = 'EDIT')
ob = bpy.context.object
me = ob.data
bm = bmesh.from_edit_mesh(me)
for face in bm.faces:
if face.material_index == index:
face.select = True
Required, but never shown