diff options
author | Pablo Vazquez <pablo@blender.org> | 2021-08-27 20:48:55 +0300 |
---|---|---|
committer | Pablo Vazquez <pablo@blender.org> | 2021-08-27 20:49:08 +0300 |
commit | 071007e0eff9dd474f4a3d1f479649242be22717 (patch) | |
tree | ffcb5b3a10494abeb99f72a0e15da7a59184a77a /source/blender/editors/space_action | |
parent | 8b9a3b94fc148d197b137aa892855c60db2783e6 (diff) |
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).
Diffstat (limited to 'source/blender/editors/space_action')
-rw-r--r-- | source/blender/editors/space_action/action_draw.c | 24 |
1 files changed, 14 insertions, 10 deletions
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); } } } |