def _add_filter_multi(data): clip, track, item_id, item_data = data x, filter_info = item_data clipeffectseditor.set_stack_update_blocked( ) # We update stack on set_clip below range_in = movemodes.selected_range_in range_out = movemodes.selected_range_out clips = track.clips[range_in:range_out + 1] data = { "clips": clips, "filter_info": filter_info, "filter_edit_done_func": clipeffectseditor.filter_edit_multi_done_stack_update } action = edit.add_filter_multi_action(data) action.do_edit() clipeffectseditor.set_stack_update_unblocked() # (re)open clip in editor frame = tlinewidgets.get_frame(x) index = track.get_clip_index_at(frame) clipeffectseditor.set_clip(clip, track, index) clipeffectseditor.set_filter_item_expanded(len(clip.filters) - 1)
def open_selection_in_effects(): if movemodes.selected_range_in == -1: return track = get_track(movemodes.selected_track) clip = track.clips[movemodes.selected_range_in] clipeffectseditor.set_clip(clip, track, movemodes.selected_range_in)
def _add_filter(data): clip, track, item_id, item_data = data x, filter_info = item_data action = clipeffectseditor.get_filter_add_action(filter_info, clip) action.do_edit() # (re)open clip in editor frame = tlinewidgets.get_frame(x) index = track.get_clip_index_at(frame) clipeffectseditor.set_clip(clip, track, index)
def _add_filter(data): clip, track, item_id, item_data = data x, filter_info = item_data action = clipeffectseditor.get_filter_add_action(filter_info, clip) clipeffectseditor.set_stack_update_blocked( ) # We update stack on set_clip below action.do_edit() clipeffectseditor.set_stack_update_unblocked() # (re)open clip in editor frame = tlinewidgets.get_frame(x) index = track.get_clip_index_at(frame) clipeffectseditor.set_clip(clip, track, index) clipeffectseditor.set_filter_item_expanded(len(clip.filters) - 1)
def tline_effect_drop(x, y): clip, track, index = tlinewidgets.get_clip_track_and_index_for_pos(x, y) if clip == None: return if track == None: return if track.id < 1 or track.id >= (len(current_sequence().tracks) - 1): return if dialogutils.track_lock_check_and_user_info(track): modesetting.set_default_edit_mode() return if clip != clipeffectseditor.clip: clipeffectseditor.set_clip(clip, track, index) clipeffectseditor.add_currently_selected_effect() # drag start selects the dragged effect
def tline_effect_drop(x, y): clip, track, index = tlinewidgets.get_clip_track_and_index_for_pos(x, y) if clip == None: return if track == None: return if track.id < 1 or track.id >= (len(current_sequence().tracks) - 1): return if track_lock_check_and_user_info(track): set_default_edit_mode() return if clip != clipeffectseditor.clip: clipeffectseditor.set_clip(clip, track, index) clipeffectseditor.add_currently_selected_effect() # drag start selects the dragged effect
def select_prev_clip_for_filter_edit(): if not editorstate.timeline_visible(): updater.display_sequence_in_monitor() tline_frame = PLAYER().tracktor_producer.frame() - 1 clip, track = current_sequence().find_prev_editable_clip_and_track( tline_frame) if clip == None: return range_in = track.clips.index(clip) frame = track.clip_start(range_in) movemodes.select_clip(track.id, range_in) PLAYER().seek_frame(frame) clipeffectseditor.set_clip(clip, track, range_in)
def tline_effect_drop(x, y): clip, track, index = tlinewidgets.get_clip_track_and_index_for_pos(x, y) if clip == None: return if track == None: return if track.id < 1 or track.id >= (len(current_sequence().tracks) - 1): return if dialogutils.track_lock_check_and_user_info(track): modesetting.set_default_edit_mode() return selected_track_before = movemodes.selected_track selected_in_before = movemodes.selected_range_in selected_out_before = movemodes.selected_range_out if clipeffectseditor.clip_is_being_edited(clip) == False: clipeffectseditor.set_clip(clip, track, index) clipeffectseditor.add_currently_selected_effect() # drag start selects the dragged effect filter_info = clipeffectseditor.get_currently_selected_filter_info() if selected_track_before != track.id: return if not((selected_in_before <= index) and (selected_out_before >= index)): return if selected_in_before != -1: for add_index in range(selected_in_before, selected_out_before + 1): if add_index == index: continue add_clip = track.clips[add_index] if add_clip.is_blanck_clip == True: continue data = {"clip":add_clip, "filter_info":filter_info, "filter_edit_done_func":clipeffectseditor.filter_edit_done_stack_update} action = edit.add_filter_action(data) action.do_edit()
def open_clip_in_effects_editor(data): clip, track, item_id, x = data frame = tlinewidgets.get_frame(x) index = current_sequence().get_clip_index(track, frame) clipeffectseditor.set_clip(clip, track, index)
def _move_mode_pressed(event, frame): """ User presses mouse when in a move mode. Initializes move mode edit action based on user action and state. """ x = event.x y = event.y global edit_data, pressed_on_selected, drag_disabled # Clear edit data in gui module edit_data = None drag_disabled = False tlinewidgets.set_edit_mode_data(edit_data) # Get pressed track track = tlinewidgets.get_track(y) # Selecting empty clears selection and prevents from setting edit data since we cannot have it. # Exitance of edit_data is also used to determine if we should enter box mode so we need to not have it if we're not hitting clip if track == None or track.id < 1 or track.id > len( current_sequence().tracks) - 2: # -2 because topmost hidden track clear_selected_clips() pressed_on_selected = False updater.repaint_tline() return # Get pressed clip index clip_index = current_sequence().get_clip_index(track, frame) # Selecting empty clears selection if clip_index == -1: clear_selected_clips() pressed_on_selected = False updater.repaint_tline() return # Check locking for pressed track if _track_is_locked(track): clear_selected_clips() pressed_on_selected = False updater.repaint_tline() return pressed_clip = track.clips[clip_index] # Handle pressed clip according to current selection state # Case: no selected clips, select single clip if selected_track == -1: if not pressed_clip.is_blanck_clip: select_clip(track.id, clip_index) if editorpersistance.prefs.single_click_effects_editor_load == True: clipeffectseditor.set_clip(pressed_clip, track, clip_index, False) pressed_on_selected = False else: # There may be multiple blank clips in area that for user # seems to a single blank area. All of these must be # selected together automatically or user will be exposed to # this impl. detail unnecesserarely. # THIS HAS BEEN CHANGED BECAUSE BLANKS ARE NOW AUTO CONSOLIDATED AFTER ALL EDITS. range_in, range_out = _get_blanck_range(track, clip_index) _select_multiple_clips(track.id, range_in, range_out) pressed_on_selected = False drag_disabled = True # case: CTRL or SHIFT down, combine selection with earlier selected clips elif ((event.get_state() & Gdk.ModifierType.CONTROL_MASK) or (event.get_state() & Gdk.ModifierType.SHIFT_MASK)): # CTRL pressing blank clears selection if pressed_clip.is_blanck_clip: clear_selected_clips() pressed_on_selected = False updater.repaint_tline() return # clip before range, make it start if clip_index < selected_range_in: _select_multiple_clips(track.id, clip_index, selected_range_out) pressed_on_selected = False # clip after range, make it end elif clip_index > selected_range_out: _select_multiple_clips(track.id, selected_range_in, clip_index) pressed_on_selected = False else: # Pressing on selected clip clears selection on release pressed_on_selected = True # case: new single clip pressed else: if selected_track != track.id: clear_selected_clips() select_clip(track.id, clip_index) if editorpersistance.prefs.single_click_effects_editor_load == True: clipeffectseditor.set_clip(pressed_clip, track, clip_index, False) pressed_on_selected = False else: if not pressed_clip.is_blanck_clip: # Pressing on selected clip keeps selection unchanged if clip_index < selected_range_in or clip_index > selected_range_out: select_clip(track.id, clip_index) if editorpersistance.prefs.single_click_effects_editor_load == True: clipeffectseditor.set_clip(pressed_clip, track, clip_index, False) pressed_on_selected = False # Pressing on non-selected clip clears current selection and selects newly selected clip else: pressed_on_selected = True else: # Black clip, see comment above range_in, range_out = _get_blanck_range(track, clip_index) _select_multiple_clips(track.id, range_in, range_out) pressed_on_selected = False drag_disabled = True # Get length info on selected clips clip_lengths = [] for i in range(selected_range_in, selected_range_out + 1): clip = track.clips[i] clip_lengths.append(clip.clip_out - clip.clip_in + 1) # Overwrite mode ignores this insert_frame = track.clip_start(selected_range_in) # Set edit mode data. This is not used unless mouse delta big enough # to initiate move. edit_data = { "track_id": track.id, "track_object": track, "to_track_object": track, "move_on": False, "press_frame": frame, # on timeline at mouse press "current_frame": frame, "first_clip_start": insert_frame, # on timeline at mouse press "insert_frame": insert_frame, "clip_lengths": clip_lengths, "mouse_start_x": x, "mouse_start_y": y, "selected_range_in": selected_range_in, # clip index "selected_range_out": selected_range_out } # clip index tlinewidgets.set_edit_mode_data(edit_data) updater.repaint_tline()