Translate and Modal


I have a little question !

I created a modal operator to make operation and when I launch the operator, I use the transform.translate in Invoke.

Like this

bpy.ops.transform.translate('INVOKE_DEFAULT', True)

There is a code example, select the object you want place a cube on it, launche the tool.

import bpy
from bpy.props import IntProperty, FloatProperty

class Project_Cube_Modal(bpy.types.Operator):
    """Move an object with the mouse, example"""
    bl_idname = "object.project_cube_modal"
    bl_label = "Simple Modal Operator"

    first_mouse_x = IntProperty()
    count = 0
    def modal(self, context, event):
        scene = bpy.context.scene
        wm = bpy.context.window_manager
        self.count += 1
        if self.count == 1 :
            bpy.ops.transform.translate('INVOKE_DEFAULT', True)
        if event.type == 'MIDDLEMOUSE':
            return {'PASS_THROUGH'} 

        if event.type == 'S' and event.value == 'PRESS':
            act_obj = bpy.context.active_object
            for obj in context.selected_objects:
       = obj
                bpy.ops.transform.resize('INVOKE_DEFAULT', True)

        elif event.type == '' and event.value == 'PRESS':
            for obj in context.selected_objects:
       = obj
                bpy.ops.transform.rotate('INVOKE_DEFAULT',True, constraint_axis=(False, False, True), constraint_orientation='LOCAL')
        elif event.type == 'LEFTMOUSE':
            bpy.context.scene.tool_settings.use_snap = False
            self.first_mouse_x = event.mouse_x
            return {'FINISHED'}
        elif event.type in {'RIGHTMOUSE', 'ESC', 'SPACE'}:
            return {'CANCELLED'}

        return {'RUNNING_MODAL'}

    def invoke(self, context, event):
        if context.object:
            bpy.context.scene.tool_settings.use_snap = True

            self.first_mouse_x = event.mouse_x

            return {'RUNNING_MODAL'}
  {'WARNING'}, "No active object, could not finish")
            return {'CANCELLED'}

class Projection_Cube_Modal_Panel(bpy.types.Panel):
    bl_idname = "projection_cube_modal_panel"
    bl_label = "Projection Cube Modal Panel"
    bl_space_type = "VIEW_3D"
    bl_region_type = "TOOLS"
    bl_category = "category"

    def draw(self, context):
        layout = self.layout
        layout.operator("object.project_cube_modal", text='Project', icon='FACESEL')

def register():

def unregister():

if __name__ == "__main__":

My issue is that I cannot exit the translate mode to start other modes.

If you have any idea :wink:
thx for your help !

Sorry for bumping that old thread, but did you ever find a solution?
I’m in the same situation here.