diff options
Diffstat (limited to 'source/blender/editors/space_sequencer')
5 files changed, 42 insertions, 20 deletions
diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index ac31e0e7c37..1239286d4da 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -260,7 +260,7 @@ static void load_data_init_from_operator(SeqLoadData *load_data, bContext *C, wm RNA_PROP_BEGIN (op->ptr, itemptr, prop) { char *filename = RNA_string_get_alloc(&itemptr, "name", NULL, 0); BLI_strncpy(load_data->name, filename, sizeof(load_data->name)); - BLI_snprintf(load_data->path, sizeof(load_data->path), "%s%s", directory, filename); + BLI_join_dirfile(load_data->path, sizeof(load_data->path), directory, filename); MEM_freeN(filename); break; } diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 8341dbe6014..cdbe5bc63ce 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -101,7 +101,7 @@ #define SEQ_SCROLLER_TEXT_OFFSET 8 #define MUTE_ALPHA 120 -/* Note, Don't use SEQ_ALL_BEGIN/SEQ_ALL_END while drawing! +/* NOTE: Don't use SEQ_ALL_BEGIN/SEQ_ALL_END while drawing! * it messes up transform. */ #undef SEQ_ALL_BEGIN #undef SEQ_ALL_END @@ -453,13 +453,13 @@ static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1, GPU_blend(GPU_BLEND_NONE); } -/* Get handle width in pixels. */ +/* Get handle width in 2d-View space. */ float sequence_handle_size_get_clamped(Sequence *seq, const float pixelx) { const float maxhandle = (pixelx * SEQ_HANDLE_SIZE) * U.pixelsize; - /* Ensure that handle is not wider, than half of strip. */ - return min_ff(maxhandle, ((float)(seq->enddisp - seq->startdisp) / 2.0f) / pixelx); + /* Ensure that handle is not wider, than quarter of strip. */ + return min_ff(maxhandle, ((float)(seq->enddisp - seq->startdisp) / 4.0f)); } /* Draw a handle, on left or right side of strip. */ @@ -1556,7 +1556,7 @@ static void *sequencer_OCIO_transform_ibuf(const bContext *C, *r_format = GPU_RGB16F; } else { - BLI_assert(!"Incompatible number of channels for float buffer in sequencer"); + BLI_assert_msg(0, "Incompatible number of channels for float buffer in sequencer"); *r_format = GPU_RGBA16F; display_buffer = NULL; } @@ -2479,10 +2479,12 @@ void draw_timeline_seq_display(const bContext *C, ARegion *region) const SpaceSeq *sseq = CTX_wm_space_seq(C); View2D *v2d = ®ion->v2d; - if (scene->ed && scene->ed->over_flag & SEQ_EDIT_OVERLAY_SHOW) { + if (scene->ed != NULL) { UI_view2d_view_ortho(v2d); draw_cache_view(C); - draw_overlap_frame_indicator(scene, v2d); + if (scene->ed->over_flag & SEQ_EDIT_OVERLAY_SHOW) { + draw_overlap_frame_indicator(scene, v2d); + } UI_view2d_view_restore(C); } diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 48b8a1b87a3..4b26469aad3 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -2258,7 +2258,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))) { @@ -2414,6 +2414,7 @@ static int sequencer_copy_exec(bContext *C, wmOperator *op) (LIB_ID_CREATE_NO_USER_REFCOUNT | LIB_ID_FREE_NO_MAIN)); seqbase_clipboard_frame = scene->r.cfra; + SEQ_clipboard_active_seq_name_store(scene); /* Remove anything that references the current scene. */ LISTBASE_FOREACH (Sequence *, seq, &seqbase_clipboard) { @@ -2504,6 +2505,10 @@ static int sequencer_paste_exec(bContext *C, wmOperator *op) BLI_movelisttolist(ed->seqbasep, &nseqbase); for (iseq = iseq_first; iseq; iseq = iseq->next) { + if (SEQ_clipboard_pasted_seq_was_active(iseq)) { + SEQ_select_active_set(scene, iseq); + } + /* Make sure, that pasted strips have unique names. */ SEQ_ensure_unique_name(iseq, scene); /* Translate after name has been changed, otherwise this will affect animdata of original @@ -2804,9 +2809,9 @@ static int sequencer_change_path_exec(bContext *C, wmOperator *op) RNA_string_get(op->ptr, "directory", directory); if (is_relative_path) { - /* TODO, shouldn't this already be relative from the filesel? + /* TODO(campbell): shouldn't this already be relative from the filesel? * (as the 'filepath' is) for now just make relative here, - * but look into changing after 2.60 - campbell */ + * but look into changing after 2.60. */ BLI_path_rel(directory, BKE_main_blendfile_path(bmain)); } BLI_strncpy(seq->strip->dir, directory, sizeof(seq->strip->dir)); @@ -2929,6 +2934,23 @@ void SEQUENCER_OT_change_path(struct wmOperatorType *ot) /** \name Export Subtitles Operator * \{ */ +/** Comparison function suitable to be used with BLI_listbase_sort(). */ +static int seq_cmp_time_startdisp_channel(const void *a, const void *b) +{ + Sequence *seq_a = (Sequence *)a; + Sequence *seq_b = (Sequence *)b; + + int seq_a_start = SEQ_transform_get_left_handle_frame(seq_a); + int seq_b_start = SEQ_transform_get_left_handle_frame(seq_b); + + /** If strips have the same start frame favor the one with a higher channel. **/ + if (seq_a_start == seq_b_start) { + return seq_a->machine > seq_b->machine; + } + + return (seq_a_start > seq_b_start); +} + static int sequencer_export_subtitles_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) @@ -2998,7 +3020,7 @@ static int sequencer_export_subtitles_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - BLI_listbase_sort(&text_seq, SEQ_time_cmp_time_startdisp); + BLI_listbase_sort(&text_seq, seq_cmp_time_startdisp_channel); /* Open and write file. */ file = BLI_fopen(filepath, "w"); @@ -3008,7 +3030,7 @@ static int sequencer_export_subtitles_exec(bContext *C, wmOperator *op) char timecode_str_start[32]; char timecode_str_end[32]; - /* Write timecode relative to start frame of scene. Don't allow negative timecodes. */ + /* Write time-code relative to start frame of scene. Don't allow negative time-codes. */ BLI_timecode_string_from_time(timecode_str_start, sizeof(timecode_str_start), -2, diff --git a/source/blender/editors/space_sequencer/sequencer_scopes.c b/source/blender/editors/space_sequencer/sequencer_scopes.c index 16768e09cb8..5d857f62b47 100644 --- a/source/blender/editors/space_sequencer/sequencer_scopes.c +++ b/source/blender/editors/space_sequencer/sequencer_scopes.c @@ -32,8 +32,8 @@ #include "sequencer_intern.h" -/* XXX, why is this function better than BLI_math version? - * only difference is it does some normalize after, need to double check on this - campbell */ +/* XXX(campbell): why is this function better than BLI_math version? + * only difference is it does some normalize after, need to double check on this. */ static void rgb_to_yuv_normalized(const float rgb[3], float yuv[3]) { yuv[0] = 0.299f * rgb[0] + 0.587f * rgb[1] + 0.114f * rgb[2]; @@ -624,8 +624,6 @@ static void vectorscope_put_cross(uchar r, uchar g, uchar b, char *tgt, int w, i { float rgb[3], yuv[3]; char *p; - int x = 0; - int y = 0; rgb[0] = (float)r / 255.0f; rgb[1] = (float)g / 255.0f; @@ -638,8 +636,8 @@ static void vectorscope_put_cross(uchar r, uchar g, uchar b, char *tgt, int w, i r = 255; } - for (y = -size; y <= size; y++) { - for (x = -size; x <= size; x++) { + for (int y = -size; y <= size; y++) { + for (int x = -size; x <= size; x++) { char *q = p + 4 * (y * w + x); q[0] = r; q[1] = g; diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c index 7e515271b13..5980bfe37cd 100644 --- a/source/blender/editors/space_sequencer/sequencer_select.c +++ b/source/blender/editors/space_sequencer/sequencer_select.c @@ -534,7 +534,7 @@ static int sequencer_select_exec(bContext *C, wmOperator *op) seq = find_nearest_seq(scene, v2d, &hand, mval); - /* XXX - not nice, Ctrl+RMB needs to do side_of_frame only when not over a strip */ + /* XXX: not nice, Ctrl+RMB needs to do side_of_frame only when not over a strip. */ if (seq && linked_time) { side_of_frame = false; } |