i was working on a code to print this word (extruded) for every time i use extrude region tool bpy.ops.mesh.extrude_region_move
so i created this code
import bpy
class ModalOperator(bpy.types.Operator):
bl_idname = "object.modal_operator"
bl_label = "Simple Modal Operator"
def execute(self, context):
print("This is the modal operator")
return {'FINISHED'}
def modal(self, context, event):
if bpy.ops.mesh.extrude_region_move != None:
print("extruded")
return {'PASS_THROUGH'}
def invoke(self, context, event):
print("This is the invoker")
context.window_manager.modal_handler_add(self)
return {'RUNNING_MODAL'}
bpy.utils.register_class(ModalOperator)
bpy.ops.object.modal_operator('INVOKE_DEFAULT')
but the problem is this line run for every extrude that happen before not only the new ones so how to fix it ?
the line to get the extrude events
if bpy.ops.mesh.extrude_region_move != None:
print("extruded")
return {'PASS_THROUGH'}