def _do_one_roll_trim_edit(frame): # Get legal edit delta and set to edit mode data for overlay draw global edit_data frame = _legalize_one_roll_trim(frame, edit_data["trim_limits"]) delta = frame - edit_data["edit_frame"] # case: editing from-side of last clip global last_from_trimmed if last_from_trimmed: data = { "track": edit_data["track_object"], "index": edit_data["index"], "clip": edit_data["from_clip"], "delta": delta, "undo_done_callback": clip_end_first_do_done, "first_do": True } action = edit.trim_last_clip_end_action(data) last_from_trimmed = False action.do_edit() # Edit is reinitialized in callback from edit action one_roll_trim_undo_done # case: editing to-side of cut elif edit_data["to_side_being_edited"]: data = { "track": edit_data["track_object"], "index": edit_data["index"], "clip": edit_data["to_clip"], "delta": delta, "undo_done_callback": one_roll_trim_undo_done, "first_do": True } action = edit.trim_start_action(data) action.do_edit() # Edit is reinitialized in callback from edit action one_roll_trim_undo_done # case: editing from-side of cut else: data = { "track": edit_data["track_object"], "index": edit_data["index"] - 1, "clip": edit_data["from_clip"], "delta": delta, "undo_done_callback": one_roll_trim_undo_done, "first_do": True } action = edit.trim_end_action(data) action.do_edit()
def _do_one_roll_trim_edit(frame): # Get legal edit delta and set to edit mode data for overlay draw global edit_data frame = _legalize_one_roll_trim(frame, edit_data["trim_limits"]) delta = frame - edit_data["edit_frame"] # case: editing from-side of last clip global last_from_trimmed if last_from_trimmed: data = {"track":edit_data["track_object"], "index":edit_data["index"], "clip":edit_data["from_clip"], "delta":delta, "undo_done_callback":clip_end_first_do_done, "first_do":True} action = edit.trim_last_clip_end_action(data) last_from_trimmed = False action.do_edit() # Edit is reinitialized in callback from edit action one_roll_trim_undo_done # case: editing to-side of cut elif edit_data["to_side_being_edited"]: data = {"track":edit_data["track_object"], "index":edit_data["index"], "clip":edit_data["to_clip"], "delta":delta, "undo_done_callback":one_roll_trim_undo_done, "first_do":True} action = edit.trim_start_action(data) action.do_edit() # Edit is reinitialized in callback from edit action one_roll_trim_undo_done # case: editing from-side of cut else: data = {"track":edit_data["track_object"], "index":edit_data["index"] - 1, "clip":edit_data["from_clip"], "delta":delta, "undo_done_callback":one_roll_trim_undo_done, "first_do":True} action = edit.trim_end_action(data) action.do_edit()
def mouse_release(x, y, frame, state): frame = _legalize_frame(frame) _edit_data["frame"] = frame updater.repaint_tline() track = _edit_data["track"] clip_index = _edit_data["clip_index"] clip = track.clips[clip_index] orig_in = _edit_data["orig_in"] orig_out = _edit_data["orig_out"] # do edit # Dragging clip end if _edit_data["editing_clip_end"] == True: delta = frame - orig_out # next clip is not blank or last clip if ((clip_index == len(track.clips) - 1) or (track.clips[clip_index + 1].is_blanck_clip == False)): data = { "track": track, "index": clip_index, "clip": clip, "delta": delta } action = edit.trim_last_clip_end_action(data) action.do_edit() else: # next clip is blank blank_clip = track.clips[clip_index + 1] blank_clip_length = blank_clip.clip_length() data = { "track": track, "index": clip_index, "clip": clip, "blank_clip_length": blank_clip_length, "delta": delta } if delta < blank_clip_length: # partial blank overwrite action = edit.clip_end_drag_on_blank_action(data) action.do_edit() else: # full blank replace action = edit.clip_end_drag_replace_blank_action(data) action.do_edit() else: # Dragging clip start delta = frame - orig_in - 1 # -1 because..uhh..inclusive exclusive something something # prev clip is not blank or first clip if ((clip_index == 0) or (track.clips[clip_index - 1].is_blanck_clip == False)): data = { "track": track, "index": clip_index, "clip": clip, "delta": delta } action = edit.trim_start_action(data) action.do_edit() else: # prev clip is blank blank_clip = track.clips[clip_index - 1] blank_clip_length = blank_clip.clip_length() data = { "track": track, "index": clip_index, "clip": clip, "blank_clip_length": blank_clip_length, "delta": delta } if -delta < blank_clip_length: # partial blank overwrite action = edit.clip_start_drag_on_blank_action(data) action.do_edit() else: # full blank replace action = edit.clip_start_drag_replace_blank_action(data) action.do_edit() _exit_clip_end_drag() updater.repaint_tline()
def mouse_release(x, y, frame, state): frame = _legalize_frame(frame) _edit_data["frame"] = frame updater.repaint_tline() track = _edit_data["track"] clip_index = _edit_data["clip_index"] clip = track.clips[clip_index] orig_in = _edit_data["orig_in"] orig_out = _edit_data["orig_out"] # do edit # Dragging clip end if _edit_data["editing_clip_end"] == True: delta = frame - orig_out # next clip is not blank or last clip if ((clip_index == len(track.clips) - 1) or (track.clips[clip_index + 1].is_blanck_clip == False)): data = {"track":track, "index":clip_index, "clip":clip, "delta":delta} action = edit.trim_last_clip_end_action(data) action.do_edit() else: # next clip is blank blank_clip = track.clips[clip_index + 1] blank_clip_length = blank_clip.clip_length() data = {"track":track, "index":clip_index, "clip":clip, "blank_clip_length":blank_clip_length, "delta":delta} if delta < blank_clip_length: # partial blank overwrite action = edit.clip_end_drag_on_blank_action(data) action.do_edit() else: # full blank replace action = edit.clip_end_drag_replace_blank_action(data) action.do_edit() else:# Dragging clip start delta = frame - orig_in - 1 # -1 because..uhh..inclusive exclusive something something # prev clip is not blank or first clip if ((clip_index == 0) or (track.clips[clip_index - 1].is_blanck_clip == False)): data = {"track":track, "index":clip_index, "clip":clip, "delta":delta} action = edit.trim_start_action(data) action.do_edit() else: # prev clip is blank blank_clip = track.clips[clip_index - 1] blank_clip_length = blank_clip.clip_length() data = {"track":track, "index":clip_index, "clip":clip, "blank_clip_length":blank_clip_length, "delta":delta} if -delta < blank_clip_length: # partial blank overwrite action = edit.clip_start_drag_on_blank_action(data) action.do_edit() else: # full blank replace action = edit.clip_start_drag_replace_blank_action(data) action.do_edit() _exit_clip_end_drag() updater.repaint_tline()