Animation: Graph Editor - grey out area outside of normalization range
When normalization is enabled in the Graph Editor, the area outside the -1/1 range on the y axis isn't meaningful. To visually represent that this patch greys out that area just as it does with anything outside the current frame range. Pull Request: https://projects.blender.org/blender/blender/pulls/106302
This commit is contained in:
committed by
Christoph Lendenfeld
parent
324ba509b5
commit
7775fecb14
@@ -182,6 +182,28 @@ static void graph_main_region_init(wmWindowManager *wm, ARegion *region)
|
||||
WM_event_add_keymap_handler(®ion->handlers, keymap);
|
||||
}
|
||||
|
||||
/* Draw a darker area above 1 and below -1. */
|
||||
static void draw_normalization_borders(Scene *scene, View2D *v2d)
|
||||
{
|
||||
GPU_blend(GPU_BLEND_ALPHA);
|
||||
|
||||
GPUVertFormat *format = immVertexFormat();
|
||||
const uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
|
||||
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
||||
immUniformThemeColorShadeAlpha(TH_BACK, -25, -180);
|
||||
|
||||
if (v2d->cur.ymax >= 1) {
|
||||
immRectf(pos, scene->r.sfra, 1, scene->r.efra, v2d->cur.ymax);
|
||||
}
|
||||
if (v2d->cur.ymin <= -1) {
|
||||
immRectf(pos, scene->r.sfra, v2d->cur.ymin, scene->r.efra, -1);
|
||||
}
|
||||
|
||||
GPU_blend(GPU_BLEND_NONE);
|
||||
immUnbindProgram();
|
||||
}
|
||||
|
||||
static void graph_main_region_draw(const bContext *C, ARegion *region)
|
||||
{
|
||||
/* draw entirely, view changes should be handled here */
|
||||
@@ -207,6 +229,10 @@ static void graph_main_region_draw(const bContext *C, ARegion *region)
|
||||
ANIM_draw_framerange(scene, v2d);
|
||||
}
|
||||
|
||||
if (sipo->mode == SIPO_MODE_ANIMATION && (sipo->flag & SIPO_NORMALIZE)) {
|
||||
draw_normalization_borders(scene, v2d);
|
||||
}
|
||||
|
||||
/* draw data */
|
||||
if (ANIM_animdata_get_context(C, &ac)) {
|
||||
/* draw ghost curves */
|
||||
|
||||
Reference in New Issue
Block a user