UI: Use flat colors for NLA strip drawing

The NLA editor is in need of a design overhaul, hopefully for 3.1 or 3.2.

This should be a project on itself, however, the worst offender currently is the use of
gradients on strips. Something that can be fixed easily.

{F11390293, size=full, loop, autoplay}

A simple replace of `UI_draw_roundbox_shade_x` for `UI_draw_roundbox_4fv` brings strips
in line with how other areas are drawn.

This patch also:
* Remove embossed lines around active action channel.
* Highlight the strip while being moved.

This patch does not include any theme changes. This will be tackled separately.

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D12968
This commit is contained in:
Pablo Vazquez 2021-10-25 16:28:56 +02:00
parent 1bc28fc73b
commit 4758a7d357
5 changed files with 20 additions and 42 deletions

@ -1 +1 @@
Subproject commit 80d9e7ee122c626cbbcd1da554683bce79f8d3df
Subproject commit 8ee2942570f08d10484bb2328d0d1b0aaaa0367c

@ -1 +1 @@
Subproject commit e68c0118c13c3575e6096ad2dc7fb4434eadf38e
Subproject commit c49c16c38d4bce29a1e0518d5fad5d90f42ab5e7

@ -1 +1 @@
Subproject commit 42da56aa73726710107031787af5eea186797984
Subproject commit 16467648282500cc229c271f62201ef897f2c2c3

View File

@ -323,12 +323,19 @@ static void nla_draw_strip_curves(NlaStrip *strip, float yminc, float ymaxc, uin
{
const float yheight = ymaxc - yminc;
immUniformColor3f(0.7f, 0.7f, 0.7f);
/* draw with AA'd line */
GPU_line_smooth(true);
GPU_blend(GPU_BLEND_ALPHA);
/* Fully opaque line on selected strips. */
if (strip->flag & NLASTRIP_FLAG_SELECT) {
/* TODO: Use theme setting. */
immUniformColor3f(1.0f, 1.0f, 1.0f);
}
else {
immUniformColor4f(1.0f, 1.0f, 1.0f, 0.5f);
}
/* influence -------------------------- */
if (strip->flag & NLASTRIP_FLAG_USR_INFLUENCE) {
FCurve *fcu = BKE_fcurve_find(&strip->fcurves, "influence", 0);
@ -501,7 +508,7 @@ static void nla_draw_strip(SpaceNla *snla,
/* strip is in normal track */
UI_draw_roundbox_corner_set(UI_CNR_ALL); /* all corners rounded */
UI_draw_roundbox_shade_x(
UI_draw_roundbox_4fv(
&(const rctf){
.xmin = strip->start,
.xmax = strip->end,
@ -509,9 +516,7 @@ static void nla_draw_strip(SpaceNla *snla,
.ymax = ymaxc,
},
true,
0.0,
0.5,
0.1,
0.0f,
color);
/* restore current vertex format & program (roundbox trashes it) */
@ -545,11 +550,9 @@ static void nla_draw_strip(SpaceNla *snla,
/* draw strip outline
* - color used here is to indicate active vs non-active
*/
if (strip->flag & NLASTRIP_FLAG_ACTIVE) {
if (strip->flag & NLASTRIP_FLAG_ACTIVE | strip->flag & NLASTRIP_FLAG_SELECT) {
/* strip should appear 'sunken', so draw a light border around it */
color[0] = 0.9f; /* FIXME: hardcoded temp-hack colors */
color[1] = 1.0f;
color[2] = 0.9f;
color[0] = color[1] = color[2] = 1.0f; /* FIXME: hardcoded temp-hack colors */
}
else {
/* strip should appear to stand out, so draw a dark border around it */
@ -566,7 +569,7 @@ static void nla_draw_strip(SpaceNla *snla,
}
else {
/* non-muted - draw solid, rounded outline */
UI_draw_roundbox_shade_x(
UI_draw_roundbox_4fv(
&(const rctf){
.xmin = strip->start,
.xmax = strip->end,
@ -574,9 +577,7 @@ static void nla_draw_strip(SpaceNla *snla,
.ymax = ymaxc,
},
false,
0.0,
0.0,
0.1,
0.0f,
color);
/* restore current vertex format & program (roundbox trashes it) */
@ -661,7 +662,7 @@ static void nla_draw_strip_text(AnimData *adt,
}
/* set text color - if colors (see above) are light, draw black text, otherwise draw white */
if (strip->flag & (NLASTRIP_FLAG_ACTIVE | NLASTRIP_FLAG_SELECT | NLASTRIP_FLAG_TWEAKUSER)) {
if (strip->flag & (NLASTRIP_FLAG_ACTIVE | NLASTRIP_FLAG_TWEAKUSER)) {
col[0] = col[1] = col[2] = 0;
}
else {
@ -805,29 +806,6 @@ void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *region)
immRectf(
pos, v2d->cur.xmin, ymin + NLACHANNEL_SKIP, v2d->cur.xmax, ymax - NLACHANNEL_SKIP);
/* draw 'embossed' lines above and below the strip for effect */
/* white base-lines */
GPU_line_width(2.0f);
immUniformColor4f(1.0f, 1.0f, 1.0f, 0.3f);
immBegin(GPU_PRIM_LINES, 4);
immVertex2f(pos, v2d->cur.xmin, ymin + NLACHANNEL_SKIP);
immVertex2f(pos, v2d->cur.xmax, ymin + NLACHANNEL_SKIP);
immVertex2f(pos, v2d->cur.xmin, ymax - NLACHANNEL_SKIP);
immVertex2f(pos, v2d->cur.xmax, ymax - NLACHANNEL_SKIP);
immEnd();
/* black top-lines */
GPU_line_width(1.0f);
immUniformColor3f(0.0f, 0.0f, 0.0f);
immBegin(GPU_PRIM_LINES, 4);
immVertex2f(pos, v2d->cur.xmin, ymin + NLACHANNEL_SKIP);
immVertex2f(pos, v2d->cur.xmax, ymin + NLACHANNEL_SKIP);
immVertex2f(pos, v2d->cur.xmin, ymax - NLACHANNEL_SKIP);
immVertex2f(pos, v2d->cur.xmax, ymax - NLACHANNEL_SKIP);
immEnd();
/* TODO: these lines but better --^ */
immUnbindProgram();
/* draw keyframes in the action */

@ -1 +1 @@
Subproject commit 7c5acb95df918503d11cfc43172ce13901019289
Subproject commit 2e8c879248822c8e500ed49d79acc605e5aa75b9