Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/space_sequencer/sequencer_draw.c')
-rw-r--r--source/blender/editors/space_sequencer/sequencer_draw.c150
1 files changed, 94 insertions, 56 deletions
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index 7aa6550a77b..c9ed0b2eddd 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -293,6 +293,20 @@ static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1,
int chan_range = 0;
float draw_range = y2 - y1;
float draw_height;
+ ListBase *seqbase;
+ int offset;
+
+ seqbase = BKE_sequence_seqbase_get(seqm, &offset);
+ if (!seqbase || BLI_listbase_is_empty(seqbase)) {
+ return;
+ }
+
+ if (seqm->type == SEQ_TYPE_SCENE) {
+ offset = seqm->start - offset;
+ }
+ else {
+ offset = 0;
+ }
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
@@ -300,7 +314,7 @@ static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1,
if (seqm->flag & SEQ_MUTE)
drawmeta_stipple(1);
- for (seq = seqm->seqbase.first; seq; seq = seq->next) {
+ for (seq = seqbase->first; seq; seq = seq->next) {
chan_min = min_ii(chan_min, seq->machine);
chan_max = max_ii(chan_max, seq->machine);
}
@@ -310,11 +324,14 @@ static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1,
col[3] = 196; /* alpha, used for all meta children */
- for (seq = seqm->seqbase.first; seq; seq = seq->next) {
- if ((seq->startdisp > x2 || seq->enddisp < x1) == 0) {
+ for (seq = seqbase->first; seq; seq = seq->next) {
+ const int startdisp = seq->startdisp + offset;
+ const int enddisp = seq->enddisp + offset;
+
+ if ((startdisp > x2 || enddisp < x1) == 0) {
float y_chan = (seq->machine - chan_min) / (float)(chan_range) * draw_range;
- float x1_chan = seq->startdisp;
- float x2_chan = seq->enddisp;
+ float x1_chan = startdisp;
+ float x2_chan = enddisp;
float y1_chan, y2_chan;
if ((seqm->flag & SEQ_MUTE) == 0 && (seq->flag & SEQ_MUTE))
@@ -822,23 +839,27 @@ static void draw_seq_strip(const bContext *C, SpaceSeq *sseq, Scene *scene, AReg
glDisable(GL_LINE_STIPPLE);
}
- if (seq->type == SEQ_TYPE_META) {
+ if ((seq->type == SEQ_TYPE_META) ||
+ ((seq->type == SEQ_TYPE_SCENE) && (seq->flag & SEQ_SCENE_STRIPS)))
+ {
drawmeta_contents(scene, seq, x1, y1, x2, y2);
}
-
- /* calculate if seq is long enough to print a name */
- x1 = seq->startdisp + handsize_clamped;
- x2 = seq->enddisp - handsize_clamped;
- /* info text on the strip */
- if (x1 < v2d->cur.xmin) x1 = v2d->cur.xmin;
- else if (x1 > v2d->cur.xmax) x1 = v2d->cur.xmax;
- if (x2 < v2d->cur.xmin) x2 = v2d->cur.xmin;
- else if (x2 > v2d->cur.xmax) x2 = v2d->cur.xmax;
+ if (!(sseq->flag & SEQ_NO_INFO)) {
+ /* calculate if seq is long enough to print a name */
+ x1 = seq->startdisp + handsize_clamped;
+ x2 = seq->enddisp - handsize_clamped;
+
+ /* info text on the strip */
+ if (x1 < v2d->cur.xmin) x1 = v2d->cur.xmin;
+ else if (x1 > v2d->cur.xmax) x1 = v2d->cur.xmax;
+ if (x2 < v2d->cur.xmin) x2 = v2d->cur.xmin;
+ else if (x2 > v2d->cur.xmax) x2 = v2d->cur.xmax;
- /* nice text here would require changing the view matrix for texture text */
- if ((x2 - x1) / pixelx > 32) {
- draw_seq_text(v2d, seq, x1, x2, y1, y2, background_col);
+ /* nice text here would require changing the view matrix for texture text */
+ if ((x2 - x1) / pixelx > 32) {
+ draw_seq_text(v2d, seq, x1, x2, y1, y2, background_col);
+ }
}
}
@@ -960,7 +981,7 @@ static ImBuf *sequencer_make_scope(Scene *scene, ImBuf *ibuf, ImBuf *(*make_scop
return scope;
}
-static void sequencer_display_size(Scene *scene, SpaceSeq *sseq, float r_viewrect[2])
+void sequencer_display_size(Scene *scene, SpaceSeq *sseq, float r_viewrect[2])
{
float render_size, proxy_size;
@@ -1056,7 +1077,7 @@ static void sequencer_draw_background(const SpaceSeq *sseq, View2D *v2d, const f
}
}
-void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq, int cfra, int frame_ofs, bool draw_overlay, bool draw_backdrop)
+void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq, int cfra, int frame_ofs, bool draw_overlay, bool draw_overdrop)
{
struct Main *bmain = CTX_data_main(C);
struct ImBuf *ibuf = NULL;
@@ -1075,6 +1096,7 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq
const bool draw_gpencil = ((sseq->flag & SEQ_SHOW_GPENCIL) && sseq->gpd);
const char *names[2] = {STEREO_LEFT_NAME, STEREO_RIGHT_NAME};
bool draw_metadata = false;
+ rctf metadataframe;
if (G.is_rendering == false && (scene->r.seq_flag & R_SEQ_GL_PREV) == 0) {
/* stop all running jobs, except screen one. currently previews frustrate Render
@@ -1090,7 +1112,7 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq
}
}
- if ((!draw_overlay || sseq->overlay_type == SEQ_DRAW_OVERLAY_REFERENCE) && !draw_backdrop) {
+ if ((!draw_overlay || sseq->overlay_type == SEQ_DRAW_OVERLAY_REFERENCE) && !draw_overdrop) {
UI_GetThemeColor3fv(TH_SEQ_PREVIEW, col);
glClearColor(col[0], col[1], col[2], 0.0);
glClear(GL_COLOR_BUFFER_BIT);
@@ -1127,7 +1149,7 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq
sequencer_display_size(scene, sseq, viewrect);
- if (!draw_backdrop && (sseq->mainb != SEQ_DRAW_IMG_IMBUF || sseq->zebra != 0)) {
+ if (!draw_overdrop && (sseq->mainb != SEQ_DRAW_IMG_IMBUF || sseq->zebra != 0)) {
SequencerScopes *scopes = &sseq->scopes;
sequencer_check_scopes(scopes, ibuf);
@@ -1186,8 +1208,26 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq
}
}
- if (!draw_backdrop) {
- sequencer_draw_background(sseq, v2d, viewrect);
+ /* without this colors can flicker from previous opengl state */
+ glColor4ub(255, 255, 255, 255);
+
+ if (!draw_overdrop) {
+ UI_view2d_totRect_set(v2d, viewrect[0] + 0.5f, viewrect[1] + 0.5f);
+ UI_view2d_curRect_validate(v2d);
+
+ /* setting up the view - actual drawing starts here */
+ UI_view2d_view_ortho(v2d);
+
+ /* only draw alpha for main buffer */
+ if (sseq->mainb == SEQ_DRAW_IMG_IMBUF) {
+ if (sseq->flag & SEQ_USE_ALPHA) {
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
+ fdrawcheckerboard(v2d->tot.xmin, v2d->tot.ymin, v2d->tot.xmax, v2d->tot.ymax);
+ glColor4f(1.0, 1.0, 1.0, 1.0);
+ }
+ }
}
if (scope) {
@@ -1279,13 +1319,8 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq
else
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, ibuf->x, ibuf->y, 0, format, type, display_buffer);
- if (draw_backdrop) {
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glLoadIdentity();
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- glLoadIdentity();
+ if (draw_overdrop) {
+ UI_view2d_view_restore(C);
}
glBegin(GL_QUADS);
@@ -1309,30 +1344,25 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq
glTexCoord2f(1.0f, 0.0f); glVertex2f(v2d->tot.xmax, v2d->tot.ymin);
}
}
- else if (draw_backdrop) {
- float aspect;
- float image_aspect = viewrect[0] / viewrect[1];
- float imagex, imagey;
+ else if (draw_overdrop) {
+ float imagex = (scene->r.size * scene->r.xsch) / 200.0f * sseq->overdrop_zoom;
+ float imagey = (scene->r.size * scene->r.ysch) / 200.0f * sseq->overdrop_zoom;
+ float xofs = BLI_rcti_size_x(&ar->winrct)/2.0f + sseq->overdrop_offset[0];
+ float yofs = BLI_rcti_size_y(&ar->winrct)/2.0f + sseq->overdrop_offset[1];
- aspect = BLI_rcti_size_x(&ar->winrct) / (float)BLI_rcti_size_y(&ar->winrct);
+ draw_metadata = ((sseq->flag & SEQ_SHOW_METADATA) != 0);
- if (aspect >= image_aspect) {
- imagex = image_aspect / aspect;
- imagey = 1.0f;
- }
- else {
- imagex = 1.0f;
- imagey = aspect / image_aspect;
- }
+ BLI_rctf_init(&metadataframe, -imagex + xofs, imagex + xofs, -imagey + yofs, imagey + yofs);
- glTexCoord2f(0.0f, 0.0f); glVertex2f(-imagex, -imagey);
- glTexCoord2f(0.0f, 1.0f); glVertex2f(-imagex, imagey);
- glTexCoord2f(1.0f, 1.0f); glVertex2f(imagex, imagey);
- glTexCoord2f(1.0f, 0.0f); glVertex2f(imagex, -imagey);
+ glTexCoord2f(0.0f, 0.0f); glVertex2f(-imagex + xofs, -imagey + yofs);
+ glTexCoord2f(0.0f, 1.0f); glVertex2f(-imagex + xofs, imagey + yofs);
+ glTexCoord2f(1.0f, 1.0f); glVertex2f(imagex + xofs, imagey + yofs);
+ glTexCoord2f(1.0f, 0.0f); glVertex2f(imagex + xofs, -imagey + yofs);
}
else {
draw_metadata = ((sseq->flag & SEQ_SHOW_METADATA) != 0);
+ metadataframe = v2d->tot;
glTexCoord2f(0.0f, 0.0f); glVertex2f(v2d->tot.xmin, v2d->tot.ymin);
glTexCoord2f(0.0f, 1.0f); glVertex2f(v2d->tot.xmin, v2d->tot.ymax);
glTexCoord2f(1.0f, 1.0f); glVertex2f(v2d->tot.xmax, v2d->tot.ymax);
@@ -1356,14 +1386,10 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq
IMB_freeImBuf(ibuf);
if (draw_metadata) {
- ED_region_image_metadata_draw(0.0, 0.0, ibuf, v2d->tot, 1.0, 1.0);
+ ED_region_image_metadata_draw(0.0, 0.0, ibuf, metadataframe, 1.0, 1.0);
}
- if (draw_backdrop) {
- glPopMatrix();
- glMatrixMode(GL_PROJECTION);
- glPopMatrix();
- glMatrixMode(GL_MODELVIEW);
+ if (draw_overdrop) {
return;
}
@@ -1597,11 +1623,13 @@ void draw_timeline_seq(const bContext *C, ARegion *ar)
// 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);
+ /*
if (sseq->draw_flag & SEQ_DRAW_BACKDROP) {
draw_image_seq(C, scene, ar, sseq, scene->r.cfra, 0, false, true);
UI_view2d_view_ortho(v2d);
}
-
+ */
+
ED_region_draw_cb_draw(C, ar, REGION_DRAW_PRE_VIEW);
seq_draw_sfra_efra(scene, v2d);
@@ -1641,12 +1669,22 @@ void draw_timeline_seq(const bContext *C, ARegion *ar)
glEnd();
}
-
+
/* callback */
ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW);
+ if (sseq->draw_flag & SEQ_DRAW_OVERDROP) {
+ draw_image_seq(C, scene, ar, sseq, scene->r.cfra, 0, false, true);
+ UI_SetTheme(SPACE_SEQ, RGN_TYPE_WINDOW);
+ UI_view2d_view_ortho(v2d);
+ }
+
/* reset view matrix */
UI_view2d_view_restore(C);
+
+ /* finally draw any widgets here */
+ WM_widgets_update(C, ar->widgetmaps.first);
+ WM_widgets_draw(C, ar->widgetmaps.first, false);
/* scrollers */
unit = (sseq->flag & SEQ_DRAWFRAMES) ? V2D_UNIT_FRAMES : V2D_UNIT_SECONDS;