[Bf-blender-cvs] [071007e0eff] master: UI: Fix summary overlay wrong range and overlap in Dopesheet

Pablo Vazquez noreply at git.blender.org
Fri Aug 27 19:49:16 CEST 2021


Commit: 071007e0eff9dd474f4a3d1f479649242be22717
Author: Pablo Vazquez
Date:   Fri Aug 27 19:48:55 2021 +0200
Branches: master
https://developer.blender.org/rB071007e0eff9dd474f4a3d1f479649242be22717

UI: Fix summary overlay wrong range and overlap in Dopesheet

The overlay was drawn twice on top of each other making it hard to see,
hard to theme, and making it more prominent in the wrong areas (before
frame 0, not even start frame). The comment in the code was also wrong
since it said "frame one" but it was 0.

Checked with the Animation module team that it's better to use start/end
frame range instead of frame 0.

There is a TODO note to de-duplicate this section eventually so I left it there.
This fix is currently done for Grease Pencil and Mask modes, but it should
also be fixed for the regular Dopesheet mode (in line 244 if anyone wants to do it).

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

M	source/blender/editors/space_action/action_draw.c

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

diff --git a/source/blender/editors/space_action/action_draw.c b/source/blender/editors/space_action/action_draw.c
index a3bdcd2adf5..6f1a90e56a5 100644
--- a/source/blender/editors/space_action/action_draw.c
+++ b/source/blender/editors/space_action/action_draw.c
@@ -259,17 +259,18 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *region
           else {
             color = sel ? col1 : col2;
           }
-          /* frames less than one get less saturated background */
+
+          /* Color overlay on frames between the start/end frames. */
           immUniformColor4ubv(color);
-          immRectf(pos, 0.0f, ymin, v2d->cur.xmin, ymax);
+          immRectf(pos, ac->scene->r.sfra, ymin, ac->scene->r.efra, ymax);
 
-          /* frames one and higher get a saturated background */
-          immUniformColor3ubvAlpha(color, MIN2(255, color[3] * 2));
-          immRectf(pos, v2d->cur.xmin, ymin, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymax);
+          /* Color overlay outside the start/end frame range get a more transparent overlay. */
+          immUniformColor3ubvAlpha(color, MIN2(255, color[3] / 2));
+          immRectf(pos, v2d->cur.xmin, ymin, ac->scene->r.sfra, ymax);
+          immRectf(pos, ac->scene->r.efra, ymin, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymax);
         }
         else if (ac->datatype == ANIMCONT_MASK) {
           /* TODO: this is a copy of gpencil. */
-          /* frames less than one get less saturated background */
           uchar *color;
           if (ale->type == ANIMTYPE_SUMMARY) {
             color = col_summary;
@@ -277,12 +278,15 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *region
           else {
             color = sel ? col1 : col2;
           }
+
+          /* Color overlay on frames between the start/end frames. */
           immUniformColor4ubv(color);
-          immRectf(pos, 0.0f, ymin, v2d->cur.xmin, ymax);
+          immRectf(pos, ac->scene->r.sfra, ymin, ac->scene->r.efra, ymax);
 
-          /* frames one and higher get a saturated background */
-          immUniformColor3ubvAlpha(color, MIN2(255, color[3] * 2));
-          immRectf(pos, v2d->cur.xmin, ymin, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymax);
+          /* Color overlay outside the start/end frame range get a more transparent overlay. */
+          immUniformColor3ubvAlpha(color, MIN2(255, color[3] / 2));
+          immRectf(pos, v2d->cur.xmin, ymin, ac->scene->r.sfra, ymax);
+          immRectf(pos, ac->scene->r.efra, ymin, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymax);
         }
       }
     }



More information about the Bf-blender-cvs mailing list