diff options
author | Richard Antalik <richardantalik@gmail.com> | 2020-04-06 00:55:51 +0300 |
---|---|---|
committer | Richard Antalik <richardantalik@gmail.com> | 2020-04-06 00:55:51 +0300 |
commit | 0d0036cb53f83597aa8a52edd0e19fd915f4ed65 (patch) | |
tree | c826a7f824ddd19dd37dd84be47e457ad0bcaced | |
parent | 43cc2f31959277c6c9ecb5b6b6d83c0af6d7923e (diff) |
Cleanup: Fix comment style and check if they are valid or make sense.
12 files changed, 598 insertions, 774 deletions
diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index 278fb9fb683..049f3d76b53 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -51,8 +51,7 @@ #include "RNA_define.h" #include "RNA_enum_types.h" -/* for menu/popup icons etc etc*/ - +/* For menu, popup, icons, etc. */ #include "ED_screen.h" #include "ED_sequencer.h" @@ -67,16 +66,16 @@ #include "DEG_depsgraph.h" #include "DEG_depsgraph_build.h" -/* own include */ +/* Own include. */ #include "sequencer_intern.h" typedef struct SequencerAddData { ImageFormatData im_format; } SequencerAddData; -/* Generic functions, reused by add strip operators */ +/* Generic functions, reused by add strip operators. */ -/* avoid passing multiple args and be more verbose */ +/* Avoid passing multiple args and be more verbose. */ #define SEQPROP_STARTFRAME (1 << 0) #define SEQPROP_ENDFRAME (1 << 1) #define SEQPROP_NOPATHS (1 << 2) @@ -101,7 +100,7 @@ static void sequencer_generic_props__internal(wmOperatorType *ot, int flag) } if (flag & SEQPROP_ENDFRAME) { - /* not usual since most strips have a fixed length */ + /* Not usual since most strips have a fixed length. */ RNA_def_int(ot->srna, "frame_end", 0, @@ -119,7 +118,7 @@ static void sequencer_generic_props__internal(wmOperatorType *ot, int flag) RNA_def_boolean( ot->srna, "replace_sel", 1, "Replace Selection", "Replace the current selection"); - /* only for python scripts which import strips and place them after */ + /* Only for python scripts which import strips and place them after. */ prop = RNA_def_boolean( ot->srna, "overlap", 0, "Allow Overlap", "Don't correct overlap on new sequence strips"); RNA_def_property_flag(prop, PROP_HIDDEN); @@ -175,7 +174,7 @@ static void sequencer_generic_invoke_xy__internal(bContext *C, wmOperator *op, i int cfra = (int)CFRA; - /* effect strips don't need a channel initialized from the mouse */ + /* Effect strips don't need a channel initialized from the mouse. */ if (!(flag & SEQPROP_NOCHAN) && RNA_struct_property_is_set(op->ptr, "channel") == 0) { RNA_int_set(op->ptr, "channel", sequencer_generic_invoke_xy_guess_channel(C, type)); } @@ -203,18 +202,17 @@ static void seq_load_operator_info(SeqLoadInfo *seq_load, bContext *C, wmOperato memset(seq_load, 0, sizeof(SeqLoadInfo)); seq_load->start_frame = RNA_int_get(op->ptr, "frame_start"); - seq_load->end_frame = seq_load->start_frame; /* un-set */ - + seq_load->end_frame = seq_load->start_frame; seq_load->channel = RNA_int_get(op->ptr, "channel"); - seq_load->len = 1; // images only, if endframe isn't set! + seq_load->len = 1; if ((prop = RNA_struct_find_property(op->ptr, "filepath"))) { - /* full path, file is set by the caller */ + /* Full path, file is set by the caller. */ RNA_property_string_get(op->ptr, prop, seq_load->path); is_file = 1; } else if ((prop = RNA_struct_find_property(op->ptr, "directory"))) { - /* full path, file is set by the caller */ + /* Full path, file is set by the caller. */ RNA_property_string_get(op->ptr, prop, seq_load->path); is_file = 0; } @@ -252,15 +250,13 @@ static void seq_load_operator_info(SeqLoadInfo *seq_load, bContext *C, wmOperato seq_load->flag |= SEQ_LOAD_SYNC_FPS; } - /* always use this for ops */ + /* Create consecutive array of strips. */ seq_load->flag |= SEQ_LOAD_FRAME_ADVANCE; if (is_file == 1) { BLI_strncpy(seq_load->name, BLI_path_basename(seq_load->path), sizeof(seq_load->name)); } else if ((prop = RNA_struct_find_property(op->ptr, "files"))) { - /* used for image strip */ - /* best guess, first images name */ RNA_PROP_BEGIN (op->ptr, itemptr, prop) { char *name = RNA_string_get_alloc(&itemptr, "name", NULL, 0); BLI_strncpy(seq_load->name, name, sizeof(seq_load->name)); @@ -278,9 +274,6 @@ static void seq_load_operator_info(SeqLoadInfo *seq_load, bContext *C, wmOperato seq_load->views_format = imf->views_format; seq_load->flag |= SEQ_USE_VIEWS; - - /* operator custom data is always released after the SeqLoadInfo, - * no need to handle the memory here */ seq_load->stereo3d_format = &imf->stereo3d_format; } } @@ -332,22 +325,17 @@ static bool seq_effect_add_properties_poll(const bContext *UNUSED(C), return true; } -/* add scene operator */ static int sequencer_add_scene_strip_exec(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); Editing *ed = BKE_sequencer_editing_get(scene, true); - Scene *sce_seq; + Sequence *seq; - Sequence *seq; /* generic strip vars */ - - int start_frame, channel; /* operator props */ - + int start_frame, channel; start_frame = RNA_int_get(op->ptr, "frame_start"); channel = RNA_int_get(op->ptr, "channel"); - sce_seq = BLI_findlink(&bmain->scenes, RNA_enum_get(op->ptr, "scene")); if (sce_seq == NULL) { @@ -356,11 +344,8 @@ static int sequencer_add_scene_strip_exec(bContext *C, wmOperator *op) } seq = BKE_sequence_alloc(ed->seqbasep, start_frame, channel, SEQ_TYPE_SCENE); - seq->blend_mode = SEQ_TYPE_CROSS; /* so alpha adjustment fade to the strip below */ - + seq->blend_mode = SEQ_TYPE_CROSS; seq->scene = sce_seq; - - /* basic defaults */ seq->len = sce_seq->r.efra - sce_seq->r.sfra + 1; BLI_strncpy(seq->name + 2, sce_seq->id.name + 2, sizeof(seq->name) - 2); @@ -388,26 +373,23 @@ static int sequencer_add_scene_strip_invoke(bContext *C, wmOperator *op, const w sequencer_generic_invoke_xy__internal(C, op, 0, SEQ_TYPE_SCENE); return sequencer_add_scene_strip_exec(C, op); - // needs a menu - // return WM_menu_invoke(C, op, event); } void SEQUENCER_OT_scene_strip_add(struct wmOperatorType *ot) { PropertyRNA *prop; - /* identifiers */ + /* Identifiers. */ ot->name = "Add Scene Strip"; ot->idname = "SEQUENCER_OT_scene_strip_add"; ot->description = "Add a strip to the sequencer using a blender scene as a source"; - /* api callbacks */ + /* Api callbacks. */ ot->invoke = sequencer_add_scene_strip_invoke; ot->exec = sequencer_add_scene_strip_exec; - ot->poll = ED_operator_sequencer_active_editable; - /* flags */ + /* Flags. */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME); @@ -417,22 +399,17 @@ void SEQUENCER_OT_scene_strip_add(struct wmOperatorType *ot) ot->prop = prop; } -/* add movieclip operator */ static int sequencer_add_movieclip_strip_exec(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); Editing *ed = BKE_sequencer_editing_get(scene, true); - MovieClip *clip; + Sequence *seq; - Sequence *seq; /* generic strip vars */ - - int start_frame, channel; /* operator props */ - + int start_frame, channel; start_frame = RNA_int_get(op->ptr, "frame_start"); channel = RNA_int_get(op->ptr, "channel"); - clip = BLI_findlink(&bmain->movieclips, RNA_enum_get(op->ptr, "clip")); if (clip == NULL) { @@ -443,12 +420,10 @@ static int sequencer_add_movieclip_strip_exec(bContext *C, wmOperator *op) seq = BKE_sequence_alloc(ed->seqbasep, start_frame, channel, SEQ_TYPE_MOVIECLIP); seq->blend_mode = SEQ_TYPE_CROSS; seq->clip = clip; + seq->len = BKE_movieclip_get_duration(clip); id_us_ensure_real(&seq->clip->id); - /* basic defaults */ - seq->len = BKE_movieclip_get_duration(clip); - BLI_strncpy(seq->name + 2, clip->id.name + 2, sizeof(seq->name) - 2); BKE_sequence_base_unique_name_recursive(&ed->seqbase, seq); @@ -473,26 +448,23 @@ static int sequencer_add_movieclip_strip_invoke(bContext *C, wmOperator *op, con sequencer_generic_invoke_xy__internal(C, op, 0, SEQ_TYPE_MOVIECLIP); return sequencer_add_movieclip_strip_exec(C, op); - // needs a menu - // return WM_menu_invoke(C, op, event); } void SEQUENCER_OT_movieclip_strip_add(struct wmOperatorType *ot) { PropertyRNA *prop; - /* identifiers */ + /* Identifiers. */ ot->name = "Add MovieClip Strip"; ot->idname = "SEQUENCER_OT_movieclip_strip_add"; ot->description = "Add a movieclip strip to the sequencer"; - /* api callbacks */ + /* Api callbacks. */ ot->invoke = sequencer_add_movieclip_strip_invoke; ot->exec = sequencer_add_movieclip_strip_exec; - ot->poll = ED_operator_sequencer_active_editable; - /* flags */ + /* Flags. */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME); @@ -508,16 +480,12 @@ static int sequencer_add_mask_strip_exec(bContext *C, wmOperator *op) Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); Editing *ed = BKE_sequencer_editing_get(scene, true); - Mask *mask; + Sequence *seq; - Sequence *seq; /* generic strip vars */ - - int start_frame, channel; /* operator props */ - + int start_frame, channel; start_frame = RNA_int_get(op->ptr, "frame_start"); channel = RNA_int_get(op->ptr, "channel"); - mask = BLI_findlink(&bmain->masks, RNA_enum_get(op->ptr, "mask")); if (mask == NULL) { @@ -528,12 +496,10 @@ static int sequencer_add_mask_strip_exec(bContext *C, wmOperator *op) seq = BKE_sequence_alloc(ed->seqbasep, start_frame, channel, SEQ_TYPE_MASK); seq->blend_mode = SEQ_TYPE_CROSS; seq->mask = mask; + seq->len = BKE_mask_get_duration(mask); id_us_ensure_real(&seq->mask->id); - /* basic defaults */ - seq->len = BKE_mask_get_duration(mask); - BLI_strncpy(seq->name + 2, mask->id.name + 2, sizeof(seq->name) - 2); BKE_sequence_base_unique_name_recursive(&ed->seqbase, seq); @@ -558,26 +524,23 @@ static int sequencer_add_mask_strip_invoke(bContext *C, wmOperator *op, const wm sequencer_generic_invoke_xy__internal(C, op, 0, SEQ_TYPE_MASK); return sequencer_add_mask_strip_exec(C, op); - // needs a menu - // return WM_menu_invoke(C, op, event); } void SEQUENCER_OT_mask_strip_add(struct wmOperatorType *ot) { PropertyRNA *prop; - /* identifiers */ + /* Identifiers. */ ot->name = "Add Mask Strip"; ot->idname = "SEQUENCER_OT_mask_strip_add"; ot->description = "Add a mask strip to the sequencer"; - /* api callbacks */ + /* Api callbacks. */ ot->invoke = sequencer_add_mask_strip_invoke; ot->exec = sequencer_add_mask_strip_exec; - ot->poll = ED_operator_sequencer_active_editable; - /* flags */ + /* Flags. */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME); @@ -589,7 +552,7 @@ void SEQUENCER_OT_mask_strip_add(struct wmOperatorType *ot) static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoadFn seq_load_fn) { - Scene *scene = CTX_data_scene(C); /* only for sound */ + Scene *scene = CTX_data_scene(C); Editing *ed = BKE_sequencer_editing_get(scene, true); SeqLoadInfo seq_load; int tot_files; @@ -603,7 +566,6 @@ static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoad tot_files = RNA_property_collection_length(op->ptr, RNA_struct_find_property(op->ptr, "files")); if (tot_files > 1) { - /* multiple files */ char dir_only[FILE_MAX]; char file_only[FILE_MAX]; @@ -614,7 +576,7 @@ static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoad RNA_string_get(&itemptr, "name", file_only); BLI_join_dirfile(seq_load.path, sizeof(seq_load.path), dir_only, file_only); - /* Set seq_load.name, else all video/audio files get the same name! ugly! */ + /* Set seq_load.name, otherwise all video/audio files get the same name. */ BLI_strncpy(seq_load.name, file_only, sizeof(seq_load.name)); seq = seq_load_fn(C, ed->seqbasep, &seq_load); @@ -627,11 +589,10 @@ static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoad } RNA_END; } - else { + else { /* Single file./ */ Sequence *seq; - - /* single file */ seq = seq_load_fn(C, ed->seqbasep, &seq_load); + if (seq) { sequencer_add_apply_overlap(C, op, seq); if (seq_load.seq_sound) { @@ -658,7 +619,6 @@ static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoad return OPERATOR_FINISHED; } -/* add sequencer operators */ static void sequencer_add_init(bContext *UNUSED(C), wmOperator *op) { op->customdata = MEM_callocN(sizeof(SequencerAddData), __func__); @@ -673,8 +633,8 @@ static void sequencer_add_cancel(bContext *UNUSED(C), wmOperator *op) } static bool sequencer_add_draw_check_fn(PointerRNA *UNUSED(ptr), - PropertyRNA *prop, - void *UNUSED(user_data)) + PropertyRNA *prop, + void *UNUSED(user_data)) { const char *prop_id = RNA_property_identifier(prop); @@ -682,7 +642,6 @@ static bool sequencer_add_draw_check_fn(PointerRNA *UNUSED(ptr), STREQ(prop_id, "filename")); } -/* add movie operator */ static int sequencer_add_movie_strip_exec(bContext *C, wmOperator *op) { return sequencer_add_generic_strip_exec(C, op, BKE_sequencer_add_movie_strip); @@ -696,20 +655,12 @@ static int sequencer_add_movie_strip_invoke(bContext *C, Scene *scene = CTX_data_scene(C); Editing *ed = BKE_sequencer_editing_get(scene, false); - /* only enable "use_framerate" if there aren't any existing strips - * - When there are no strips yet, there is no harm in enabling this, - * and it makes the single-strip case really nice for casual users - * - When there are strips, it's best we don't touch the framerate, - * as all hell may break loose (e.g. audio strips start overlapping - * and can't be restored) - * - These initial guesses can still be manually overridden by users - * from the modal options panel - */ + /* Only enable "use_framerate" if there aren't any existing strips, unless overriden by user. */ if (ed && ed->seqbasep && ed->seqbasep->first) { RNA_boolean_set(op->ptr, "use_framerate", false); } - /* This is for drag and drop */ + /* This is for drag and drop. */ if ((RNA_struct_property_is_set(op->ptr, "files") && RNA_collection_length(op->ptr, "files")) || RNA_struct_property_is_set(op->ptr, "filepath")) { sequencer_generic_invoke_xy__internal(C, op, SEQPROP_NOPATHS, SEQ_TYPE_MOVIE); @@ -717,17 +668,14 @@ static int sequencer_add_movie_strip_invoke(bContext *C, } sequencer_generic_invoke_xy__internal(C, op, 0, SEQ_TYPE_MOVIE); - sequencer_add_init(C, op); - /* show multiview save options only if scene has multiviews */ + /* Show multiview save options only if scene use multiview. */ prop = RNA_struct_find_property(op->ptr, "show_multiview"); RNA_property_boolean_set(op->ptr, prop, (scene->r.scemode & R_MULTIVIEW) != 0); WM_event_add_fileselect(C, op); return OPERATOR_RUNNING_MODAL; - - // return sequencer_add_movie_strip_exec(C, op); } static void sequencer_add_draw(bContext *UNUSED(C), wmOperator *op) @@ -737,15 +685,15 @@ static void sequencer_add_draw(bContext *UNUSED(C), wmOperator *op) ImageFormatData *imf = &sad->im_format; PointerRNA imf_ptr, ptr; - /* main draw call */ + /* Main draw call. */ RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr); uiDefAutoButsRNA( layout, &ptr, sequencer_add_draw_check_fn, NULL, NULL, UI_BUT_LABEL_ALIGN_NONE, false); - /* image template */ + /* Image template. */ RNA_pointer_create(NULL, &RNA_ImageFormatSettings, imf, &imf_ptr); - /* multiview template */ + /* Multiview template. */ if (RNA_boolean_get(op->ptr, "show_multiview")) { uiTemplateImageFormatViews(layout, &imf_ptr, op->ptr); } @@ -754,20 +702,19 @@ static void sequencer_add_draw(bContext *UNUSED(C), wmOperator *op) void SEQUENCER_OT_movie_strip_add(struct wmOperatorType *ot) { - /* identifiers */ + /* Identifiers. */ ot->name = "Add Movie Strip"; ot->idname = "SEQUENCER_OT_movie_strip_add"; ot->description = "Add a movie strip to the sequencer"; - /* api callbacks */ + /* Api callbacks. */ ot->invoke = sequencer_add_movie_strip_invoke; ot->exec = sequencer_add_movie_strip_exec; ot->cancel = sequencer_add_cancel; ot->ui = sequencer_add_draw; - ot->poll = ED_operator_sequencer_active_editable; - /* flags */ + /* Flags. */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; WM_operator_properties_filesel(ot, @@ -787,8 +734,6 @@ void SEQUENCER_OT_movie_strip_add(struct wmOperatorType *ot) "Use framerate from the movie to keep sound and video in sync"); } -/* add sound operator */ - static int sequencer_add_sound_strip_exec(bContext *C, wmOperator *op) { return sequencer_add_generic_strip_exec(C, op, BKE_sequencer_add_sound_strip); @@ -798,7 +743,7 @@ static int sequencer_add_sound_strip_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) { - /* This is for drag and drop */ + /* This is for drag and drop. */ if ((RNA_struct_property_is_set(op->ptr, "files") && RNA_collection_length(op->ptr, "files")) || RNA_struct_property_is_set(op->ptr, "filepath")) { sequencer_generic_invoke_xy__internal(C, op, SEQPROP_NOPATHS, SEQ_TYPE_SOUND_RAM); @@ -809,25 +754,22 @@ static int sequencer_add_sound_strip_invoke(bContext *C, WM_event_add_fileselect(C, op); return OPERATOR_RUNNING_MODAL; - - // return sequencer_add_sound_strip_exec(C, op); } void SEQUENCER_OT_sound_strip_add(struct wmOperatorType *ot) { - /* identifiers */ + /* Identifiers. */ ot->name = "Add Sound Strip"; ot->idname = "SEQUENCER_OT_sound_strip_add"; ot->description = "Add a sound strip to the sequencer"; - /* api callbacks */ + /* Api callbacks. */ ot->invoke = sequencer_add_sound_strip_invoke; ot->exec = sequencer_add_sound_strip_exec; - ot->poll = ED_operator_sequencer_active_editable; - /* flags */ + /* Flags. */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; WM_operator_properties_filesel(ot, @@ -854,7 +796,6 @@ int sequencer_image_seq_get_minmax_frame(wmOperator *op, RNA_BEGIN (op->ptr, itemptr, "files") { char *filename; int frame; - /* just get the first filename */ filename = RNA_string_get_alloc(&itemptr, "name", NULL, 0); if (filename) { @@ -885,7 +826,6 @@ void sequencer_image_seq_reserve_frames( int i; char *filename = NULL; RNA_BEGIN (op->ptr, itemptr, "files") { - /* just get the first filename */ filename = RNA_string_get_alloc(&itemptr, "name", NULL, 0); break; } @@ -894,7 +834,7 @@ void sequencer_image_seq_reserve_frames( if (filename) { char ext[PATH_MAX]; char filename_stripped[PATH_MAX]; - /* strip the frame from filename and substitute with # */ + /* Strip the frame from filename and substitute with `#`. */ BLI_path_frame_strip(filename, ext); for (i = 0; i < len; i++, se++) { @@ -907,23 +847,20 @@ void sequencer_image_seq_reserve_frames( } } -/* add image operator */ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op) { int minframe, numdigits; - /* cant use the generic function for this */ - Scene *scene = CTX_data_scene(C); /* only for sound */ + Scene *scene = CTX_data_scene(C); Editing *ed = BKE_sequencer_editing_get(scene, true); SeqLoadInfo seq_load; Sequence *seq; - Strip *strip; StripElem *se; const bool use_placeholders = RNA_boolean_get(op->ptr, "use_placeholders"); seq_load_operator_info(&seq_load, C, op); - /* images are unique in how they handle this - 1 per strip elem */ + /* Images are unique in how they handle this - 1 per strip elem. */ if (use_placeholders) { seq_load.len = sequencer_image_seq_get_minmax_frame( op, seq_load.start_frame, &minframe, &numdigits); @@ -941,11 +878,10 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op) ED_sequencer_deselect_all(scene); } - /* main adding function */ + /* Main adding function. */ seq = BKE_sequencer_add_image_strip(C, ed->seqbasep, &seq_load); strip = seq->strip; se = strip->stripdata; - seq->blend_mode = SEQ_TYPE_ALPHAOVER; if (use_placeholders) { @@ -968,21 +904,18 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op) } BKE_sequence_init_colorspace(seq); - BKE_sequence_calc_disp(scene, seq); - BKE_sequencer_sort(scene); - /* last active name */ + /* Last active name. */ BLI_strncpy(ed->act_imagedir, strip->dir, sizeof(ed->act_imagedir)); - sequencer_add_apply_overlap(C, op, seq); if (op->customdata) { MEM_freeN(op->customdata); } - BKE_sequence_invalidate_cache_composite(scene, seq); + BKE_sequence_invalidate_cache_composite(scene, seq); DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); @@ -996,7 +929,7 @@ static int sequencer_add_image_strip_invoke(bContext *C, PropertyRNA *prop; Scene *scene = CTX_data_scene(C); - /* drag drop has set the names */ + /* Name set already by drag and drop. */ if (RNA_struct_property_is_set(op->ptr, "files") && RNA_collection_length(op->ptr, "files")) { sequencer_generic_invoke_xy__internal( C, op, SEQPROP_ENDFRAME | SEQPROP_NOPATHS, SEQ_TYPE_IMAGE); @@ -1004,10 +937,9 @@ static int sequencer_add_image_strip_invoke(bContext *C, } sequencer_generic_invoke_xy__internal(C, op, SEQPROP_ENDFRAME, SEQ_TYPE_IMAGE); - sequencer_add_init(C, op); - /* show multiview save options only if scene has multiviews */ + /* Show multiview save options only if scene use multiview. */ prop = RNA_struct_find_property(op->ptr, "show_multiview"); RNA_property_boolean_set(op->ptr, prop, (scene->r.scemode & R_MULTIVIEW) != 0); @@ -1018,20 +950,19 @@ static int sequencer_add_image_strip_invoke(bContext *C, void SEQUENCER_OT_image_strip_add(struct wmOperatorType *ot) { - /* identifiers */ + /* Identifiers. */ ot->name = "Add Image Strip"; ot->idname = "SEQUENCER_OT_image_strip_add"; ot->description = "Add an image or image sequence to the sequencer"; - /* api callbacks */ + /* Api callbacks. */ ot->invoke = sequencer_add_image_strip_invoke; ot->exec = sequencer_add_image_strip_exec; ot->cancel = sequencer_add_cancel; ot->ui = sequencer_add_draw; - ot->poll = ED_operator_sequencer_active_editable; - /* flags */ + /* Flags. */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; WM_operator_properties_filesel(ot, @@ -1051,65 +982,54 @@ void SEQUENCER_OT_image_strip_add(struct wmOperatorType *ot) "Use placeholders for missing frames of the strip"); } -/* add_effect_strip operator */ static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); Editing *ed = BKE_sequencer_editing_get(scene, true); - - Sequence *seq; /* generic strip vars */ + Sequence *seq; struct SeqEffectHandle sh; - - int start_frame, end_frame, channel, type; /* operator props */ - Sequence *seq1, *seq2, *seq3; const char *error_msg; + int start_frame, end_frame, channel, type; start_frame = RNA_int_get(op->ptr, "frame_start"); end_frame = RNA_int_get(op->ptr, "frame_end"); channel = RNA_int_get(op->ptr, "channel"); - type = RNA_enum_get(op->ptr, "type"); - // XXX move to invoke if (!seq_effect_find_selected(scene, NULL, type, &seq1, &seq2, &seq3, &error_msg)) { BKE_report(op->reports, RPT_ERROR, error_msg); return OPERATOR_CANCELLED; } - /* If seq1 is NULL and no error was raised it means the seq is standalone - * (like color strips) and we need to check its start and end frames are valid */ + /* Check its start and end frames are valid. */ if (seq1 == NULL && end_frame <= start_frame) { end_frame = start_frame + 1; RNA_int_set(op->ptr, "frame_end", end_frame); } seq = BKE_sequence_alloc(ed->seqbasep, start_frame, channel, type); - BLI_strncpy(seq->name + 2, BKE_sequence_give_name(seq), sizeof(seq->name) - 2); BKE_sequence_base_unique_name_recursive(&ed->seqbase, seq); sh = BKE_sequence_get_effect(seq); - + sh.init(seq); seq->seq1 = seq1; seq->seq2 = seq2; seq->seq3 = seq3; - sh.init(seq); - - if (!seq1) { /* effect has no deps */ - seq->len = 1; + if (!seq1) { + seq->len = 1; /* Effect is generator, set non zero length. */ BKE_sequence_tx_set_final_right(seq, end_frame); } seq->flag |= SEQ_USE_EFFECT_DEFAULT_FADE; - BKE_sequence_calc(scene, seq); if (seq->type == SEQ_TYPE_COLOR) { SolidColorVars *colvars = (SolidColorVars *)seq->effectdata; RNA_float_get_array(op->ptr, "color", colvars->col); - seq->blend_mode = SEQ_TYPE_CROSS; /* so alpha adjustment fade to the strip below */ + seq->blend_mode = SEQ_TYPE_CROSS; } else if (seq->type == SEQ_TYPE_ADJUSTMENT) { seq->blend_mode = SEQ_TYPE_CROSS; @@ -1118,8 +1038,7 @@ static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op) seq->blend_mode = SEQ_TYPE_ALPHAOVER; } - /* an unset channel is a special case where we automatically go above - * the other strips. */ + /* Set channel.*/ if (!RNA_struct_property_is_set(op->ptr, "channel")) { if (seq->seq1) { int chan = max_iii(seq->seq1 ? seq->seq1->machine : 0, @@ -1134,20 +1053,16 @@ static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op) sequencer_add_apply_replace_sel(C, op, seq); sequencer_add_apply_overlap(C, op, seq); - BKE_sequencer_update_changed_seq_and_deps(scene, seq, 1, 1); /* runs BKE_sequence_calc */ - - /* not sure if this is needed with update_changed_seq_and_deps. - * it was NOT called in blender 2.4x, but wont hurt */ + BKE_sequencer_update_changed_seq_and_deps(scene, seq, 1, 1); /* Runs BKE_sequence_calc. */ BKE_sequencer_sort(scene); - BKE_sequence_invalidate_cache_composite(scene, seq); + BKE_sequence_invalidate_cache_composite(scene, seq); DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); return OPERATOR_FINISHED; } -/* add color */ static int sequencer_add_effect_strip_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) @@ -1159,10 +1074,8 @@ static int sequencer_add_effect_strip_invoke(bContext *C, if (is_type_set) { type = RNA_enum_get(op->ptr, "type"); - /* when invoking an effect strip which uses inputs, - * skip initializing the channel from the mouse. - * Instead leave the property unset so exec() initializes it to be - * above the strips its applied to. */ + /* When invoking an effect strip which uses inputs, skip initializing the channel from the + * mouse. */ if (BKE_sequence_effect_get_num_inputs(type) != 0) { prop_flag |= SEQPROP_NOCHAN; } @@ -1177,19 +1090,18 @@ void SEQUENCER_OT_effect_strip_add(struct wmOperatorType *ot) { PropertyRNA *prop; - /* identifiers */ + /* Identifiers. */ ot->name = "Add Effect Strip"; ot->idname = "SEQUENCER_OT_effect_strip_add"; ot->description = "Add an effect to the sequencer, most are applied on top of existing strips"; - /* api callbacks */ + /* Api callbacks. */ ot->invoke = sequencer_add_effect_strip_invoke; ot->exec = sequencer_add_effect_strip_exec; - ot->poll = ED_operator_sequencer_active_editable; ot->poll_property = seq_effect_add_properties_poll; - /* flags */ + /* Flags. */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; RNA_def_enum(ot->srna, diff --git a/source/blender/editors/space_sequencer/sequencer_buttons.c b/source/blender/editors/space_sequencer/sequencer_buttons.c index a2568e2e827..dce8aa16985 100644 --- a/source/blender/editors/space_sequencer/sequencer_buttons.c +++ b/source/blender/editors/space_sequencer/sequencer_buttons.c @@ -54,7 +54,7 @@ static bool sequencer_grease_pencil_panel_poll(const bContext *C, PanelType *UNU { SpaceSeq *sseq = CTX_wm_space_seq(C); - /* don't show the gpencil if we are not showing the image */ + /* Don't show the gpencil if we are not showing the image. */ return ED_space_sequencer_check_show_imbuf(sseq); } #endif diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index db045b65d3f..2887113bdbe 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -79,20 +79,17 @@ #include "MEM_guardedalloc.h" -/* own include */ +/* Own include. */ #include "sequencer_intern.h" #define SEQ_LEFTHANDLE 1 #define SEQ_RIGHTHANDLE 2 - #define SEQ_HANDLE_SIZE 8.0f - #define SEQ_SCROLLER_TEXT_OFFSET 8 - #define MUTE_ALPHA 120 /* Note, Don't use SEQ_BEGIN/SEQ_END while drawing! - * it messes up transform, - Campbell */ + * it messes up transform. */ #undef SEQ_BEGIN #undef SEQP_BEGIN #undef SEQ_END @@ -141,7 +138,7 @@ void color3ubv_from_seq(Scene *curscene, Sequence *seq, uchar col[3]) col[2] = 130; break; - /* effects */ + /* Effects. */ case SEQ_TYPE_TRANSFORM: case SEQ_TYPE_SPEED: case SEQ_TYPE_ADD: @@ -234,13 +231,10 @@ static void draw_seq_waveform(View2D *v2d, float y2, float stepsize) { - /* - * x1 is the starting x value to draw the wave, - * x2 the end x value, same for y1 and y2 - * stepsize is width of a pixel. - */ + /* X1, x2 is the starting and end X value to draw the wave, same for y1 and y2. + * Stepsize is width of a pixel. */ - /* offset x1 and x2 values, to match view min/max, if strip is out of bounds */ + /* Offset x1 and x2 values, to match view min/max, if strip is out of bounds. */ int x1_offset = max_ff(v2d->cur.xmin, x1); int x2_offset = min_ff(v2d->cur.xmax + 1.0f, x2); @@ -254,8 +248,6 @@ static void draw_seq_waveform(View2D *v2d, float volume = seq->volume; float value1, value2; bSound *sound = seq->sound; - FCurve *fcu = id_data_find_fcurve(&scene->id, seq, &RNA_Sequence, "volume", 0, NULL); - SoundWaveform *waveform; if (length < 2) { @@ -265,7 +257,7 @@ static void draw_seq_waveform(View2D *v2d, BLI_spin_lock(sound->spinlock); if (!sound->waveform) { if (!(sound->tags & SOUND_TAGS_WAVEFORM_LOADING)) { - /* prevent sounds from reloading */ + /* Prevent sounds from reloading. */ sound->tags |= SOUND_TAGS_WAVEFORM_LOADING; BLI_spin_unlock(sound->spinlock); sequencer_preview_add_sound(C, seq); @@ -273,15 +265,14 @@ static void draw_seq_waveform(View2D *v2d, else { BLI_spin_unlock(sound->spinlock); } - return; /* nothing to draw */ + return; /* Nothing to draw. */ } BLI_spin_unlock(sound->spinlock); waveform = sound->waveform; + /* Waveform could not be built. */ if (waveform->length == 0) { - /* BKE_sound_read_waveform() set an empty SoundWaveform data in case it cannot generate a - * valid one. See T45726. */ return; } @@ -299,6 +290,9 @@ static void draw_seq_waveform(View2D *v2d, return; } + /* Fcurve lookup is quite expensive, so do this after precondition. */ + FCurve *fcu = id_data_find_fcurve(&scene->id, seq, &RNA_Sequence, "volume", 0, NULL); + GPU_blend(true); GPUVertFormat *format = immVertexFormat(); uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); @@ -325,7 +319,7 @@ static void draw_seq_waveform(View2D *v2d, } } else if (p + 1 < waveform->length) { - /* use simple linear interpolation */ + /* Use simple linear interpolation. */ float f = sampleoffset - p; value1 = (1.0f - f) * value1 + f * waveform->data[p * 3 + 3]; value2 = (1.0f - f) * value2 + f * waveform->data[p * 3 + 4]; @@ -361,10 +355,6 @@ static void draw_seq_waveform(View2D *v2d, static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1, float x2, float y2) { - /* note: this used to use SEQ_BEGIN/SEQ_END, but it messes up the - * seq->depth value, (needed by transform when doing overlap checks) - * so for now, just use the meta's immediate children, could be fixed but - * its only drawing - campbell */ Sequence *seq; uchar col[4]; @@ -400,12 +390,12 @@ static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1, chan_range = (chan_max - chan_min) + 1; draw_height = draw_range / chan_range; - col[3] = 196; /* alpha, used for all meta children */ + col[3] = 196; /* Alpha, used for all meta children. */ uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); - immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); + /* Draw only immediate children (1 level depth). */ for (seq = seqbase->first; seq; seq = seq->next) { const int startdisp = seq->startdisp + offset; const int enddisp = seq->enddisp + offset; @@ -433,7 +423,7 @@ static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1, immUniformColor4ubv(col); - /* clamp within parent sequence strip bounds */ + /* Clamp within parent sequence strip bounds. */ if (x1_chan < x1) { x1_chan = x1; } @@ -453,16 +443,16 @@ static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1, GPU_blend(false); } -/* clamp handles to defined size in pixel space */ +/* Get handle width in pixels. */ float sequence_handle_size_get_clamped(Sequence *seq, const float pixelx) { const float maxhandle = (pixelx * SEQ_HANDLE_SIZE) * U.pixelsize; - /* ensure we're not greater than half width */ + /* Ensure that handle is not wider, than half of strip. */ return min_ff(maxhandle, ((float)(seq->enddisp - seq->startdisp) / 2.0f) / pixelx); } -/* draw a handle, for each end of a sequence strip */ +/* Draw a handle, on left or right side of strip. */ static void draw_seq_handle(View2D *v2d, Sequence *seq, const float handsize_clamped, @@ -483,7 +473,7 @@ static void draw_seq_handle(View2D *v2d, y1 = seq->machine + SEQ_STRIP_OFSBOTTOM; y2 = seq->machine + SEQ_STRIP_OFSTOP; - /* set up co-ordinates/dimensions for either left or right handle */ + /* Set up co-ordinates and dimensions for either left or right handle. */ if (direction == SEQ_LEFTHANDLE) { rx1 = x1; rx2 = x1 + handsize_clamped; @@ -495,7 +485,6 @@ static void draw_seq_handle(View2D *v2d, whichsel = SEQ_RIGHTSEL; } - /* draw! */ if (!(seq->type & SEQ_TYPE_EFFECT) || BKE_sequence_effect_get_num_inputs(seq->type) == 0) { GPU_blend(true); @@ -522,9 +511,7 @@ static void draw_seq_handle(View2D *v2d, GPU_blend(false); } - /* Draw numbers for start and end of the strip next to its handles. - * - Draw only when handles are selected or while translating the strip. - */ + /* Draw numbers for start and end of the strip next to its handles. */ if (y_threshold && (((seq->flag & SELECT) && (G.moving & G_TRANSFORM_SEQ)) || (seq->flag & whichsel))) { @@ -575,8 +562,8 @@ static void draw_seq_outline(Sequence *seq, else if (seq->flag & SELECT) { UI_GetThemeColor3ubv(TH_SEQ_SELECTED, col); } - /* Regular color for unselected strips: a bit darker than the background. */ else { + /* Color for unselected strips is a bit darker than the background. */ UI_GetThemeColor3ubv(TH_BACK, col); UI_GetColorPtrShade3ubv(col, col, -40); } @@ -610,13 +597,13 @@ static void draw_seq_outline(Sequence *seq, /* Top */ immRectf(pos, x1 - pixelx, y2 - 2 * pixely, x2 + pixelx, y2); } - /* 1px wide outline for unselected strips. */ else { + /* 1px wide outline for unselected strips. */ imm_draw_box_wire_2d(pos, x1, y1, x2, y2); } } -/* draw info text on a sequence strip */ +/* Draw info text on a sequence strip. */ static void draw_seq_text(View2D *v2d, Sequence *seq, SpaceSeq *sseq, @@ -633,7 +620,7 @@ static void draw_seq_text(View2D *v2d, const char *name = seq->name + 2; uchar col[4]; - /* note, all strings should include 'name' */ + /* All strings should include name. */ if (name[0] == '\0') { name = BKE_sequence_give_name(seq); } @@ -723,7 +710,7 @@ static void draw_seq_text(View2D *v2d, seq->len); } else { - /* should never get here!, but might with files from future */ + /* Should never get here!, but might with files from future. */ BLI_assert(0); str_len = BLI_snprintf(str, sizeof(str), "%s | %d", name, seq->len); @@ -888,7 +875,7 @@ static void draw_seq_background(Scene *scene, } } - /* Transition strips.. Draw right half. */ + /* Draw right half of transition strips. */ if (ELEM(seq->type, SEQ_TYPE_CROSS, SEQ_TYPE_GAMCROSS, SEQ_TYPE_WIPE)) { float vert_pos[3][2]; Sequence *seq1 = seq->seq1; @@ -966,7 +953,7 @@ static void calculate_seq_text_offsets( float scroller_vert_xoffs = (V2D_SCROLL_HANDLE_WIDTH + SEQ_SCROLLER_TEXT_OFFSET) * pixelx; - /* info text on the strip */ + /* Info text on the strip. */ if (*x1 < v2d->cur.xmin + scroller_vert_xoffs) { *x1 = v2d->cur.xmin + scroller_vert_xoffs; } @@ -981,11 +968,7 @@ static void calculate_seq_text_offsets( } } -/* - * Draw a sequence strip, bounds check already made - * ARegion is currently only used to get the windows width in pixels - * so wave file sample drawing precision is zoom adjusted - */ +/* Draw visible strips. */ static void draw_seq_strip(const bContext *C, SpaceSeq *sseq, Scene *scene, @@ -999,20 +982,19 @@ static void draw_seq_strip(const bContext *C, const float handsize_clamped = sequence_handle_size_get_clamped(seq, pixelx); float pixely = BLI_rctf_size_y(&v2d->cur) / BLI_rcti_size_y(&v2d->mask); - /* We need to know if this is a single image/color or not for drawing. */ + /* Check if we are doing "solo preview". */ bool is_single_image = (char)BKE_sequence_single_check(seq); - /* body */ + /* Draw strip body. */ x1 = (seq->startstill) ? seq->start : seq->startdisp; y1 = seq->machine + SEQ_STRIP_OFSBOTTOM; x2 = (seq->endstill) ? (seq->start + seq->len) : seq->enddisp; y2 = seq->machine + SEQ_STRIP_OFSTOP; - /* Position of the text, - * make sure that the strip content is visible also when the strip height gets lower. */ + /* Calculate height needed for drawing text on strip. */ float text_margin_y = y2 - min_ff(0.40f, 20 * U.dpi_fac * pixely); - /* Show some content only when the strip is high enough. */ + /* Is there enough space for drawing something else than text? */ bool y_threshold = ((y2 - y1) / pixely) > 20 * U.dpi_fac; uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); @@ -1020,12 +1002,12 @@ static void draw_seq_strip(const bContext *C, draw_seq_background(scene, seq, pos, x1, x2, y1, y2, is_single_image); - /* Color strips.. Draw a band with the strip's color on its lower part. */ + /* Draw a color band inside color strip. */ if (seq->type == SEQ_TYPE_COLOR && y_threshold) { draw_color_strip_band(seq, pos, text_margin_y, y1); } - /* Draw strip's offsets when flag is enabled or during "solo preview". */ + /* Draw strip offsets when flag is enabled or during "solo preview". */ if (!is_single_image && (seq->startofs || seq->endofs) && pixely > 0) { if ((sseq->draw_flag & SEQ_DRAW_OFFSET_EXT) || (seq == special_seq_update)) { draw_sequence_extensions(scene, seq, pos, pixely); @@ -1042,7 +1024,7 @@ static void draw_seq_strip(const bContext *C, drawmeta_contents(scene, seq, x1, y1, x2, y2); } - /* Sound strips.. Draw waveforms. */ + /* Draw sound strip waveform. */ if ((seq->type == SEQ_TYPE_SOUND_RAM) && (sseq->flag & SEQ_NO_WAVEFORMS) == 0) { draw_seq_waveform(v2d, C, @@ -1061,7 +1043,7 @@ static void draw_seq_strip(const bContext *C, draw_seq_locked(x1, y1, x2, y2); } - /* Missing media indication.. Draw a red line on the top of the strip. */ + /* Draw Red line on the top of invalid strip (Missing media). */ if (!BKE_sequence_is_valid_check(seq)) { draw_seq_invalid(x1, x2, y2, text_margin_y); } @@ -1082,11 +1064,9 @@ static void draw_seq_strip(const bContext *C, calculate_seq_text_offsets(v2d, seq, &x1, &x2, pixelx); - /* Draw the text on the top section of the strip, - * - depending on the vertical space, move it to the center or don't draw it. - * - don't draw it when there is not enough horizontal space. - */ + /* Don't draw strip if there is not enough vertical or horizontal space. */ if (((x2 - x1) > 32 * pixelx * U.dpi_fac) && ((y2 - y1) > 8 * pixely * U.dpi_fac)) { + /* Depending on the vertical space, draw text on top or in the center of strip. */ draw_seq_text( v2d, seq, sseq, x1, x2, y_threshold ? text_margin_y : y1, y2, seq_active, y_threshold); } @@ -1203,7 +1183,7 @@ ImBuf *sequencer_ibuf_get(struct Main *bmain, GPU_framebuffer_bind(fb); } - /* restore state so real rendering would be canceled (if needed) */ + /* Restore state so real rendering would be canceled if needed. */ G.is_break = is_break; return ibuf; @@ -1264,17 +1244,17 @@ static void sequencer_display_size(Scene *scene, float r_viewrect[2]) static void sequencer_draw_gpencil(const bContext *C) { - /* draw grease-pencil (image aligned) */ + /* Draw grease-pencil (image aligned). */ ED_annotation_draw_2dimage(C); - /* ortho at pixel level */ + /* Ortho at pixel level. */ UI_view2d_view_restore(C); - /* draw grease-pencil (screen aligned) */ + /* Draw grease-pencil (screen aligned). */ ED_annotation_draw_view2d(C, 0); } -/* draws content borders plus safety borders if needed */ +/* Draw content and safety borders borders. */ static void sequencer_draw_borders(const SpaceSeq *sseq, const View2D *v2d, const Scene *scene) { float x1 = v2d->tot.xmin; @@ -1284,7 +1264,7 @@ static void sequencer_draw_borders(const SpaceSeq *sseq, const View2D *v2d, cons GPU_line_width(1.0f); - /* border */ + /* Draw border. */ const uint shdr_pos = GPU_vertformat_attr_add( immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); @@ -1301,7 +1281,7 @@ static void sequencer_draw_borders(const SpaceSeq *sseq, const View2D *v2d, cons imm_draw_box_wire_2d(shdr_pos, x1 - 0.5f, y1 - 0.5f, x2 + 0.5f, y2 + 0.5f); - /* safety border */ + /* Draw safety border. */ if (sseq->flag & SEQ_SHOW_SAFE_MARGINS) { immUniformThemeColorBlend(TH_VIEW_OVERLAY, TH_BACK, 0.25f); @@ -1325,8 +1305,8 @@ static void sequencer_draw_borders(const SpaceSeq *sseq, const View2D *v2d, cons #if 0 void sequencer_draw_maskedit(const bContext *C, Scene *scene, ARegion *region, SpaceSeq *sseq) { - /* NOTE: sequencer mask editing isnt finished, the draw code is working but editing not, - * for now just disable drawing since the strip frame will likely be offset */ + /* NOTE: sequencer mask editing isnt finished, the draw code is working but editing not. + * For now just disable drawing since the strip frame will likely be offset. */ // if (sc->mode == SC_MODE_MASKEDIT) if (0 && sseq->mainb == SEQ_DRAW_IMG_IMBUF) { @@ -1377,8 +1357,8 @@ static void *sequencer_OCIO_transform_ibuf( force_fallback |= (ED_draw_imbuf_method(ibuf) != IMAGE_DRAW_METHOD_GLSL); force_fallback |= (ibuf->dither != 0.0f); + /* Fallback to CPU based color space conversion. */ if (force_fallback) { - /* Fallback to CPU based color space conversion */ *r_glsl_used = false; *r_format = GL_RGBA; *r_type = GL_UNSIGNED_BYTE; @@ -1423,9 +1403,8 @@ static void *sequencer_OCIO_transform_ibuf( display_buffer = NULL; } - /* there's a data to be displayed, but GLSL is not initialized - * properly, in this case we fallback to CPU-based display transform - */ + /* There is data to be displayed, but GLSL is not initialized + * properly, in this case we fallback to CPU-based display transform. */ if ((ibuf->rect || ibuf->rect_float) && !*r_glsl_used) { display_buffer = IMB_display_buffer_acquire_ctx(C, ibuf, &cache_handle); *r_format = GL_RGBA; @@ -1441,14 +1420,12 @@ static void *sequencer_OCIO_transform_ibuf( static void sequencer_stop_running_jobs(const bContext *C, Scene *scene) { if (G.is_rendering == false && (scene->r.seq_prev_type) == OB_RENDER) { - /* stop all running jobs, except screen one. currently previews frustrate Render - * needed to make so sequencer's rendering doesn't conflict with compositor - */ + /* Stop all running jobs, except screen one. Currently previews frustrate Render. + * Need to make so sequencer's rendering doesn't conflict with compositor. */ WM_jobs_kill_type(CTX_wm_manager(C), NULL, WM_JOB_TYPE_COMPOSITE); - /* in case of final rendering used for preview, kill all previews, - * otherwise threading conflict will happen in rendering module - */ + /* In case of final rendering used for preview, kill all previews, + * otherwise threading conflict will happen in rendering module. */ WM_jobs_kill_type(CTX_wm_manager(C), NULL, WM_JOB_TYPE_RENDER_PREVIEW); } } @@ -1521,8 +1498,7 @@ static void sequencer_draw_display_buffer(const bContext *C, } /* Format needs to be created prior to any immBindProgram call. - * Do it here because OCIO binds it's own shader. - */ + * Do it here because OCIO binds it's own shader. */ int format, type; bool glsl_used = false; GLuint texid; @@ -1671,7 +1647,7 @@ static ImBuf *sequencer_get_scope(Scene *scene, SpaceSeq *sseq, ImBuf *ibuf, boo break; } - /* future files may have new scopes we don't catch above */ + /* Future files may have new scopes we don't catch above. */ if (scope) { scopes->reference_ibuf = ibuf; } @@ -1708,13 +1684,13 @@ void sequencer_draw_preview(const bContext *C, return; } - /* Setup view */ + /* Setup view. */ sequencer_display_size(scene, viewrect); UI_view2d_totRect_set(v2d, viewrect[0] + 0.5f, viewrect[1] + 0.5f); UI_view2d_curRect_validate(v2d); UI_view2d_view_ortho(v2d); - /* Draw background */ + /* Draw background. */ if (!draw_backdrop && (!draw_overlay || sseq->overlay_type == SEQ_DRAW_OVERLAY_REFERENCE)) { sequencer_preview_clear(); @@ -1722,18 +1698,18 @@ void sequencer_draw_preview(const bContext *C, imm_draw_box_checker_2d(v2d->tot.xmin, v2d->tot.ymin, v2d->tot.xmax, v2d->tot.ymax); } } - /* Get image */ + /* Get image. */ ibuf = sequencer_ibuf_get( bmain, depsgraph, scene, sseq, cfra, frame_ofs, names[sseq->multiview_eye]); if (ibuf) { scope = sequencer_get_scope(scene, sseq, ibuf, draw_backdrop); - /* Draw image */ + /* Draw image. */ sequencer_draw_display_buffer( C, scene, region, sseq, ibuf, scope, draw_overlay, draw_backdrop); - /* Draw over image */ + /* Draw over image. */ if (sseq->flag & SEQ_SHOW_METADATA) { ED_region_image_metadata_draw(0.0, 0.0, ibuf, &v2d->tot, 1.0, 1.0); } @@ -1746,12 +1722,11 @@ void sequencer_draw_preview(const bContext *C, if (draw_gpencil && show_imbuf) { sequencer_draw_gpencil(C); } +#if 0 + sequencer_draw_maskedit(C, scene, region, sseq); +#endif - /* TODO */ - /* sequencer_draw_maskedit(C, scene, region, sseq); */ - - /* Scope is freed in sequencer_check_scopes when ibuf changes and - * scope image is to be replaced. */ + /* Scope is freed in sequencer_check_scopes when ibuf changes and redraw is needed. */ if (ibuf) { IMB_freeImBuf(ibuf); } @@ -1760,7 +1735,7 @@ void sequencer_draw_preview(const bContext *C, seq_prefetch_wm_notify(C, scene); } -/* draw backdrop of the sequencer strips view */ +/* Draw backdrop in sequencer timeline. */ static void draw_seq_backdrop(View2D *v2d) { int i; @@ -1768,11 +1743,11 @@ static void draw_seq_backdrop(View2D *v2d) uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); - /* darker gray overlay over the view backdrop */ + /* Darker gray overlay over the view backdrop. */ immUniformThemeColorShade(TH_BACK, -20); immRectf(pos, v2d->cur.xmin, -1.0, v2d->cur.xmax, 1.0); - /* Alternating horizontal stripes */ + /* Alternating horizontal stripes. */ i = max_ii(1, ((int)v2d->cur.ymin) - 1); while (i < v2d->cur.ymax) { @@ -1788,7 +1763,7 @@ static void draw_seq_backdrop(View2D *v2d) i++; } - /* Darker lines separating the horizontal bands */ + /* Darker lines separating the horizontal bands. */ i = max_ii(1, ((int)v2d->cur.ymin) - 1); int line_len = (int)v2d->cur.ymax - i + 1; immUniformThemeColor(TH_GRID); @@ -1802,7 +1777,6 @@ static void draw_seq_backdrop(View2D *v2d) immUnbindProgram(); } -/* draw the contents of the sequencer strips view */ static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *region) { Scene *scene = CTX_data_scene(C); @@ -1812,12 +1786,12 @@ static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *region) int sel = 0, j; float pixelx = BLI_rctf_size_x(&v2d->cur) / BLI_rcti_size_x(&v2d->mask); - /* loop through twice, first unselected, then selected */ + /* Loop through twice, first unselected, then selected. */ for (j = 0; j < 2; j++) { Sequence *seq; - /* loop through strips, checking for those that are visible */ + /* Loop through strips, checking for those that are visible. */ for (seq = ed->seqbasep->first; seq; seq = seq->next) { - /* boundbox and selection tests for NOT drawing the strip... */ + /* Boundbox and selection tests for NOT drawing the strip. */ if ((seq->flag & SELECT) != sel) { continue; } @@ -1837,11 +1811,11 @@ static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *region) continue; } - /* strip passed all tests unscathed... so draw it now */ + /* Strip passed all tests, draw it now. */ draw_seq_strip(C, sseq, scene, region, seq, pixelx, seq == last_seq ? true : false); } - /* draw selected next time round */ + /* Draw selected next time round. */ sel = SELECT; } @@ -1872,7 +1846,7 @@ static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *region) } } - /* draw highlight when previewing a single strip */ + /* Draw highlight if "solo preview" is used. */ if (special_seq_update) { const Sequence *seq = special_seq_update; GPU_blend(true); @@ -1904,8 +1878,7 @@ static void seq_draw_sfra_efra(Scene *scene, View2D *v2d) uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); - /* draw darkened area outside of active timeline - * frame range used is preview range or scene range */ + /* Draw overlay outside of frame range. */ immUniformThemeColorShadeAlpha(TH_BACK, -25, -100); if (frame_sta < frame_end) { @@ -1918,7 +1891,7 @@ static void seq_draw_sfra_efra(Scene *scene, View2D *v2d) immUniformThemeColorShade(TH_BACK, -60); - /* thin lines where the actual frames are */ + /* Draw frame range boundary. */ immBegin(GPU_PRIM_LINES, 4); immVertex2f(pos, frame_sta, v2d->cur.ymin); @@ -1929,7 +1902,7 @@ static void seq_draw_sfra_efra(Scene *scene, View2D *v2d) immEnd(); - /* While inside a meta strip, draw a checkerboard pattern outside of its range. */ + /* While in meta strip, draw a checkerboard overlay outside of frame range. */ if (ed && !BLI_listbase_is_empty(&ed->metastack)) { MetaStack *ms = ed->metastack.last; immUnbindProgram(); @@ -1979,7 +1952,7 @@ typedef struct CacheDrawData { size_t final_out_vert_count; } CacheDrawData; -/* Called as a callback */ +/* Called as a callback. */ static bool draw_cache_view_init_fn(void *userdata, size_t item_count) { if (item_count == 0) { @@ -2175,7 +2148,7 @@ static void draw_cache_view(const bContext *C) GPU_blend(false); } -/* Draw Timeline/Strip Editor Mode for Sequencer */ +/* Draw sequencer timeline. */ void draw_timeline_seq(const bContext *C, ARegion *region) { Scene *scene = CTX_data_scene(C); @@ -2188,7 +2161,6 @@ void draw_timeline_seq(const bContext *C, ARegion *region) seq_prefetch_wm_notify(C, scene); - /* clear and setup matrix */ UI_GetThemeColor3fv(TH_BACK, col); if (ed && ed->metastack.first) { GPU_clear_color(col[0], col[1], col[2] - 0.1f, 0.0f); @@ -2199,44 +2171,36 @@ void draw_timeline_seq(const bContext *C, ARegion *region) GPU_clear(GPU_COLOR_BIT); UI_view2d_view_ortho(v2d); - - /* calculate extents of sequencer strips/data - * NOTE: needed for the scrollers later - */ + /* Get timeline boundbox, needed for the scrollers. */ boundbox_seq(scene, &v2d->tot); - - /* draw backdrop */ draw_seq_backdrop(v2d); - - /* regular grid-pattern over the rest of the view (i.e. 1-second grid lines) */ UI_view2d_constant_grid_draw(v2d, FPS); - /* Only draw backdrop in pure sequence view. */ + /* Only draw backdrop in timeline view. */ if (sseq->view == SEQ_VIEW_SEQUENCE && sseq->draw_flag & SEQ_DRAW_BACKDROP) { sequencer_draw_preview(C, scene, region, sseq, scene->r.cfra, 0, false, true); UI_view2d_view_ortho(v2d); } + /* Draw attached callbacks. */ ED_region_draw_cb_draw(C, region, REGION_DRAW_PRE_VIEW); - seq_draw_sfra_efra(scene, v2d); - /* sequence strips (if there is data available to be drawn) */ if (ed) { - /* draw the data */ draw_seq_strips(C, ed, region); - /* text draw cached (for sequence names), in pixelspace now */ + /* Draw text added in previous function. */ UI_view2d_text_cache_draw(region); } - /* current frame */ UI_view2d_view_ortho(v2d); if ((sseq->flag & SEQ_DRAWFRAMES) == 0) { cfra_flag |= DRAWCFRA_UNIT_SECONDS; } + + /* Draw playhead. */ ANIM_draw_cfra(C, v2d, cfra_flag); - /* overlap playhead */ + /* Draw overlap playhead. */ if (scene->ed && scene->ed->over_flag & SEQ_EDIT_OVERLAY_SHOW) { int cfra_over = (scene->ed->over_flag & SEQ_EDIT_OVERLAY_ABS) ? scene->ed->over_cfra : @@ -2247,7 +2211,8 @@ void draw_timeline_seq(const bContext *C, ARegion *region) float viewport_size[4]; GPU_viewport_size_get_f(viewport_size); immUniform2f("viewport_size", viewport_size[2], viewport_size[3]); - immUniform1i("colors_len", 0); /* "simple" mode */ + /* Shader may have color set from past usage - reset it. */ + immUniform1i("colors_len", 0); immUniform1f("dash_width", 20.0f * U.pixelsize); immUniform1f("dash_factor", 0.5f); immUniformThemeColor(TH_CFRAME); @@ -2260,7 +2225,6 @@ void draw_timeline_seq(const bContext *C, ARegion *region) immUnbindProgram(); } - /* markers */ UI_view2d_view_orthoSpecial(region, v2d, 1); int marker_draw_flag = DRAW_MARKERS_MARGIN; if (sseq->flag & SEQ_SHOW_MARKERS) { @@ -2268,28 +2232,22 @@ void draw_timeline_seq(const bContext *C, ARegion *region) } UI_view2d_view_ortho(v2d); - /* draw cache on top of markers area */ + if (ed) { draw_cache_view(C); } - /* preview range */ + ANIM_draw_previewrange(C, v2d, 1); - /* callback */ + /* Draw registered callbacks. */ ED_region_draw_cb_draw(C, region, REGION_DRAW_POST_VIEW); - - /* reset view matrix */ UI_view2d_view_restore(C); - - /* scrubbing region */ ED_time_scrub_draw(region, scene, !(sseq->flag & SEQ_DRAWFRAMES), true); - - /* scrollers */ scrollers = UI_view2d_scrollers_calc(v2d, NULL); UI_view2d_scrollers_draw(v2d, scrollers); UI_view2d_scrollers_free(scrollers); - /* channel numbers */ + /* Draw channel numbers. */ { rcti rect; BLI_rcti_init( 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"); diff --git a/source/blender/editors/space_sequencer/sequencer_intern.h b/source/blender/editors/space_sequencer/sequencer_intern.h index f70bc06caf7..708682cd04f 100644 --- a/source/blender/editors/space_sequencer/sequencer_intern.h +++ b/source/blender/editors/space_sequencer/sequencer_intern.h @@ -27,7 +27,7 @@ #include "DNA_sequence_types.h" #include "RNA_access.h" -/* internal exports only */ +/* Internal exports only. */ struct ARegion; struct ARegionType; @@ -57,7 +57,7 @@ void sequencer_special_update_set(Sequence *seq); float sequence_handle_size_get_clamped(struct Sequence *seq, const float pixelx); /* UNUSED */ -// void seq_reset_imageofs(struct SpaceSeq *sseq); +/* void seq_reset_imageofs(struct SpaceSeq *sseq); */ struct ImBuf *sequencer_ibuf_get(struct Main *bmain, struct Depsgraph *depsgraph, @@ -88,19 +88,19 @@ int seq_effect_find_selected(struct Scene *scene, struct Sequence **r_selseq3, const char **r_error_str); -/* operator helpers */ +/* Operator helpers. */ bool sequencer_edit_poll(struct bContext *C); /* UNUSED */ -// bool sequencer_strip_poll(struct bContext *C); +/* bool sequencer_strip_poll(struct bContext *C); */ bool sequencer_strip_has_path_poll(struct bContext *C); bool sequencer_view_preview_poll(struct bContext *C); bool sequencer_view_strips_poll(struct bContext *C); -/* externs */ +/* Externs. */ extern EnumPropertyItem sequencer_prop_effect_types[]; extern EnumPropertyItem prop_side_types[]; -/* operators */ +/* Operators. */ struct wmKeyConfig; struct wmOperatorType; @@ -152,7 +152,7 @@ void SEQUENCER_OT_export_subtitles(struct wmOperatorType *ot); void SEQUENCER_OT_set_range_to_strips(struct wmOperatorType *ot); -/* preview specific operators */ +/* Preview specific operators. */ void SEQUENCER_OT_view_all_preview(struct wmOperatorType *ot); /* sequencer_select.c */ @@ -193,8 +193,8 @@ enum { SEQ_SELECT_LR_RIGHT, }; -/* defines used internally */ -#define SCE_MARKERS 0 // XXX - dummy +/* Defines used internally. */ +#define SCE_MARKERS 0 /* XXX - dummy */ /* sequencer_ops.c */ void sequencer_operatortypes(void); @@ -222,7 +222,7 @@ void SEQUENCER_OT_sample(struct wmOperatorType *ot); /* sequencer_preview.c */ void sequencer_preview_add_sound(const struct bContext *C, struct Sequence *seq); -/* sequencer_add */ +/* sequencer_add.c */ int sequencer_image_seq_get_minmax_frame(struct wmOperator *op, int sfra, int *r_minframe, diff --git a/source/blender/editors/space_sequencer/sequencer_modifier.c b/source/blender/editors/space_sequencer/sequencer_modifier.c index b90dc5e10ff..e0f7179c3f9 100644 --- a/source/blender/editors/space_sequencer/sequencer_modifier.c +++ b/source/blender/editors/space_sequencer/sequencer_modifier.c @@ -35,7 +35,7 @@ #include "RNA_define.h" #include "RNA_enum_types.h" -/* own include */ +/* Own include. */ #include "sequencer_intern.h" /*********************** Add modifier operator *************************/ diff --git a/source/blender/editors/space_sequencer/sequencer_ops.c b/source/blender/editors/space_sequencer/sequencer_ops.c index 4296701366a..ac00838a079 100644 --- a/source/blender/editors/space_sequencer/sequencer_ops.c +++ b/source/blender/editors/space_sequencer/sequencer_ops.c @@ -32,7 +32,7 @@ #include "ED_markers.h" #include "ED_select_utils.h" #include "ED_sequencer.h" -#include "ED_transform.h" /* transform keymap */ +#include "ED_transform.h" /* Transform keymap. */ #include "BKE_sequencer.h" diff --git a/source/blender/editors/space_sequencer/sequencer_preview.c b/source/blender/editors/space_sequencer/sequencer_preview.c index d50047c4839..7d416884721 100644 --- a/source/blender/editors/space_sequencer/sequencer_preview.c +++ b/source/blender/editors/space_sequencer/sequencer_preview.c @@ -52,9 +52,9 @@ typedef struct PreviewJobAudio { struct PreviewJobAudio *next, *prev; struct Main *bmain; bSound *sound; - int lr; /* sample left or right */ + int lr; /* Sample left or right. */ int startframe; - bool waveform; /* reload sound or waveform */ + bool waveform; /* Reload sound or waveform. */ } PreviewJobAudio; static void free_preview_job(void *data) @@ -66,7 +66,7 @@ static void free_preview_job(void *data) MEM_freeN(pj); } -/* only this runs inside thread */ +/* Only this runs inside thread. */ static void preview_startjob(void *data, short *stop, short *do_update, float *progress) { PreviewJob *pj = data; @@ -89,7 +89,7 @@ static void preview_startjob(void *data, short *stop, short *do_update, float *p while (previewjb) { sound = previewjb->sound; - /* make sure we cleanup the loading flag! */ + /* Make sure we cleanup the loading flag! */ BLI_spin_lock(sound->spinlock); sound->tags &= ~SOUND_TAGS_WAVEFORM_LOADING; BLI_spin_unlock(sound->spinlock); @@ -127,7 +127,6 @@ static void preview_endjob(void *data) void sequencer_preview_add_sound(const bContext *C, Sequence *seq) { - /* first, get the preview job, if it exists */ wmJob *wm_job; PreviewJob *pj; ScrArea *area = CTX_wm_area(C); @@ -139,6 +138,7 @@ void sequencer_preview_add_sound(const bContext *C, Sequence *seq) WM_JOB_PROGRESS, WM_JOB_TYPE_SEQ_BUILD_PREVIEW); + /* Get the preview job if it exists. */ pj = WM_jobs_customdata_get(wm_job); if (!pj) { @@ -152,8 +152,6 @@ void sequencer_preview_add_sound(const bContext *C, Sequence *seq) WM_jobs_callbacks(wm_job, preview_startjob, NULL, NULL, preview_endjob); } - /* attempt to lock mutex of job here */ - audiojob->bmain = CTX_data_main(C); audiojob->sound = seq->sound; diff --git a/source/blender/editors/space_sequencer/sequencer_scopes.c b/source/blender/editors/space_sequencer/sequencer_scopes.c index 02912b2755f..b08c35623af 100644 --- a/source/blender/editors/space_sequencer/sequencer_scopes.c +++ b/source/blender/editors/space_sequencer/sequencer_scopes.c @@ -42,7 +42,7 @@ static void rgb_to_yuv_normalized(const float rgb[3], float yuv[3]) yuv[1] = 0.492f * (rgb[2] - yuv[0]); yuv[2] = 0.877f * (rgb[0] - yuv[0]); - /* Normalize */ + /* Normalize. */ yuv[1] *= 255.0f / (122 * 2.0f); yuv[1] += 0.5f; diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c index 810e1009ecb..c5472ed88e5 100644 --- a/source/blender/editors/space_sequencer/sequencer_select.c +++ b/source/blender/editors/space_sequencer/sequencer_select.c @@ -40,7 +40,7 @@ #include "RNA_define.h" -/* for menu/popup icons etc etc*/ +/* For menu, popup, icons, etc. */ #include "ED_outliner.h" #include "ED_screen.h" @@ -49,7 +49,7 @@ #include "UI_view2d.h" -/* own include */ +/* Own include. */ #include "sequencer_intern.h" static void *find_nearest_marker(int UNUSED(d1), int UNUSED(d2)) @@ -147,7 +147,7 @@ static void select_active_side_range(ListBase *seqbase, } } -/* used for mouse selection in SEQUENCER_OT_select */ +/* Used for mouse selection in SEQUENCER_OT_select */ static void select_linked_time(ListBase *seqbase, Sequence *seq_link) { Sequence *seq; @@ -158,7 +158,7 @@ static void select_linked_time(ListBase *seqbase, Sequence *seq_link) int right_match = (seq->enddisp == seq_link->enddisp) ? 1 : 0; if (left_match && right_match) { - /* a direct match, copy the selection settinhs */ + /* Direct match, copy the selection settings. */ seq->flag &= ~(SELECT | SEQ_LEFTSEL | SEQ_RIGHTSEL); seq->flag |= seq_link->flag & (SELECT | SEQ_LEFTSEL | SEQ_RIGHTSEL); @@ -166,7 +166,7 @@ static void select_linked_time(ListBase *seqbase, Sequence *seq_link) } else if (seq_link->flag & SELECT && (left_match || right_match)) { - /* clear for reselection */ + /* Clear for reselection. */ seq->flag &= ~(SEQ_LEFTSEL | SEQ_RIGHTSEL); if (left_match && seq_link->flag & SEQ_LEFTSEL) { @@ -248,12 +248,11 @@ static void select_neighbor_from_last(Scene *scene, int lr) } } if (changed) { - /* pass */ + /* Pass. */ } } #endif -/* (de)select operator */ static int sequencer_de_select_all_exec(bContext *C, wmOperator *op) { int action = RNA_enum_get(op->ptr, "action"); @@ -302,22 +301,21 @@ static int sequencer_de_select_all_exec(bContext *C, wmOperator *op) void SEQUENCER_OT_select_all(struct wmOperatorType *ot) { - /* identifiers */ + /* Identifiers. */ ot->name = "(De)select All"; ot->idname = "SEQUENCER_OT_select_all"; ot->description = "Select or deselect all strips"; - /* api callbacks */ + /* Api callbacks. */ ot->exec = sequencer_de_select_all_exec; ot->poll = sequencer_edit_poll; - /* flags */ + /* Flags. */ ot->flag = OPTYPE_UNDO; WM_operator_properties_select_all(ot); } -/* (de)select operator */ static int sequencer_select_inverse_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene = CTX_data_scene(C); @@ -343,16 +341,16 @@ static int sequencer_select_inverse_exec(bContext *C, wmOperator *UNUSED(op)) void SEQUENCER_OT_select_inverse(struct wmOperatorType *ot) { - /* identifiers */ + /* Identifiers. */ ot->name = "Select Inverse"; ot->idname = "SEQUENCER_OT_select_inverse"; ot->description = "Select unselected strips"; - /* api callbacks */ + /* Api callbacks. */ ot->exec = sequencer_select_inverse_exec; ot->poll = sequencer_edit_poll; - /* flags */ + /* Flags. */ ot->flag = OPTYPE_UNDO; } @@ -385,18 +383,18 @@ static int sequencer_select_exec(bContext *C, wmOperator *op) wait_to_deselect_others = false; } - marker = find_nearest_marker(SCE_MARKERS, 1); // XXX - dummy function for now + marker = find_nearest_marker(SCE_MARKERS, 1); /* XXX - dummy function for now */ seq = find_nearest_seq(scene, v2d, &hand, mval); - // XXX - not nice, Ctrl+RMB needs to do left_right only when not over a strip + /* XXX - not nice, Ctrl+RMB needs to do left_right only when not over a strip */ if (seq && linked_time && (left_right == SEQ_SELECT_LR_MOUSE)) { left_right = SEQ_SELECT_LR_NONE; } if (marker) { int oldflag; - /* select timeline marker */ + /* Select timeline marker. */ if (extend) { oldflag = marker->flag; if (oldflag & SELECT) { @@ -415,7 +413,7 @@ static int sequencer_select_exec(bContext *C, wmOperator *op) ret_value = OPERATOR_FINISHED; } else if (left_right != SEQ_SELECT_LR_NONE) { - /* use different logic for this */ + /* Use different logic for this. */ float x; if (extend == false) { ED_sequencer_deselect_all(scene); @@ -494,7 +492,7 @@ static int sequencer_select_exec(bContext *C, wmOperator *op) } } - /* On Alt selection, select the strip and bordering handles */ + /* On Alt selection, select the strip and bordering handles. */ if (linked_handle) { if (!ELEM(hand, SEQ_SIDE_LEFT, SEQ_SIDE_RIGHT)) { /* First click selects the strip and its adjacent handles (if valid). @@ -510,7 +508,7 @@ static int sequencer_select_exec(bContext *C, wmOperator *op) select_surrounding_handles(scene, seq); } else { - /* always select the strip under the cursor */ + /* Always select the strip under the cursor. */ seq->flag |= SELECT; /* First click selects adjacent handles on that side. @@ -635,21 +633,21 @@ void SEQUENCER_OT_select(wmOperatorType *ot) }; PropertyRNA *prop; - /* identifiers */ + /* Identifiers. */ ot->name = "Select"; ot->idname = "SEQUENCER_OT_select"; ot->description = "Select a strip (last selected becomes the \"active strip\")"; - /* api callbacks */ + /* Api callbacks. */ ot->exec = sequencer_select_exec; ot->invoke = WM_generic_select_invoke; ot->modal = WM_generic_select_modal; ot->poll = ED_operator_sequencer_active; - /* flags */ + /* Flags. */ ot->flag = OPTYPE_UNDO; - /* properties */ + /* Properties. */ WM_operator_properties_generic_select(ot); RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend the selection"); prop = RNA_def_boolean(ot->srna, @@ -660,7 +658,7 @@ void SEQUENCER_OT_select(wmOperatorType *ot) RNA_def_property_flag(prop, PROP_SKIP_SAVE); RNA_def_boolean( ot->srna, "linked_handle", 0, "Linked Handle", "Select handles next to the active strip"); - /* for animation this is an enum but atm having an enum isn't useful for us */ + /* For animation this is enum but atm having an enum isn't useful for us. */ RNA_def_enum(ot->srna, "left_right", sequencer_select_left_right_types, @@ -671,7 +669,7 @@ void SEQUENCER_OT_select(wmOperatorType *ot) ot->srna, "linked_time", 0, "Linked Time", "Select other strips at the same time"); } -/* run recursively to select linked */ +/* Run recursively to select linked. */ static bool select_more_less_seq__internal(Scene *scene, bool sel, const bool linked) { Editing *ed = BKE_sequencer_editing_get(scene, false); @@ -693,7 +691,7 @@ static bool select_more_less_seq__internal(Scene *scene, bool sel, const bool li } if (!linked) { - /* if not linked we only want to touch each seq once, newseq */ + /* If not linked we only want to touch each seq once, newseq. */ for (seq = ed->seqbasep->first; seq; seq = seq->next) { seq->tmp = NULL; } @@ -702,7 +700,7 @@ static bool select_more_less_seq__internal(Scene *scene, bool sel, const bool li for (seq = ed->seqbasep->first; seq; seq = seq->next) { if ((seq->flag & SELECT) == sel) { if (linked || (seq->tmp == NULL)) { - /* only get unselected neighbors */ + /* Only get unselected neighbors. */ neighbor = find_neighboring_sequence(scene, seq, SEQ_SIDE_LEFT, isel); if (neighbor) { if (sel) { @@ -738,7 +736,6 @@ static bool select_more_less_seq__internal(Scene *scene, bool sel, const bool li return changed; } -/* select more operator */ static int sequencer_select_more_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene = CTX_data_scene(C); @@ -756,22 +753,19 @@ static int sequencer_select_more_exec(bContext *C, wmOperator *UNUSED(op)) void SEQUENCER_OT_select_more(wmOperatorType *ot) { - /* identifiers */ + /* Identifiers. */ ot->name = "Select More"; ot->idname = "SEQUENCER_OT_select_more"; ot->description = "Select more strips adjacent to the current selection"; - /* api callbacks */ + /* Api callbacks. */ ot->exec = sequencer_select_more_exec; ot->poll = sequencer_edit_poll; - /* flags */ + /* Flags. */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - - /* properties */ } -/* select less operator */ static int sequencer_select_less_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene = CTX_data_scene(C); @@ -789,22 +783,19 @@ static int sequencer_select_less_exec(bContext *C, wmOperator *UNUSED(op)) void SEQUENCER_OT_select_less(wmOperatorType *ot) { - /* identifiers */ + /* Identifiers. */ ot->name = "Select Less"; ot->idname = "SEQUENCER_OT_select_less"; ot->description = "Shrink the current selection of adjacent selected strips"; - /* api callbacks */ + /* Api callbacks. */ ot->exec = sequencer_select_less_exec; ot->poll = sequencer_edit_poll; - /* flags */ + /* Flags. */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - - /* properties */ } -/* select pick linked operator (uses the mouse) */ static int sequencer_select_linked_pick_invoke(bContext *C, wmOperator *op, const wmEvent *event) { Scene *scene = CTX_data_scene(C); @@ -815,10 +806,10 @@ static int sequencer_select_linked_pick_invoke(bContext *C, wmOperator *op, cons Sequence *mouse_seq; int selected, hand; - /* this works like UV, not mesh */ + /* This works like UV, not mesh. */ mouse_seq = find_nearest_seq(scene, v2d, &hand, event->mval); if (!mouse_seq) { - return OPERATOR_FINISHED; /* user error as with mesh?? */ + return OPERATOR_FINISHED; /* User error as with mesh?? */ } if (extend == 0) { @@ -842,23 +833,22 @@ static int sequencer_select_linked_pick_invoke(bContext *C, wmOperator *op, cons void SEQUENCER_OT_select_linked_pick(wmOperatorType *ot) { - /* identifiers */ + /* Identifiers. */ ot->name = "Select Pick Linked"; ot->idname = "SEQUENCER_OT_select_linked_pick"; ot->description = "Select a chain of linked strips nearest to the mouse pointer"; - /* api callbacks */ + /* Api callbacks. */ ot->invoke = sequencer_select_linked_pick_invoke; ot->poll = ED_operator_sequencer_active; - /* flags */ + /* Flags. */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - /* properties */ + /* Properties. */ RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend the selection"); } -/* select linked operator */ static int sequencer_select_linked_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene = CTX_data_scene(C); @@ -878,22 +868,19 @@ static int sequencer_select_linked_exec(bContext *C, wmOperator *UNUSED(op)) void SEQUENCER_OT_select_linked(wmOperatorType *ot) { - /* identifiers */ + /* Identifiers. */ ot->name = "Select Linked"; ot->idname = "SEQUENCER_OT_select_linked"; ot->description = "Select all strips adjacent to the current selection"; - /* api callbacks */ + /* Api callbacks. */ ot->exec = sequencer_select_linked_exec; ot->poll = sequencer_edit_poll; - /* flags */ + /* Flags. */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - - /* properties */ } -/* select handles operator */ static int sequencer_select_handles_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); @@ -928,19 +915,19 @@ static int sequencer_select_handles_exec(bContext *C, wmOperator *op) void SEQUENCER_OT_select_handles(wmOperatorType *ot) { - /* identifiers */ + /* Identifiers. */ ot->name = "Select Handles"; ot->idname = "SEQUENCER_OT_select_handles"; ot->description = "Select gizmo handles on the sides of the selected strip"; - /* api callbacks */ + /* Api callbacks. */ ot->exec = sequencer_select_handles_exec; ot->poll = sequencer_edit_poll; - /* flags */ + /* Flags. */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - /* properties */ + /* Properties. */ RNA_def_enum(ot->srna, "side", prop_side_types, @@ -949,7 +936,6 @@ void SEQUENCER_OT_select_handles(wmOperatorType *ot) "The side of the handle that is selected"); } -/* select side operator */ static int sequencer_select_side_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); @@ -993,19 +979,19 @@ static int sequencer_select_side_exec(bContext *C, wmOperator *op) void SEQUENCER_OT_select_side(wmOperatorType *ot) { - /* identifiers */ + /* Identifiers. */ ot->name = "Select Side"; ot->idname = "SEQUENCER_OT_select_side"; ot->description = "Select strips on the nominated side of the selected strips"; - /* api callbacks */ + /* Api callbacks. */ ot->exec = sequencer_select_side_exec; ot->poll = sequencer_edit_poll; - /* flags */ + /* Flags. */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - /* properties */ + /* Properties. */ RNA_def_enum(ot->srna, "side", prop_side_types, @@ -1014,7 +1000,6 @@ void SEQUENCER_OT_select_side(wmOperatorType *ot) "The side to which the selection is applied"); } -/* box_select operator */ static int sequencer_box_select_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); @@ -1089,7 +1074,6 @@ static int sequencer_box_select_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -/* ****** Box Select ****** */ static int sequencer_box_select_invoke(bContext *C, wmOperator *op, const wmEvent *event) { Scene *scene = CTX_data_scene(C); @@ -1112,12 +1096,12 @@ void SEQUENCER_OT_select_box(wmOperatorType *ot) { PropertyRNA *prop; - /* identifiers */ + /* Identifiers. */ ot->name = "Box Select"; ot->idname = "SEQUENCER_OT_select_box"; ot->description = "Select strips using box selection"; - /* api callbacks */ + /* Api callbacks. */ ot->invoke = sequencer_box_select_invoke; ot->exec = sequencer_box_select_exec; ot->modal = WM_gesture_box_modal; @@ -1125,10 +1109,10 @@ void SEQUENCER_OT_select_box(wmOperatorType *ot) ot->poll = ED_operator_sequencer_active; - /* flags */ + /* Flags. */ ot->flag = OPTYPE_UNDO; - /* properties */ + /* Properties. */ WM_operator_properties_gesture_box(ot); WM_operator_properties_select_operation_simple(ot); @@ -1140,8 +1124,6 @@ void SEQUENCER_OT_select_box(wmOperatorType *ot) RNA_def_property_flag(prop, PROP_SKIP_SAVE); } -/* ****** Selected Grouped ****** */ - enum { SEQ_SELECT_GROUP_TYPE, SEQ_SELECT_GROUP_TYPE_BASIC, @@ -1366,7 +1348,7 @@ static bool select_grouped_effect_link(Editing *ed, Sequence *actseq, const int BKE_sequence_iterator_next(&iter)) { seq = iter.seq; - /* Ignore all seqs already selected! */ + /* Ignore all seqs already selected. */ /* Ignore all seqs not sharing some time with active one. */ /* Ignore all seqs of incompatible types (audio vs video). */ if (!SEQ_CHANNEL_CHECK(seq, channel) || (seq->flag & SELECT) || (seq->startdisp >= enddisp) || @@ -1375,7 +1357,7 @@ static bool select_grouped_effect_link(Editing *ed, Sequence *actseq, const int continue; } - /* If the seq is an effect one, we need extra checking! */ + /* If the seq is an effect one, we need extra checking. */ if (SEQ_IS_EFFECT(seq) && ((seq->seq1 && seq->seq1->tmp) || (seq->seq2 && seq->seq2->tmp) || (seq->seq3 && seq->seq3->tmp))) { if (startdisp > seq->startdisp) { @@ -1398,7 +1380,7 @@ static bool select_grouped_effect_link(Editing *ed, Sequence *actseq, const int BKE_sequence_iterator_begin(ed, &iter, true); } - /* Video strips below active one, or any strip for audio (order do no matters here!). */ + /* Video strips below active one, or any strip for audio (order doesn't matter here). */ else if (seq->machine < machine || is_audio) { seq->flag |= SELECT; changed = true; @@ -1476,20 +1458,20 @@ static int sequencer_select_grouped_exec(bContext *C, wmOperator *op) void SEQUENCER_OT_select_grouped(wmOperatorType *ot) { - /* identifiers */ + /* Identifiers. */ ot->name = "Select Grouped"; ot->description = "Select all strips grouped by various properties"; ot->idname = "SEQUENCER_OT_select_grouped"; - /* api callbacks */ + /* Api callbacks. */ ot->invoke = WM_menu_invoke; ot->exec = sequencer_select_grouped_exec; ot->poll = sequencer_edit_poll; - /* flags */ + /* Flags. */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - /* properties */ + /* Properties. */ ot->prop = RNA_def_enum(ot->srna, "type", sequencer_prop_select_grouped_types, 0, "Type", ""); RNA_def_boolean(ot->srna, "extend", diff --git a/source/blender/editors/space_sequencer/sequencer_view.c b/source/blender/editors/space_sequencer/sequencer_view.c index b2114eab62e..a890b770c83 100644 --- a/source/blender/editors/space_sequencer/sequencer_view.c +++ b/source/blender/editors/space_sequencer/sequencer_view.c @@ -46,7 +46,7 @@ #include "UI_view2d.h" -/* own include */ +/* Own include. */ #include "sequencer_intern.h" /******************** sample backdrop operator ********************/ @@ -158,7 +158,7 @@ static void sample_apply(bContext *C, wmOperator *op, const wmEvent *event) info->colf[3] = fp[3]; info->colfp = info->colf; - /* sequencer's image buffers are in non-linear space, need to make them linear */ + /* Sequencer's image buffers are in non-linear space, need to make them linear. */ copy_v4_v4(info->linearcol, info->colf); BKE_sequencer_pixel_from_sequencer_space_v4(scene, info->linearcol); @@ -236,17 +236,17 @@ static bool sample_poll(bContext *C) void SEQUENCER_OT_sample(wmOperatorType *ot) { - /* identifiers */ + /* Identifiers. */ ot->name = "Sample Color"; ot->idname = "SEQUENCER_OT_sample"; ot->description = "Use mouse to sample color in current frame"; - /* api callbacks */ + /* Api callbacks. */ ot->invoke = sample_invoke; ot->modal = sample_modal; ot->cancel = sample_cancel; ot->poll = sample_poll; - /* flags */ + /* Flags. */ ot->flag = OPTYPE_BLOCKING; } diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c index ed8117fda31..e40fe91ae99 100644 --- a/source/blender/editors/space_sequencer/space_sequencer.c +++ b/source/blender/editors/space_sequencer/space_sequencer.c @@ -43,7 +43,7 @@ #include "ED_screen.h" #include "ED_space_api.h" #include "ED_view3d.h" -#include "ED_view3d_offscreen.h" /* only for sequencer view3d drawing callback */ +#include "ED_view3d_offscreen.h" /* Only for sequencer view3d drawing callback. */ #include "WM_api.h" #include "WM_message.h" @@ -57,7 +57,8 @@ #include "IMB_imbuf.h" -#include "sequencer_intern.h" // own include +/* Own include. */ +#include "sequencer_intern.h" /**************************** common state *****************************/ @@ -97,7 +98,7 @@ static SpaceLink *sequencer_new(const ScrArea *UNUSED(area), const Scene *scene) sseq->mainb = SEQ_DRAW_IMG_IMBUF; sseq->flag = SEQ_SHOW_GPENCIL | SEQ_USE_ALPHA | SEQ_SHOW_MARKERS; - /* tool header */ + /* Tool header. */ region = MEM_callocN(sizeof(ARegion), "tool header for sequencer"); BLI_addtail(&sseq->regionbase, region); @@ -105,14 +106,14 @@ static SpaceLink *sequencer_new(const ScrArea *UNUSED(area), const Scene *scene) region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP; region->flag = RGN_FLAG_HIDDEN | RGN_FLAG_HIDDEN_BY_USER; - /* header */ + /* Header. */ region = MEM_callocN(sizeof(ARegion), "header for sequencer"); BLI_addtail(&sseq->regionbase, region); region->regiontype = RGN_TYPE_HEADER; region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP; - /* buttons/list view */ + /* Buttons/list view. */ region = MEM_callocN(sizeof(ARegion), "buttons for sequencer"); BLI_addtail(&sseq->regionbase, region); @@ -120,7 +121,7 @@ static SpaceLink *sequencer_new(const ScrArea *UNUSED(area), const Scene *scene) region->alignment = RGN_ALIGN_RIGHT; region->flag = RGN_FLAG_HIDDEN; - /* toolbar */ + /* Toolbar. */ region = MEM_callocN(sizeof(ARegion), "tools for sequencer"); BLI_addtail(&sseq->regionbase, region); @@ -128,19 +129,19 @@ static SpaceLink *sequencer_new(const ScrArea *UNUSED(area), const Scene *scene) region->alignment = RGN_ALIGN_LEFT; region->flag = RGN_FLAG_HIDDEN; - /* preview region */ - /* NOTE: if you change values here, also change them in sequencer_init_preview_region */ + /* Preview region. */ + /* NOTE: if you change values here, also change them in sequencer_init_preview_region. */ region = MEM_callocN(sizeof(ARegion), "preview region for sequencer"); BLI_addtail(&sseq->regionbase, region); region->regiontype = RGN_TYPE_PREVIEW; region->alignment = RGN_ALIGN_TOP; region->flag |= RGN_FLAG_HIDDEN; - /* for now, aspect ratio should be maintained, and zoom is clamped within sane default limits */ + /* For now, aspect ratio should be maintained, and zoom is clamped within sane default limits. */ region->v2d.keepzoom = V2D_KEEPASPECT | V2D_KEEPZOOM | V2D_LIMITZOOM; region->v2d.minzoom = 0.001f; region->v2d.maxzoom = 1000.0f; - region->v2d.tot.xmin = -960.0f; /* 1920 width centered */ - region->v2d.tot.ymin = -540.0f; /* 1080 height centered */ + region->v2d.tot.xmin = -960.0f; /* 1920 width centered. */ + region->v2d.tot.ymin = -540.0f; /* 1080 height centered. */ region->v2d.tot.xmax = 960.0f; region->v2d.tot.ymax = 540.0f; region->v2d.min[0] = 0.0f; @@ -151,14 +152,13 @@ static SpaceLink *sequencer_new(const ScrArea *UNUSED(area), const Scene *scene) region->v2d.align = V2D_ALIGN_FREE; region->v2d.keeptot = V2D_KEEPTOT_FREE; - /* main region */ + /* Main region. */ region = MEM_callocN(sizeof(ARegion), "main region for sequencer"); BLI_addtail(&sseq->regionbase, region); region->regiontype = RGN_TYPE_WINDOW; - /* seq space goes from (0,8) to (0, efra) */ - + /* Seq space goes from (0,8) to (0, efra). */ region->v2d.tot.xmin = 0.0f; region->v2d.tot.ymin = 0.0f; region->v2d.tot.xmax = scene->r.efra; @@ -184,13 +184,13 @@ static SpaceLink *sequencer_new(const ScrArea *UNUSED(area), const Scene *scene) return (SpaceLink *)sseq; } -/* not spacelink itself */ +/* Not spacelink itself. */ static void sequencer_free(SpaceLink *sl) { SpaceSeq *sseq = (SpaceSeq *)sl; SequencerScopes *scopes = &sseq->scopes; - // XXX if (sseq->gpd) BKE_gpencil_free(sseq->gpd); + /* XXX if (sseq->gpd) BKE_gpencil_free(sseq->gpd); */ if (scopes->zebra_ibuf) { IMB_freeImBuf(scopes->zebra_ibuf); @@ -213,7 +213,7 @@ static void sequencer_free(SpaceLink *sl) } } -/* spacetype; init callback */ +/* Spacetype init callback. */ static void sequencer_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(area)) { } @@ -300,7 +300,7 @@ static void sequencer_refresh(const bContext *C, ScrArea *area) region_preview->alignment = RGN_ALIGN_TOP; view_changed = true; } - /* Final check that both preview and main height are reasonable! */ + /* Final check that both preview and main height are reasonable. */ if (region_preview->sizey < 10 || region_main->sizey < 10 || region_preview->sizey + region_main->sizey > height) { region_preview->sizey = (int)(height * 0.4f + 0.5f); @@ -321,8 +321,8 @@ static SpaceLink *sequencer_duplicate(SpaceLink *sl) { SpaceSeq *sseqn = MEM_dupallocN(sl); - /* clear or remove stuff from old */ - // XXX sseq->gpd = gpencil_data_duplicate(sseq->gpd, false); + /* Clear or remove stuff from old. */ + /* XXX sseq->gpd = gpencil_data_duplicate(sseq->gpd, false); */ memset(&sseqn->scopes, 0, sizeof(sseqn->scopes)); @@ -334,7 +334,7 @@ static void sequencer_listener(wmWindow *UNUSED(win), wmNotifier *wmn, Scene *UNUSED(scene)) { - /* context changes */ + /* Context changes. */ switch (wmn->category) { case NC_SCENE: switch (wmn->data) { @@ -370,7 +370,7 @@ static bool image_drop_poll(bContext *C, int hand; if (drag->type == WM_DRAG_PATH) { - if (ELEM(drag->icon, ICON_FILE_IMAGE, ICON_FILE_BLANK)) { /* rule might not work? */ + if (ELEM(drag->icon, ICON_FILE_IMAGE, ICON_FILE_BLANK)) { /* Rule might not work? */ if (find_nearest_seq(scene, ®ion->v2d, &hand, event->mval) == NULL) { return 1; } @@ -390,7 +390,7 @@ static bool movie_drop_poll(bContext *C, int hand; if (drag->type == WM_DRAG_PATH) { - if (ELEM(drag->icon, 0, ICON_FILE_MOVIE, ICON_FILE_BLANK)) { /* rule might not work? */ + if (ELEM(drag->icon, 0, ICON_FILE_MOVIE, ICON_FILE_BLANK)) { /* Rule might not work? */ if (find_nearest_seq(scene, ®ion->v2d, &hand, event->mval) == NULL) { return 1; } @@ -409,7 +409,7 @@ static bool sound_drop_poll(bContext *C, int hand; if (drag->type == WM_DRAG_PATH) { - if (ELEM(drag->icon, ICON_FILE_SOUND, ICON_FILE_BLANK)) { /* rule might not work? */ + if (ELEM(drag->icon, ICON_FILE_SOUND, ICON_FILE_BLANK)) { /* Rule might not work? */ if (find_nearest_seq(scene, ®ion->v2d, &hand, event->mval) == NULL) { return 1; } @@ -420,7 +420,7 @@ static bool sound_drop_poll(bContext *C, static void sequencer_drop_copy(wmDrag *drag, wmDropBox *drop) { - /* copy drag path to properties */ + /* Copy drag path to properties. */ if (RNA_struct_find_property(drop->ptr, "filepath")) { RNA_string_set(drop->ptr, "filepath", drag->path); } @@ -439,7 +439,7 @@ static void sequencer_drop_copy(wmDrag *drag, wmDropBox *drop) } } -/* this region dropbox definition */ +/* This region dropbox definition. */ static void sequencer_dropboxes(void) { ListBase *lb = WM_dropboxmap_find("Sequencer", SPACE_SEQ, RGN_TYPE_WINDOW); @@ -452,7 +452,7 @@ static void sequencer_dropboxes(void) /* ************* end drop *********** */ /* DO NOT make this static, this hides the symbol and breaks API generation script. */ -extern const char *sequencer_context_dir[]; /* quiet warning. */ +extern const char *sequencer_context_dir[]; /* Quiet warning. */ const char *sequencer_context_dir[] = {"edit_mask", NULL}; static int sequencer_context(const bContext *C, const char *member, bContextDataResult *result) @@ -489,7 +489,7 @@ static void sequencer_gizmos(void) } /* *********************** sequencer (main) region ************************ */ -/* add handlers, stuff you only do once or on area/region changes */ +/* Add handlers, stuff you only do once or on area/region changes. */ static void sequencer_main_region_init(wmWindowManager *wm, ARegion *region) { wmKeyMap *keymap; @@ -505,19 +505,19 @@ static void sequencer_main_region_init(wmWindowManager *wm, ARegion *region) keymap = WM_keymap_ensure(wm->defaultconf, "SequencerCommon", SPACE_SEQ, 0); WM_event_add_keymap_handler_v2d_mask(®ion->handlers, keymap); - /* own keymap */ + /* Own keymap. */ keymap = WM_keymap_ensure(wm->defaultconf, "Sequencer", SPACE_SEQ, 0); WM_event_add_keymap_handler_v2d_mask(®ion->handlers, keymap); - /* add drop boxes */ + /* Add drop boxes. */ lb = WM_dropboxmap_find("Sequencer", SPACE_SEQ, RGN_TYPE_WINDOW); WM_event_add_dropbox_handler(®ion->handlers, lb); } +/* Strip editing timeline. */ static void sequencer_main_region_draw(const bContext *C, ARegion *region) { - /* NLE - strip editing timeline interface */ draw_timeline_seq(C, region); } @@ -527,14 +527,14 @@ static void sequencer_main_region_listener(wmWindow *UNUSED(win), wmNotifier *wmn, const Scene *UNUSED(scene)) { - /* context changes */ + /* Context changes. */ switch (wmn->category) { case NC_SCENE: switch (wmn->data) { case ND_FRAME: case ND_FRAME_RANGE: case ND_MARKERS: - case ND_RENDER_OPTIONS: /* for FPS and FPS Base */ + case ND_RENDER_OPTIONS: /* For FPS and FPS Base. */ case ND_SEQUENCER: case ND_RENDER_RESULT: ED_region_tag_redraw(region); @@ -625,7 +625,7 @@ static void sequencer_main_region_message_subscribe(const struct bContext *UNUSE } /* *********************** header region ************************ */ -/* add handlers, stuff you only do once or on area/region changes */ +/* Add handlers, stuff you only do once or on area/region changes. */ static void sequencer_header_region_init(wmWindowManager *UNUSED(wm), ARegion *region) { ED_region_header_init(region); @@ -637,7 +637,7 @@ static void sequencer_header_region_draw(const bContext *C, ARegion *region) } /* *********************** toolbar region ************************ */ -/* add handlers, stuff you only do once or on area/region changes */ +/* Add handlers, stuff you only do once or on area/region changes. */ static void sequencer_tools_region_init(wmWindowManager *wm, ARegion *region) { wmKeyMap *keymap; @@ -668,7 +668,7 @@ static void sequencer_preview_region_init(wmWindowManager *wm, ARegion *region) keymap = WM_keymap_ensure(wm->defaultconf, "SequencerCommon", SPACE_SEQ, 0); WM_event_add_keymap_handler_v2d_mask(®ion->handlers, keymap); - /* own keymap */ + /* Own keymap. */ keymap = WM_keymap_ensure(wm->defaultconf, "SequencerPreview", SPACE_SEQ, 0); WM_event_add_keymap_handler_v2d_mask(®ion->handlers, keymap); } @@ -722,7 +722,7 @@ static void sequencer_preview_region_listener(wmWindow *UNUSED(win), wmNotifier *wmn, const Scene *UNUSED(scene)) { - /* context changes */ + /* Context changes. */ switch (wmn->category) { case NC_GPENCIL: if (ELEM(wmn->action, NA_EDITED, NA_SELECTED)) { @@ -769,7 +769,7 @@ static void sequencer_preview_region_listener(wmWindow *UNUSED(win), /* *********************** buttons region ************************ */ -/* add handlers, stuff you only do once or on area/region changes */ +/* Add handlers, stuff you only do once or on area/region changes. */ static void sequencer_buttons_region_init(wmWindowManager *wm, ARegion *region) { wmKeyMap *keymap; @@ -792,7 +792,7 @@ static void sequencer_buttons_region_listener(wmWindow *UNUSED(win), wmNotifier *wmn, const Scene *UNUSED(scene)) { - /* context changes */ + /* Context changes. */ switch (wmn->category) { case NC_GPENCIL: if (ELEM(wmn->action, NA_EDITED, NA_SELECTED)) { @@ -837,7 +837,7 @@ static void sequencer_id_remap(ScrArea *UNUSED(area), SpaceLink *slink, ID *old_ /* ************************************* */ -/* only called once, from space/spacetypes.c */ +/* Only called once, from space/spacetypes.c. */ void ED_spacetype_sequencer(void) { SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype sequencer"); @@ -859,7 +859,8 @@ void ED_spacetype_sequencer(void) st->listener = sequencer_listener; st->id_remap = sequencer_id_remap; - /* regions: main window */ + /* Create regions: */ + /* Main window. */ art = MEM_callocN(sizeof(ARegionType), "spacetype sequencer region"); art->regionid = RGN_TYPE_WINDOW; art->init = sequencer_main_region_init; @@ -867,10 +868,9 @@ void ED_spacetype_sequencer(void) art->listener = sequencer_main_region_listener; art->message_subscribe = sequencer_main_region_message_subscribe; art->keymapflag = ED_KEYMAP_TOOL | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | ED_KEYMAP_ANIMATION; - BLI_addhead(&st->regiontypes, art); - /* preview */ + /* Preview. */ art = MEM_callocN(sizeof(ARegionType), "spacetype sequencer region"); art->regionid = RGN_TYPE_PREVIEW; art->init = sequencer_preview_region_init; @@ -880,7 +880,7 @@ void ED_spacetype_sequencer(void) ED_KEYMAP_GPENCIL; BLI_addhead(&st->regiontypes, art); - /* regions: listview/buttons */ + /* Listview/buttons. */ art = MEM_callocN(sizeof(ARegionType), "spacetype sequencer region"); art->regionid = RGN_TYPE_UI; art->prefsizex = UI_SIDEBAR_PANEL_WIDTH * 1.3f; @@ -892,7 +892,7 @@ void ED_spacetype_sequencer(void) BLI_addhead(&st->regiontypes, art); sequencer_buttons_register(art); - /* regions: tool(bar) */ + /* Toolbar. */ art = MEM_callocN(sizeof(ARegionType), "spacetype sequencer tools region"); art->regionid = RGN_TYPE_TOOLS; art->prefsizex = 58; /* XXX */ @@ -904,7 +904,7 @@ void ED_spacetype_sequencer(void) art->draw = sequencer_tools_region_draw; BLI_addhead(&st->regiontypes, art); - /* regions: tool header */ + /* Tool header. */ art = MEM_callocN(sizeof(ARegionType), "spacetype sequencer tool header region"); art->regionid = RGN_TYPE_TOOL_HEADER; art->prefsizey = HEADERY; @@ -915,7 +915,7 @@ void ED_spacetype_sequencer(void) art->message_subscribe = ED_area_do_mgs_subscribe_for_tool_header; BLI_addhead(&st->regiontypes, art); - /* regions: header */ + /* Header. */ art = MEM_callocN(sizeof(ARegionType), "spacetype sequencer region"); art->regionid = RGN_TYPE_HEADER; art->prefsizey = HEADERY; @@ -924,16 +924,15 @@ void ED_spacetype_sequencer(void) art->init = sequencer_header_region_init; art->draw = sequencer_header_region_draw; art->listener = sequencer_main_region_listener; - BLI_addhead(&st->regiontypes, art); - /* regions: hud */ + /* Hud. */ art = ED_area_type_hud(st->spaceid); BLI_addhead(&st->regiontypes, art); BKE_spacetype_register(st); - /* set the sequencer callback when not in background mode */ + /* Set the sequencer callback when not in background mode. */ if (G.background == 0) { sequencer_view3d_fn = ED_view3d_draw_offscreen_imbuf_simple; } |