def insert_move_release(x, y, frame, state): """ User releases mouse when in insert move mode. """ global edit_data, drag_disabled if drag_disabled: drag_disabled = False return # If mouse was not pressed on clip we cant move anyhing if edit_data == None: return # Get attempt insert frame press_frame = edit_data["press_frame"] first_clip_start = edit_data["first_clip_start"] attempt_insert_frame = first_clip_start + (frame - press_frame) # Get tracks and insert index track = edit_data["track_object"] to_track = edit_data["to_track_object"] insert_index = to_track.get_clip_index_at(attempt_insert_frame) # Check locking of target track. Source track checked at press event. if _track_is_locked(to_track): edit_data = None tlinewidgets.set_edit_mode_data(edit_data) updater.repaint_tline() return # Update data for editmode overlay edit_data["current_frame"] = frame edit_data["insert_frame"] = track.clip_start(insert_index) # Collect selection data range_in = edit_data["selected_range_in"] range_out = edit_data["selected_range_out"] data = {"track":track, "insert_index":insert_index, "selected_range_in":range_in, "selected_range_out":range_out, "move_edit_done_func":move_edit_done} # Do edit. Use different actions depending on if # clip is moved to a differrent track if track == to_track: # Do edit if were moving and insert is not into same index # Update selection after edit if (edit_data["move_on"] == True and (insert_index < selected_range_in or insert_index > selected_range_out)): # Remeber selected range to later find index of dropped range # after edit old_range_length = selected_range_out - selected_range_in clear_selected_clips() action = edit.insert_move_action(data) action.do_edit() # Move playback to first frame of dropped range select_index = insert_index if (range_in < insert_index):#when moving forward clips are removed affecting later indexes select_index = insert_index - (old_range_length + 1) PLAYER().seek_frame(track.clip_start(select_index), False) else: _move_mode_released() else: # insert to different track data["to_track"] = to_track clear_selected_clips() action = edit.multitrack_insert_move_action(data) action.do_edit() PLAYER().seek_frame(to_track.clip_start(insert_index), False) # Clear edit mode data edit_data = None tlinewidgets.set_edit_mode_data(edit_data) updater.repaint_tline()