diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-03-27 00:34:13 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-03-27 00:34:13 +0400 |
commit | 879e4fd9be91b590a9c15fc68bdb9850f6f15bb1 (patch) | |
tree | dfb5294520eed1400aa02e7c96b12a2a2eb234c7 /source/blender/editors/space_sequencer/sequencer_edit.c | |
parent | 166cdf8b5aaf5f36012f8d62a4882ec838bd5cb3 (diff) |
sequencer gaps
- remove unneeded checks (poll checks editor is non-null)
- use booleans
- rename operator SEQUENCER_OT_gap_remove, _gap_insert
also quiet shadow warning in rigidbody.c (shadowing 'loc')
Diffstat (limited to 'source/blender/editors/space_sequencer/sequencer_edit.c')
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_edit.c | 49 |
1 files changed, 22 insertions, 27 deletions
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 516ec6f3a0d..fb372a7b838 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -866,11 +866,11 @@ static int cut_seq_list(Scene *scene, ListBase *slist, int cutframe, return (seq_first_new != NULL); } -static int insert_gap(Scene *scene, int gap, int cfra) +static bool insert_gap(Scene *scene, int gap, int cfra) { Sequence *seq; Editing *ed = BKE_sequencer_editing_get(scene, FALSE); - int done = FALSE; + bool done = false; /* all strips >= cfra are shifted */ @@ -881,7 +881,7 @@ static int insert_gap(Scene *scene, int gap, int cfra) if (seq->startdisp >= cfra) { seq->start += gap; BKE_sequence_calc(scene, seq); - done = TRUE; + done = true; } } SEQ_END @@ -988,15 +988,13 @@ static void UNUSED_FUNCTION(seq_remap_paths) (Scene *scene) } -static int sequencer_no_gap_exec(bContext *C, wmOperator *op) +static int sequencer_gap_remove_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); - Editing *ed = BKE_sequencer_editing_get(scene, FALSE); rctf rectf; - int cfra, efra, sfra, first = 0, done; - int do_all = RNA_boolean_get(op->ptr, "all"); - - if (ed == NULL) return OPERATOR_CANCELLED; + int cfra, efra, sfra; + bool first = false, done; + bool do_all = RNA_boolean_get(op->ptr, "all"); /* get first and last frame */ boundbox_seq(scene, &rectf); @@ -1006,23 +1004,23 @@ static int sequencer_no_gap_exec(bContext *C, wmOperator *op) /* 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; + first = true; 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; + if (first == false) { + if (BKE_sequencer_evaluate_frame(scene, cfra) ) first = true; } else if (BKE_sequencer_evaluate_frame(scene, cfra) == 0) { - done = TRUE; + done = true; while (BKE_sequencer_evaluate_frame(scene, cfra) == 0) { done = insert_gap(scene, -1, cfra); - if (done == 0) break; + if (done == false) break; } - if (done == 0 || do_all == 0) break; + if (done == false || do_all == false) break; } } @@ -1033,16 +1031,16 @@ static int sequencer_no_gap_exec(bContext *C, wmOperator *op) } -void SEQUENCER_OT_no_gap(struct wmOperatorType *ot) +void SEQUENCER_OT_gap_remove(struct wmOperatorType *ot) { /* identifiers */ - ot->name = "Remove Gap"; - ot->idname = "SEQUENCER_OT_no_gap"; + ot->name = "Remove Gaps"; + ot->idname = "SEQUENCER_OT_gap_remove"; 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->exec = sequencer_gap_remove_exec; ot->poll = sequencer_edit_poll; /* flags */ @@ -1051,14 +1049,11 @@ void SEQUENCER_OT_no_gap(struct wmOperatorType *ot) 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) +static int sequencer_gap_insert_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); @@ -1067,16 +1062,16 @@ static int sequencer_insert_gap_exec(bContext *C, wmOperator *op) } -void SEQUENCER_OT_insert_gap(struct wmOperatorType *ot) +void SEQUENCER_OT_gap_insert(struct wmOperatorType *ot) { /* identifiers */ - ot->name = "Insert Gap"; - ot->idname = "SEQUENCER_OT_insert_gap"; + ot->name = "Insert Gaps"; + ot->idname = "SEQUENCER_OT_gap_insert"; 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->exec = sequencer_gap_insert_exec; ot->poll = sequencer_edit_poll; /* flags */ |