def overwrite_move_press(event, frame): """ User presses mouse when in overwrite move mode. """ if editorstate.overwrite_mode_box == True: boxmove.mouse_press(event, frame) return tlinewidgets.set_edit_mode( None, tlinewidgets.draw_overwrite_overlay ) # if we were in box mode draw func needs to be reset here _move_mode_pressed(event, frame) global edit_data if (not (edit_data == None)): edit_data["over_in"] = -1 edit_data["over_out"] = -1 # Length of moving clip/s moving_length = 0 clip_lengths = edit_data["clip_lengths"] for length in clip_lengths: moving_length += length edit_data["moving_length"] = moving_length
def slide_trim_no_edit_init(): stop_looping() # Stops looping editorstate.edit_mode = editorstate.SLIDE_TRIM_NO_EDIT gui.editor_window.set_cursor_to_mode() tlinewidgets.set_edit_mode(None, None) # No overlays are drawn in this edit mode movemodes.clear_selected_clips() # Entering trim edit mode clears selection updater.set_trim_mode_gui()
def _exit_clip_end_drag(): # Go back to enter mode editorstate.edit_mode = _enter_mode tlinewidgets.set_edit_mode(None, _enter_draw_func) gui.editor_window.set_cursor_to_mode() updater.repaint_tline()
def overwrite_move_press(event, frame): """ User presses mouse when in overwrite move mode. """ # This happens when we already have a box selection and now are trying to move it if editorstate.overwrite_mode_box == True: boxmove.mouse_press(event, frame) return tlinewidgets.set_edit_mode(None, tlinewidgets.draw_overwrite_overlay) # if we were in box mode draw func needs to be reset here _move_mode_pressed(event, frame) global edit_data if edit_data != None: edit_data["over_in"] = -1 edit_data["over_out"] = -1 # Length of moving clip/s moving_length = 0 clip_lengths = edit_data["clip_lengths"] for length in clip_lengths: moving_length += length edit_data["moving_length"] = moving_length else: if editorpersistance.prefs.box_for_empty_press_in_overwrite_tool == True: # We now enter box mode with special flag set that we will return to overwrite after edit complete editorstate.overwrite_mode_box = True boxmove.entered_from_overwrite = True boxmove.clear_data() # This happens when we start drawing a box boxmove.mouse_press(event, frame)
def mouse_press(event, frame): global edit_data, box_selection_data if box_selection_data == None: # mouse action is to select press_point = (event.x, event.y) edit_data = { "action_on": True, "press_point": press_point, "mouse_point": press_point, "box_selection_data": None } else: # mouse action is to move if box_selection_data.is_hit(event.x, event.y) == False: # Back to start state if selection box missed edit_data = None box_selection_data = None else: edit_data = { "action_on": True, "press_frame": frame, "delta": 0, "box_selection_data": box_selection_data } tlinewidgets.set_edit_mode(edit_data, tlinewidgets.draw_overwrite_box_overlay) updater.repaint_tline()
def _exit_clip_end_drag(): # Go back to enter mode editorstate.edit_mode = _enter_mode tlinewidgets.set_edit_mode(None, _enter_draw_func) tlinewidgets.pointer_context = appconsts.POINTER_CONTEXT_NONE gui.editor_window.set_cursor_to_mode() updater.repaint_tline()
def multitrim_mode_pressed(): stop_looping() editorstate.edit_mode = editorstate.MULTI_TRIM tlinewidgets.set_edit_mode(None, None) # No overlays are drawn in this edit mode movemodes.clear_selected_clips( ) # Entering trim edit mode clears selection updater.set_trim_mode_gui()
def maybe_init_for_mouse_press(event, frame): # See if we actually hit a clip track = tlinewidgets.get_track(event.y) if track == None: return if track.id < 1 or (track.id >= len(current_sequence().tracks) - 1): return False clip_index = current_sequence().get_clip_index(track, frame) if clip_index == -1: return clip = track.clips[clip_index] if clip.is_blanck_clip: return # Now we will in fact enter CLIP_END_DRAG edit mode # See if we're dragging clip end or start cut_frame = current_sequence().get_closest_cut_frame(track.id, frame) editing_clip_end = True if frame >= cut_frame: editing_clip_end = False else: cut_frame = cut_frame - (clip.clip_out - clip.clip_in) if editing_clip_end == True: # clip end drags bound_end = ( cut_frame - clip.clip_in + clip.get_length() - 1 ) # get_length() is available media length, not current clip length bound_start = cut_frame - 1 if clip_index == len(track.clips) - 1: # last clip bound_end = bound_end - 1 else: # clip beginning drags bound_start = cut_frame - clip.clip_in bound_end = cut_frame + (clip.clip_out - clip.clip_in) + 1 global _enter_mode, _enter_draw_func, _edit_data _enter_mode = editorstate.edit_mode editorstate.edit_mode = editorstate.CLIP_END_DRAG _enter_draw_func = tlinewidgets.canvas_widget.edit_mode_overlay_draw_func _edit_data = {} _edit_data["track"] = track _edit_data["clip_index"] = clip_index _edit_data["frame"] = frame _edit_data["press_frame"] = frame _edit_data["editing_clip_end"] = editing_clip_end _edit_data["bound_end"] = bound_end _edit_data["bound_start"] = bound_start _edit_data["track_height"] = track.height _edit_data["orig_in"] = cut_frame - 1 _edit_data["orig_out"] = cut_frame + (clip.clip_out - clip.clip_in) tlinewidgets.set_edit_mode(_edit_data, tlinewidgets.draw_clip_end_drag_overlay) gui.editor_window.set_cursor_to_mode()
def cut_mode_pressed(): stop_looping() current_sequence().clear_hidden_track() # Box tool is implemeted as sub mode of OVERWRITE_MOVE editorstate.edit_mode = editorstate.CUT tlinewidgets.set_edit_mode(None, tlinewidgets.draw_cut_overlay) movemodes.clear_selected_clips() # Entering trim edit mode clears selection
def multi_mode_pressed(): stop_looping() current_sequence().clear_hidden_track() editorstate.edit_mode = editorstate.MULTI_MOVE tlinewidgets.set_edit_mode(None, tlinewidgets.draw_multi_overlay) updater.set_move_mode_gui() updater.repaint_tline()
def maybe_init_for_mouse_press(event, frame): # See if we actually hit a clip track = tlinewidgets.get_track(event.y) if track == None: return if track.id < 1 or (track.id >= len(current_sequence().tracks) - 1): return False clip_index = current_sequence().get_clip_index(track, frame) if clip_index == -1: return clip = track.clips[clip_index] if clip.is_blanck_clip: return # Now we will in fact enter CLIP_END_DRAG edit mode # See if we're dragging clip end or start cut_frame = current_sequence().get_closest_cut_frame(track.id, frame) editing_clip_end = True if frame >= cut_frame: editing_clip_end = False else: cut_frame = cut_frame - (clip.clip_out - clip.clip_in) if editing_clip_end == True: # clip end drags bound_end = cut_frame - clip.clip_in + clip.get_length() - 1 # get_length() is available media length, not current clip length bound_start = cut_frame - 1 if clip_index == len(track.clips) - 1: # last clip bound_end = bound_end - 1 else: # clip beginning drags bound_start = cut_frame - clip.clip_in bound_end = cut_frame + (clip.clip_out - clip.clip_in) + 1 global _enter_mode, _enter_draw_func, _edit_data _enter_mode = editorstate.edit_mode editorstate.edit_mode = editorstate.CLIP_END_DRAG _enter_draw_func = tlinewidgets.canvas_widget.edit_mode_overlay_draw_func _edit_data = {} _edit_data["track"] = track _edit_data["clip_index"] = clip_index _edit_data["frame"] = frame _edit_data["press_frame"] = frame _edit_data["editing_clip_end"] = editing_clip_end _edit_data["bound_end"] = bound_end _edit_data["bound_start"] = bound_start _edit_data["track_height"] = track.height _edit_data["orig_in"] = cut_frame - 1 _edit_data["orig_out"] = cut_frame + (clip.clip_out - clip.clip_in) tlinewidgets.set_edit_mode(_edit_data, tlinewidgets.draw_clip_end_drag_overlay) gui.editor_window.set_cursor_to_mode()
def _edit_completed(): """ Called after edit completed in trimmodes.py """ trimmodes.edit_complete_callback = None # Get back to MULTI_TRIM mode after doing the edit editorstate.edit_mode = editorstate.MULTI_TRIM tlinewidgets.set_edit_mode(None, None) # No overlays are drawn in this edit mode updater.set_trim_mode_gui()
def set_slide_mode(track, current_frame): """ Sets two roll mode """ if track == None: return None if current_frame > track.get_length(): return False current_sequence().clear_hidden_track() view_frame, start_frame_being_viewed = _get_trim_edit(track, current_frame) # _get_trim_edit() gives first frame belonging to next clip if press closer to end frame of clip if not start_frame_being_viewed: view_frame = view_frame - 1 try: _set_slide_mode_edit_data(track, view_frame) except: return False if edit_data["clip"].is_blanck_clip: return False clip = edit_data["clip"] clip_start = edit_data["trim_limits"]["clip_start"] edit_data["start_frame_being_viewed"] = start_frame_being_viewed fake_current_frame = clip_start if not start_frame_being_viewed: fake_current_frame = clip_start + clip.clip_out - clip.clip_in # Give timeline widget needed data tlinewidgets.set_edit_mode(edit_data, tlinewidgets.draw_slide_overlay) tlinewidgets.fake_current_frame = fake_current_frame # Set clip as producer on hidden track and display current frame from it. clip = edit_data["clip"] clip_start = 0 # we'll calculate the offset from actual position of clip on timeline to display the frame displayed after sliding if clip.media_type != appconsts.PATTERN_PRODUCER: current_sequence().display_trim_clip(clip.path, clip_start) # File producer else: current_sequence().display_trim_clip( None, clip_start, clip.create_data) # pattern producer if start_frame_being_viewed: PLAYER().seek_frame(clip.clip_in) else: PLAYER().seek_frame(clip.clip_out) updater.repaint_tline() return True
def kftool_mode_pressed(): stop_looping() current_sequence().clear_hidden_track() # Box tool is implemeted as sub mode of OVERWRITE_MOVE editorstate.edit_mode = editorstate.KF_TOOL kftoolmode.enter_mode = None kftoolmode.set_no_clip_edit_data() tlinewidgets.set_edit_mode(None, tlinewidgets.draw_kftool_overlay) movemodes.clear_selected_clips() # Entering trim edit mode clears selection
def insert_move_mode_pressed(): """ User selects insert move mode. """ stop_looping() current_sequence().clear_hidden_track() editorstate.edit_mode = editorstate.INSERT_MOVE tlinewidgets.set_edit_mode(None, tlinewidgets.draw_insert_overlay) _set_move_mode()
def overwrite_move_mode_pressed(): """ User selects overwrite move mode. """ stop_looping() current_sequence().clear_hidden_track() editorstate.edit_mode = editorstate.OVERWRITE_MOVE tlinewidgets.set_edit_mode(None, tlinewidgets.draw_overwrite_overlay) _set_move_mode()
def insert_move_mode_pressed(): """ User selects Insert tool. """ stop_looping() current_sequence().clear_hidden_track() editorstate.edit_mode = editorstate.INSERT_MOVE tlinewidgets.set_edit_mode(None, tlinewidgets.draw_insert_overlay) _set_move_mode()
def set_slide_mode(track, current_frame): """ Sets two roll mode """ if track == None: return None if current_frame > track.get_length(): return False current_sequence().clear_hidden_track() view_frame, start_frame_being_viewed = _get_trim_edit(track, current_frame) # _get_trim_edit() gives first frame belonging to next clip if press closer to end frame of clip if not start_frame_being_viewed: view_frame = view_frame -1 try: _set_slide_mode_edit_data(track, view_frame) except: return False if edit_data["clip"].is_blanck_clip: return False clip = edit_data["clip"] clip_start = edit_data["trim_limits"]["clip_start"] edit_data["start_frame_being_viewed"] = start_frame_being_viewed fake_current_frame = clip_start if not start_frame_being_viewed: fake_current_frame = clip_start + clip.clip_out - clip.clip_in # Give timeline widget needed data tlinewidgets.set_edit_mode(edit_data, tlinewidgets.draw_slide_overlay) tlinewidgets.fake_current_frame = fake_current_frame # Set clip as producer on hidden track and display current frame from it. clip = edit_data["clip"] clip_start = 0 # we'll calculate the offset from actual position of clip on timeline to display the frame displayed after sliding if clip.media_type != appconsts.PATTERN_PRODUCER: current_sequence().display_trim_clip(clip.path, clip_start) # File producer else: current_sequence().display_trim_clip(None, clip_start, clip.create_data) # pattern producer if start_frame_being_viewed: PLAYER().seek_frame(clip.clip_in) else: PLAYER().seek_frame(clip.clip_out) updater.repaint_tline() return True
def kftool_mode_from_popup_menu(clip, track): stop_looping() current_sequence().clear_hidden_track() # Box tool is implemeted as sub mode of OVERWRITE_MOVE editorstate.edit_mode = editorstate.KF_TOOL tlinewidgets.set_edit_mode(None, tlinewidgets.draw_kftool_overlay) movemodes.clear_selected_clips() # Entering trim edit mode clears selection kftoolmode.init_tool_for_clip(clip, track) gui.editor_window.set_cursor_to_mode()
def oneroll_trim_no_edit_init(): """ This mode is entered and this method is called when: - user first selects trim tool - user does cut(X) action while in trim mode - user clicks empty and preference is to keep using trim tool (to not exit to INSERT_MOVE) """ stop_looping() editorstate.edit_mode = editorstate.ONE_ROLL_TRIM_NO_EDIT gui.editor_window.set_cursor_to_mode() tlinewidgets.set_edit_mode(None, None) # No overlays are drawn in this edit mode movemodes.clear_selected_clips() # Entering trim edit mode clears selection updater.set_trim_mode_gui()
def overwrite_move_mode_pressed(): """ User selects Overwrite tool. """ stop_looping() current_sequence().clear_hidden_track() editorstate.edit_mode = editorstate.OVERWRITE_MOVE # Box tool is implemeted as sub mode of OVERWRITE_MOVE so this false editorstate.overwrite_mode_box = False tlinewidgets.set_edit_mode(None, tlinewidgets.draw_overwrite_overlay) _set_move_mode()
def kftool_mode_from_popup_menu(clip, track, edit_type): stop_looping() current_sequence().clear_hidden_track() kftoolmode.enter_mode = editorstate.edit_mode editorstate.edit_mode = editorstate.KF_TOOL tlinewidgets.set_edit_mode(None, tlinewidgets.draw_kftool_overlay) movemodes.clear_selected_clips() # Entering this edit mode clears selection kftoolmode.set_no_clip_edit_data() kftoolmode.init_tool_for_clip(clip, track, edit_type) gui.editor_window.set_cursor_to_mode()
def box_mode_pressed(): """ User selects Box tool. """ stop_looping() current_sequence().clear_hidden_track() # Box tool is implemeted as sub mode of OVERWRITE_MOVE editorstate.edit_mode = editorstate.OVERWRITE_MOVE editorstate.overwrite_mode_box = True boxmove.clear_data() tlinewidgets.set_edit_mode(None, None) # these get set later for box move _set_move_mode()
def box_mode_pressed(): """ User selects Box tool. """ stop_looping() current_sequence().clear_hidden_track() # Box tool is implemeted as sub mode of OVERWRITE_MOVE editorstate.edit_mode = editorstate.OVERWRITE_MOVE editorstate.overwrite_mode_box = True boxmove.clear_data() boxmove.entered_from_overwrite = False tlinewidgets.set_edit_mode(None, None) # these get set later for box move _set_move_mode()
def mouse_press(event, frame): track = current_sequence().tracks[compositor.transition.b_track - 1] global edit_data, sub_mode compositor_y = tlinewidgets._get_track_y(track.id) - tlinewidgets.COMPOSITOR_HEIGHT_OFF if abs(event.x - tlinewidgets._get_frame_x(compositor.clip_in)) < TRIM_HANDLE_WIDTH: edit_data = {"clip_in":compositor.clip_in, "clip_out":compositor.clip_out, "trim_is_clip_in":True, "compositor_y": compositor_y, "compositor": compositor} tlinewidgets.set_edit_mode(edit_data, tlinewidgets.draw_compositor_trim) sub_mode = TRIM_EDIT elif abs(event.x - tlinewidgets._get_frame_x(compositor.clip_out + 1)) < TRIM_HANDLE_WIDTH: edit_data = {"clip_in":compositor.clip_in, "clip_out":compositor.clip_out, "trim_is_clip_in":False, "compositor_y": compositor_y, "compositor": compositor} tlinewidgets.set_edit_mode(edit_data, tlinewidgets.draw_compositor_trim) sub_mode = TRIM_EDIT else: edit_data = {"press_frame":frame, "current_frame":frame, "clip_in":compositor.clip_in, "clip_length":(compositor.clip_out - compositor.clip_in + 1), "compositor_y": compositor_y, "compositor": compositor} tlinewidgets.set_edit_mode(edit_data, tlinewidgets.draw_compositor_move_overlay) sub_mode = MOVE_EDIT updater.repaint_tline()
def mouse_press(event, frame): global edit_data, box_selection_data if box_selection_data == None: # mouse action is to select press_point = (event.x, event.y) edit_data = {"action_on":True, "press_point":press_point, "mouse_point":press_point, "box_selection_data":None} else: # mouse action is to move if box_selection_data.is_hit(event.x, event.y) == False: # Back to start state if selection box missed edit_data = None box_selection_data = None else: edit_data = {"action_on":True, "press_frame":frame, "delta":0, "box_selection_data":box_selection_data} tlinewidgets.set_edit_mode(edit_data, tlinewidgets.draw_overwrite_box_overlay) updater.repaint_tline()
def mouse_release(x, y, frame, state): global sub_mode tlinewidgets.pointer_context = appconsts.POINTER_CONTEXT_NONE # Se we're only handling 3 editmodes here. editorstate.edit_mode = prev_edit_mode if editorstate.edit_mode == editorstate.INSERT_MOVE: tlinewidgets.set_edit_mode(None, tlinewidgets.draw_insert_overlay) elif editorstate.edit_mode == editorstate.OVERWRITE_MOVE: tlinewidgets.set_edit_mode(None, tlinewidgets.draw_overwrite_overlay) elif editorstate.edit_mode == editorstate.MULTI_MOVE: tlinewidgets.set_edit_mode(None, tlinewidgets.draw_multi_overlay) else: print("COMPOSITOR MODE EXIT PROBLEM at compositormodes.mouse_release") gui.editor_window.set_cursor_to_mode() if sub_mode == TRIM_EDIT: _bounds_check_trim(frame, edit_data) data = { "compositor": compositor, "clip_in": edit_data["clip_in"], "clip_out": edit_data["clip_out"] } action = edit.move_compositor_action(data) action.do_edit() else: press_frame = edit_data["press_frame"] current_frame = frame delta = current_frame - press_frame data = { "compositor": compositor, "clip_in": compositor.clip_in + delta, "clip_out": compositor.clip_out + delta } if data["clip_in"] < 0: data["clip_in"] = 0 if data["clip_out"] < 0: data["clip_out"] = 0 action = edit.move_compositor_action(data) action.do_edit() sub_mode = NO_COMPOSITOR_EDIT updater.repaint_tline()
def mouse_release(x, y, frame, state): global sub_mode tlinewidgets.pointer_context = appconsts.POINTER_CONTEXT_NONE editorstate.edit_mode = prev_edit_mode if editorstate.edit_mode == editorstate.INSERT_MOVE: tlinewidgets.set_edit_mode(None, tlinewidgets.draw_insert_overlay) elif editorstate.edit_mode == editorstate.OVERWRITE_MOVE: tlinewidgets.set_edit_mode(None, tlinewidgets.draw_overwrite_overlay) elif editorstate.edit_mode == editorstate.MULTI_MOVE: tlinewidgets.set_edit_mode(None, tlinewidgets.draw_multi_overlay) else: print "COMPOSITOR MODE EXIT PROBLEM at compositormodes.mouse_release" gui.editor_window.set_cursor_to_mode() if sub_mode == TRIM_EDIT: _bounds_check_trim(frame, edit_data) data = {"compositor":compositor, "clip_in":edit_data["clip_in"], "clip_out":edit_data["clip_out"]} action = edit.move_compositor_action(data) action.do_edit() else: press_frame = edit_data["press_frame"] current_frame = frame delta = current_frame - press_frame data = {"compositor":compositor, "clip_in":compositor.clip_in + delta, "clip_out":compositor.clip_out + delta} if data["clip_in"] < 0: data["clip_in"] = 0 if data["clip_out"] < 0: data["clip_out"] = 0 action = edit.move_compositor_action(data) action.do_edit() sub_mode = NO_COMPOSITOR_EDIT updater.repaint_tline()
def mouse_release(x, y, frame, state): editorstate.edit_mode = prev_edit_mode if editorstate.edit_mode == editorstate.INSERT_MOVE: tlinewidgets.set_edit_mode(None, tlinewidgets.draw_insert_overlay) elif editorstate.edit_mode == editorstate.INSERT_MOVE: tlinewidgets.set_edit_mode(None, tlinewidgets.draw_overwrite_overlay) elif editorstate.edit_mode == editorstate.MULTI_MOVE: tlinewidgets.set_edit_mode(None, tlinewidgets.draw_multi_overlay) else: print "COMPOSITOR MODE EXIT PROBLEM at compositormodes.mouse_release" gui.editor_window.set_cursor_to_mode() if sub_mode == TRIM_EDIT: _bounds_check_trim(frame, edit_data) data = {"compositor":compositor, "clip_in":edit_data["clip_in"], "clip_out":edit_data["clip_out"]} action = edit.move_compositor_action(data) action.do_edit() else: press_frame = edit_data["press_frame"] current_frame = frame delta = current_frame - press_frame data = {"compositor":compositor, "clip_in":compositor.clip_in + delta, "clip_out":compositor.clip_out + delta} if data["clip_in"] < 0: data["clip_in"] = 0 if data["clip_out"] < 0: data["clip_out"] = 0 action = edit.move_compositor_action(data) action.do_edit() updater.repaint_tline()
def set_tworoll_mode(track, current_frame = -1): """ Sets two roll mode """ if track == None: return False if current_frame == -1: current_frame = PLAYER().producer.frame() + 1 # +1 because cut frame selects previous clip if current_frame >= track.get_length(): return False current_sequence().clear_hidden_track() edit_frame, to_side_being_edited = _get_trim_edit(track, current_frame) # Trying to two roll edit last clip's out frame inits one roll trim mode # via programmed click. if edit_frame >= track.get_length(): return False try: _set_edit_data(track, edit_frame, False) except: # fails for last clip return False if edit_frame == 0: _tworoll_init_failed_window() return False global edit_data if edit_data["from_clip"] == None: _tworoll_init_failed_window() return False # Force edit side to be on non-blanck side if to_side_being_edited and edit_data["to_clip"].is_blanck_clip: to_side_being_edited = False if ((to_side_being_edited == False) and edit_data["from_clip"].is_blanck_clip): to_side_being_edited = True edit_data["to_side_being_edited"] = to_side_being_edited # Find out if non edit side is blank non_edit_side_blank = False if to_side_being_edited and edit_data["from_clip"].is_blanck_clip: non_edit_side_blank = True if ((to_side_being_edited == False) and edit_data["to_clip"].is_blanck_clip): non_edit_side_blank = True edit_data["non_edit_side_blank"] = non_edit_side_blank # Give timeline widget needed data tlinewidgets.set_edit_mode(edit_data, tlinewidgets.draw_two_roll_overlay) # Set clip as producer on hidden track and display current frame # from it. trim_limits = edit_data["trim_limits"] if edit_data["to_side_being_edited"]: clip = edit_data["to_clip"] clip_start = trim_limits["to_start"] else: clip = edit_data["from_clip"] clip_start = trim_limits["from_start"] if clip.media_type != appconsts.PATTERN_PRODUCER: current_sequence().display_trim_clip(clip.path, clip_start) # File producer else: current_sequence().display_trim_clip(None, clip_start, clip.create_data) # pattern producer PLAYER().seek_frame(edit_frame) updater.repaint_tline() return True
def set_tworoll_mode(track, current_frame=-1): """ Sets two roll mode """ if track == None: return False if current_frame == -1: current_frame = PLAYER().producer.frame( ) + 1 # +1 because cut frame selects previous clip if current_frame >= track.get_length(): return False current_sequence().clear_hidden_track() edit_frame, to_side_being_edited = _get_trim_edit(track, current_frame) # Trying to two roll edit last clip's out frame inits one roll trim mode # via programmed click. if edit_frame >= track.get_length(): return False try: _set_edit_data(track, edit_frame, False) except: # fails for last clip return False if edit_frame == 0: _tworoll_init_failed_window() return False global edit_data if edit_data["from_clip"] == None: _tworoll_init_failed_window() return False # Force edit side to be on non-blanck side if to_side_being_edited and edit_data["to_clip"].is_blanck_clip: to_side_being_edited = False if ((to_side_being_edited == False) and edit_data["from_clip"].is_blanck_clip): to_side_being_edited = True edit_data["to_side_being_edited"] = to_side_being_edited # Find out if non edit side is blank non_edit_side_blank = False if to_side_being_edited and edit_data["from_clip"].is_blanck_clip: non_edit_side_blank = True if ((to_side_being_edited == False) and edit_data["to_clip"].is_blanck_clip): non_edit_side_blank = True edit_data["non_edit_side_blank"] = non_edit_side_blank # Give timeline widget needed data tlinewidgets.set_edit_mode(edit_data, tlinewidgets.draw_two_roll_overlay) # Set clip as producer on hidden track and display current frame # from it. trim_limits = edit_data["trim_limits"] if edit_data["to_side_being_edited"]: clip = edit_data["to_clip"] clip_start = trim_limits["to_start"] else: clip = edit_data["from_clip"] clip_start = trim_limits["from_start"] if clip.media_type != appconsts.PATTERN_PRODUCER: current_sequence().display_trim_clip(clip.path, clip_start) # File producer else: current_sequence().display_trim_clip( None, clip_start, clip.create_data) # pattern producer PLAYER().seek_frame(edit_frame) updater.repaint_tline() return True
def set_oneroll_mode(track, current_frame=-1, editing_to_clip=None): """ Sets one roll mode """ if track == None: return False if track.id < 1 or (track.id >= len(current_sequence().tracks) - 1): return False if current_frame == -1: # from button, ctrl + mouse calls with frame current_frame = PLAYER().producer.frame( ) + 1 # +1 because cut frame selects previous clip if current_frame >= track.get_length(): return False edit_frame, to_side_being_edited = _get_trim_edit(track, current_frame) if edit_frame == -1: return False # hack fix for last clip out trim. If frame pointer not at very end of clip # the other functions for getting trim frame given +1 too much if edit_frame > track.get_length(): edit_frame = track.get_length() if editing_to_clip != None: # This is set when mode reset after edit or after undo or redo # _get_trim_edit() might give different(wrong) clip being edited # because cut is now at a different place. to_side_being_edited = editing_to_clip _set_edit_data(track, edit_frame, True) global edit_data # Set side being edited to default to-side edit_data["to_side_being_edited"] = to_side_being_edited current_sequence().clear_hidden_track() # Cant't trim a blank clip. Blank clips are special in MLT and can't be # made to do things that are needed in trim. if _trimmed_clip_is_blank(): set_exit_mode_func() primary_txt = _("Cant ONE ROLL TRIM blank clips.") secondary_txt = _( "You can use MOVE OVERWRITE or TWO ROLL TRIM edits instead\nto get the desired change." ) dialogutils.info_message(primary_txt, secondary_txt, gui.editor_window.window) return False # Give timeline widget needed data tlinewidgets.set_edit_mode(edit_data, tlinewidgets.draw_one_roll_overlay) # Set clip as special producer on hidden track and display current frame # from it. trim_limits = edit_data["trim_limits"] if edit_data["to_side_being_edited"]: clip = edit_data["to_clip"] clip_start = trim_limits["to_start"] else: clip = edit_data["from_clip"] clip_start = trim_limits["from_start"] # Display trim clip if clip.media_type != appconsts.PATTERN_PRODUCER: current_sequence().display_trim_clip(clip.path, clip_start) # file producer else: current_sequence().display_trim_clip( None, clip_start, clip.create_data) # pattern producer PLAYER().seek_frame(edit_frame) return True
def multitrim_mode_pressed(): stop_looping() editorstate.edit_mode = editorstate.MULTI_TRIM tlinewidgets.set_edit_mode(None, None) # No overlays are drawn in this edit mode movemodes.clear_selected_clips() # Entering trim edit mode clears selection updater.set_trim_mode_gui()
def set_oneroll_mode(track, current_frame=-1, editing_to_clip=None): """ Sets one roll mode """ if track == None: return False if track.id < 1 or (track.id >= len(current_sequence().tracks) - 1): return False if current_frame == -1: # from button, ctrl + mouse calls with frame current_frame = PLAYER().producer.frame() + 1 # +1 because cut frame selects previous clip if current_frame >= track.get_length(): return False edit_frame, to_side_being_edited = _get_trim_edit(track, current_frame) if edit_frame == -1: return False # hack fix for last clip out trim. If frame pointer not at very end of clip # the other functions for getting trim frame given +1 too much if edit_frame > track.get_length(): edit_frame = track.get_length() if editing_to_clip != None: # This is set when mode reset after edit or after undo or redo # _get_trim_edit() might give different(wrong) clip being edited # because cut is now at a different place. to_side_being_edited = editing_to_clip _set_edit_data(track, edit_frame, True) global edit_data # Set side being edited to default to-side edit_data["to_side_being_edited"] = to_side_being_edited current_sequence().clear_hidden_track() # Cant't trim a blank clip. Blank clips are special in MLT and can't be # made to do things that are needed in trim. if _trimmed_clip_is_blank(): set_exit_mode_func() primary_txt = _("Cant ONE ROLL TRIM blank clips.") secondary_txt = _("You can use MOVE OVERWRITE or TWO ROLL TRIM edits instead\nto get the desired change.") dialogutils.info_message(primary_txt, secondary_txt, gui.editor_window.window) return False # Give timeline widget needed data tlinewidgets.set_edit_mode(edit_data, tlinewidgets.draw_one_roll_overlay) # Set clip as special producer on hidden track and display current frame # from it. trim_limits = edit_data["trim_limits"] if edit_data["to_side_being_edited"]: clip = edit_data["to_clip"] clip_start = trim_limits["to_start"] else: clip = edit_data["from_clip"] clip_start = trim_limits["from_start"] # Display trim clip if clip.media_type != appconsts.PATTERN_PRODUCER: current_sequence().display_trim_clip(clip.path, clip_start) # file producer else: current_sequence().display_trim_clip(None, clip_start, clip.create_data) # pattern producer PLAYER().seek_frame(edit_frame) return True