T37579: Theme settings for Keyframe Colours
authorJose Molina Garcia <jose_molinag@yahoo.es>
Tue, 7 Jan 2014 09:45:40 +0000 (22:45 +1300)
committerJoshua Leung <aligorith@gmail.com>
Fri, 17 Jan 2014 01:42:10 +0000 (14:42 +1300)
This patch makes it possible to customise the colours used for the different
keyframe types (Keyframe, Breakdown, Extreme, Jitter) and the border colours
(normal and selected).

Reviewed by: Joshua Leung

source/blender/editors/animation/keyframes_draw.c
source/blender/editors/include/UI_resources.h
source/blender/editors/interface/resources.c
source/blender/makesdna/DNA_userdef_types.h
source/blender/makesrna/intern/rna_userdef.c

index db51e3c2398ba2e70b8d5fa11a2c84c6fc2f237f..05c390d1462450ccba852d4adfbda4b6355f374c 100644 (file)
@@ -599,27 +599,27 @@ void draw_keyframe_shape(float x, float y, float xscale, float hsize, short sel,
                switch (key_type) {
                        case BEZT_KEYTYPE_BREAKDOWN: /* bluish frames for now */
                        {
-                               if (sel) glColor4f(0.33f, 0.75f, 0.93f, alpha);
-                               else glColor4f(0.70f, 0.86f, 0.91f, alpha);
+                               if (sel)  UI_ThemeColor(TH_KEYTYPE_BREAKDOWN_SELECT);
+                               else UI_ThemeColor(TH_KEYTYPE_BREAKDOWN);
                                break;
                        }
                        case BEZT_KEYTYPE_EXTREME: /* redish frames for now */
                        {
-                               if (sel) glColor4f(0.95f, 0.5f, 0.5f, alpha);
-                               else glColor4f(0.91f, 0.70f, 0.80f, alpha);
+                               if (sel) UI_ThemeColor(TH_KEYTYPE_EXTREME_SELECT);
+                               else UI_ThemeColor(TH_KEYTYPE_EXTREME);
                                break;
                        }
                        case BEZT_KEYTYPE_JITTER: /* greenish frames for now? */
                        {
-                               if (sel) glColor4f(0.38f, 0.75f, 0.26f, alpha);
-                               else glColor4f(0.58f, 0.90f, 0.46f, alpha);
+                               if (sel) UI_ThemeColor(TH_KEYTYPE_JITTER_SELECT);
+                               else UI_ThemeColor(TH_KEYTYPE_JITTER);
                                break;
                        }
                        case BEZT_KEYTYPE_KEYFRAME: /* traditional yellowish frames for now */
                        default:
                        {
-                               if (sel) UI_ThemeColorShadeAlpha(TH_STRIP_SELECT, 50, -255 * (1.0f - alpha));
-                               else glColor4f(0.91f, 0.91f, 0.91f, alpha);
+                               if (sel) UI_ThemeColor(TH_KEYTYPE_KEYFRAME_SELECT);
+                               else UI_ThemeColor(TH_KEYTYPE_KEYFRAME);
                                break;
                        }
                }
@@ -629,7 +629,8 @@ void draw_keyframe_shape(float x, float y, float xscale, float hsize, short sel,
        
        if (ELEM(mode, KEYFRAME_SHAPE_FRAME, KEYFRAME_SHAPE_BOTH)) {
                /* exterior - black frame */
-               glColor4f(0.0f, 0.0f, 0.0f, alpha);
+               if (sel)  UI_ThemeColor4(TH_KEYBORDER_SELECT);
+               else  UI_ThemeColor4(TH_KEYBORDER);
                
                glCallList(displist1);
        }
index 0773b86aaab3388728783f6c0645d88d83d88e02..23498dcf4aaf3bff28cab4e0074eda416a682a10 100644 (file)
@@ -138,6 +138,18 @@ enum {
        TH_STRIP,
        TH_STRIP_SELECT,
        
+       TH_KEYTYPE_KEYFRAME, /* KEYTYPES */
+       TH_KEYTYPE_KEYFRAME_SELECT,
+       TH_KEYTYPE_EXTREME,
+       TH_KEYTYPE_EXTREME_SELECT,
+       TH_KEYTYPE_BREAKDOWN,
+       TH_KEYTYPE_BREAKDOWN_SELECT,
+       TH_KEYTYPE_JITTER,
+       TH_KEYTYPE_JITTER_SELECT,
+       
+       TH_KEYBORDER,
+       TH_KEYBORDER_SELECT,
+       
        TH_LAMP,
        TH_SPEAKER,
        TH_CAMERA,
index d4b23d5aaa65321e5eda9b0c0f652de587aeed89..38f185304e8dd42632dc63ea915d011a806fcadf 100644 (file)
@@ -331,6 +331,26 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
                                        cp = ts->strip; break;
                                case TH_STRIP_SELECT:
                                        cp = ts->strip_select; break;
+                               case TH_KEYTYPE_KEYFRAME:
+                                       cp = ts->keytype_keyframe; break;
+                               case TH_KEYTYPE_KEYFRAME_SELECT:
+                                       cp = ts->keytype_keyframe_select; break;
+                               case TH_KEYTYPE_EXTREME:
+                                       cp = ts->keytype_extreme; break;
+                               case TH_KEYTYPE_EXTREME_SELECT:
+                                       cp = ts->keytype_extreme_select; break;
+                               case TH_KEYTYPE_BREAKDOWN:
+                                       cp = ts->keytype_breakdown; break;
+                               case TH_KEYTYPE_BREAKDOWN_SELECT:
+                                       cp = ts->keytype_breakdown_select; break;
+                               case TH_KEYTYPE_JITTER:
+                                       cp = ts->keytype_jitter; break;
+                               case TH_KEYTYPE_JITTER_SELECT:
+                                       cp = ts->keytype_jitter_select; break;
+                               case TH_KEYBORDER:
+                                       cp = ts->keyborder; break;
+                               case TH_KEYBORDER_SELECT:
+                                       cp = ts->keyborder_select; break;
                                case TH_CFRAME:
                                        cp = ts->cframe; break;
                                case TH_NURB_ULINE:
@@ -893,6 +913,18 @@ void ui_theme_init_default(void)
        
        rgba_char_args_set(btheme->tact.anim_active,    204, 112, 26, 102);
        
+       rgba_char_args_set(btheme->tact.keytype_keyframe,           232, 232, 232, 255);
+       rgba_char_args_set(btheme->tact.keytype_keyframe_select,    255, 190,  50, 255);
+       rgba_char_args_set(btheme->tact.keytype_extreme,            237, 178, 204, 255);
+       rgba_char_args_set(btheme->tact.keytype_extreme_select,     242, 127, 127, 255);
+       rgba_char_args_set(btheme->tact.keytype_breakdown,          178, 219, 232, 255);
+       rgba_char_args_set(btheme->tact.keytype_breakdown_select,    84, 191, 237, 255);
+       rgba_char_args_set(btheme->tact.keytype_jitter,             148, 229, 117, 255);
+       rgba_char_args_set(btheme->tact.keytype_jitter_select,       97, 191, 066, 255);
+       
+       rgba_char_args_set(btheme->tact.keyborder,                   0,   0,   0, 255);
+       rgba_char_args_set(btheme->tact.keyborder_select,        0,   0,   0, 255);
+       
        /* space nla */
        btheme->tnla = btheme->tact;
        
index 77b21a514b7aa1952788f0c33a7006087c1937aa..8f0adc7d39ed7ede46eefc2405ce607123ef7e4d 100644 (file)
@@ -249,6 +249,9 @@ typedef struct ThemeSpace {
        char handle_sel_free[4], handle_sel_auto[4], handle_sel_vect[4], handle_sel_align[4], handle_sel_auto_clamped[4];
        
        char ds_channel[4], ds_subchannel[4]; /* dopesheet */
+       char keytype_keyframe[4], keytype_extreme[4], keytype_breakdown[4], keytype_jitter[4]; /* keytypes */
+       char keytype_keyframe_select[4], keytype_extreme_select[4], keytype_breakdown_select[4], keytype_jitter_select[4]; /* keytypes */
+       char keyborder[4],keyborder_select[4];
        
        char console_output[4], console_input[4], console_info[4], console_error[4];
        char console_cursor[4], console_select[4], pad1[4];
index 7b5c269ff0dd8911e8ae209ec4c3fe8235760065..50b4a2efada37862e2e9ae997e92257b943a3c00 100644 (file)
@@ -2460,6 +2460,66 @@ static void rna_def_userdef_theme_space_action(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Dope Sheet Sub-Channel", "");
        RNA_def_property_update(prop, 0, "rna_userdef_update");
        
+       prop = RNA_def_property(srna, "keyframe", PROP_FLOAT, PROP_COLOR_GAMMA);
+       RNA_def_property_float_sdna(prop, NULL, "keytype_keyframe");
+       RNA_def_property_array(prop, 3);
+       RNA_def_property_ui_text(prop, "Keyframe", "Color of Keyframe");
+       RNA_def_property_update(prop, 0, "rna_userdef_update");
+       
+       prop = RNA_def_property(srna, "keyframe_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
+       RNA_def_property_float_sdna(prop, NULL, "keytype_keyframe_select");
+       RNA_def_property_array(prop, 3);
+       RNA_def_property_ui_text(prop, "Keyframe Selected", "Color of Keyframe Selected");
+       RNA_def_property_update(prop, 0, "rna_userdef_update");
+       
+       prop = RNA_def_property(srna, "keyframe_extreme", PROP_FLOAT, PROP_COLOR_GAMMA);
+       RNA_def_property_float_sdna(prop, NULL, "keytype_extreme");
+       RNA_def_property_array(prop, 3);
+       RNA_def_property_ui_text(prop, "Extreme Keyframe", "Color of Extreme Keyframe");
+       RNA_def_property_update(prop, 0, "rna_userdef_update");
+       
+       prop = RNA_def_property(srna, "keyframe_extreme_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
+       RNA_def_property_float_sdna(prop, NULL, "keytype_extreme_select");
+       RNA_def_property_array(prop, 3);
+       RNA_def_property_ui_text(prop, "Extreme Keyframe Selected", "Color of Extreme Keyframe selected");
+       RNA_def_property_update(prop, 0, "rna_userdef_update");
+       
+       prop = RNA_def_property(srna, "keyframe_breakdown", PROP_FLOAT, PROP_COLOR_GAMMA);
+       RNA_def_property_float_sdna(prop, NULL, "keytype_breakdown");
+       RNA_def_property_array(prop, 3);
+       RNA_def_property_ui_text(prop, "Breakdown Keyframe", "Color of Breakdown keyframe");
+       RNA_def_property_update(prop, 0, "rna_userdef_update");
+       
+       prop = RNA_def_property(srna, "keyframe_breakdown_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
+       RNA_def_property_float_sdna(prop, NULL, "keytype_breakdown_select");
+       RNA_def_property_array(prop, 3);
+       RNA_def_property_ui_text(prop, "Breakdown Keyframe Selected", "Color of Breakdown Keyframe selected");
+       RNA_def_property_update(prop, 0, "rna_userdef_update");
+       
+       prop = RNA_def_property(srna, "keyframe_jitter", PROP_FLOAT, PROP_COLOR_GAMMA);
+       RNA_def_property_float_sdna(prop, NULL, "keytype_jitter");
+       RNA_def_property_array(prop, 3);
+       RNA_def_property_ui_text(prop, "Jitter Keyframe", "Color of Jitter Keyframe");
+       RNA_def_property_update(prop, 0, "rna_userdef_update");
+       
+       prop = RNA_def_property(srna, "keyframe_jitter_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
+       RNA_def_property_float_sdna(prop, NULL, "keytype_jitter_select");
+       RNA_def_property_array(prop, 3);
+       RNA_def_property_ui_text(prop, "Jitter Keyframe Selected", "Color of Jitter Keyframe selected");
+       RNA_def_property_update(prop, 0, "rna_userdef_update");
+       
+       prop = RNA_def_property(srna, "keyframe_border", PROP_FLOAT, PROP_COLOR_GAMMA);
+       RNA_def_property_float_sdna(prop, NULL, "keyborder");
+       RNA_def_property_array(prop, 4);
+       RNA_def_property_ui_text(prop, "Keyframe Border", "Color of Keyframe border");
+       RNA_def_property_update(prop, 0, "rna_userdef_update");
+       
+       prop = RNA_def_property(srna, "keyframe_border_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
+       RNA_def_property_float_sdna(prop, NULL, "keyborder_select");
+       RNA_def_property_array(prop, 4);
+       RNA_def_property_ui_text(prop, "Keyframe Border Selected", "Color of Key Border Selected");
+       RNA_def_property_update(prop, 0, "rna_userdef_update");
+       
        prop = RNA_def_property(srna, "summary", PROP_FLOAT, PROP_COLOR_GAMMA);
        RNA_def_property_float_sdna(prop, NULL, "anim_active");
        RNA_def_property_array(prop, 4);