def _compositor_menu_item_activated(widget, data): action_id, compositor = data if action_id == "open in editor": compositeeditor.set_compositor(compositor) elif action_id == "delete": compositor.selected = False data = {"compositor":compositor} action = edit.delete_compositor_action(data) action.do_edit() elif action_id == "sync with origin": track = current_sequence().tracks[compositor.transition.b_track] # b_track is source track where origin clip is origin_clip = None for clip in track.clips: if clip.id == compositor.origin_clip_id: origin_clip = clip if origin_clip == None: dialogutils.info_message(_("Origin clip not found!"), _("Clip used to create this Compositor has been removed\nor moved to different track."), gui.editor_window.window) return clip_index = track.clips.index(origin_clip) clip_start = track.clip_start(clip_index) clip_end = clip_start + origin_clip.clip_out - origin_clip.clip_in data = {"compositor":compositor,"clip_in":clip_start,"clip_out":clip_end} action = edit.move_compositor_action(data) action.do_edit()
def tline_canvas_double_click(frame, x, y): if PLAYER().looping(): return elif PLAYER().is_playing(): PLAYER().stop_playback() if not timeline_visible(): updater.display_sequence_in_monitor() set_default_edit_mode() return hit_compositor = tlinewidgets.compositor_hit(frame, y, current_sequence().compositors) if hit_compositor != None: compositeeditor.set_compositor(hit_compositor) return track = tlinewidgets.get_track(y) if track == None: return clip_index = current_sequence().get_clip_index(track, frame) if clip_index == -1: return clip = track.clips[clip_index] data = (clip, track, None, x) updater.open_clip_in_effects_editor(data)
def _compositor_menu_item_activated(widget, data): action_id, compositor = data if action_id == "open in editor": compositeeditor.set_compositor(compositor) elif action_id == "delete": compositor.selected = False data = {"compositor":compositor} action = edit.delete_compositor_action(data) action.do_edit() elif action_id == "sync with origin": tlineaction.sync_compositor(compositor)
def _compositor_menu_item_activated(widget, data): action_id, compositor = data if action_id == "open in editor": compositeeditor.set_compositor(compositor) elif action_id == "delete": compositor.selected = False data = {"compositor": compositor} action = edit.delete_compositor_action(data) action.do_edit() elif action_id == "sync with origin": tlineaction.sync_compositor(compositor)
def _compositor_menu_item_activated(widget, data): action_id, compositor = data if action_id == "open in editor": compositeeditor.set_compositor(compositor) elif action_id == "delete": compositor.selected = False data = {"compositor": compositor} action = edit.delete_compositor_action(data) action.do_edit() elif action_id == "sync with origin": tlineaction.sync_compositor(compositor) elif action_id == "set auto follow": compositor.obey_autofollow = widget.get_active() updater.repaint_tline()
def _compositor_menu_item_activated(widget, data): action_id, compositor = data if action_id == "open in editor": compositeeditor.set_compositor(compositor) elif action_id == "delete": compositor.selected = False data = {"compositor":compositor} action = edit.delete_compositor_action(data) action.do_edit() elif action_id == "sync with origin": tlineaction.sync_compositor(compositor) elif action_id == "set auto follow": compositor.obey_autofollow = widget.get_active() updater.repaint_tline()
def tline_canvas_mouse_pressed(event, frame): """ Mouse event callback from timeline canvas widget """ editorstate.timeline_mouse_disabled = False # This is used to disable "move and "release" events when they would get bad data. if PLAYER().looping(): return elif PLAYER().is_playing(): PLAYER().stop_playback() # Double click handled separately if event.type == Gdk.EventType._2BUTTON_PRESS: return # Handle and exit parent clip selecting if EDIT_MODE() == editorstate.SELECT_PARENT_CLIP: syncsplitevent.select_sync_parent_mouse_pressed(event, frame) editorstate.timeline_mouse_disabled = True # Set INSERT_MODE modesetting.set_default_edit_mode() return # Handle and exit tline sync clip selecting if EDIT_MODE() == editorstate.SELECT_TLINE_SYNC_CLIP: audiosync.select_sync_clip_mouse_pressed(event, frame) editorstate.timeline_mouse_disabled = True # Set INSERT_MODE modesetting.set_default_edit_mode() return # Hitting timeline in clip display mode displays timeline in # default mode. if not timeline_visible(): updater.display_sequence_in_monitor() if (event.button == 1): # Now that we have correct edit mode we'll reenter # this method to get e.g. a select action tline_canvas_mouse_pressed(event, frame) return if (event.button == 3): # Right mouse + CTRL displays clip menu if we hit clip if (event.get_state() & Gdk.ModifierType.CONTROL_MASK): PLAYER().seek_frame(frame) # Right mouse on timeline seeks frame else: success = display_clip_menu_pop_up(event.y, event, frame) if not success: PLAYER().seek_frame(frame) return # If clip end drag mode is for some reason still active, exit to default edit mode if EDIT_MODE() == editorstate.CLIP_END_DRAG: modesetting.set_default_edit_mode() # This shouldn't happen unless for some reason mouse release didn't hit clipenddragmode listener. print("EDIT_MODE() == editorstate.CLIP_END_DRAG at mouse press!") # Check if match frame close is hit if editorstate.current_is_move_mode() and timeline_visible(): if tlinewidgets.match_frame_close_hit(event.x, event.y) == True: tlinewidgets.set_match_frame(-1, -1, True) updater.repaint_tline() return # Check if compositor is hit and if so, handle compositor editing if editorstate.current_is_move_mode() and timeline_visible(): hit_compositor = tlinewidgets.compositor_hit(frame, event.x, event.y, current_sequence().compositors) if hit_compositor != None: if editorstate.get_compositing_mode() == appconsts.COMPOSITING_MODE_STANDARD_AUTO_FOLLOW: compositeeditor.set_compositor(hit_compositor) compositormodes.set_compositor_selected(hit_compositor) movemodes.clear_selected_clips() editorstate.timeline_mouse_disabled = True return elif editorstate.auto_follow_active() == False or hit_compositor.obey_autofollow == False: movemodes.clear_selected_clips() if event.button == 1 or (event.button == 3 and event.get_state() & Gdk.ModifierType.CONTROL_MASK): compositormodes.set_compositor_mode(hit_compositor) mode_funcs = EDIT_MODE_FUNCS[editorstate.COMPOSITOR_EDIT] press_func = mode_funcs[TL_MOUSE_PRESS] press_func(event, frame) return if event.button == 3: compositormodes.set_compositor_selected(hit_compositor) guicomponents.display_compositor_popup_menu(event, hit_compositor, compositor_menu_item_activated) return elif event.button == 2: updater.zoom_project_length() return compositormodes.clear_compositor_selection() # Check if we should enter clip end drag mode if (event.button == 3 and editorstate.current_is_move_mode() and timeline_visible() and (event.get_state() & Gdk.ModifierType.CONTROL_MASK)): # with CTRL right mouse clipenddragmode.maybe_init_for_mouse_press(event, frame) elif (timeline_visible() and (EDIT_MODE() == editorstate.INSERT_MOVE or EDIT_MODE() == editorstate.OVERWRITE_MOVE) and (tlinewidgets.pointer_context == appconsts.POINTER_CONTEXT_END_DRAG_LEFT or tlinewidgets.pointer_context == appconsts.POINTER_CONTEXT_END_DRAG_RIGHT)): # with pointer context clipenddragmode.maybe_init_for_mouse_press(event, frame) # Handle mouse button presses depending which button was pressed and # editor state. # RIGHT BUTTON: seek frame or display clip menu if not dragging clip end if (event.button == 3 and EDIT_MODE() != editorstate.CLIP_END_DRAG and EDIT_MODE() != editorstate.KF_TOOL): if ((not editorstate.current_is_active_trim_mode()) and timeline_visible()): if not(event.get_state() & Gdk.ModifierType.CONTROL_MASK): success = display_clip_menu_pop_up(event.y, event, frame) if not success: PLAYER().seek_frame(frame) else: # For trim modes set <X>_NO_EDIT edit mode and seek frame. and seek frame trimmodes.set_no_edit_trim_mode() PLAYER().seek_frame(frame) return # LEFT BUTTON: Select new trimmed clip in active one roll trim mode with sensitive cursor. elif (event.button == 1 and EDIT_MODE() == editorstate.ONE_ROLL_TRIM): track = tlinewidgets.get_track(event.y) if track == None: modesetting.set_default_edit_mode(True) return success = trimmodes.set_oneroll_mode(track, frame) if not success: modesetting.set_default_edit_mode(True) return if trimmodes.edit_data["to_side_being_edited"] == True: pointer_context = appconsts.POINTER_CONTEXT_TRIM_LEFT else: pointer_context = appconsts.POINTER_CONTEXT_TRIM_RIGHT gui.editor_window.set_tline_cursor_to_context(pointer_context) gui.editor_window.set_tool_selector_to_mode() if not editorpersistance.prefs.quick_enter_trims: editorstate.timeline_mouse_disabled = True else: trimmodes.oneroll_trim_move(event.x, event.y, frame, None) elif event.button == 2: updater.zoom_project_length() # LEFT BUTTON: Handle left mouse button edits by passing event to current edit mode # handler func elif event.button == 1 or event.button == 3: mode_funcs = EDIT_MODE_FUNCS[EDIT_MODE()] press_func = mode_funcs[TL_MOUSE_PRESS] press_func(event, frame)