From 288bcb2593f52c47225da9ea8efe13d288d35892 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Fri, 6 Jul 2018 15:38:25 +1200 Subject: Further tweaks to drawing of non-selected graph editor keyframes The previous commit only solves the problem when using the default theme using factory settings. For previously saved themes, there could still be problems, as the alpha values were still 0. This commit improves the logic here so that while keyframe points on unselected F-Curves will still get faded out (to not stick out too much from the curves they live on), but the effect will not be as pronounced (i.e. the points will stay visible all the time). --- source/blender/editors/space_graph/graph_draw.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index b08ff8dcfa1..4e9f8cd3733 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -148,21 +148,27 @@ static void draw_fcurve_modifier_controls_envelope(FModifier *fcm, View2D *v2d) /* helper func - set color to draw F-Curve data with */ static void set_fcurve_vertex_color(FCurve *fcu, bool sel) { - /* Fade the 'intensity' of the vertices based on the selection of the curves too */ - int alphaOffset = (int)((fcurve_display_alpha(fcu) - 1.0f) * 255); - float color[4]; + float diff; /* Set color of curve vertex based on state of curve (i.e. 'Edit' Mode) */ if ((fcu->flag & FCURVE_PROTECTED) == 0) { /* Curve's points ARE BEING edited */ - UI_GetThemeColorShadeAlpha4fv(sel ? TH_VERTEX_SELECT : TH_VERTEX, 0, alphaOffset, color); + UI_GetThemeColor3fv(sel ? TH_VERTEX_SELECT : TH_VERTEX, color); } else { /* Curve's points CANNOT BE edited */ - UI_GetThemeColorShadeAlpha4fv(sel ? TH_TEXT_HI : TH_TEXT, 0, alphaOffset, color); + UI_GetThemeColor3fv(sel ? TH_TEXT_HI : TH_TEXT, color); } + /* Fade the 'intensity' of the vertices based on the selection of the curves too + * - Only fade by 50% the amount the curves were faded by, so that the points + * still stand out for easier selection + */ + diff = 1.0f - fcurve_display_alpha(fcu); + color[3] = 1.0f - (diff * 0.5f); + CLAMP(color[3], 0.2f, 1.0f); + immUniformColor4fv(color); } -- cgit v1.2.3