diff options
author | Nate Rupsis <nrupsis> | 2022-09-15 11:45:51 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2022-09-15 11:47:02 +0300 |
commit | 2310daed3a555cf49994524ba44c0be04d2ad8ff (patch) | |
tree | 39e57559241315804c3e6383969c59bdd2fcf08c /source | |
parent | 3eae1bfe35fef3e28870f7688b105dfaacd11ca0 (diff) |
NLA: draw track bg based on strip's extrapolation type
In the NLA, draw the track background based on the strip's extrapolation
setting. Previously, this had no visual indicator; "Hold", "Hold
Forward", and "Nothing" were visually indistinguishable. Now "Nothing"
actually shows nothing, "Hold Forward" shows a dimly colored background
from the strip to its right, and "Hold" shows that in both directions.
Reviewed By: RiggingDojo, sybren
Maniphest Tasks: T97572
Differential Revision: https://developer.blender.org/D14836
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/space_nla/nla_draw.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c index e614055441d..f57c9fead56 100644 --- a/source/blender/editors/space_nla/nla_draw.c +++ b/source/blender/editors/space_nla/nla_draw.c @@ -22,6 +22,7 @@ #include "BLI_range.h" #include "BLI_utildefines.h" +#include "BKE_action.h" #include "BKE_context.h" #include "BKE_fcurve.h" #include "BKE_nla.h" @@ -856,8 +857,9 @@ void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *region) immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); - /* just draw a semi-shaded rect spanning the width of the viewable area if there's data, - * and a second darker rect within which we draw keyframe indicator dots if there's data + /* just draw a semi-shaded rect spanning the width of the viewable area, based on if + * there's data and the action's extrapolation mode. Draw a second darker rect within + * which we draw keyframe indicator dots if there's data. */ GPU_blend(GPU_BLEND_ALPHA); @@ -869,8 +871,26 @@ void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *region) /* draw slightly shifted up for greater separation from standard channels, * but also slightly shorter for some more contrast when viewing the strips */ - immRectf( - pos, v2d->cur.xmin, ymin + NLACHANNEL_SKIP, v2d->cur.xmax, ymax - NLACHANNEL_SKIP); + switch (adt->act_extendmode) { + case NLASTRIP_EXTEND_HOLD: { + immRectf(pos, + v2d->cur.xmin, + ymin + NLACHANNEL_SKIP, + v2d->cur.xmax, + ymax - NLACHANNEL_SKIP); + break; + } + case NLASTRIP_EXTEND_HOLD_FORWARD: { + float r_start; + float r_end; + BKE_action_get_frame_range(ale->data, &r_start, &r_end); + + immRectf(pos, r_end, ymin + NLACHANNEL_SKIP, v2d->cur.xmax, ymax - NLACHANNEL_SKIP); + break; + } + case NLASTRIP_EXTEND_NOTHING: + break; + } immUnbindProgram(); |