Sequencer usability:
Brought back old tools "Remove Gap(s)" and "Insert Gap". It's actually one of the first tools I ever coded for it in 90ies, so useful! * Remove Gap(s) This checks if there's no strip at a given position, and slides all strips together to the left, until the gap is closed. - BackSpace key, remove gap at current frame (or first gap at right of frame) - SHIFT+BackSpace, remove all gaps at or to right of current frame. * Insert Gap Shifts all strips to right of current frame with 10 frames. (Amount can be set in Toolbar redo panel).
This commit is contained in:
@@ -284,6 +284,9 @@ class SEQUENCER_MT_strip(Menu):
|
||||
|
||||
layout.operator("transform.transform", text="Grab/Move").mode = 'TRANSLATION'
|
||||
layout.operator("transform.transform", text="Grab/Extend from frame").mode = 'TIME_EXTEND'
|
||||
layout.operator("sequencer.no_gap")
|
||||
layout.operator("sequencer.insert_gap")
|
||||
|
||||
# uiItemO(layout, NULL, 0, "sequencer.strip_snap"); // TODO - add this operator
|
||||
layout.separator()
|
||||
|
||||
|
||||
@@ -988,30 +988,104 @@ static void UNUSED_FUNCTION(seq_remap_paths) (Scene *scene)
|
||||
}
|
||||
|
||||
|
||||
static void UNUSED_FUNCTION(no_gaps) (Scene *scene)
|
||||
static int sequencer_no_gap_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
|
||||
int cfra, first = 0, done;
|
||||
|
||||
rctf rectf;
|
||||
int cfra, efra, sfra, first = 0, done;
|
||||
int do_all = RNA_boolean_get(op->ptr, "all");
|
||||
|
||||
if (ed == NULL) return;
|
||||
if (ed == NULL) return OPERATOR_CANCELLED;
|
||||
|
||||
for (cfra = CFRA; cfra <= EFRA; cfra++) {
|
||||
/* get first and last frame */
|
||||
boundbox_seq(scene, &rectf);
|
||||
sfra = (int)rectf.xmin;
|
||||
efra = (int)rectf.xmax;
|
||||
|
||||
/* first check if the current frame has a gap already */
|
||||
for (cfra = CFRA; cfra >= sfra; cfra--) {
|
||||
if (BKE_sequencer_evaluate_frame(scene, cfra)) {
|
||||
first = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for ( ; cfra < efra; cfra++) {
|
||||
/* first == 0 means there's still no strip to remove a gap for */
|
||||
if (first == 0) {
|
||||
if (BKE_sequencer_evaluate_frame(scene, cfra) ) first = 1;
|
||||
}
|
||||
else {
|
||||
else if (BKE_sequencer_evaluate_frame(scene, cfra) == 0) {
|
||||
done = TRUE;
|
||||
while (BKE_sequencer_evaluate_frame(scene, cfra) == 0) {
|
||||
done = insert_gap(scene, -1, cfra);
|
||||
if (done == 0) break;
|
||||
}
|
||||
if (done == 0) break;
|
||||
if (done == 0 || do_all == 0) break;
|
||||
}
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void SEQUENCER_OT_no_gap(struct wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name = "Remove Gap";
|
||||
ot->idname = "SEQUENCER_OT_no_gap";
|
||||
ot->description = "Remove gap at current frame to first strip at the right";
|
||||
|
||||
/* api callbacks */
|
||||
// ot->invoke = sequencer_snap_invoke;
|
||||
ot->exec = sequencer_no_gap_exec;
|
||||
ot->poll = sequencer_edit_poll;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
RNA_def_boolean(ot->srna, "all", 0, "All Gaps", "Do all gaps to right of current frame");
|
||||
}
|
||||
|
||||
static int sequencer_insert_gap_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
|
||||
int frames = RNA_int_get(op->ptr, "frames");
|
||||
|
||||
if (ed == NULL) return OPERATOR_CANCELLED;
|
||||
|
||||
insert_gap(scene, frames, CFRA);
|
||||
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
|
||||
}
|
||||
|
||||
void SEQUENCER_OT_insert_gap(struct wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name = "Insert Gap";
|
||||
ot->idname = "SEQUENCER_OT_insert_gap";
|
||||
ot->description = "Insert gap at current frame to first strips at the right";
|
||||
|
||||
/* api callbacks */
|
||||
// ot->invoke = sequencer_snap_invoke;
|
||||
ot->exec = sequencer_insert_gap_exec;
|
||||
ot->poll = sequencer_edit_poll;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
RNA_def_int(ot->srna, "frames", 10, 0, 1000, "Frames", "Frames to insert after current strip", 0, INT_MAX);
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
static int seq_get_snaplimit(View2D *v2d)
|
||||
{
|
||||
|
||||
@@ -97,7 +97,11 @@ void SEQUENCER_OT_images_separate(struct wmOperatorType *ot);
|
||||
void SEQUENCER_OT_meta_toggle(struct wmOperatorType *ot);
|
||||
void SEQUENCER_OT_meta_make(struct wmOperatorType *ot);
|
||||
void SEQUENCER_OT_meta_separate(struct wmOperatorType *ot);
|
||||
|
||||
void SEQUENCER_OT_no_gap(struct wmOperatorType *ot);
|
||||
void SEQUENCER_OT_insert_gap(struct wmOperatorType *ot);
|
||||
void SEQUENCER_OT_snap(struct wmOperatorType *ot);
|
||||
|
||||
void SEQUENCER_OT_strip_jump(struct wmOperatorType *ot);
|
||||
void SEQUENCER_OT_swap(struct wmOperatorType *ot);
|
||||
void SEQUENCER_OT_swap_data(struct wmOperatorType *ot);
|
||||
|
||||
@@ -72,6 +72,9 @@ void sequencer_operatortypes(void)
|
||||
WM_operatortype_append(SEQUENCER_OT_meta_toggle);
|
||||
WM_operatortype_append(SEQUENCER_OT_meta_make);
|
||||
WM_operatortype_append(SEQUENCER_OT_meta_separate);
|
||||
|
||||
WM_operatortype_append(SEQUENCER_OT_no_gap);
|
||||
WM_operatortype_append(SEQUENCER_OT_insert_gap);
|
||||
WM_operatortype_append(SEQUENCER_OT_snap);
|
||||
WM_operatortype_append(SEQUENCER_OT_strip_jump);
|
||||
WM_operatortype_append(SEQUENCER_OT_swap);
|
||||
@@ -213,6 +216,10 @@ void sequencer_keymap(wmKeyConfig *keyconf)
|
||||
RNA_enum_set(WM_keymap_add_item(keymap, "SEQUENCER_OT_swap", LEFTARROWKEY, KM_PRESS, KM_ALT, 0)->ptr, "side", SEQ_SIDE_LEFT);
|
||||
RNA_enum_set(WM_keymap_add_item(keymap, "SEQUENCER_OT_swap", RIGHTARROWKEY, KM_PRESS, KM_ALT, 0)->ptr, "side", SEQ_SIDE_RIGHT);
|
||||
|
||||
RNA_boolean_set(WM_keymap_add_item(keymap, "SEQUENCER_OT_no_gap", BACKSPACEKEY, KM_PRESS, 0, 0)->ptr, "all", FALSE);
|
||||
RNA_boolean_set(WM_keymap_add_item(keymap, "SEQUENCER_OT_no_gap", BACKSPACEKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "all", TRUE);
|
||||
WM_keymap_add_item(keymap, "SEQUENCER_OT_insert_gap", EQUALKEY, KM_PRESS, KM_SHIFT, 0);
|
||||
|
||||
WM_keymap_add_item(keymap, "SEQUENCER_OT_snap", SKEY, KM_PRESS, KM_SHIFT, 0);
|
||||
WM_keymap_add_item(keymap, "SEQUENCER_OT_swap_inputs", SKEY, KM_PRESS, KM_ALT, 0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user