I am not too great at scripting and wanted to make a script that would extrude the individual faces that are selected in edit mode. I am attempting to do so with bmesh. However, my script keeps crashing. Can anyone help me figure out why? Here is the code:
import bpy
import bmesh
obj = bpy.context.active_object.data
bm = bmesh.from_edit_mesh(obj)
selected_faces = [face for face in bm.faces if face.select]
bmesh.ops.extrude_discrete_faces(bm, faces=selected_faces[:])
bmesh.update_edit_mesh(obj, False, False)
Works like a charm! Thank you very much! Also, one more question. If I wanted to make the script responsive to user input such as using the mouse to control the depth, how could I do that? Would I use a modal operator and somehow compare the distance of the original mouse position to the mouse position at a later time?