Beispiel #1
0
def mouse_release(x, y, frame):
    global box_selection_data, edit_data
    if edit_data == None:
        return
        
    if box_selection_data == None: # mouse action to select
        box_selection_data = BoxMoveData(edit_data["press_point"], (x, y))
        if box_selection_data.is_empty() == False:
            edit_data = {"action_on":True,
                         "press_frame":frame,
                         "delta":0,
                         "box_selection_data":box_selection_data}
        else:
            box_selection_data = None
            edit_data = {"action_on":False,
                         "press_frame":-1,
                         "delta":0,
                         "box_selection_data":box_selection_data}
    else: # mouse action to move
        delta = frame - edit_data["press_frame"]
        edit_data["delta"] = delta

        # Do edit
        data = {"box_selection_data":box_selection_data,
                "delta":delta}
        action = edit.box_overwrite_move_action(data)
        action.do_edit()
        
        # Back to start state
        edit_data = None
        box_selection_data = None
    
    tlinewidgets.set_edit_mode_data(edit_data)
    updater.repaint_tline()
Beispiel #2
0
def mouse_release(x, y, frame):
    global box_selection_data, edit_data, entered_from_overwrite
    if edit_data == None:
        if entered_from_overwrite == True:
            _exit_to_overwrite()
        return
        
    if box_selection_data == None: # mouse action is to select
        box_selection_data = BoxMoveData(edit_data["press_point"], (x, y))
        
        locked_track = box_selection_data.get_possible_locked_track()
        if locked_track != None:
            dialogutils.track_lock_check_and_user_info(locked_track)
            edit_data = None
            box_selection_data = None
            tlinewidgets.set_edit_mode_data(edit_data)
            updater.repaint_tline()
            # Exit box mode if entered from overwrite
            if entered_from_overwrite == True:
                _exit_to_overwrite()
            return 
              
        if box_selection_data.is_empty() == False:
            edit_data = {"action_on":True,
                         "press_frame":frame,
                         "delta":0,
                         "box_selection_data":box_selection_data}
        else:
            box_selection_data = None
            edit_data = {"action_on":False,
                         "press_frame":-1,
                         "delta":0,
                         "box_selection_data":box_selection_data}
            # Exit box mode if entered from overwrite  with empty selection
            if entered_from_overwrite == True:
                _exit_to_overwrite()
                return 
    
    else: # mouse action is to move
        # Exit if selection contains locked track
        locked_track = box_selection_data.get_possible_locked_track()
        if locked_track != None:
            dialogutils.track_lock_check_and_user_info(locked_track)
            edit_data = None
            box_selection_data = None
            tlinewidgets.set_edit_mode_data(edit_data)
            updater.repaint_tline()
            # Exit box mode if entered from overwrite
            if entered_from_overwrite == True:
                _exit_to_overwrite()
            return 
            
        # If we lock track after 
        delta = frame - edit_data["press_frame"]
        edit_data["delta"] = delta

        # Do edit
        data = {"box_selection_data":box_selection_data,
                "delta":delta}
        action = edit.box_overwrite_move_action(data)
        action.do_edit()
        
        # Back to start state
        edit_data = None
        box_selection_data = None
        
        # Exit box mode if entered from overwrite with empty selection
        if entered_from_overwrite == True:
            _exit_to_overwrite()
            return 
    
    tlinewidgets.set_edit_mode_data(edit_data)
    updater.repaint_tline()