diff options
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/animation/keyframing.c | 3 | ||||
-rw-r--r-- | source/blender/editors/space_graph/space_graph.c | 45 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_anim_types.h | 5 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_fcurve.c | 2 |
4 files changed, 53 insertions, 2 deletions
diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index 66b3a63c669..0c0f54f0179 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -1069,6 +1069,9 @@ short insert_keyframe(ReportList *reports, ID *id, bAction *act, const char grou if (ELEM(RNA_property_subtype(prop), PROP_TRANSLATION, PROP_XYZ, PROP_EULER, PROP_COLOR, PROP_COORDS)) { fcu->color_mode = FCURVE_COLOR_AUTO_RGB; } + else if (RNA_property_subtype(prop), PROP_QUATERNION) { + fcu->color_mode = FCURVE_COLOR_AUTO_YRGB; + } } /* insert keyframe */ 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: { diff --git a/source/blender/makesdna/DNA_anim_types.h b/source/blender/makesdna/DNA_anim_types.h index 4c1283452ff..6bd7b3a4999 100644 --- a/source/blender/makesdna/DNA_anim_types.h +++ b/source/blender/makesdna/DNA_anim_types.h @@ -537,8 +537,9 @@ typedef enum eFCurve_Extend { /* curve coloring modes */ typedef enum eFCurve_Coloring { FCURVE_COLOR_AUTO_RAINBOW = 0, /* automatically determine color using rainbow (calculated at drawtime) */ - FCURVE_COLOR_AUTO_RGB, /* automatically determine color using XYZ (array index) <-> RGB */ - FCURVE_COLOR_CUSTOM /* custom color */ + FCURVE_COLOR_AUTO_RGB = 1, /* automatically determine color using XYZ (array index) <-> RGB */ + FCURVE_COLOR_AUTO_YRGB = 3, /* automatically determine color where XYZ <-> RGB, but index(X) != 0 */ + FCURVE_COLOR_CUSTOM = 2, /* custom color */ } eFCurve_Coloring; /* ************************************************ */ diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index 1487dfa074e..3043c5452c0 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -1844,6 +1844,8 @@ static void rna_def_fcurve(BlenderRNA *brna) "Cycle through the rainbow, trying to give each curve a unique color"}, {FCURVE_COLOR_AUTO_RGB, "AUTO_RGB", 0, "Auto XYZ to RGB", "Use axis colors for transform and color properties, and auto-rainbow for the rest"}, + {FCURVE_COLOR_AUTO_YRGB, "AUTO_YRGB", 0, "Auto WXYZ to YRGB", + "Use axis colors for XYZ parts of transform, and yellow for the 'W' channel"}, {FCURVE_COLOR_CUSTOM, "CUSTOM", 0, "User Defined", "Use custom hand-picked color for F-Curve"}, {0, NULL, 0, NULL, NULL} |