blender 2.8: OpenGL immediate mode: action_draw
Updated action_draw to use imm mode. Reviewers: merwin Subscribers: LazyDodo Differential Revision: https://developer.blender.org/D2351
This commit is contained in:
@@ -61,6 +61,7 @@
|
||||
#include "ED_keyframes_draw.h"
|
||||
|
||||
#include "action_intern.h"
|
||||
#include "GPU_immediate.h"
|
||||
|
||||
/* ************************************************************************* */
|
||||
/* Channel List */
|
||||
@@ -203,6 +204,12 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
|
||||
|
||||
/* first backdrop strips */
|
||||
y = (float)(-ACHANNEL_HEIGHT(ac));
|
||||
|
||||
VertexFormat* format = immVertexFormat();
|
||||
unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT);
|
||||
|
||||
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
|
||||
for (ale = anim_data.first; ale; ale = ale->next) {
|
||||
@@ -221,7 +228,7 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
|
||||
/* determine if channel is selected */
|
||||
if (acf->has_setting(ac, ale, ACHANNEL_SETTING_SELECT))
|
||||
sel = ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_SELECT);
|
||||
|
||||
|
||||
if (ELEM(ac->datatype, ANIMCONT_ACTION, ANIMCONT_DOPESHEET, ANIMCONT_SHAPEKEY)) {
|
||||
switch (ale->type) {
|
||||
case ANIMTYPE_SUMMARY:
|
||||
@@ -233,60 +240,60 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
|
||||
case ANIMTYPE_SCENE:
|
||||
case ANIMTYPE_OBJECT:
|
||||
{
|
||||
if (sel) glColor4ub(col1b[0], col1b[1], col1b[2], 0x45);
|
||||
else glColor4ub(col1b[0], col1b[1], col1b[2], 0x22);
|
||||
if (sel) immUniformColor4ub(col1b[0], col1b[1], col1b[2], 0x45);
|
||||
else immUniformColor4ub(col1b[0], col1b[1], col1b[2], 0x22);
|
||||
break;
|
||||
}
|
||||
case ANIMTYPE_FILLACTD:
|
||||
case ANIMTYPE_DSSKEY:
|
||||
case ANIMTYPE_DSWOR:
|
||||
{
|
||||
if (sel) glColor4ub(col2b[0], col2b[1], col2b[2], 0x45);
|
||||
else glColor4ub(col2b[0], col2b[1], col2b[2], 0x22);
|
||||
if (sel) immUniformColor4ub(col2b[0], col2b[1], col2b[2], 0x45);
|
||||
else immUniformColor4ub(col2b[0], col2b[1], col2b[2], 0x22);
|
||||
break;
|
||||
}
|
||||
case ANIMTYPE_GROUP:
|
||||
{
|
||||
if (sel) glColor4ub(col1a[0], col1a[1], col1a[2], 0x22);
|
||||
else glColor4ub(col2a[0], col2a[1], col2a[2], 0x22);
|
||||
if (sel) immUniformColor4ub(col1a[0], col1a[1], col1a[2], 0x22);
|
||||
else immUniformColor4ub(col2a[0], col2a[1], col2a[2], 0x22);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
if (sel) glColor4ub(col1[0], col1[1], col1[2], 0x22);
|
||||
else glColor4ub(col2[0], col2[1], col2[2], 0x22);
|
||||
if (sel) immUniformColor4ub(col1[0], col1[1], col1[2], 0x22);
|
||||
else immUniformColor4ub(col2[0], col2[1], col2[2], 0x22);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* draw region twice: firstly backdrop, then the current range */
|
||||
glRectf(v2d->cur.xmin, (float)y - ACHANNEL_HEIGHT_HALF(ac), v2d->cur.xmax + EXTRA_SCROLL_PAD, (float)y + ACHANNEL_HEIGHT_HALF(ac));
|
||||
immRectf(pos, v2d->cur.xmin, (float)y - ACHANNEL_HEIGHT_HALF(ac), v2d->cur.xmax + EXTRA_SCROLL_PAD, (float)y + ACHANNEL_HEIGHT_HALF(ac));
|
||||
|
||||
if (ac->datatype == ANIMCONT_ACTION)
|
||||
glRectf(act_start, (float)y - ACHANNEL_HEIGHT_HALF(ac), act_end, (float)y + ACHANNEL_HEIGHT_HALF(ac));
|
||||
immRectf(pos, act_start, (float)y - ACHANNEL_HEIGHT_HALF(ac), act_end, (float)y + ACHANNEL_HEIGHT_HALF(ac));
|
||||
}
|
||||
else if (ac->datatype == ANIMCONT_GPENCIL) {
|
||||
/* frames less than one get less saturated background */
|
||||
if (sel) glColor4ub(col1[0], col1[1], col1[2], 0x22);
|
||||
else glColor4ub(col2[0], col2[1], col2[2], 0x22);
|
||||
glRectf(0.0f, (float)y - ACHANNEL_HEIGHT_HALF(ac), v2d->cur.xmin, (float)y + ACHANNEL_HEIGHT_HALF(ac));
|
||||
if (sel) immUniformColor4ub(col1[0], col1[1], col1[2], 0x22);
|
||||
else immUniformColor4ub(col2[0], col2[1], col2[2], 0x22);
|
||||
immRectf(pos, 0.0f, (float)y - ACHANNEL_HEIGHT_HALF(ac), v2d->cur.xmin, (float)y + ACHANNEL_HEIGHT_HALF(ac));
|
||||
|
||||
/* frames one and higher get a saturated background */
|
||||
if (sel) glColor4ub(col1[0], col1[1], col1[2], 0x44);
|
||||
else glColor4ub(col2[0], col2[1], col2[2], 0x44);
|
||||
glRectf(v2d->cur.xmin, (float)y - ACHANNEL_HEIGHT_HALF(ac), v2d->cur.xmax + EXTRA_SCROLL_PAD, (float)y + ACHANNEL_HEIGHT_HALF(ac));
|
||||
if (sel) immUniformColor4ub(col1[0], col1[1], col1[2], 0x44);
|
||||
else immUniformColor4ub(col2[0], col2[1], col2[2], 0x44);
|
||||
immRectf(pos, v2d->cur.xmin, (float)y - ACHANNEL_HEIGHT_HALF(ac), v2d->cur.xmax + EXTRA_SCROLL_PAD, (float)y + ACHANNEL_HEIGHT_HALF(ac));
|
||||
}
|
||||
else if (ac->datatype == ANIMCONT_MASK) {
|
||||
/* TODO --- this is a copy of gpencil */
|
||||
/* frames less than one get less saturated background */
|
||||
if (sel) glColor4ub(col1[0], col1[1], col1[2], 0x22);
|
||||
else glColor4ub(col2[0], col2[1], col2[2], 0x22);
|
||||
glRectf(0.0f, (float)y - ACHANNEL_HEIGHT_HALF(ac), v2d->cur.xmin, (float)y + ACHANNEL_HEIGHT_HALF(ac));
|
||||
if (sel) immUniformColor4ub(col1[0], col1[1], col1[2], 0x22);
|
||||
else immUniformColor4ub(col2[0], col2[1], col2[2], 0x22);
|
||||
immRectf(pos, 0.0f, (float)y - ACHANNEL_HEIGHT_HALF(ac), v2d->cur.xmin, (float)y + ACHANNEL_HEIGHT_HALF(ac));
|
||||
|
||||
/* frames one and higher get a saturated background */
|
||||
if (sel) glColor4ub(col1[0], col1[1], col1[2], 0x44);
|
||||
else glColor4ub(col2[0], col2[1], col2[2], 0x44);
|
||||
glRectf(v2d->cur.xmin, (float)y - ACHANNEL_HEIGHT_HALF(ac), v2d->cur.xmax + EXTRA_SCROLL_PAD, (float)y + ACHANNEL_HEIGHT_HALF(ac));
|
||||
if (sel) immUniformColor4ub(col1[0], col1[1], col1[2], 0x44);
|
||||
else immUniformColor4ub(col2[0], col2[1], col2[2], 0x44);
|
||||
immRectf(pos, v2d->cur.xmin, (float)y - ACHANNEL_HEIGHT_HALF(ac), v2d->cur.xmax + EXTRA_SCROLL_PAD, (float)y + ACHANNEL_HEIGHT_HALF(ac));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -353,11 +360,12 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
|
||||
|
||||
/* black line marking 'current frame' for Time-Slide transform mode */
|
||||
if (saction->flag & SACTION_MOVING) {
|
||||
glColor3f(0.0f, 0.0f, 0.0f);
|
||||
|
||||
glBegin(GL_LINES);
|
||||
glVertex2f(saction->timeslide, v2d->cur.ymin - EXTRA_SCROLL_PAD);
|
||||
glVertex2f(saction->timeslide, v2d->cur.ymax);
|
||||
glEnd();
|
||||
immUniformColor3f(0.0f, 0.0f, 0.0f);
|
||||
|
||||
immBegin(GL_LINES, 2);
|
||||
immVertex2f(pos, saction->timeslide, v2d->cur.ymin - EXTRA_SCROLL_PAD);
|
||||
immVertex2f(pos, saction->timeslide, v2d->cur.ymax);
|
||||
immEnd();
|
||||
}
|
||||
immUnbindProgram();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user