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).
This commit is contained in:
Joshua Leung
2018-07-06 15:38:25 +12:00
parent a71c2deac5
commit 288bcb2593

View File

@@ -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);
}