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
path: root/source
diff options
context:
space:
mode:
authorMike Erwin <significant.bit@gmail.com>2017-02-28 09:21:27 +0300
committerMike Erwin <significant.bit@gmail.com>2017-02-28 09:21:27 +0300
commite7d57628c955c1843c70c8fc5023f5d8954847bd (patch)
treeebd1a94dba38fd2d958850f60a48263aae7ead63 /source
parent5138fe3c0a24d5890438eed90a70401d90423356 (diff)
OpenGL: keyframe shape fixes
- Size parameter is total size of the shape, not its radius (half size). Updated hard-coded sizes to match this. - Shader expands size to include outline. - Fixed fringe between outline color and transparent background.
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/animation/keyframes_draw.c16
-rw-r--r--source/blender/editors/interface/interface_icons.c6
-rw-r--r--source/blender/editors/space_nla/nla_draw.c6
-rw-r--r--source/blender/gpu/shaders/gpu_shader_keyframe_diamond_frag.glsl2
-rw-r--r--source/blender/gpu/shaders/gpu_shader_keyframe_diamond_vert.glsl2
5 files changed, 16 insertions, 16 deletions
diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c
index c8d141eab07..5f96f95e95b 100644
--- a/source/blender/editors/animation/keyframes_draw.c
+++ b/source/blender/editors/animation/keyframes_draw.c
@@ -470,7 +470,7 @@ void draw_keyframe_shape(float x, float y, float size, bool sel, short key_type,
bool draw_fill = ELEM(mode, KEYFRAME_SHAPE_INSIDE, KEYFRAME_SHAPE_BOTH);
bool draw_outline = ELEM(mode, KEYFRAME_SHAPE_FRAME, KEYFRAME_SHAPE_BOTH);
- if (!(draw_fill || draw_outline)) return; /* TODO: assert this? */
+ BLI_assert(draw_fill || draw_outline);
/* tweak size of keyframe shape according to type of keyframe
* - 'proper' keyframes have key_type = 0, so get drawn at full size
@@ -484,8 +484,7 @@ void draw_keyframe_shape(float x, float y, float size, bool sel, short key_type,
break;
case BEZT_KEYTYPE_MOVEHOLD: /* slightly smaller than normal keyframes (but by less than for breakdowns) */
- //size *= 0.72f;
- size *= 0.95f;
+ size *= 0.925f;
break;
case BEZT_KEYTYPE_EXTREME: /* slightly larger */
@@ -559,8 +558,9 @@ void draw_keyframe_shape(float x, float y, float size, bool sel, short key_type,
static void draw_keylist(View2D *v2d, DLRBT_Tree *keys, DLRBT_Tree *blocks, float ypos, float yscale_fac, bool channelLocked)
{
- const float iconsize = U.widget_unit * 0.25f * yscale_fac;
- const float mhsize = iconsize * 0.7f;
+ const float icon_sz = U.widget_unit * 0.5f * yscale_fac;
+ const float half_icon_sz = 0.5f * icon_sz;
+ const float smaller_sz = 0.35f * icon_sz;
glEnable(GL_BLEND);
@@ -593,12 +593,12 @@ static void draw_keylist(View2D *v2d, DLRBT_Tree *keys, DLRBT_Tree *blocks, floa
if (ab->flag & ACTKEYBLOCK_FLAG_MOVING_HOLD) {
/* draw "moving hold" long-keyframe block - slightly smaller */
immUniformColor4fv(ab->sel ? sel_mhcol : unsel_mhcol);
- immRectf(pos_id, ab->start, ypos - mhsize, ab->end, ypos + mhsize);
+ immRectf(pos_id, ab->start, ypos - smaller_sz, ab->end, ypos + smaller_sz);
}
else {
/* draw standard long-keyframe block */
immUniformColor4fv(ab->sel ? sel_color : unsel_color);
- immRectf(pos_id, ab->start, ypos - iconsize, ab->end, ypos + iconsize);
+ immRectf(pos_id, ab->start, ypos - half_icon_sz, ab->end, ypos + half_icon_sz);
}
}
}
@@ -629,7 +629,7 @@ static void draw_keylist(View2D *v2d, DLRBT_Tree *keys, DLRBT_Tree *blocks, floa
for (ActKeyColumn *ak = keys->first; ak; ak = ak->next) {
if (IN_RANGE_INCL(ak->cfra, v2d->cur.xmin, v2d->cur.xmax)) {
- draw_keyframe_shape(ak->cfra, ypos, iconsize, (ak->sel & SELECT), ak->key_type, KEYFRAME_SHAPE_BOTH, alpha,
+ draw_keyframe_shape(ak->cfra, ypos, icon_sz, (ak->sel & SELECT), ak->key_type, KEYFRAME_SHAPE_BOTH, alpha,
pos_id, size_id, color_id, outline_color_id);
}
}
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index 1c1e6cd3576..526e73e33e5 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -264,12 +264,12 @@ static void vicon_keytype_draw_wrapper(int x, int y, int w, int h, float alpha,
immBindBuiltinProgram(GPU_SHADER_KEYFRAME_DIAMOND);
GPU_enable_program_point_size();
immBegin(PRIM_POINTS, 1);
-
+
/* draw keyframe
- * - size: 0.3 * h (found out experimentally... dunno why!)
+ * - size: 0.6 * h (found out experimentally... dunno why!)
* - sel: true (so that "keyframe" state shows the iconic yellow icon)
*/
- draw_keyframe_shape(xco, yco, 0.3f * h, true, key_type, KEYFRAME_SHAPE_BOTH, alpha,
+ draw_keyframe_shape(xco, yco, 0.6f * h, true, key_type, KEYFRAME_SHAPE_BOTH, alpha,
pos_id, size_id, color_id, outline_color_id);
immEnd();
diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c
index e744a39fde9..65582b994e8 100644
--- a/source/blender/editors/space_nla/nla_draw.c
+++ b/source/blender/editors/space_nla/nla_draw.c
@@ -150,11 +150,11 @@ static void nla_action_draw_keyframes(AnimData *adt, bAction *act, float y, floa
immBegin(PRIM_POINTS, key_ct);
/* - disregard the selection status of keyframes so they draw a certain way
- * - size is 3.0f which is smaller than the editable keyframes, so that there is a distinction
+ * - size is 6.0f which is smaller than the editable keyframes, so that there is a distinction
*/
for (ActKeyColumn *ak = keys.first; ak; ak = ak->next) {
- draw_keyframe_shape(ak->cfra, y, 3.0f, false, ak->key_type, KEYFRAME_SHAPE_FRAME, 1.0f,
- pos_id, size_id, color_id, outline_color_id);
+ draw_keyframe_shape(ak->cfra, y, 6.0f, false, ak->key_type, KEYFRAME_SHAPE_FRAME, 1.0f,
+ pos_id, size_id, color_id, outline_color_id);
}
immEnd();
diff --git a/source/blender/gpu/shaders/gpu_shader_keyframe_diamond_frag.glsl b/source/blender/gpu/shaders/gpu_shader_keyframe_diamond_frag.glsl
index 43a7e42153a..ebda79558c7 100644
--- a/source/blender/gpu/shaders/gpu_shader_keyframe_diamond_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_keyframe_diamond_frag.glsl
@@ -29,7 +29,7 @@ void main() {
float mid_stroke = 0.5 * (radii[1] + radii[2]);
- vec4 backgroundColor = vec4(finalColor.rgb, 0.0);
+ vec4 backgroundColor = vec4(finalOutlineColor.rgb, 0.0);
if (dist > mid_stroke)
fragColor = mix(finalOutlineColor, backgroundColor, smoothstep(radii[1], radii[0], dist));
diff --git a/source/blender/gpu/shaders/gpu_shader_keyframe_diamond_vert.glsl b/source/blender/gpu/shaders/gpu_shader_keyframe_diamond_vert.glsl
index 69afefa685f..6f33491af55 100644
--- a/source/blender/gpu/shaders/gpu_shader_keyframe_diamond_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_keyframe_diamond_vert.glsl
@@ -26,7 +26,7 @@ void main() {
gl_Position = ModelViewProjectionMatrix * vec4(pos, 0.0, 1.0);
// pass through unchanged
- gl_PointSize = size;
+ gl_PointSize = size + pixel_fudge; // 0.5 pixel_fudge on either side
finalColor = color;
finalOutlineColor = outlineColor;