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 sync_compositor(compositor): 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 # Auto fades need to go to start or end of clips and maintain their lengths if compositor.transition.info.auto_fade_compositor == True: if compositor.transition.info.name == "##auto_fade_in": clip_end = clip_start + compositor.get_length() - 1 else: clip_start = clip_end - compositor.get_length() + 1 data = { "compositor": compositor, "clip_in": clip_start, "clip_out": clip_end } action = edit.move_compositor_action(data) action.do_edit()
def sync_all_compositors(): # Pair all compositors with their origin clips and clip data comp_clip_pairings = {} for compositor in current_sequence().compositors: comp_clip_pairings[compositor.origin_clip_id] = compositor for i in range(current_sequence().first_video_index, len(current_sequence().tracks) - 1): # -1, there is a topmost hidden track track = current_sequence().tracks[i] # b_track is source track where origin clip is for j in range(0, len(track.clips)): clip = track.clips[j] if clip.id in comp_clip_pairings: compositor = comp_clip_pairings[clip.id] comp_clip_pairings[clip.id] = (clip, track, j, compositor) # Do sync for origin_clip_id in comp_clip_pairings: try: clip, track, clip_index, compositor = comp_clip_pairings[origin_clip_id] clip_start = track.clip_start(clip_index) clip_end = clip_start + clip.clip_out - clip.clip_in data = {"compositor":compositor,"clip_in":clip_start,"clip_out":clip_end} action = edit.move_compositor_action(data) action.do_edit() except: # Clip is probably already deleted pass
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 sync_all_compositors(): # Pair all compositors with their origin clips and clip data comp_clip_pairings = {} for compositor in current_sequence().compositors: comp_clip_pairings[compositor.origin_clip_id] = compositor for i in range(current_sequence().first_video_index, len(current_sequence().tracks) - 1): # -1, there is a topmost hidden track track = current_sequence().tracks[ i] # b_track is source track where origin clip is for j in range(0, len(track.clips)): clip = track.clips[j] if clip.id in comp_clip_pairings: compositor = comp_clip_pairings[clip.id] comp_clip_pairings[clip.id] = (clip, track, j, compositor) # Do sync for origin_clip_id in comp_clip_pairings: try: clip, track, clip_index, compositor = comp_clip_pairings[ origin_clip_id] clip_start = track.clip_start(clip_index) clip_end = clip_start + clip.clip_out - clip.clip_in data = { "compositor": compositor, "clip_in": clip_start, "clip_out": clip_end } action = edit.move_compositor_action(data) action.do_edit() except: # Clip is probably already deleted pass
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 sync_all_compositors(): # Pair all compositors with their origin clips ids comp_clip_pairings = {} for compositor in current_sequence().compositors: if compositor.origin_clip_id in comp_clip_pairings: comp_clip_pairings[compositor.origin_clip_id].append(compositor) else: comp_clip_pairings[compositor.origin_clip_id] = [compositor] # Create resync list resync_list = [] for i in range(current_sequence().first_video_index, len(current_sequence().tracks) - 1): # -1, there is a topmost hidden track track = current_sequence().tracks[ i] # b_track is source track where origin clip is for j in range(0, len(track.clips)): clip = track.clips[j] if clip.id in comp_clip_pairings: compositor_list = comp_clip_pairings[clip.id] for compositor in compositor_list: resync_list.append((clip, track, j, compositor)) # Do sync for resync_item in resync_list: try: clip, track, clip_index, compositor = resync_item clip_start = track.clip_start(clip_index) clip_end = clip_start + clip.clip_out - clip.clip_in # Auto fades need to go to start or end of clips and maintain their lengths if compositor.transition.info.auto_fade_compositor == True: if compositor.transition.info.name == "##auto_fade_in": clip_end = clip_start + compositor.get_length() - 1 else: clip_start = clip_end - compositor.get_length() + 1 data = { "compositor": compositor, "clip_in": clip_start, "clip_out": clip_end } action = edit.move_compositor_action(data) action.do_edit() except: # Clip is probably deleted pass
def sync_compositor(compositor): 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()