[Bf-blender-cvs] [4758a7d3575] master: UI: Use flat colors for NLA strip drawing

Pablo Vazquez noreply at git.blender.org
Mon Oct 25 16:29:27 CEST 2021


Commit: 4758a7d35750ae0a2ed24014817e5b169a71e364
Author: Pablo Vazquez
Date:   Mon Oct 25 16:28:56 2021 +0200
Branches: master
https://developer.blender.org/rB4758a7d35750ae0a2ed24014817e5b169a71e364

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

===================================================================

M	release/datafiles/locale
M	release/scripts/addons
M	release/scripts/addons_contrib
M	source/blender/editors/space_nla/nla_draw.c
M	source/tools

===================================================================

diff --git a/release/datafiles/locale b/release/datafiles/locale
index 80d9e7ee122..8ee2942570f 160000
--- a/release/datafiles/locale
+++ b/release/datafiles/locale
@@ -1 +1 @@
-Subproject commit 80d9e7ee122c626cbbcd1da554683bce79f8d3df
+Subproject commit 8ee2942570f08d10484bb2328d0d1b0aaaa0367c
diff --git a/release/scripts/addons b/release/scripts/addons
index e68c0118c13..c49c16c38d4 160000
--- a/release/scripts/addons
+++ b/release/scripts/addons
@@ -1 +1 @@
-Subproject commit e68c0118c13c3575e6096ad2dc7fb4434eadf38e
+Subproject commit c49c16c38d4bce29a1e0518d5fad5d90f42ab5e7
diff --git a/release/scripts/addons_contrib b/release/scripts/addons_contrib
index 42da56aa737..16467648282 160000
--- a/release/scripts/addons_contrib
+++ b/release/scripts/addons_contrib
@@ -1 +1 @@
-Subproject commit 42da56aa73726710107031787af5eea186797984
+Subproject commit 16467648282500cc229c271f62201ef897f2c2c3
diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c
index 4694d8652f6..0c81f461369 100644
--- a/source/blender/editors/space_nla/nla_draw.c
+++ b/source/blender/editors/space_nla/nla_draw.c
@@ -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 */
diff --git a/source/tools b/source/tools
index 7c5acb95df9..2e8c8792488 160000
--- a/source/tools
+++ b/source/tools
@@ -1 +1 @@
-Subproject commit 7c5acb95df918503d11cfc43172ce13901019289
+Subproject commit 2e8c879248822c8e500ed49d79acc605e5aa75b9



More information about the Bf-blender-cvs mailing list