diff options
Diffstat (limited to 'source/blender/editors/space_sequencer/sequencer_edit.c')
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_edit.c | 617 |
1 files changed, 296 insertions, 321 deletions
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 3d9de1f567c..c2ffb2f55c2 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -52,7 +52,7 @@ #include "RNA_define.h" #include "RNA_enum_types.h" -/* for menu/popup icons etc etc*/ +/* For menu, popup, icons, etc. */ #include "ED_anim_api.h" #include "ED_numinput.h" @@ -67,11 +67,11 @@ #include "DEG_depsgraph.h" #include "DEG_depsgraph_build.h" -/* own include */ +/* Own include. */ #include "sequencer_intern.h" /* XXX */ -/* RNA Enums, used in multiple files */ +/* RNA Enums, used in multiple files. */ EnumPropertyItem sequencer_prop_effect_types[] = { {SEQ_TYPE_CROSS, "CROSS", 0, "Crossfade", "Crossfade effect strip type"}, {SEQ_TYPE_ADD, "ADD", 0, "Add", "Add effect strip type"}, @@ -94,8 +94,6 @@ EnumPropertyItem sequencer_prop_effect_types[] = { {0, NULL, 0, NULL, NULL}, }; -/* mute operator */ - #define SEQ_SIDE_MOUSE -1 EnumPropertyItem prop_side_types[] = { @@ -144,7 +142,7 @@ static void proxy_freejob(void *pjv) MEM_freeN(pj); } -/* only this runs inside thread */ +/* Only this runs inside thread. */ static void proxy_startjob(void *pjv, short *stop, short *do_update, float *progress) { ProxyJob *pj = pjv; @@ -291,7 +289,7 @@ static int mouse_frame_side(View2D *v2d, short mouse_x, int frame) mval[0] = mouse_x; mval[1] = 0; - /* choose the side based on which side of the playhead the mouse is on */ + /* Choose the side based on which side of the playhead the mouse is on. */ UI_view2d_region_to_view(v2d, mval[0], mval[1], &mouseloc[0], &mouseloc[1]); return mouseloc[0] > frame ? SEQ_SIDE_RIGHT : SEQ_SIDE_LEFT; @@ -299,7 +297,7 @@ static int mouse_frame_side(View2D *v2d, short mouse_x, int frame) Sequence *find_neighboring_sequence(Scene *scene, Sequence *test, int lr, int sel) { - /* sel - 0==unselected, 1==selected, -1==done care*/ + /* sel: 0==unselected, 1==selected, -1==don't care. */ Sequence *seq; Editing *ed = BKE_sequencer_editing_get(scene, false); @@ -334,7 +332,7 @@ Sequence *find_neighboring_sequence(Scene *scene, Sequence *test, int lr, int se static Sequence *find_next_prev_sequence(Scene *scene, Sequence *test, int lr, int sel) { - /* sel - 0==unselected, 1==selected, -1==done care*/ + /* sel: 0==unselected, 1==selected, -1==don't care. */ Sequence *seq, *best_seq = NULL; Editing *ed = BKE_sequencer_editing_get(scene, false); @@ -375,7 +373,7 @@ static Sequence *find_next_prev_sequence(Scene *scene, Sequence *test, int lr, i } seq = seq->next; } - return best_seq; /* can be null */ + return best_seq; /* Can be null. */ } Sequence *find_nearest_seq(Scene *scene, View2D *v2d, int *hand, const int mval[2]) @@ -400,22 +398,21 @@ Sequence *find_nearest_seq(Scene *scene, View2D *v2d, int *hand, const int mval[ while (seq) { if (seq->machine == (int)y) { - /* check for both normal strips, and strips that have been flipped horizontally */ + /* Check for both normal strips, and strips that have been flipped horizontally. */ if (((seq->startdisp < seq->enddisp) && (seq->startdisp <= x && seq->enddisp >= x)) || ((seq->startdisp > seq->enddisp) && (seq->startdisp >= x && seq->enddisp <= x))) { if (BKE_sequence_tx_test(seq)) { - /* clamp handles to defined size in pixel space */ - + /* Clamp handles to defined size in pixel space. */ handsize = 2.0f * sequence_handle_size_get_clamped(seq, pixelx); displen = (float)abs(seq->startdisp - seq->enddisp); - /* don't even try to grab the handles of small strips */ + /* Don't even try to grab the handles of small strips. */ if (displen / pixelx > 16) { + /* Set the max value to handle to 1/3 of the total len when its * less than 28. This is important because otherwise selecting * handles happens even when you click in the middle. */ - if ((displen / 3) < 30 * pixelx) { handsize = displen / 3; } @@ -510,7 +507,6 @@ void recurs_sel_seq(Sequence *seqm) bool ED_space_sequencer_maskedit_mask_poll(bContext *C) { - /* in this case both funcs are the same, for clip editor not */ return ED_space_sequencer_maskedit_poll(C); } @@ -535,7 +531,7 @@ bool ED_space_sequencer_maskedit_poll(bContext *C) return false; } -/* are we displaying the seq output (not channels or histogram)*/ +/* Are we displaying the seq output (not channels or histogram). */ bool ED_space_sequencer_check_show_imbuf(SpaceSeq *sseq) { return (ELEM(sseq->view, SEQ_VIEW_PREVIEW, SEQ_VIEW_SEQUENCE_PREVIEW) && @@ -589,8 +585,8 @@ int seq_effect_find_selected(Scene *scene, } } - /* make sequence selection a little bit more intuitive - * for 3 strips: the last-strip should be sequence3 */ + /* Make sequence selection a little bit more intuitive + * for 3 strips: the last-strip should be seq3. */ if (seq3 != NULL && seq2 != NULL) { Sequence *tmp = seq2; seq2 = seq3; @@ -600,7 +596,7 @@ int seq_effect_find_selected(Scene *scene, switch (BKE_sequence_effect_get_num_inputs(type)) { case 0: *r_selseq1 = *r_selseq2 = *r_selseq3 = NULL; - return 1; /* success */ + return 1; /* Success. */ case 1: if (seq2 == NULL) { *r_error_str = N_("At least one selected sequence strip is needed"); @@ -640,8 +636,8 @@ static Sequence *del_seq_find_replace_recurs(Scene *scene, Sequence *seq) { Sequence *seq1, *seq2, *seq3; - /* try to find a replacement input sequence, and flag for later deletion if - * no replacement can be found */ + /* Try to find a replacement input sequence, and flag for later deletion if + * no replacement can be found. */ if (!seq) { return NULL; @@ -650,13 +646,13 @@ static Sequence *del_seq_find_replace_recurs(Scene *scene, Sequence *seq) return ((seq->flag & SELECT) ? NULL : seq); } else if (!(seq->flag & SELECT)) { - /* try to find replacement for effect inputs */ + /* Try to find replacement for effect inputs. */ seq1 = del_seq_find_replace_recurs(scene, seq->seq1); seq2 = del_seq_find_replace_recurs(scene, seq->seq2); seq3 = del_seq_find_replace_recurs(scene, seq->seq3); if (seq1 == seq->seq1 && seq2 == seq->seq2 && seq3 == seq->seq3) { - /* pass */ + /* Pass. */ } else if (seq1 || seq2 || seq3) { seq->seq1 = (seq1) ? seq1 : (seq2) ? seq2 : seq3; @@ -666,7 +662,7 @@ static Sequence *del_seq_find_replace_recurs(Scene *scene, Sequence *seq) BKE_sequencer_update_changed_seq_and_deps(scene, seq, 1, 1); } else { - seq->flag |= SELECT; /* mark for delete */ + seq->flag |= SELECT; /* Mark for delete. */ } } @@ -740,7 +736,7 @@ static Sequence *split_seq_hard( /* Unlike soft-split, it's important to use the same value for both strips. */ const bool is_end_exact = ((seq->start + seq->len) == split_frame); - /* backup values */ + /* Backup values. */ ts.start = seq->start; ts.machine = seq->machine; ts.startstill = seq->startstill; @@ -753,21 +749,19 @@ static Sequence *split_seq_hard( ts.anim_endofs = seq->anim_endofs; ts.len = seq->len; - /* First Strip! */ - /* strips with extended stillfames before */ - - /* Precaution, needed because the length saved on-disk may not match the length saved in the - * blend file, or our code may have minor differences reading file length between versions. - * This causes hard-split to fail, see: T47862 */ if (seq->type != SEQ_TYPE_META) { + /* Precaution, needed because the length saved on-disk may not match the length saved in the + * blend file, or our code may have minor differences reading file length between versions. + * This causes hard-split to fail, see: T47862. */ BKE_sequence_reload_new_file(bmain, scene, seq, true); BKE_sequence_calc(scene, seq); } + /* First Strip. */ /* Important to offset the start when 'split_frame == seq->start' * because we need at least one frame of content after start/end still have clipped it. */ if ((seq->startstill) && (split_frame <= seq->start)) { - /* don't do funny things with METAs ... */ + /* Don't do funny things with METAs. */ if (seq->type == SEQ_TYPE_META) { skip_dup = true; seq->startstill = seq->start - split_frame; @@ -779,18 +773,18 @@ static Sequence *split_seq_hard( seq->endstill = 0; } } - /* normal strip */ + /* Normal strip. */ else if ((is_end_exact == false) && ((split_frame >= seq->start) && (split_frame <= (seq->start + seq->len)))) { seq->endofs = 0; seq->endstill = 0; seq->anim_endofs += (seq->start + seq->len) - split_frame; } - /* strips with extended stillframes after */ + /* Strips with extended stillframes. */ else if ((is_end_exact == true) || (((seq->start + seq->len) < split_frame) && (seq->endstill))) { seq->endstill -= seq->enddisp - split_frame; - /* don't do funny things with METAs ... */ + /* Don't do funny things with METAs. */ if (seq->type == SEQ_TYPE_META) { skip_dup = true; } @@ -800,7 +794,7 @@ static Sequence *split_seq_hard( BKE_sequence_calc(scene, seq); if (!skip_dup) { - /* Duplicate AFTER the first change */ + /* Duplicate AFTER the first change. */ seqn = BKE_sequence_dupli_recursive( scene, scene, new_seq_list, seq, SEQ_DUPE_UNIQUE_NAME | SEQ_DUPE_ANIM); } @@ -808,12 +802,11 @@ static Sequence *split_seq_hard( if (seqn) { seqn->flag |= SELECT; - /* Important not to re-assign this (unlike soft-split) */ #if 0 is_end_exact = ((seqn->start + seqn->len) == split_frame); #endif - /* Second Strip! */ - /* strips with extended stillframes before */ + /* Second Strip. */ + /* strips with extended stillframes. */ if ((seqn->startstill) && (split_frame == seqn->start + 1)) { seqn->start = ts.start; seqn->startstill = ts.start - split_frame; @@ -821,7 +814,7 @@ static Sequence *split_seq_hard( seqn->endstill = ts.endstill; } - /* normal strip */ + /* Normal strip. */ else if ((is_end_exact == false) && ((split_frame >= seqn->start) && (split_frame <= (seqn->start + seqn->len)))) { seqn->start = split_frame; @@ -833,7 +826,7 @@ static Sequence *split_seq_hard( seqn->endstill = ts.endstill; } - /* strips with extended stillframes after */ + /* Strips with extended stillframes after. */ else if ((is_end_exact == true) || (((seqn->start + seqn->len) < split_frame) && (seqn->endstill))) { seqn->start = split_frame; @@ -858,7 +851,7 @@ static Sequence *split_seq_soft( bool is_end_exact = ((seq->start + seq->len) == split_frame); - /* backup values */ + /* Backup values. */ ts.start = seq->start; ts.machine = seq->machine; ts.startstill = seq->startstill; @@ -871,9 +864,8 @@ static Sequence *split_seq_soft( ts.anim_endofs = seq->anim_endofs; ts.len = seq->len; - /* First Strip! */ - /* strips with extended stillfames before */ - + /* First Strip. */ + /* Strips with extended stillfames. */ /* Important to offset the start when 'split_frame == seq->start' * because we need at least one frame of content after start/end still have clipped it. */ if ((seq->startstill) && (split_frame <= seq->start)) { @@ -889,16 +881,16 @@ static Sequence *split_seq_soft( seq->endstill = 0; } } - /* normal strip */ + /* Normal strip. */ else if ((is_end_exact == false) && (split_frame >= seq->start) && (split_frame <= (seq->start + seq->len))) { seq->endofs = (seq->start + seq->len) - split_frame; } - /* strips with extended stillframes after */ + /* Strips with extended stillframes. */ else if ((is_end_exact == true) || (((seq->start + seq->len) < split_frame) && (seq->endstill))) { seq->endstill -= seq->enddisp - split_frame; - /* don't do funny things with METAs ... */ + /* Don't do funny things with METAs. */ if (seq->type == SEQ_TYPE_META) { skip_dup = true; } @@ -907,7 +899,7 @@ static Sequence *split_seq_soft( BKE_sequence_calc(scene, seq); if (!skip_dup) { - /* Duplicate AFTER the first change */ + /* Duplicate AFTER the first change. */ seqn = BKE_sequence_dupli_recursive( scene, scene, new_seq_list, seq, SEQ_DUPE_UNIQUE_NAME | SEQ_DUPE_ANIM); } @@ -917,8 +909,8 @@ static Sequence *split_seq_soft( is_end_exact = ((seqn->start + seqn->len) == split_frame); - /* Second Strip! */ - /* strips with extended stillframes before */ + /* Second Strip. */ + /* Strips with extended stillframes. */ if ((seqn->startstill) && (split_frame == seqn->start + 1)) { seqn->start = ts.start; seqn->startstill = ts.start - split_frame; @@ -926,7 +918,7 @@ static Sequence *split_seq_soft( seqn->endstill = ts.endstill; } - /* normal strip */ + /* Normal strip. */ else if ((is_end_exact == false) && (split_frame >= seqn->start) && (split_frame <= (seqn->start + seqn->len))) { seqn->startstill = 0; @@ -935,7 +927,7 @@ static Sequence *split_seq_soft( seqn->endstill = ts.endstill; } - /* strips with extended stillframes after */ + /* Strips with extended stillframes. */ else if ((is_end_exact == true) || (((seqn->start + seqn->len) < split_frame) && (seqn->endstill))) { seqn->start = split_frame - ts.len + 1; @@ -949,12 +941,12 @@ static Sequence *split_seq_soft( return seqn; } -/* like duplicate, but only duplicate and split overlapping strips, +/* Like duplicate, but only duplicate and split overlapping strips, * strips to the left of the split_frame are ignored and strips to the right - * are moved to the end of slist - * we have to work on the same slist (not using a separate list), since + * are moved to the end of slist. + * We have to work on the same slist (not using a separate list), since * otherwise dupli_seq can't check for duplicate names properly and - * may generate strips with the same name (which will mess up animdata) + * may generate strips with the same name which will mess up animdata. */ static bool split_seq_list( @@ -973,7 +965,7 @@ static bool split_seq_list( seq = slist->first; while (seq && seq != seq_first_new) { - seq_next_iter = seq->next; /* we need this because we may remove seq */ + seq_next_iter = seq->next; /* We need this because we may remove seq. */ seq->tmp = NULL; if (use_cursor_position) { if (seq->machine == channel && seq->startdisp < split_frame && seq->enddisp > split_frame) { @@ -996,10 +988,10 @@ static bool split_seq_list( } } else if (seq->enddisp <= split_frame) { - /* do nothing */ + /* Pass. */ } else if (seq->startdisp >= split_frame) { - /* move to tail */ + /* Move to tail. */ BLI_remlink(slist, seq); BLI_addtail(slist, seq); @@ -1022,7 +1014,7 @@ static bool sequence_offset_after_frame(Scene *scene, const int delta, const int bool done = false; TimeMarker *marker; - /* all strips >= cfra are shifted */ + /* All strips >= cfra are shifted. */ if (ed == NULL) { return 0; @@ -1085,12 +1077,12 @@ static void UNUSED_FUNCTION(seq_remap_paths)(Scene *scene) } BLI_strncpy(from, last_seq->strip->dir, sizeof(from)); - // XXX if (0 == sbutton(from, 0, sizeof(from) - 1, "From: ")) - // return; + /* XXX if (0 == sbutton(from, 0, sizeof(from) - 1, "From: ")) + * return; */ BLI_strncpy(to, from, sizeof(to)); - // XXX if (0 == sbutton(to, 0, sizeof(to) - 1, "To: ")) - // return; + /* XXX if (0 == sbutton(to, 0, sizeof(to) - 1, "To: ")) + * return; */ if (STREQ(to, from)) { return; @@ -1101,11 +1093,11 @@ static void UNUSED_FUNCTION(seq_remap_paths)(Scene *scene) if (STREQLEN(seq->strip->dir, from, strlen(from))) { printf("found %s\n", seq->strip->dir); - /* strip off the beginning */ + /* Strip off the beginning. */ stripped[0] = 0; BLI_strncpy(stripped, seq->strip->dir + strlen(from), FILE_MAX); - /* new path */ + /* New path. */ BLI_snprintf(seq->strip->dir, sizeof(seq->strip->dir), "%s%s", to, stripped); printf("new %s\n", seq->strip->dir); } @@ -1122,12 +1114,12 @@ static int sequencer_gap_remove_exec(bContext *C, wmOperator *op) bool first = false, done; bool do_all = RNA_boolean_get(op->ptr, "all"); - /* get first and last frame */ + /* 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 */ + /* Check if the current frame has a gap already. */ for (cfra = CFRA; cfra >= sfra; cfra--) { if (BKE_sequencer_evaluate_frame(scene, cfra)) { first = true; @@ -1136,7 +1128,7 @@ static int sequencer_gap_remove_exec(bContext *C, wmOperator *op) } for (; cfra < efra; cfra++) { - /* first == 0 means there's still no strip to remove a gap for */ + /* There's still no strip to remove a gap for. */ if (first == false) { if (BKE_sequencer_evaluate_frame(scene, cfra)) { first = true; @@ -1164,19 +1156,19 @@ static int sequencer_gap_remove_exec(bContext *C, wmOperator *op) void SEQUENCER_OT_gap_remove(struct wmOperatorType *ot) { - /* identifiers */ + /* Identifiers. */ ot->name = "Remove Gaps"; ot->idname = "SEQUENCER_OT_gap_remove"; ot->description = "Remove gap at current frame to first strip at the right, independent of selection or " "locked state of strips"; - /* api callbacks */ + /* Api callbacks. */ // ot->invoke = sequencer_snap_invoke; ot->exec = sequencer_gap_remove_exec; ot->poll = sequencer_edit_poll; - /* flags */ + /* Flags. */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; RNA_def_boolean(ot->srna, "all", 0, "All Gaps", "Do all gaps to right of current frame"); @@ -1196,19 +1188,19 @@ static int sequencer_gap_insert_exec(bContext *C, wmOperator *op) void SEQUENCER_OT_gap_insert(struct wmOperatorType *ot) { - /* identifiers */ + /* Identifiers. */ ot->name = "Insert Gaps"; ot->idname = "SEQUENCER_OT_gap_insert"; ot->description = "Insert gap at current frame to first strips at the right, independent of selection or " "locked state of strips"; - /* api callbacks */ + /* Api callbacks. */ // ot->invoke = sequencer_snap_invoke; ot->exec = sequencer_gap_insert_exec; ot->poll = sequencer_edit_poll; - /* flags */ + /* Flags. */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; RNA_def_int(ot->srna, @@ -1238,7 +1230,7 @@ static int seq_get_snaplimit(View2D *v2d) } #endif -/* Operator functions */ +/* Operator functions. */ bool sequencer_edit_poll(bContext *C) { return (BKE_sequencer_editing_get(CTX_data_scene(C), false) != NULL); @@ -1282,7 +1274,7 @@ bool sequencer_view_strips_poll(bContext *C) return 0; } -/* snap operator*/ +/* Snap operator. */ static int sequencer_snap_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); @@ -1293,14 +1285,11 @@ static int sequencer_snap_exec(bContext *C, wmOperator *op) snap_frame = RNA_int_get(op->ptr, "frame"); - /* also check metas */ + /* Check metas. */ for (seq = ed->seqbasep->first; seq; seq = seq->next) { if (seq->flag & SELECT && !(seq->depth == 0 && seq->flag & SEQ_LOCK) && BKE_sequence_tx_test(seq)) { if ((seq->flag & (SEQ_LEFTSEL + SEQ_RIGHTSEL)) == 0) { - /* simple but no anim update */ - /* seq->start = snap_frame-seq->startofs+seq->startstill; */ - BKE_sequence_translate( scene, seq, (snap_frame - seq->startofs + seq->startstill) - seq->start); } @@ -1318,8 +1307,8 @@ static int sequencer_snap_exec(bContext *C, wmOperator *op) } } - /* test for effects and overlap - * don't use SEQP_BEGIN since that would be recursive */ + /* Test for effects and overlap. + * Don't use SEQP_BEGIN since that would be recursive. */ for (seq = ed->seqbasep->first; seq; seq = seq->next) { if (seq->flag & SELECT && !(seq->depth == 0 && seq->flag & SEQ_LOCK)) { seq->flag &= ~SEQ_OVERLAP; @@ -1340,7 +1329,6 @@ static int sequencer_snap_exec(bContext *C, wmOperator *op) } } - /* as last: */ BKE_sequencer_sort(scene); DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); @@ -1363,17 +1351,17 @@ static int sequencer_snap_invoke(bContext *C, wmOperator *op, const wmEvent *UNU void SEQUENCER_OT_snap(struct wmOperatorType *ot) { - /* identifiers */ + /* Identifiers. */ ot->name = "Snap Strips to Playhead"; ot->idname = "SEQUENCER_OT_snap"; ot->description = "Frame where selected strips will be snapped"; - /* api callbacks */ + /* Api callbacks. */ ot->invoke = sequencer_snap_invoke; ot->exec = sequencer_snap_exec; ot->poll = sequencer_edit_poll; - /* flags */ + /* Flags. */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; RNA_def_int(ot->srna, @@ -1395,7 +1383,7 @@ typedef struct SlipData { bool *trim; int num_seq; bool slow; - int slow_offset; /* offset at the point where offset was turned on */ + int slow_offset; /* Offset at the point where offset was turned on. */ NumInput num_input; } SlipData; @@ -1442,7 +1430,7 @@ static int slip_add_sequences_recursive( num_items++; if (seq->type == SEQ_TYPE_META) { - /* trim the sub-sequences */ + /* Trim the sub-sequences. */ num_items += slip_add_sequences_recursive( &seq->seqbase, seq_array, trim, num_items + offset, false); } @@ -1465,7 +1453,7 @@ static int slip_count_sequences_recursive(ListBase *seqbasep, bool first_level) trimmed_sequences++; if (seq->type == SEQ_TYPE_META) { - /* trim the sub-sequences */ + /* Trim the sub-sequences. */ trimmed_sequences += slip_count_sequences_recursive(&seq->seqbase, false); } } @@ -1483,7 +1471,7 @@ static int sequencer_slip_invoke(bContext *C, wmOperator *op, const wmEvent *eve int num_seq, i; View2D *v2d = UI_view2d_fromcontext(C); - /* first recursively count the trimmed elements */ + /* Recursively count the trimmed elements. */ num_seq = slip_count_sequences_recursive(ed->seqbasep, true); if (num_seq == 0) { @@ -1517,7 +1505,7 @@ static int sequencer_slip_invoke(bContext *C, wmOperator *op, const wmEvent *eve WM_event_add_modal_handler(C, op); - /* notify so we draw extensions immediately */ + /* Notify so we draw extensions immediately. */ WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); return OPERATOR_RUNNING_MODAL; @@ -1529,20 +1517,19 @@ static bool sequencer_slip_recursively(Scene *scene, SlipData *data, int offset) Editing *ed = BKE_sequencer_editing_get(scene, false); bool changed = false; - /* We iterate in reverse so meta-strips are iterated after their children. */ + /* Iterate in reverse so meta-strips are iterated after their children. */ for (int i = data->num_seq - 1; i >= 0; i--) { Sequence *seq = data->seq_array[i]; int endframe; - /* We have the offset, apply the values to the sequence strips. */ - /* first, do the offset */ + /* Offset seq start. */ seq->start = data->ts[i].start + offset; if (data->trim[i]) { /* Find the end-frame. */ endframe = seq->start + seq->len; - /* Now compute the sequence offsets. */ + /* Compute the sequence offsets. */ if (endframe > seq->enddisp) { seq->endstill = 0; seq->endofs = endframe - seq->enddisp; @@ -1566,7 +1553,7 @@ static bool sequencer_slip_recursively(Scene *scene, SlipData *data, int offset) } } else { - /* If no real trim, don't change the data, rather transform the strips themselves. */ + /* No transform data (likely effect strip). Only move start and end. */ seq->startdisp = data->ts[i].startdisp + offset; seq->enddisp = data->ts[i].enddisp + offset; changed = true; @@ -1575,7 +1562,7 @@ static bool sequencer_slip_recursively(Scene *scene, SlipData *data, int offset) /* Effects are only added if we they are in a meta-strip. * In this case, dependent strips will just be transformed and * we can skip calculating for effects. - * This way we can avoid an extra loop just for effects*/ + * This way we can avoid an extra loop just for effects. */ if (!(seq->type & SEQ_TYPE_EFFECT)) { BKE_sequence_calc(scene, seq); } @@ -1595,7 +1582,7 @@ static int sequencer_slip_exec(bContext *C, wmOperator *op) int offset = RNA_int_get(op->ptr, "offset"); bool success = false; - /* first recursively count the trimmed elements */ + /* Recursively count the trimmed elements. */ num_seq = slip_count_sequences_recursive(ed->seqbasep, true); if (num_seq == 0) { @@ -1658,7 +1645,7 @@ static int sequencer_slip_modal(bContext *C, wmOperator *op, const wmEvent *even const bool has_numInput = hasNumInput(&data->num_input); bool handled = true; - /* Modal numinput active, try to handle numeric inputs first... */ + /* Modal numinput active, try to handle numeric inputs. */ if (event->val == KM_PRESS && has_numInput && handleNumInput(C, &data->num_input, event)) { float offset; applyNumInput(&data->num_input, &offset); @@ -1691,7 +1678,7 @@ static int sequencer_slip_modal(bContext *C, wmOperator *op, const wmEvent *even mouse_x = event->mval[0]; } - /* choose the side based on which side of the playhead the mouse is on */ + /* Choose the side based on which side of the playhead the mouse is. */ UI_view2d_region_to_view(v2d, mouse_x, 0, &mouseloc[0], &mouseloc[1]); offset = mouseloc[0] - data->init_mouseloc[0]; @@ -1772,7 +1759,7 @@ static int sequencer_slip_modal(bContext *C, wmOperator *op, const wmEvent *even break; } - /* Modal numinput inactive, try to handle numeric inputs last... */ + /* Modal numinput inactive, try to handle numeric inputs. */ if (!handled && event->val == KM_PRESS && handleNumInput(C, &data->num_input, event)) { float offset; applyNumInput(&data->num_input, &offset); @@ -1791,18 +1778,18 @@ static int sequencer_slip_modal(bContext *C, wmOperator *op, const wmEvent *even void SEQUENCER_OT_slip(struct wmOperatorType *ot) { - /* identifiers */ + /* Identifiers. */ ot->name = "Trim Strips"; ot->idname = "SEQUENCER_OT_slip"; ot->description = "Trim the contents of the active strip"; - /* api callbacks */ + /* Api callbacks. */ ot->invoke = sequencer_slip_invoke; ot->modal = sequencer_slip_modal; ot->exec = sequencer_slip_exec; ot->poll = sequencer_edit_poll; - /* flags */ + /* Flags. */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; RNA_def_int(ot->srna, @@ -1816,7 +1803,7 @@ void SEQUENCER_OT_slip(struct wmOperatorType *ot) INT32_MAX); } -/* mute operator */ +/* Mute operator. */ static int sequencer_mute_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); @@ -1828,7 +1815,7 @@ static int sequencer_mute_exec(bContext *C, wmOperator *op) for (seq = ed->seqbasep->first; seq; seq = seq->next) { if ((seq->flag & SEQ_LOCK) == 0) { - if (selected) { /* mute unselected */ + if (selected) { if (seq->flag & SELECT) { seq->flag |= SEQ_MUTE; BKE_sequence_invalidate_dependent(scene, seq); @@ -1851,23 +1838,23 @@ static int sequencer_mute_exec(bContext *C, wmOperator *op) void SEQUENCER_OT_mute(struct wmOperatorType *ot) { - /* identifiers */ + /* Identifiers. */ ot->name = "Mute Strips"; ot->idname = "SEQUENCER_OT_mute"; ot->description = "Mute (un)selected strips"; - /* api callbacks */ + /* Api callbacks. */ ot->exec = sequencer_mute_exec; ot->poll = sequencer_edit_poll; - /* flags */ + /* Flags. */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; RNA_def_boolean( ot->srna, "unselected", 0, "Unselected", "Mute unselected rather than selected strips"); } -/* unmute operator */ +/* Unmute operator. */ static int sequencer_unmute_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); @@ -1879,7 +1866,7 @@ static int sequencer_unmute_exec(bContext *C, wmOperator *op) for (seq = ed->seqbasep->first; seq; seq = seq->next) { if ((seq->flag & SEQ_LOCK) == 0) { - if (selected) { /* unmute unselected */ + if (selected) { if (seq->flag & SELECT) { seq->flag &= ~SEQ_MUTE; BKE_sequence_invalidate_dependent(scene, seq); @@ -1902,23 +1889,23 @@ static int sequencer_unmute_exec(bContext *C, wmOperator *op) void SEQUENCER_OT_unmute(struct wmOperatorType *ot) { - /* identifiers */ + /* Identifiers. */ ot->name = "Unmute Strips"; ot->idname = "SEQUENCER_OT_unmute"; ot->description = "Unmute (un)selected strips"; - /* api callbacks */ + /* Api callbacks. */ ot->exec = sequencer_unmute_exec; ot->poll = sequencer_edit_poll; - /* flags */ + /* Flags. */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; RNA_def_boolean( ot->srna, "unselected", 0, "Unselected", "Unmute unselected rather than selected strips"); } -/* lock operator */ +/* Lock operator. */ static int sequencer_lock_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene = CTX_data_scene(C); @@ -1938,20 +1925,20 @@ static int sequencer_lock_exec(bContext *C, wmOperator *UNUSED(op)) void SEQUENCER_OT_lock(struct wmOperatorType *ot) { - /* identifiers */ + /* Identifiers. */ ot->name = "Lock Strips"; ot->idname = "SEQUENCER_OT_lock"; ot->description = "Lock strips so they can't be transformed"; - /* api callbacks */ + /* Api callbacks. */ ot->exec = sequencer_lock_exec; ot->poll = sequencer_edit_poll; - /* flags */ + /* Flags. */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } -/* unlock operator */ +/* Unlock operator. */ static int sequencer_unlock_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene = CTX_data_scene(C); @@ -1971,20 +1958,20 @@ static int sequencer_unlock_exec(bContext *C, wmOperator *UNUSED(op)) void SEQUENCER_OT_unlock(struct wmOperatorType *ot) { - /* identifiers */ + /* Identifiers. */ ot->name = "Unlock Strips"; ot->idname = "SEQUENCER_OT_unlock"; ot->description = "Unlock strips so they can be transformed"; - /* api callbacks */ + /* Api callbacks. */ ot->exec = sequencer_unlock_exec; ot->poll = sequencer_edit_poll; - /* flags */ + /* Flags. */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } -/* reload operator */ +/* Reload operator. */ static int sequencer_reload_exec(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); @@ -2015,17 +2002,17 @@ void SEQUENCER_OT_reload(struct wmOperatorType *ot) { PropertyRNA *prop; - /* identifiers */ + /* Identifiers. */ ot->name = "Reload Strips"; ot->idname = "SEQUENCER_OT_reload"; ot->description = "Reload strips in the sequencer"; - /* api callbacks */ + /* Api callbacks. */ ot->exec = sequencer_reload_exec; ot->poll = sequencer_edit_poll; - /* flags */ - ot->flag = OPTYPE_REGISTER; /* no undo, the data changed is stored outside 'main' */ + /* Flags. */ + ot->flag = OPTYPE_REGISTER; /* No undo, the data changed is stored outside 'main'. */ prop = RNA_def_boolean(ot->srna, "adjust_length", @@ -2035,7 +2022,7 @@ void SEQUENCER_OT_reload(struct wmOperatorType *ot) RNA_def_property_flag(prop, PROP_SKIP_SAVE); } -/* reload operator */ +/* Reload operator. */ static bool sequencer_refresh_all_poll(bContext *C) { if (G.is_rendering) { @@ -2058,12 +2045,12 @@ static int sequencer_refresh_all_exec(bContext *C, wmOperator *UNUSED(op)) void SEQUENCER_OT_refresh_all(struct wmOperatorType *ot) { - /* identifiers */ + /* Identifiers. */ ot->name = "Refresh Sequencer"; ot->idname = "SEQUENCER_OT_refresh_all"; ot->description = "Refresh the sequencer editor"; - /* api callbacks */ + /* Api callbacks. */ ot->exec = sequencer_refresh_all_exec; ot->poll = sequencer_refresh_all_poll; } @@ -2079,7 +2066,7 @@ static int sequencer_reassign_inputs_exec(bContext *C, wmOperator *op) BKE_report(op->reports, RPT_ERROR, error_msg); return OPERATOR_CANCELLED; } - /* see reassigning would create a cycle */ + /* Check if reassigning would create recursivity. */ if (seq_is_predecessor(seq1, last_seq) || seq_is_predecessor(seq2, last_seq) || seq_is_predecessor(seq3, last_seq)) { BKE_report(op->reports, RPT_ERROR, "Cannot reassign inputs: no cycles allowed"); @@ -2114,16 +2101,16 @@ static bool sequencer_effect_poll(bContext *C) void SEQUENCER_OT_reassign_inputs(struct wmOperatorType *ot) { - /* identifiers */ + /* Identifiers. */ ot->name = "Reassign Inputs"; ot->idname = "SEQUENCER_OT_reassign_inputs"; ot->description = "Reassign the inputs for the effect strip"; - /* api callbacks */ + /* Api callbacks. */ ot->exec = sequencer_reassign_inputs_exec; ot->poll = sequencer_effect_poll; - /* flags */ + /* Flags. */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } @@ -2149,20 +2136,20 @@ static int sequencer_swap_inputs_exec(bContext *C, wmOperator *op) } void SEQUENCER_OT_swap_inputs(struct wmOperatorType *ot) { - /* identifiers */ + /* Identifiers. */ ot->name = "Swap Inputs"; ot->idname = "SEQUENCER_OT_swap_inputs"; ot->description = "Swap the first two inputs for the effect strip"; - /* api callbacks */ + /* Api callbacks. */ ot->exec = sequencer_swap_inputs_exec; ot->poll = sequencer_effect_poll; - /* flags */ + /* Flags. */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } -/* split operator */ +/* Split operator. */ static const EnumPropertyItem prop_split_types[] = { {SEQ_SPLIT_SOFT, "SOFT", 0, "Soft", ""}, {SEQ_SPLIT_HARD, "HARD", 0, "Hard", ""}, @@ -2203,7 +2190,7 @@ static int sequencer_split_exec(bContext *C, wmOperator *op) use_cursor_position, split_seq_soft); } - if (changed) { /* got new strips ? */ + if (changed) { /* Got new strips? */ Sequence *seq; if (ignore_selection) { if (use_cursor_position) { @@ -2246,7 +2233,7 @@ static int sequencer_split_exec(bContext *C, wmOperator *op) } } SEQ_END; - /* as last: */ + BKE_sequencer_sort(scene); } if (changed) { @@ -2285,24 +2272,24 @@ static int sequencer_split_invoke(bContext *C, wmOperator *op, const wmEvent *ev } RNA_int_set(op->ptr, "channel", mouseloc[1]); RNA_enum_set(op->ptr, "side", split_side); - /*RNA_enum_set(op->ptr, "type", split_hard); */ /*This type is set from the key - shortsplit */ + /*RNA_enum_set(op->ptr, "type", split_hard); */ + return sequencer_split_exec(C, op); } void SEQUENCER_OT_split(struct wmOperatorType *ot) { - /* identifiers */ + /* Identifiers. */ ot->name = "Split Strips"; ot->idname = "SEQUENCER_OT_split"; ot->description = "Split the selected strips in two"; - /* api callbacks */ + /* Api callbacks. */ ot->invoke = sequencer_split_invoke; ot->exec = sequencer_split_exec; ot->poll = sequencer_edit_poll; - /* flags */ + /* Flags. */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; PropertyRNA *prop; @@ -2358,7 +2345,7 @@ void SEQUENCER_OT_split(struct wmOperatorType *ot) #undef SEQ_SIDE_MOUSE -/* duplicate operator */ +/* Duplicate operator. */ static int apply_unique_name_fn(Sequence *seq, void *arg_pt) { Scene *scene = (Scene *)arg_pt; @@ -2385,7 +2372,7 @@ static int sequencer_add_duplicate_exec(bContext *C, wmOperator *UNUSED(op)) if (nseqbase.first) { Sequence *seq = nseqbase.first; - /* rely on the nseqbase list being added at the end */ + /* Rely on the nseqbase list being added at the end. */ BLI_movelisttolist(ed->seqbasep, &nseqbase); for (; seq; seq = seq->next) { @@ -2401,20 +2388,20 @@ static int sequencer_add_duplicate_exec(bContext *C, wmOperator *UNUSED(op)) void SEQUENCER_OT_duplicate(wmOperatorType *ot) { - /* identifiers */ + /* Identifiers. */ ot->name = "Duplicate Strips"; ot->idname = "SEQUENCER_OT_duplicate"; ot->description = "Duplicate the selected strips"; - /* api callbacks */ + /* Api callbacks. */ ot->exec = sequencer_add_duplicate_exec; ot->poll = ED_operator_sequencer_active; - /* flags */ + /* Flags. */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } -/* delete operator */ +/* Delete operator. */ static int sequencer_delete_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain = CTX_data_main(C); @@ -2425,7 +2412,7 @@ static int sequencer_delete_exec(bContext *C, wmOperator *UNUSED(op)) bool nothing_selected = true; seq = BKE_sequencer_active_get(scene); - if (seq && seq->flag & SELECT) { /* avoid a loop since this is likely to be selected */ + if (seq && seq->flag & SELECT) { /* Avoid a loop since this is likely to be selected. */ nothing_selected = false; } else { @@ -2441,7 +2428,7 @@ static int sequencer_delete_exec(bContext *C, wmOperator *UNUSED(op)) return OPERATOR_FINISHED; } - /* for effects and modifiers, try to find a replacement input */ + /* For effects and modifiers, try to find a replacement input. */ for (seq = ed->seqbasep->first; seq; seq = seq->next) { if (!(seq->flag & SELECT)) { if ((seq->type & SEQ_TYPE_EFFECT)) { @@ -2453,17 +2440,17 @@ static int sequencer_delete_exec(bContext *C, wmOperator *UNUSED(op)) } } - /* delete all selected strips */ + /* Delete all selected strips. */ recurs_del_seq_flag(scene, ed->seqbasep, SELECT, 0); - /* updates lengths etc */ + /* Update lengths, etc. */ seq = ed->seqbasep->first; while (seq) { BKE_sequence_calc(scene, seq); seq = seq->next; } - /* free parent metas */ + /* Free parent metas. */ ms = ed->metastack.last; while (ms) { BKE_sequence_calc(scene, ms->parseq); @@ -2482,8 +2469,8 @@ static int sequencer_delete_invoke(bContext *C, wmOperator *op, const wmEvent *e ARegion *region = CTX_wm_region(C); if (region->regiontype == RGN_TYPE_WINDOW) { - /* bounding box of 30 pixels is used for markers shortcuts, - * prevent conflict with markers shortcuts here + /* Bounding box of 30 pixels is used for markers shortcuts, + * prevent conflict with markers shortcuts here. */ if (event->mval[1] <= 30) { return OPERATOR_PASS_THROUGH; @@ -2496,35 +2483,35 @@ static int sequencer_delete_invoke(bContext *C, wmOperator *op, const wmEvent *e void SEQUENCER_OT_delete(wmOperatorType *ot) { - /* identifiers */ + /* Identifiers. */ ot->name = "Erase Strips"; ot->idname = "SEQUENCER_OT_delete"; ot->description = "Erase selected strips from the sequencer"; - /* api callbacks */ + /* Api callbacks. */ ot->invoke = sequencer_delete_invoke; ot->exec = sequencer_delete_exec; ot->poll = sequencer_edit_poll; - /* flags */ + /* Flags. */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } -/* offset clear operator */ +/* Offset clear operator. */ static int sequencer_offset_clear_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene = CTX_data_scene(C); Editing *ed = BKE_sequencer_editing_get(scene, false); Sequence *seq; - /* for effects, try to find a replacement input */ + /* For effects, try to find a replacement input. */ for (seq = ed->seqbasep->first; seq; seq = seq->next) { if ((seq->type & SEQ_TYPE_EFFECT) == 0 && (seq->flag & SELECT)) { seq->startofs = seq->endofs = seq->startstill = seq->endstill = 0; } } - /* updates lengths etc */ + /* Update lengths, etc. */ seq = ed->seqbasep->first; while (seq) { BKE_sequence_calc(scene, seq); @@ -2547,20 +2534,20 @@ static int sequencer_offset_clear_exec(bContext *C, wmOperator *UNUSED(op)) void SEQUENCER_OT_offset_clear(wmOperatorType *ot) { - /* identifiers */ + /* Identifiers. */ ot->name = "Clear Strip Offset"; ot->idname = "SEQUENCER_OT_offset_clear"; ot->description = "Clear strip offsets from the start and end frames"; - /* api callbacks */ + /* Api callbacks. */ ot->exec = sequencer_offset_clear_exec; ot->poll = sequencer_edit_poll; - /* flags */ + /* Flags. */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } -/* separate_images operator */ +/* Separate_images operator. */ static int sequencer_separate_images_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); @@ -2572,13 +2559,13 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op) int start_ofs, cfra, frame_end; int step = RNA_int_get(op->ptr, "length"); - seq = ed->seqbasep->first; /* poll checks this is valid */ + seq = ed->seqbasep->first; /* Poll checks this is valid. */ while (seq) { if ((seq->flag & SELECT) && (seq->type == SEQ_TYPE_IMAGE) && (seq->len > 1)) { Sequence *seq_next; - /* remove seq so overlap tests don't conflict, + /* Remove seq so overlap tests don't conflict, * see seq_free_sequence below for the real freeing. */ BLI_remlink(ed->seqbasep, seq); /* if (seq->ipo) id_us_min(&seq->ipo->id); */ @@ -2588,7 +2575,7 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op) frame_end = BKE_sequence_tx_get_final_right(seq, false); while (cfra < frame_end) { - /* new seq */ + /* New seq. */ se = BKE_sequencer_give_stripelem(seq, cfra); seq_new = BKE_sequence_dupli_recursive( @@ -2599,11 +2586,11 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op) seq_new->len = 1; seq_new->endstill = step - 1; - /* new strip */ + /* New strip. */ strip_new = seq_new->strip; strip_new->us = 1; - /* new stripdata (only one element now!) */ + /* New stripdata, only one element now. */ /* Note this assume all elements (images) have the same dimension, * since we only copy the name here. */ se_new = MEM_reallocN(strip_new->stripdata, sizeof(*se_new)); @@ -2634,7 +2621,6 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op) } } - /* as last: */ BKE_sequencer_sort(scene); WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); @@ -2644,25 +2630,25 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op) void SEQUENCER_OT_images_separate(wmOperatorType *ot) { - /* identifiers */ + /* Identifiers. */ ot->name = "Separate Images"; ot->idname = "SEQUENCER_OT_images_separate"; ot->description = "On image sequence strips, it returns a strip for each image"; - /* api callbacks */ + /* Api callbacks. */ ot->exec = sequencer_separate_images_exec; ot->invoke = WM_operator_props_popup_confirm; ot->poll = sequencer_edit_poll; - /* flags */ + /* Flags. */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; RNA_def_int(ot->srna, "length", 1, 1, INT_MAX, "Length", "Length of each frame", 1, 1000); } -/* META Operators */ +/* META Operators. */ -/* separate_meta_toggle operator */ +/* Separate_meta_toggle operator. */ static int sequencer_meta_toggle_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene = CTX_data_scene(C); @@ -2671,7 +2657,7 @@ static int sequencer_meta_toggle_exec(bContext *C, wmOperator *UNUSED(op)) MetaStack *ms; if (last_seq && last_seq->type == SEQ_TYPE_META && last_seq->flag & SELECT) { - /* Enter Metastrip */ + /* Enter metastrip. */ ms = MEM_mallocN(sizeof(MetaStack), "metastack"); BLI_addtail(&ed->metastack, ms); ms->parseq = last_seq; @@ -2683,7 +2669,7 @@ static int sequencer_meta_toggle_exec(bContext *C, wmOperator *UNUSED(op)) BKE_sequencer_active_set(scene, NULL); } else { - /* Exit Metastrip (if possible) */ + /* Exit metastrip if possible. */ Sequence *seq; @@ -2696,18 +2682,18 @@ static int sequencer_meta_toggle_exec(bContext *C, wmOperator *UNUSED(op)) ed->seqbasep = ms->oldbasep; - /* for old files, update from meta */ + /* For old files, update from meta. */ if (ms->disp_range[0] == ms->disp_range[1]) { copy_v2_v2_int(ms->disp_range, &ms->parseq->startdisp); } - /* recalc all: the meta can have effects connected to it */ + /* Recalc all: the meta can have effects connected to it. */ for (seq = ed->seqbasep->first; seq; seq = seq->next) { BKE_sequence_calc(scene, seq); } /* 2.73+, keeping endpoints is important! - * moving them around means you can't usefully use metas in a complex edit. */ + * Moving them around means you can't usefully use metas in a complex edit. */ #if 1 BKE_sequence_tx_set_final_left(ms->parseq, ms->disp_range[0]); BKE_sequence_tx_set_final_right(ms->parseq, ms->disp_range[1]); @@ -2735,20 +2721,20 @@ static int sequencer_meta_toggle_exec(bContext *C, wmOperator *UNUSED(op)) void SEQUENCER_OT_meta_toggle(wmOperatorType *ot) { - /* identifiers */ + /* Identifiers. */ ot->name = "Toggle Meta Strip"; ot->idname = "SEQUENCER_OT_meta_toggle"; ot->description = "Toggle a metastrip (to edit enclosed strips)"; - /* api callbacks */ + /* Api callbacks. */ ot->exec = sequencer_meta_toggle_exec; ot->poll = sequencer_edit_poll; - /* flags */ + /* Flags. */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } -/* separate_meta_make operator */ +/* Separate_meta_make operator. */ static int sequencer_meta_make_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); @@ -2762,9 +2748,9 @@ static int sequencer_meta_make_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - /* remove all selected from main list, and put in meta */ + /* Remove all selected from main list, and put in meta. */ - seqm = BKE_sequence_alloc(ed->seqbasep, 1, 1, SEQ_TYPE_META); /* channel number set later */ + seqm = BKE_sequence_alloc(ed->seqbasep, 1, 1, SEQ_TYPE_META); /* Channel number set later. */ strcpy(seqm->name + 2, "MetaStrip"); seqm->flag = SELECT; @@ -2799,16 +2785,16 @@ static int sequencer_meta_make_exec(bContext *C, wmOperator *op) void SEQUENCER_OT_meta_make(wmOperatorType *ot) { - /* identifiers */ + /* Identifiers. */ ot->name = "Make Meta Strip"; ot->idname = "SEQUENCER_OT_meta_make"; ot->description = "Group selected strips into a metastrip"; - /* api callbacks */ + /* Api callbacks. */ ot->exec = sequencer_meta_make_exec; ot->poll = sequencer_edit_poll; - /* flags */ + /* Flags. */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } @@ -2831,7 +2817,7 @@ static int seq_depends_on_meta(Sequence *seq, Sequence *seqm) } } -/* separate_meta_make operator */ +/* Separate_meta_make operator. */ static int sequencer_meta_separate_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene = CTX_data_scene(C); @@ -2854,7 +2840,7 @@ static int sequencer_meta_separate_exec(bContext *C, wmOperator *UNUSED(op)) BLI_remlink(ed->seqbasep, last_seq); BKE_sequence_free(scene, last_seq); - /* empty meta strip, delete all effects depending on it */ + /* Empty meta strip, delete all effects depending on it. */ for (seq = ed->seqbasep->first; seq; seq = seq->next) { if ((seq->type & SEQ_TYPE_EFFECT) && seq_depends_on_meta(seq, last_seq)) { seq->flag |= SEQ_FLAG_DELETE; @@ -2863,8 +2849,8 @@ static int sequencer_meta_separate_exec(bContext *C, wmOperator *UNUSED(op)) recurs_del_seq_flag(scene, ed->seqbasep, SEQ_FLAG_DELETE, 0); - /* test for effects and overlap - * don't use SEQP_BEGIN since that would be recursive */ + /* Test for effects and overlap + * don't use SEQP_BEGIN since that would be recursive. */ for (seq = ed->seqbasep->first; seq; seq = seq->next) { if (seq->flag & SELECT) { seq->flag &= ~SEQ_OVERLAP; @@ -2884,20 +2870,20 @@ static int sequencer_meta_separate_exec(bContext *C, wmOperator *UNUSED(op)) void SEQUENCER_OT_meta_separate(wmOperatorType *ot) { - /* identifiers */ + /* Identifiers. */ ot->name = "UnMeta Strip"; ot->idname = "SEQUENCER_OT_meta_separate"; ot->description = "Put the contents of a metastrip back in the sequencer"; - /* api callbacks */ + /* Api callbacks. */ ot->exec = sequencer_meta_separate_exec; ot->poll = sequencer_edit_poll; - /* flags */ + /* Flags. */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } -/* view_all operator */ +/* View_all operator. */ static int sequencer_view_all_exec(bContext *C, wmOperator *op) { ARegion *region = CTX_wm_region(C); @@ -2912,16 +2898,16 @@ static int sequencer_view_all_exec(bContext *C, wmOperator *op) void SEQUENCER_OT_view_all(wmOperatorType *ot) { - /* identifiers */ + /* Identifiers. */ ot->name = "View All"; ot->idname = "SEQUENCER_OT_view_all"; ot->description = "View all the strips in the sequencer"; - /* api callbacks */ + /* Api callbacks. */ ot->exec = sequencer_view_all_exec; ot->poll = ED_operator_sequencer_active; - /* flags */ + /* Flags. */ ot->flag = OPTYPE_REGISTER; } @@ -2935,20 +2921,20 @@ static int sequencer_view_frame_exec(bContext *C, wmOperator *op) void SEQUENCER_OT_view_frame(wmOperatorType *ot) { - /* identifiers */ + /* Identifiers. */ ot->name = "Go to Current Frame"; ot->idname = "SEQUENCER_OT_view_frame"; ot->description = "Move the view to the playhead"; - /* api callbacks */ + /* Api callbacks. */ ot->exec = sequencer_view_frame_exec; ot->poll = ED_operator_sequencer_active; - /* flags */ + /* Flags. */ ot->flag = 0; } -/* view_all operator */ +/* View_all operator. */ static int sequencer_view_all_preview_exec(bContext *C, wmOperator *UNUSED(op)) { bScreen *screen = CTX_wm_screen(C); @@ -2965,7 +2951,7 @@ static int sequencer_view_all_preview_exec(bContext *C, wmOperator *UNUSED(op)) UI_view2d_sync(screen, area, v2d, V2D_LOCK_COPY); #if 0 - /* Like zooming on an image view */ + /* Like zooming on an image view. */ float zoomX, zoomY; int width, height, imgwidth, imgheight; @@ -2977,11 +2963,11 @@ static int sequencer_view_all_preview_exec(bContext *C, wmOperator *UNUSED(op)) imgwidth = (scene->r.size * scene->r.xsch) / 100; imgheight = (scene->r.size * scene->r.ysch) / 100; - /* Apply aspect, doesn't need to be that accurate */ + /* Apply aspect, doesn't need to be that accurate. */ imgwidth = (int)(imgwidth * (scene->r.xasp / scene->r.yasp)); if (((imgwidth >= width) || (imgheight >= height)) && ((width > 0) && (height > 0))) { - /* Find the zoom value that will fit the image in the image space */ + /* Find the zoom value that will fit the image in the image space. */ zoomX = ((float)width) / ((float)imgwidth); zoomY = ((float)height) / ((float)imgheight); sseq->zoom = (zoomX < zoomY) ? zoomX : zoomY; @@ -2999,16 +2985,16 @@ static int sequencer_view_all_preview_exec(bContext *C, wmOperator *UNUSED(op)) void SEQUENCER_OT_view_all_preview(wmOperatorType *ot) { - /* identifiers */ + /* Identifiers. */ ot->name = "View All"; ot->idname = "SEQUENCER_OT_view_all_preview"; ot->description = "Zoom preview to fit in the area"; - /* api callbacks */ + /* Api callbacks. */ ot->exec = sequencer_view_all_preview_exec; ot->poll = ED_operator_sequencer_active; - /* flags */ + /* Flags. */ ot->flag = OPTYPE_REGISTER; } @@ -3034,16 +3020,16 @@ static int sequencer_view_zoom_ratio_exec(bContext *C, wmOperator *op) void SEQUENCER_OT_view_zoom_ratio(wmOperatorType *ot) { - /* identifiers */ + /* Identifiers. */ ot->name = "Sequencer View Zoom Ratio"; ot->idname = "SEQUENCER_OT_view_zoom_ratio"; ot->description = "Change zoom ratio of sequencer preview"; - /* api callbacks */ + /* Api callbacks. */ ot->exec = sequencer_view_zoom_ratio_exec; ot->poll = ED_operator_sequencer_active; - /* properties */ + /* Properties. */ RNA_def_float(ot->srna, "ratio", 1.0f, @@ -3068,7 +3054,7 @@ static const EnumPropertyItem view_type_items[] = { }; #endif -/* view_all operator */ +/* View_all operator. */ static int sequencer_view_toggle_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceSeq *sseq = (SpaceSeq *)CTX_wm_space_data(C); @@ -3085,20 +3071,20 @@ static int sequencer_view_toggle_exec(bContext *C, wmOperator *UNUSED(op)) void SEQUENCER_OT_view_toggle(wmOperatorType *ot) { - /* identifiers */ + /* Identifiers. */ ot->name = "View Toggle"; ot->idname = "SEQUENCER_OT_view_toggle"; ot->description = "Toggle between sequencer views (sequence, preview, both)"; - /* api callbacks */ + /* Api callbacks. */ ot->exec = sequencer_view_toggle_exec; ot->poll = ED_operator_sequencer_active; - /* flags */ + /* Flags. */ ot->flag = OPTYPE_REGISTER; } -/* view_selected operator */ +/* View_selected operator. */ static int sequencer_view_selected_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); @@ -3148,7 +3134,7 @@ static int sequencer_view_selected_exec(bContext *C, wmOperator *op) cur_new.ymin = ymin; cur_new.ymax = ymax; - /* only zoom out vertically */ + /* Only zoom out vertically. */ if (orig_height > BLI_rctf_size_y(&cur_new)) { ymid = BLI_rctf_cent_y(&cur_new); @@ -3167,16 +3153,16 @@ static int sequencer_view_selected_exec(bContext *C, wmOperator *op) void SEQUENCER_OT_view_selected(wmOperatorType *ot) { - /* identifiers */ + /* Identifiers. */ ot->name = "Frame Selected"; ot->idname = "SEQUENCER_OT_view_selected"; ot->description = "Zoom the sequencer on the selected strips"; - /* api callbacks */ + /* Api callbacks. */ ot->exec = sequencer_view_selected_exec; ot->poll = ED_operator_sequencer_active; - /* flags */ + /* Flags. */ ot->flag = OPTYPE_REGISTER; } @@ -3199,7 +3185,7 @@ static bool strip_jump_internal(Scene *scene, static bool sequencer_strip_jump_poll(bContext *C) { - /* prevent changes during render */ + /* Prevent changes during render. */ if (G.is_rendering) { return 0; } @@ -3207,14 +3193,14 @@ static bool sequencer_strip_jump_poll(bContext *C) return sequencer_edit_poll(C); } -/* jump frame to edit point operator */ +/* Jump frame to edit point operator. */ static int sequencer_strip_jump_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); const bool next = RNA_boolean_get(op->ptr, "next"); const bool center = RNA_boolean_get(op->ptr, "center"); - /* currently do_skip_mute is always true */ + /* Currently do_skip_mute is always true. */ if (!strip_jump_internal(scene, next ? SEQ_SIDE_RIGHT : SEQ_SIDE_LEFT, true, center)) { return OPERATOR_CANCELLED; } @@ -3226,19 +3212,19 @@ static int sequencer_strip_jump_exec(bContext *C, wmOperator *op) void SEQUENCER_OT_strip_jump(wmOperatorType *ot) { - /* identifiers */ + /* Identifiers. */ ot->name = "Jump to Strip"; ot->idname = "SEQUENCER_OT_strip_jump"; ot->description = "Move frame to previous edit point"; - /* api callbacks */ + /* Api callbacks. */ ot->exec = sequencer_strip_jump_exec; ot->poll = sequencer_strip_jump_poll; - /* flags */ + /* Flags. */ ot->flag = OPTYPE_UNDO; - /* properties */ + /* Properties. */ RNA_def_boolean(ot->srna, "next", true, "Next Strip", ""); RNA_def_boolean(ot->srna, "center", true, "Use strip center", ""); } @@ -3296,7 +3282,7 @@ static int sequencer_swap_exec(bContext *C, wmOperator *op) if (seq) { - /* disallow effect strips */ + /* Disallow effect strips. */ if (BKE_sequence_effect_get_num_inputs(seq->type) >= 1 && (seq->effectdata || seq->seq1 || seq->seq2 || seq->seq3)) { return OPERATOR_CANCELLED; @@ -3315,7 +3301,7 @@ static int sequencer_swap_exec(bContext *C, wmOperator *op) break; } - // XXX - should be a generic function + /* XXX - Should be a generic function. */ for (iseq = scene->ed->seqbasep->first; iseq; iseq = iseq->next) { if ((iseq->type & SEQ_TYPE_EFFECT) && (seq_is_parent(iseq, active_seq) || seq_is_parent(iseq, seq))) { @@ -3323,11 +3309,11 @@ static int sequencer_swap_exec(bContext *C, wmOperator *op) } } - /* do this in a new loop since both effects need to be calculated first */ + /* Do this in a new loop since both effects need to be calculated first. */ for (iseq = scene->ed->seqbasep->first; iseq; iseq = iseq->next) { if ((iseq->type & SEQ_TYPE_EFFECT) && (seq_is_parent(iseq, active_seq) || seq_is_parent(iseq, seq))) { - /* this may now overlap */ + /* This may now overlap. */ if (BKE_sequence_test_overlap(ed->seqbasep, iseq)) { BKE_sequence_base_shuffle(ed->seqbasep, iseq, scene); } @@ -3346,19 +3332,19 @@ static int sequencer_swap_exec(bContext *C, wmOperator *op) void SEQUENCER_OT_swap(wmOperatorType *ot) { - /* identifiers */ + /* Identifiers. */ ot->name = "Swap Strip"; ot->idname = "SEQUENCER_OT_swap"; ot->description = "Swap active strip with strip to the right or left"; - /* api callbacks */ + /* Api callbacks. */ ot->exec = sequencer_swap_exec; ot->poll = sequencer_edit_poll; - /* flags */ + /* Flags. */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - /* properties */ + /* Properties. */ RNA_def_enum( ot->srna, "side", prop_side_lr_types, SEQ_SIDE_RIGHT, "Side", "Side of the strip to swap"); } @@ -3392,7 +3378,7 @@ static int sequencer_rendersize_exec(bContext *C, wmOperator *UNUSED(op)) } if (se) { - // prevent setting the render size if sequence values aren't initialized + /* Prevent setting the render size if sequence values aren't initialized. */ if ((se->orig_width > 0) && (se->orig_height > 0)) { scene->r.xsch = se->orig_width; scene->r.ysch = se->orig_height; @@ -3406,19 +3392,17 @@ static int sequencer_rendersize_exec(bContext *C, wmOperator *UNUSED(op)) void SEQUENCER_OT_rendersize(wmOperatorType *ot) { - /* identifiers */ + /* Identifiers. */ ot->name = "Set Render Size"; ot->idname = "SEQUENCER_OT_rendersize"; ot->description = "Set render size and aspect from active sequence"; - /* api callbacks */ + /* Api callbacks. */ ot->exec = sequencer_rendersize_exec; ot->poll = sequencer_edit_poll; - /* flags */ + /* Flags. */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - - /* properties */ } static void seq_copy_del_sound(Scene *scene, Sequence *seq) @@ -3453,9 +3437,8 @@ static int sequencer_copy_exec(bContext *C, wmOperator *op) BKE_sequence_base_dupli_recursive( scene, scene, &nseqbase, ed->seqbasep, SEQ_DUPE_UNIQUE_NAME, LIB_ID_CREATE_NO_USER_REFCOUNT); - /* To make sure the copied strips have unique names between each other add - * them temporarily to the end of the original seqbase. (bug 25932) - */ + /* Make sure that copied strips have unique names. + * Add them temporarily to the end of the original seqbase (bug 25932). */ if (nseqbase.first) { Sequence *seq, *first_seq = nseqbase.first; BLI_movelisttolist(ed->seqbasep, &nseqbase); @@ -3476,7 +3459,7 @@ static int sequencer_copy_exec(bContext *C, wmOperator *op) seqbase_clipboard_frame = scene->r.cfra; - /* Need to remove anything that references the current scene */ + /* Remove anything that references the current scene. */ LISTBASE_FOREACH (Sequence *, seq, &seqbase_clipboard) { seq_copy_del_sound(scene, seq); } @@ -3490,26 +3473,24 @@ static int sequencer_copy_exec(bContext *C, wmOperator *op) void SEQUENCER_OT_copy(wmOperatorType *ot) { - /* identifiers */ + /* Identifiers. */ ot->name = "Copy"; ot->idname = "SEQUENCER_OT_copy"; ot->description = "Copy selected strips to clipboard"; - /* api callbacks */ + /* Api callbacks. */ ot->exec = sequencer_copy_exec; ot->poll = sequencer_edit_poll; - /* flags */ + /* Flags. */ ot->flag = OPTYPE_REGISTER; - - /* properties */ } static int sequencer_paste_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); - Editing *ed = BKE_sequencer_editing_get(scene, true); /* create if needed */ + Editing *ed = BKE_sequencer_editing_get(scene, true); /* Create if needed. */ ListBase nseqbase = {NULL, NULL}; int ofs; Sequence *iseq, *iseq_first; @@ -3525,7 +3506,7 @@ static int sequencer_paste_exec(bContext *C, wmOperator *UNUSED(op)) scene, scene, &nseqbase, &seqbase_clipboard, SEQ_DUPE_UNIQUE_NAME, 0); BKE_sequencer_base_clipboard_pointers_store(bmain, &seqbase_clipboard); - /* transform pasted strips before adding */ + /* Transform pasted strips before adding. */ if (ofs) { for (iseq = nseqbase.first; iseq; iseq = iseq->next) { BKE_sequence_translate(scene, iseq, ofs); @@ -3536,12 +3517,12 @@ static int sequencer_paste_exec(bContext *C, wmOperator *UNUSED(op)) BLI_movelisttolist(ed->seqbasep, &nseqbase); - /* make sure the pasted strips have unique names between them */ + /* Make sure, that pasted strips have unique names. */ for (iseq = iseq_first; iseq; iseq = iseq->next) { BKE_sequencer_recursive_apply(iseq, apply_unique_name_fn, scene); } - /* ensure pasted strips don't overlap */ + /* Ensure, that pasted strips don't overlap. */ for (iseq = iseq_first; iseq; iseq = iseq->next) { if (BKE_sequence_test_overlap(ed->seqbasep, iseq)) { BKE_sequence_base_shuffle(ed->seqbasep, iseq, scene); @@ -3556,19 +3537,17 @@ static int sequencer_paste_exec(bContext *C, wmOperator *UNUSED(op)) void SEQUENCER_OT_paste(wmOperatorType *ot) { - /* identifiers */ + /* Identifiers. */ ot->name = "Paste"; ot->idname = "SEQUENCER_OT_paste"; ot->description = "Paste strips from clipboard"; - /* api callbacks */ + /* Api callbacks. */ ot->exec = sequencer_paste_exec; ot->poll = ED_operator_sequencer_active; - /* flags */ + /* Flags. */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - - /* properties */ } static int sequencer_swap_data_exec(bContext *C, wmOperator *op) @@ -3619,22 +3598,20 @@ static int sequencer_swap_data_exec(bContext *C, wmOperator *op) void SEQUENCER_OT_swap_data(wmOperatorType *ot) { - /* identifiers */ + /* Identifiers. */ ot->name = "Sequencer Swap Data"; ot->idname = "SEQUENCER_OT_swap_data"; ot->description = "Swap 2 sequencer strips"; - /* api callbacks */ + /* Api callbacks. */ ot->exec = sequencer_swap_data_exec; ot->poll = ED_operator_sequencer_active; - /* flags */ + /* Flags. */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - - /* properties */ } -/* box select operator */ +/* Box select operator. */ static int view_ghost_border_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); @@ -3642,7 +3619,7 @@ static int view_ghost_border_exec(bContext *C, wmOperator *op) rctf rect; - /* convert coordinates of rect to 'tot' rect coordinates */ + /* Convert coordinates of rect to 'tot' rect coordinates. */ WM_operator_properties_border_to_rctf(op, &rect); UI_view2d_region_to_view_rctf(v2d, &rect, &rect); @@ -3669,30 +3646,28 @@ static int view_ghost_border_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -/* ****** Box Select ****** */ void SEQUENCER_OT_view_ghost_border(wmOperatorType *ot) { - /* identifiers */ + /* Identifiers. */ ot->name = "Border Offset View"; ot->idname = "SEQUENCER_OT_view_ghost_border"; ot->description = "Set the boundaries of the border used for offset-view"; - /* api callbacks */ + /* Api callbacks. */ ot->invoke = WM_gesture_box_invoke; ot->exec = view_ghost_border_exec; ot->modal = WM_gesture_box_modal; ot->poll = sequencer_view_preview_poll; ot->cancel = WM_gesture_box_cancel; - /* flags */ + /* Flags. */ ot->flag = 0; - /* rna */ + /* Properties. */ WM_operator_properties_gesture_box(ot); } -/* rebuild_proxy operator */ - +/* Rebuild_proxy operator. */ static int sequencer_rebuild_proxy_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) @@ -3743,16 +3718,16 @@ static int sequencer_rebuild_proxy_exec(bContext *C, wmOperator *UNUSED(op)) void SEQUENCER_OT_rebuild_proxy(wmOperatorType *ot) { - /* identifiers */ + /* Identifiers. */ ot->name = "Rebuild Proxy and Timecode Indices"; ot->idname = "SEQUENCER_OT_rebuild_proxy"; ot->description = "Rebuild all selected proxies and timecode indices using the job system"; - /* api callbacks */ + /* Api callbacks. */ ot->invoke = sequencer_rebuild_proxy_invoke; ot->exec = sequencer_rebuild_proxy_exec; - /* flags */ + /* Flags. */ ot->flag = OPTYPE_REGISTER; } @@ -3838,16 +3813,16 @@ static int sequencer_enable_proxies_exec(bContext *C, wmOperator *op) void SEQUENCER_OT_enable_proxies(wmOperatorType *ot) { - /* identifiers */ + /* Identifiers. */ ot->name = "Set Selected Strip Proxies"; ot->idname = "SEQUENCER_OT_enable_proxies"; ot->description = "Enable selected proxies on all selected Movie, Image and Meta strips"; - /* api callbacks */ + /* Api callbacks. */ ot->invoke = sequencer_enable_proxies_invoke; ot->exec = sequencer_enable_proxies_exec; - /* flags */ + /* Flags. */ ot->flag = OPTYPE_REGISTER; RNA_def_boolean(ot->srna, "proxy_25", false, "25%", ""); @@ -3857,8 +3832,7 @@ void SEQUENCER_OT_enable_proxies(wmOperatorType *ot) RNA_def_boolean(ot->srna, "overwrite", false, "Overwrite", ""); } -/* change ops */ - +/* Change effect inputs operator. */ static const EnumPropertyItem prop_change_effect_input_types[] = { {0, "A_B", 0, "A -> B", ""}, {1, "B_C", 0, "B -> C", ""}, @@ -3899,9 +3873,8 @@ static int sequencer_change_effect_input_exec(bContext *C, wmOperator *op) BKE_sequencer_update_changed_seq_and_deps(scene, seq, 0, 1); - /* important else we don't get the imbuf cache flushed */ + /* Invalidate cache. */ BKE_sequencer_free_imbuf(scene, &ed->seqbase, false); - WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); return OPERATOR_FINISHED; @@ -3909,21 +3882,22 @@ static int sequencer_change_effect_input_exec(bContext *C, wmOperator *op) void SEQUENCER_OT_change_effect_input(struct wmOperatorType *ot) { - /* identifiers */ + /* Identifiers. */ ot->name = "Change Effect Input"; ot->idname = "SEQUENCER_OT_change_effect_input"; - /* api callbacks */ + /* Api callbacks. */ ot->exec = sequencer_change_effect_input_exec; ot->poll = sequencer_effect_poll; - /* flags */ + /* Flags. */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; ot->prop = RNA_def_enum( ot->srna, "swap", prop_change_effect_input_types, 0, "Swap", "The effect inputs to swap"); } +/* Change effect type operator. */ static int sequencer_change_effect_type_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); @@ -3931,14 +3905,14 @@ static int sequencer_change_effect_type_exec(bContext *C, wmOperator *op) Sequence *seq = BKE_sequencer_active_get(scene); const int new_type = RNA_enum_get(op->ptr, "type"); - /* free previous effect and init new effect */ + /* Free previous effect and init new effect. */ struct SeqEffectHandle sh; if ((seq->type & SEQ_TYPE_EFFECT) == 0) { return OPERATOR_CANCELLED; } - /* can someone explain the logic behind only allowing to increase this, + /* Can someone explain the logic behind only allowing to increase this, * copied from 2.4x - campbell */ if (BKE_sequence_effect_get_num_inputs(seq->type) < BKE_sequence_effect_get_num_inputs(new_type)) { @@ -3955,10 +3929,8 @@ static int sequencer_change_effect_type_exec(bContext *C, wmOperator *op) sh.init(seq); } - /* update */ BKE_sequencer_update_changed_seq_and_deps(scene, seq, 0, 1); - - /* important else we don't get the imbuf cache flushed */ + /* Invalidate cache. */ BKE_sequencer_free_imbuf(scene, &ed->seqbase, false); WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); @@ -3968,15 +3940,15 @@ static int sequencer_change_effect_type_exec(bContext *C, wmOperator *op) void SEQUENCER_OT_change_effect_type(struct wmOperatorType *ot) { - /* identifiers */ + /* Identifiers. */ ot->name = "Change Effect Type"; ot->idname = "SEQUENCER_OT_change_effect_type"; - /* api callbacks */ + /* Api callbacks. */ ot->exec = sequencer_change_effect_type_exec; ot->poll = sequencer_effect_poll; - /* flags */ + /* Flags. */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; ot->prop = RNA_def_enum(ot->srna, @@ -3987,6 +3959,7 @@ void SEQUENCER_OT_change_effect_type(struct wmOperatorType *ot) "Sequencer effect type"); } +/* Change path operator. */ static int sequencer_change_path_exec(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); @@ -4002,7 +3975,7 @@ static int sequencer_change_path_exec(bContext *C, wmOperator *op) int len; StripElem *se; - /* need to find min/max frame for placeholders */ + /* Need to find min/max frame for placeholders. */ if (use_placeholders) { len = sequencer_image_seq_get_minmax_frame(op, seq->sfra, &minframe, &numdigits); } @@ -4040,16 +4013,16 @@ static int sequencer_change_path_exec(bContext *C, wmOperator *op) RNA_END; } - /* reset these else we wont see all the images */ + /* Reset these else we wont see all the images. */ seq->anim_startofs = seq->anim_endofs = 0; - /* correct start/end frames so we don't move - * important not to set seq->len = len; allow the function to handle it */ + /* Correct start/end frames so we don't move. + * Important not to set seq->len = len; allow the function to handle it. */ BKE_sequence_reload_new_file(bmain, scene, seq, true); BKE_sequence_calc(scene, seq); - /* important else we don't get the imbuf cache flushed */ + /* Invalidate cache. */ BKE_sequencer_free_imbuf(scene, &ed->seqbase, false); } else if (ELEM(seq->type, SEQ_TYPE_SOUND_RAM, SEQ_TYPE_SOUND_HD)) { @@ -4063,7 +4036,7 @@ static int sequencer_change_path_exec(bContext *C, wmOperator *op) BKE_sound_load(bmain, sound); } else { - /* lame, set rna filepath */ + /* Lame, set rna filepath. */ PointerRNA seq_ptr; PropertyRNA *prop; char filepath[FILE_MAX]; @@ -4092,7 +4065,7 @@ static int sequencer_change_path_invoke(bContext *C, wmOperator *op, const wmEve RNA_string_set(op->ptr, "directory", seq->strip->dir); RNA_string_set(op->ptr, "filepath", filepath); - /* set default display depending on seq type */ + /* Set default display depending on seq type. */ if (seq->type == SEQ_TYPE_IMAGE) { RNA_boolean_set(op->ptr, "filter_movie", false); } @@ -4107,16 +4080,16 @@ static int sequencer_change_path_invoke(bContext *C, wmOperator *op, const wmEve void SEQUENCER_OT_change_path(struct wmOperatorType *ot) { - /* identifiers */ + /* Identifiers. */ ot->name = "Change Data/Files"; ot->idname = "SEQUENCER_OT_change_path"; - /* api callbacks */ + /* Api callbacks. */ ot->exec = sequencer_change_path_exec; ot->invoke = sequencer_change_path_invoke; ot->poll = sequencer_strip_has_path_poll; - /* flags */ + /* Flags. */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; WM_operator_properties_filesel(ot, @@ -4134,6 +4107,7 @@ void SEQUENCER_OT_change_path(struct wmOperatorType *ot) "Use placeholders for missing frames of the strip"); } +/* Export subtitles operator. */ static int sequencer_export_subtitles_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) @@ -4176,7 +4150,7 @@ static int sequencer_export_subtitles_exec(bContext *C, wmOperator *op) RNA_string_get(op->ptr, "filepath", filepath); BLI_path_extension_ensure(filepath, sizeof(filepath), ".srt"); - /* Avoid File write exceptions */ + /* Avoid File write exceptions. */ if (!BLI_exists(filepath)) { BLI_make_existing_file(filepath); if (!BLI_file_touch(filepath)) { @@ -4203,7 +4177,7 @@ static int sequencer_export_subtitles_exec(bContext *C, wmOperator *op) BLI_listbase_sort(&text_seq, BKE_sequencer_cmp_time_startdisp); - /* time to open and write! */ + /* Open and write file. */ file = BLI_fopen(filepath, "w"); for (seq = text_seq.first; seq; seq = seq_next) { @@ -4246,17 +4220,17 @@ static bool sequencer_strip_is_text_poll(bContext *C) void SEQUENCER_OT_export_subtitles(struct wmOperatorType *ot) { - /* identifiers */ + /* Identifiers. */ ot->name = "Export Subtitles"; ot->idname = "SEQUENCER_OT_export_subtitles"; ot->description = "Export .srt file containing text strips"; - /* api callbacks */ + /* Api callbacks. */ ot->exec = sequencer_export_subtitles_exec; ot->invoke = sequencer_export_subtitles_invoke; ot->poll = sequencer_strip_is_text_poll; - /* flags */ + /* Flags. */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; WM_operator_properties_filesel(ot, @@ -4268,6 +4242,7 @@ void SEQUENCER_OT_export_subtitles(struct wmOperatorType *ot) FILE_SORT_ALPHA); } +/* Set range to strips operator. */ static int sequencer_set_range_to_strips_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); @@ -4316,16 +4291,16 @@ void SEQUENCER_OT_set_range_to_strips(struct wmOperatorType *ot) { PropertyRNA *prop; - /* identifiers */ + /* Identifiers. */ ot->name = "Set Range to Strips"; ot->idname = "SEQUENCER_OT_set_range_to_strips"; ot->description = "Set the frame range to the selected strips start and end"; - /* api callbacks */ + /* Api callbacks. */ ot->exec = sequencer_set_range_to_strips_exec; ot->poll = sequencer_edit_poll; - /* flags */ + /* Flags. */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; prop = RNA_def_boolean(ot->srna, "preview", false, "Preview", "Set the preview range instead"); |