From 34024c7cd8b3e7e90754c80d60ac5cd02de87a85 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Tue, 28 Jun 2016 00:25:48 +1200 Subject: FCurve Auto Colours: "XYZ to RGB" works for Quaternions too now The "W" channel will get a yellowish colour (i.e. a blend between the X/R and Y/G axis colours), while the XYZ will behave as they do for other transforms. --- source/blender/editors/space_graph/space_graph.c | 45 ++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'source/blender/editors/space_graph/space_graph.c') diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c index a7284694f64..8ae5932f3fd 100644 --- a/source/blender/editors/space_graph/space_graph.c +++ b/source/blender/editors/space_graph/space_graph.c @@ -611,6 +611,51 @@ static void graph_refresh(const bContext *C, ScrArea *sa) } break; } + case FCURVE_COLOR_AUTO_YRGB: + { + /* Like FCURVE_COLOR_AUTO_RGB, except this is for quaternions... */ + float *col = fcu->color; + + switch (fcu->array_index) { + case 1: + UI_GetThemeColor3fv(TH_AXIS_X, col); + break; + case 2: + UI_GetThemeColor3fv(TH_AXIS_Y, col); + break; + case 3: + UI_GetThemeColor3fv(TH_AXIS_Z, col); + break; + + case 0: + { + /* Special Case: "W" channel should be yellowish, so blend X and Y channel colors... */ + float c1[3], c2[3]; + float h1[3], h2[3]; + float hresult[3]; + + /* - get colors (rgb) */ + UI_GetThemeColor3fv(TH_AXIS_X, c1); + UI_GetThemeColor3fv(TH_AXIS_Y, c2); + + /* - perform blending in HSV space (to keep brightness similar) */ + rgb_to_hsv_v(c1, h1); + rgb_to_hsv_v(c2, h2); + + interp_v3_v3v3(hresult, h1, h2, 0.5f); + + /* - convert back to RGB for display */ + hsv_to_rgb_v(hresult, col); + break; + } + + default: + /* 'unknown' color - bluish so as to not conflict with handles */ + col[0] = 0.3f; col[1] = 0.8f; col[2] = 1.0f; + break; + } + break; + } case FCURVE_COLOR_AUTO_RAINBOW: default: { -- cgit v1.2.3