Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2013-03-26 19:00:56 +0400
committerTon Roosendaal <ton@blender.org>2013-03-26 19:00:56 +0400
commite1db5a050d2be78836a389705003595df29e1eb7 (patch)
tree71b98e86a05c32a949a61a26b47a3c377bb283e3 /source/blender/editors/space_sequencer
parentb4bd43e02283d5c2df07b49441a9de24f327736f (diff)
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).
Diffstat (limited to 'source/blender/editors/space_sequencer')
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c88
-rw-r--r--source/blender/editors/space_sequencer/sequencer_intern.h4
-rw-r--r--source/blender/editors/space_sequencer/sequencer_ops.c7
3 files changed, 92 insertions, 7 deletions
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index f0ed8d4107d..68362a1c6e4 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -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)
{
diff --git a/source/blender/editors/space_sequencer/sequencer_intern.h b/source/blender/editors/space_sequencer/sequencer_intern.h
index cd79c43eac2..4eb71c9fb09 100644
--- a/source/blender/editors/space_sequencer/sequencer_intern.h
+++ b/source/blender/editors/space_sequencer/sequencer_intern.h
@@ -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);
diff --git a/source/blender/editors/space_sequencer/sequencer_ops.c b/source/blender/editors/space_sequencer/sequencer_ops.c
index 70b288a59e6..7ddc5a77555 100644
--- a/source/blender/editors/space_sequencer/sequencer_ops.c
+++ b/source/blender/editors/space_sequencer/sequencer_ops.c
@@ -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);