Fix T78237 UI: NLA colors black and broken

This was caused by missing GL blend. This patch also fix the broken
strip appearance under timeline zoom.
This commit is contained in:
Clément Foucault 2020-06-26 01:27:24 +02:00
parent 62aa103d48
commit 46815753cf
3 changed files with 13 additions and 3 deletions

View File

@ -475,13 +475,18 @@ void UI_draw_roundbox_shade_x(bool filled,
.color_outline[1] = clamp_f(col[1] + shadetop + shadedown, 0.0f, 1.0f),
.color_outline[2] = clamp_f(col[2] + shadetop + shadedown, 0.0f, 1.0f),
.color_outline[3] = clamp_f(col[3] + shadetop + shadedown, 0.0f, 1.0f),
.shade_dir = 1.0f,
.alpha_discard = 1.0f,
};
GPU_blend(true);
GPUBatch *batch = ui_batch_roundbox_widget_get();
GPU_batch_program_set_builtin(batch, GPU_SHADER_2D_WIDGET_BASE);
GPU_batch_uniform_4fv_array(batch, "parameters", 11, (float *)&widget_params);
GPU_batch_draw(batch);
GPU_blend(false);
}
#if 0 /* unused */

View File

@ -19,9 +19,14 @@ vec3 compute_masks(vec2 uv)
bool right_half = uv.x > outRectSize.x * 0.5;
float corner_rad;
/* Correct aspect ratio for 2D views not using uniform scalling.
* uv is already in pixel space so a uniform scale should give us a ratio of 1. */
float ratio = (butCo != -2.0) ? (dFdy(uv.y) / dFdx(uv.x)) : 1.0;
vec2 uv_sdf = uv;
uv_sdf.x *= ratio;
if (right_half) {
uv_sdf.x = outRectSize.x - uv_sdf.x;
uv_sdf.x = outRectSize.x * ratio - uv_sdf.x;
}
if (upper_half) {
uv_sdf.y = outRectSize.y - uv_sdf.y;
@ -43,7 +48,7 @@ vec3 compute_masks(vec2 uv)
/* Clamp line width to be at least 1px wide. This can happen if the projection matrix
* has been scaled (i.e: Node editor)... */
float line_width = (lineWidth > 0.0) ? max(fwidth(uv.x), lineWidth) : 0.0;
float line_width = (lineWidth > 0.0) ? max(fwidth(uv.y), lineWidth) : 0.0;
const float aa_radius = 0.5;
vec3 masks;

View File

@ -163,7 +163,7 @@ vec2 do_tria()
borderColor = vec4(0.0);
embossColor = vec4(0.0);
butCo = -1.0;
butCo = -2.0;
return pos;
}