I wonder if it would be possible to write a python script that could remove all vertices across all objects that are part of the same material. There are 250+ objects and I need to remove all mesh data from the body, leaving just the armour. I would then need to unlink this material from the object.
The script will loop through the selected objects and through their verts/edges/faces to remove the ones assigned to a specific material and delete them :
- select all the objects
- select the material (in material slots )
- run the script
import bpy import bmesh mat_name = bpy.context.object.active_material.name for obj in bpy.context.selected_objects : bpy.context.scene.objects.active = obj bpy.ops.object.mode_set(mode='EDIT') obj = bpy.context.edit_object me = obj.data bm = bmesh.from_edit_mesh(me) mat_id = bpy.context.object.material_slots.find(mat_name) for v in bm.verts: delete = True for f in v.link_faces : if f.material_index != mat_id : delete = False if delete : bm.verts.remove(v) for e in bm.edges: delete = True for f in e.link_faces : if f.material_index != mat_id : delete = False if delete : bm.edges.remove(e) for f in bm.faces: if f.material_index == mat_id : bm.faces.remove(f) bmesh.update_edit_mesh(me, True) bpy.ops.object.mode_set(mode='OBJECT')