Fix Drivers Editor not hiding vertical part of cursor

When "Show Cursor" is unchecked, the Drivers Editor would still display
the vertical line representing the cursor x.

Probably overseen in {rB65072499c65a} (historically the vertical line
could represent either the current frame of the cursor X in drawing, but
this is now much more separate).

There is no point in seeing part of the cursor in the Drivers Editor if
this is disabled.

Also correct outdated comments.

ref. T91157

Maniphest Tasks: T91157

Differential Revision: https://developer.blender.org/D12391
This commit is contained in:
Philipp Oeser 2021-09-03 15:51:38 +02:00
parent b91946780c
commit 6f29801f1b
Notes: blender-bot 2023-02-14 04:39:18 +01:00
Referenced by issue #91157, Drivers Editor : Frame indicator/controller & cursor problem
1 changed files with 12 additions and 14 deletions

View File

@ -237,29 +237,27 @@ static void graph_main_region_draw(const bContext *C, ARegion *region)
v2d->tot.xmax += 10.0f;
}
if (((sipo->flag & SIPO_NODRAWCURSOR) == 0) || (sipo->mode == SIPO_MODE_DRIVERS)) {
if (((sipo->flag & SIPO_NODRAWCURSOR) == 0)) {
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
/* horizontal component of value-cursor (value line before the current frame line) */
if ((sipo->flag & SIPO_NODRAWCURSOR) == 0) {
float y = sipo->cursorVal;
float y = sipo->cursorVal;
/* Draw a green line to indicate the cursor value */
immUniformThemeColorShadeAlpha(TH_CFRAME, -10, -50);
GPU_blend(GPU_BLEND_ALPHA);
GPU_line_width(2.0);
/* Draw a line to indicate the cursor value. */
immUniformThemeColorShadeAlpha(TH_CFRAME, -10, -50);
GPU_blend(GPU_BLEND_ALPHA);
GPU_line_width(2.0);
immBegin(GPU_PRIM_LINES, 2);
immVertex2f(pos, v2d->cur.xmin, y);
immVertex2f(pos, v2d->cur.xmax, y);
immEnd();
immBegin(GPU_PRIM_LINES, 2);
immVertex2f(pos, v2d->cur.xmin, y);
immVertex2f(pos, v2d->cur.xmax, y);
immEnd();
GPU_blend(GPU_BLEND_NONE);
}
GPU_blend(GPU_BLEND_NONE);
/* current frame or vertical component of vertical component of the cursor */
/* Vertical component of of the cursor. */
if (sipo->mode == SIPO_MODE_DRIVERS) {
/* cursor x-value */
float x = sipo->cursorTime;