Separate sequence extension drawing routine so it can be reused (as part
of an option or for tools)
This commit is contained in:
@@ -597,6 +597,111 @@ void draw_shadedstrip(Sequence *seq, unsigned char col[3], float x1, float y1, f
|
||||
}
|
||||
}
|
||||
|
||||
void draw_sequence_extensions(Scene *scene, ARegion *ar, Sequence *seq)
|
||||
{
|
||||
float x1, x2, y1, y2, pixely, a;
|
||||
unsigned char col[3], blendcol[3];
|
||||
View2D *v2d = &ar->v2d;
|
||||
|
||||
x1 = seq->startdisp;
|
||||
x2 = seq->enddisp;
|
||||
|
||||
y1 = seq->machine + SEQ_STRIP_OFSBOTTOM;
|
||||
y2 = seq->machine + SEQ_STRIP_OFSTOP;
|
||||
|
||||
pixely = BLI_rctf_size_y(&v2d->cur) / BLI_rcti_size_y(&v2d->mask);
|
||||
|
||||
if (pixely <= 0) return; /* can happen when the view is split/resized */
|
||||
|
||||
blendcol[0] = blendcol[1] = blendcol[2] = 120;
|
||||
|
||||
if (seq->startofs) {
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
color3ubv_from_seq(scene, seq, col);
|
||||
|
||||
if (seq->flag & SELECT) {
|
||||
UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.3, -40);
|
||||
glColor4ub(col[0], col[1], col[2], 170);
|
||||
}
|
||||
else {
|
||||
UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.6, 0);
|
||||
glColor4ub(col[0], col[1], col[2], 110);
|
||||
}
|
||||
|
||||
glRectf((float)(seq->start), y1 - SEQ_STRIP_OFSBOTTOM, x1, y1);
|
||||
|
||||
if (seq->flag & SELECT) glColor4ub(col[0], col[1], col[2], 255);
|
||||
else glColor4ub(col[0], col[1], col[2], 160);
|
||||
|
||||
fdrawbox((float)(seq->start), y1 - SEQ_STRIP_OFSBOTTOM, x1, y1); //outline
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
if (seq->endofs) {
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
color3ubv_from_seq(scene, seq, col);
|
||||
|
||||
if (seq->flag & SELECT) {
|
||||
UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.3, -40);
|
||||
glColor4ub(col[0], col[1], col[2], 170);
|
||||
}
|
||||
else {
|
||||
UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.6, 0);
|
||||
glColor4ub(col[0], col[1], col[2], 110);
|
||||
}
|
||||
|
||||
glRectf(x2, y2, (float)(seq->start + seq->len), y2 + SEQ_STRIP_OFSBOTTOM);
|
||||
|
||||
if (seq->flag & SELECT) glColor4ub(col[0], col[1], col[2], 255);
|
||||
else glColor4ub(col[0], col[1], col[2], 160);
|
||||
|
||||
fdrawbox(x2, y2, (float)(seq->start + seq->len), y2 + SEQ_STRIP_OFSBOTTOM); //outline
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
if (seq->startstill) {
|
||||
color3ubv_from_seq(scene, seq, col);
|
||||
UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.75, 40);
|
||||
glColor3ubv((GLubyte *)col);
|
||||
|
||||
draw_shadedstrip(seq, col, x1, y1, (float)(seq->start), y2);
|
||||
|
||||
/* feint pinstripes, helps see exactly which is extended and which isn't,
|
||||
* especially when the extension is very small */
|
||||
if (seq->flag & SELECT) UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, 24);
|
||||
else UI_GetColorPtrShade3ubv(col, col, -16);
|
||||
|
||||
glColor3ubv((GLubyte *)col);
|
||||
|
||||
for (a = y1; a < y2; a += pixely * 2.0f) {
|
||||
fdrawline(x1, a, (float)(seq->start), a);
|
||||
}
|
||||
}
|
||||
if (seq->endstill) {
|
||||
color3ubv_from_seq(scene, seq, col);
|
||||
UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.75, 40);
|
||||
glColor3ubv((GLubyte *)col);
|
||||
|
||||
draw_shadedstrip(seq, col, (float)(seq->start + seq->len), y1, x2, y2);
|
||||
|
||||
/* feint pinstripes, helps see exactly which is extended and which isn't,
|
||||
* especially when the extension is very small */
|
||||
if (seq->flag & SELECT) UI_GetColorPtrShade3ubv(col, col, 24);
|
||||
else UI_GetColorPtrShade3ubv(col, col, -16);
|
||||
|
||||
glColor3ubv((GLubyte *)col);
|
||||
|
||||
for (a = y1; a < y2; a += pixely * 2.0f) {
|
||||
fdrawline((float)(seq->start + seq->len), a, x2, a);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Draw a sequence strip, bounds check already made
|
||||
* ARegion is currently only used to get the windows width in pixels
|
||||
|
@@ -1282,9 +1282,6 @@ static void transseq_restore(TransSeq *ts, Sequence *seq)
|
||||
static void draw_slip_extensions(const bContext *C, ARegion *ar, void *data)
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
float x1, x2, y1, y2, pixely, a;
|
||||
unsigned char col[3], blendcol[3];
|
||||
View2D *v2d = &ar->v2d;
|
||||
SlipData *td = data;
|
||||
int i;
|
||||
|
||||
@@ -1292,103 +1289,7 @@ static void draw_slip_extensions(const bContext *C, ARegion *ar, void *data)
|
||||
Sequence *seq = td->seq_array[i];
|
||||
|
||||
if ((seq->type != SEQ_TYPE_META) && td->trim[i]) {
|
||||
|
||||
x1 = seq->startdisp;
|
||||
x2 = seq->enddisp;
|
||||
|
||||
y1 = seq->machine + SEQ_STRIP_OFSBOTTOM;
|
||||
y2 = seq->machine + SEQ_STRIP_OFSTOP;
|
||||
|
||||
pixely = BLI_rctf_size_y(&v2d->cur) / BLI_rcti_size_y(&v2d->mask);
|
||||
|
||||
if (pixely <= 0) return; /* can happen when the view is split/resized */
|
||||
|
||||
blendcol[0] = blendcol[1] = blendcol[2] = 120;
|
||||
|
||||
if (seq->startofs) {
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
color3ubv_from_seq(scene, seq, col);
|
||||
|
||||
if (seq->flag & SELECT) {
|
||||
UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.3, -40);
|
||||
glColor4ub(col[0], col[1], col[2], 170);
|
||||
}
|
||||
else {
|
||||
UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.6, 0);
|
||||
glColor4ub(col[0], col[1], col[2], 110);
|
||||
}
|
||||
|
||||
glRectf((float)(seq->start), y1 - SEQ_STRIP_OFSBOTTOM, x1, y1);
|
||||
|
||||
if (seq->flag & SELECT) glColor4ub(col[0], col[1], col[2], 255);
|
||||
else glColor4ub(col[0], col[1], col[2], 160);
|
||||
|
||||
fdrawbox((float)(seq->start), y1 - SEQ_STRIP_OFSBOTTOM, x1, y1); //outline
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
if (seq->endofs) {
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
color3ubv_from_seq(scene, seq, col);
|
||||
|
||||
if (seq->flag & SELECT) {
|
||||
UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.3, -40);
|
||||
glColor4ub(col[0], col[1], col[2], 170);
|
||||
}
|
||||
else {
|
||||
UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.6, 0);
|
||||
glColor4ub(col[0], col[1], col[2], 110);
|
||||
}
|
||||
|
||||
glRectf(x2, y2, (float)(seq->start + seq->len), y2 + SEQ_STRIP_OFSBOTTOM);
|
||||
|
||||
if (seq->flag & SELECT) glColor4ub(col[0], col[1], col[2], 255);
|
||||
else glColor4ub(col[0], col[1], col[2], 160);
|
||||
|
||||
fdrawbox(x2, y2, (float)(seq->start + seq->len), y2 + SEQ_STRIP_OFSBOTTOM); //outline
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
if (seq->startstill) {
|
||||
color3ubv_from_seq(scene, seq, col);
|
||||
UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.75, 40);
|
||||
glColor3ubv((GLubyte *)col);
|
||||
|
||||
draw_shadedstrip(seq, col, x1, y1, (float)(seq->start), y2);
|
||||
|
||||
/* feint pinstripes, helps see exactly which is extended and which isn't,
|
||||
* especially when the extension is very small */
|
||||
if (seq->flag & SELECT) UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, 24);
|
||||
else UI_GetColorPtrShade3ubv(col, col, -16);
|
||||
|
||||
glColor3ubv((GLubyte *)col);
|
||||
|
||||
for (a = y1; a < y2; a += pixely * 2.0f) {
|
||||
fdrawline(x1, a, (float)(seq->start), a);
|
||||
}
|
||||
}
|
||||
if (seq->endstill) {
|
||||
color3ubv_from_seq(scene, seq, col);
|
||||
UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.75, 40);
|
||||
glColor3ubv((GLubyte *)col);
|
||||
|
||||
draw_shadedstrip(seq, col, (float)(seq->start + seq->len), y1, x2, y2);
|
||||
|
||||
/* feint pinstripes, helps see exactly which is extended and which isn't,
|
||||
* especially when the extension is very small */
|
||||
if (seq->flag & SELECT) UI_GetColorPtrShade3ubv(col, col, 24);
|
||||
else UI_GetColorPtrShade3ubv(col, col, -16);
|
||||
|
||||
glColor3ubv((GLubyte *)col);
|
||||
|
||||
for (a = y1; a < y2; a += pixely * 2.0f) {
|
||||
fdrawline((float)(seq->start + seq->len), a, x2, a);
|
||||
}
|
||||
}
|
||||
draw_sequence_extensions(scene, ar, seq);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -56,6 +56,7 @@ void draw_timeline_seq(const struct bContext *C, struct ARegion *ar);
|
||||
void draw_image_seq(const struct bContext *C, struct Scene *scene, struct ARegion *ar, struct SpaceSeq *sseq, int cfra, int offset, bool draw_overlay, bool draw_backdrop);
|
||||
void color3ubv_from_seq(struct Scene *curscene, struct Sequence *seq, unsigned char col[3]);
|
||||
void draw_shadedstrip(struct Sequence *seq, unsigned char col[3], float x1, float y1, float x2, float y2);
|
||||
void draw_sequence_extensions(struct Scene *scene, struct ARegion *ar, struct Sequence *seq);
|
||||
|
||||
/* UNUSED */
|
||||
// void seq_reset_imageofs(struct SpaceSeq *sseq);
|
||||
|
Reference in New Issue
Block a user