diff options
Diffstat (limited to 'source/blender/editors/space_sequencer')
4 files changed, 63 insertions, 26 deletions
diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index 14004e7fbba..2fe16b3a85d 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -350,7 +350,7 @@ static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoad } sort_seq(scene); - seq_update_muting(scene, ed); + seq_update_muting(ed); WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene); diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index dc84289a8de..352e9f43648 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -127,6 +127,7 @@ static void get_seq_color3ubv(Scene *curscene, Sequence *seq, unsigned char col[ case SEQ_GLOW: case SEQ_MULTICAM: case SEQ_ADJUSTMENT: + case SEQ_TITLECARD: UI_GetThemeColor3ubv(TH_SEQ_EFFECT, col); /* slightly offset hue to distinguish different effects */ @@ -172,30 +173,63 @@ static void drawseqwave(Scene *scene, Sequence *seq, float x1, float y1, float x x2 the end x value, same for y1 and y2 stepsize is width of a pixel. */ - if(seq->sound->cache) + if(seq->flag & SEQ_AUDIO_DRAW_WAVEFORM) { - int i; + int i, j, pos; int length = floor((x2-x1)/stepsize)+1; float ymid = (y1+y2)/2; float yscale = (y2-y1)/2; - float* samples = MEM_mallocN(length * sizeof(float) * 2, "seqwave_samples"); - if(!samples) - return; - if(sound_read_sound_buffer(seq->sound, samples, length, - (seq->startofs + seq->anim_startofs)/FPS, - (seq->startofs + seq->anim_startofs + seq->enddisp - seq->startdisp)/FPS) != length) + float samplestep; + float startsample, endsample; + float value; + + SoundWaveform* waveform; + + if(!seq->sound->waveform) + sound_read_waveform(seq->sound); + + waveform = seq->sound->waveform; + + startsample = floor((seq->startofs + seq->anim_startofs)/FPS * SOUND_WAVE_SAMPLES_PER_SECOND); + endsample = ceil((seq->startofs + seq->anim_startofs + seq->enddisp - seq->startdisp)/FPS * SOUND_WAVE_SAMPLES_PER_SECOND); + samplestep = (endsample-startsample) * stepsize / (x2-x1); + + if(length > floor((waveform->length - startsample) / samplestep)) + length = floor((waveform->length - startsample) / samplestep); + + glBegin(GL_LINE_STRIP); + for(i = 0; i < length; i++) { - MEM_freeN(samples); - return; + pos = startsample + i * samplestep; + + value = waveform->data[pos * 3]; + + for(j = pos+1; (j < waveform->length) && (j < pos + samplestep); j++) + { + if(value > waveform->data[j * 3]) + value = waveform->data[j * 3]; + } + + glVertex2f(x1+i*stepsize, ymid + value * yscale); } - glBegin(GL_LINES); + glEnd(); + + glBegin(GL_LINE_STRIP); for(i = 0; i < length; i++) { - glVertex2f(x1+i*stepsize, ymid + samples[i * 2] * yscale); - glVertex2f(x1+i*stepsize, ymid + samples[i * 2 + 1] * yscale); + pos = startsample + i * samplestep; + + value = waveform->data[pos * 3 + 1]; + + for(j = pos+1; (j < waveform->length) && (j < pos + samplestep); j++) + { + if(value < waveform->data[j * 3 + 1]) + value = waveform->data[j * 3 + 1]; + } + + glVertex2f(x1+i*stepsize, ymid + value * yscale); } glEnd(); - MEM_freeN(samples); } } @@ -1042,8 +1076,8 @@ void draw_timeline_seq(const bContext *C, ARegion *ar) SpaceSeq *sseq= CTX_wm_space_seq(C); View2D *v2d= &ar->v2d; View2DScrollers *scrollers; + short unit=0, flag=0; float col[3]; - int flag=0; /* clear and setup matrix */ UI_GetThemeColor3fv(TH_BACK, col); @@ -1065,9 +1099,10 @@ void draw_timeline_seq(const bContext *C, ARegion *ar) /* draw backdrop */ draw_seq_backdrop(v2d); - /* regular grid-pattern over the rest of the view (i.e. frame grid lines) */ + /* regular grid-pattern over the rest of the view (i.e. 25-frame grid lines) */ + // NOTE: the gridlines are currently spaced every 25 frames, which is only fine for 25 fps, but maybe not for 30... UI_view2d_constant_grid_draw(v2d); - + seq_draw_sfra_efra(scene, v2d); /* sequence strips (if there is data available to be drawn) */ @@ -1110,7 +1145,8 @@ void draw_timeline_seq(const bContext *C, ARegion *ar) UI_view2d_view_restore(C); /* scrollers */ - scrollers= UI_view2d_scrollers_calc(C, v2d, V2D_UNIT_SECONDSSEQ, V2D_GRID_CLAMP, V2D_UNIT_VALUES, V2D_GRID_CLAMP); + unit= (sseq->flag & SEQ_DRAWFRAMES)? V2D_UNIT_FRAMES : V2D_UNIT_SECONDSSEQ; + scrollers= UI_view2d_scrollers_calc(C, v2d, unit, V2D_GRID_CLAMP, V2D_UNIT_VALUES, V2D_GRID_CLAMP); UI_view2d_scrollers_draw(C, v2d, scrollers); UI_view2d_scrollers_free(scrollers); } diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index e876da41bd9..24f2f5e7b4a 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -94,9 +94,10 @@ EnumPropertyItem sequencer_prop_effect_types[] = { {SEQ_GLOW, "GLOW", 0, "Glow", "Glow effect strip type"}, {SEQ_TRANSFORM, "TRANSFORM", 0, "Transform", "Transform effect strip type"}, {SEQ_COLOR, "COLOR", 0, "Color", "Color effect strip type"}, - {SEQ_SPEED, "SPEED", 0, "Speed", "Color effect strip type"}, + {SEQ_SPEED, "SPEED", 0, "Speed", ""}, {SEQ_MULTICAM, "MULTICAM", 0, "Multicam Selector", ""}, {SEQ_ADJUSTMENT, "ADJUSTMENT", 0, "Adjustment Layer", ""}, + {SEQ_TITLECARD, "TITLE_CARD", 0, "Title Card", ""}, {0, NULL, 0, NULL, NULL} }; @@ -1035,7 +1036,7 @@ static int sequencer_mute_exec(bContext *C, wmOperator *op) } } - seq_update_muting(scene, ed); + seq_update_muting(ed); WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene); return OPERATOR_FINISHED; @@ -1082,7 +1083,7 @@ static int sequencer_unmute_exec(bContext *C, wmOperator *op) } } - seq_update_muting(scene, ed); + seq_update_muting(ed); WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene); return OPERATOR_FINISHED; @@ -1756,7 +1757,7 @@ static int sequencer_meta_toggle_exec(bContext *C, wmOperator *UNUSED(op)) } - seq_update_muting(scene, ed); + seq_update_muting(ed); WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene); return OPERATOR_FINISHED; @@ -1820,7 +1821,7 @@ static int sequencer_meta_make_exec(bContext *C, wmOperator *op) if( seq_test_overlap(ed->seqbasep, seqm) ) shuffle_seq(ed->seqbasep, seqm, scene); - seq_update_muting(scene, ed); + seq_update_muting(ed); seqbase_unique_name_recursive(&scene->ed->seqbase, seqm); @@ -1893,7 +1894,7 @@ static int sequencer_meta_separate_exec(bContext *C, wmOperator *UNUSED(op)) } sort_seq(scene); - seq_update_muting(scene, ed); + seq_update_muting(ed); WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene); diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c index d1df9699fa3..36471c7ffcf 100644 --- a/source/blender/editors/space_sequencer/space_sequencer.c +++ b/source/blender/editors/space_sequencer/space_sequencer.c @@ -223,7 +223,7 @@ static SpaceLink *sequencer_new(const bContext *C) ar->v2d.cur= ar->v2d.tot; ar->v2d.min[0]= 10.0f; - ar->v2d.min[1]= 4.0f; + ar->v2d.min[1]= 0.5f; ar->v2d.max[0]= MAXFRAMEF; ar->v2d.max[1]= MAXSEQ; |