Redo for nested operator

Hello, I want to add my custom hotkeys which call operators by current component mode. It is easy and working well.



def execute(self, context):

  if( ActiveComponent() == 'EDGE' ):
    bpy.ops.mesh.fill_grid()
            
  elif( ActiveComponent() == 'VERTEX' ):    
    bpy.ops.mesh.merge(type='CENTER')
        
   return {'FINISHED'}


But I am losting settings in redo dialog (F6). I can of course add all parameters from all operators to my addon as property, but it is not what I want.

Is there any solution how can I show redo for nested operator? Or any another solution how can I call different operators by active component (Edge, Vertex, Face) with good redo?

Thanks

PS: It would be great if Blender will have subcategory EDGE, VERTEX, FACE under MESH in Hotkey editor :slight_smile:

Remove ‘UNDO’ option from operator’s bl_options if you have it. And add undo positional argument (True):


def execute(self, context):

  if( ActiveComponent() == 'EDGE' ):
    bpy.ops.mesh.fill_grid(True)
            
  elif( ActiveComponent() == 'VERTEX' ):    
    bpy.ops.mesh.merge(True, type='CENTER')
        
   return {'FINISHED'}

Thanks! It is exactly what I wanted. Now I can do context sensitive operators and save lot of hotkeys!