Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2020-06-26 02:27:24 +0300
committerClément Foucault <foucault.clem@gmail.com>2020-06-26 02:27:36 +0300
commit46815753cf0d8045b8a160b46de5f97013c2e32f (patch)
tree5b160bd376f774a765ee3cc7e80d17cf028b7ea5 /source/blender
parent62aa103d485fd6e0b15100c1928695c4fb3ce039 (diff)
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.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/editors/interface/interface_draw.c5
-rw-r--r--source/blender/gpu/shaders/gpu_shader_2D_widget_base_frag.glsl9
-rw-r--r--source/blender/gpu/shaders/gpu_shader_2D_widget_base_vert.glsl2
3 files changed, 13 insertions, 3 deletions
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index 98cb85061f2..d9402261175 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -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 */
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_widget_base_frag.glsl b/source/blender/gpu/shaders/gpu_shader_2D_widget_base_frag.glsl
index 05fbae53e18..21c7f79a57c 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_widget_base_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_2D_widget_base_frag.glsl
@@ -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;
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_widget_base_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_widget_base_vert.glsl
index 30d0cd05926..2fd5effccce 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_widget_base_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_2D_widget_base_vert.glsl
@@ -163,7 +163,7 @@ vec2 do_tria()
borderColor = vec4(0.0);
embossColor = vec4(0.0);
- butCo = -1.0;
+ butCo = -2.0;
return pos;
}