diff options
author | Joshua Leung <aligorith@gmail.com> | 2016-05-18 18:25:00 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2016-05-18 18:25:38 +0300 |
commit | e34e5ce332aaf2fa16426eaa217f5c6bb78d0f63 (patch) | |
tree | 279071c8bd5085ae16989d0e2ebded121347fe08 /source/blender/editors | |
parent | f74c7fcca2f9e2603b426fb5c0400f30b4b9ff86 (diff) |
Theme Color Sets - Dynamically generated icons
The theme color set selector (for Bone Groups) will now show previews of
what each color set looks like. It does so using a 3-color band icon.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/include/UI_icons.h | 22 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_icons.c | 78 |
2 files changed, 100 insertions, 0 deletions
diff --git a/source/blender/editors/include/UI_icons.h b/source/blender/editors/include/UI_icons.h index 76ff9e0fbd8..2c80701bf69 100644 --- a/source/blender/editors/include/UI_icons.h +++ b/source/blender/editors/include/UI_icons.h @@ -1020,3 +1020,25 @@ DEF_VICO(KEYTYPE_KEYFRAME_VEC) DEF_VICO(KEYTYPE_BREAKDOWN_VEC) DEF_VICO(KEYTYPE_EXTREME_VEC) DEF_VICO(KEYTYPE_JITTER_VEC) + +DEF_VICO(COLORSET_01_VEC) +DEF_VICO(COLORSET_02_VEC) +DEF_VICO(COLORSET_03_VEC) +DEF_VICO(COLORSET_04_VEC) +DEF_VICO(COLORSET_05_VEC) +DEF_VICO(COLORSET_06_VEC) +DEF_VICO(COLORSET_07_VEC) +DEF_VICO(COLORSET_08_VEC) +DEF_VICO(COLORSET_09_VEC) +DEF_VICO(COLORSET_10_VEC) +DEF_VICO(COLORSET_11_VEC) +DEF_VICO(COLORSET_12_VEC) +DEF_VICO(COLORSET_13_VEC) +DEF_VICO(COLORSET_14_VEC) +DEF_VICO(COLORSET_15_VEC) +DEF_VICO(COLORSET_16_VEC) +DEF_VICO(COLORSET_17_VEC) +DEF_VICO(COLORSET_18_VEC) +DEF_VICO(COLORSET_19_VEC) +DEF_VICO(COLORSET_20_VEC) + diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index 9093b965939..0da21fd442f 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -511,6 +511,63 @@ static void vicon_keytype_jitter_draw(int x, int y, int w, int h, float alpha) vicon_keytype_draw_wrapper(x, y, w, h, alpha, BEZT_KEYTYPE_JITTER); } +static void vicon_colorset_draw(int index, int x, int y, int w, int h, float UNUSED(alpha)) +{ + bTheme *btheme = UI_GetTheme(); + ThemeWireColor *cs = &btheme->tarm[index]; + + /* Draw three bands of color: One per color + * x-----a-----b-----c + * | N | S | A | + * x-----a-----b-----c + */ + const int a = x + w / 3; + const int b = x + w / 3 * 2; + const int c = x + w; + + /* XXX: Include alpha into this... */ + /* normal */ + glColor3ubv(cs->solid); + glRecti(x, y, a, y + h); + + /* selected */ + glColor3ubv(cs->select); + glRecti(a, y, b, y + h); + + /* active */ + glColor3ubv(cs->active); + glRecti(b, y, c, y + h); +} + +#define DEF_VICON_COLORSET_DRAW_NTH(prefix, index) \ + static void vicon_colorset_draw_##prefix(int x, int y, int w, int h, float alpha) \ + { \ + vicon_colorset_draw(index, x, y, w, h, alpha); \ + } + +DEF_VICON_COLORSET_DRAW_NTH(01, 0) +DEF_VICON_COLORSET_DRAW_NTH(02, 1) +DEF_VICON_COLORSET_DRAW_NTH(03, 2) +DEF_VICON_COLORSET_DRAW_NTH(04, 3) +DEF_VICON_COLORSET_DRAW_NTH(05, 4) +DEF_VICON_COLORSET_DRAW_NTH(06, 5) +DEF_VICON_COLORSET_DRAW_NTH(07, 6) +DEF_VICON_COLORSET_DRAW_NTH(08, 7) +DEF_VICON_COLORSET_DRAW_NTH(09, 8) +DEF_VICON_COLORSET_DRAW_NTH(10, 9) +DEF_VICON_COLORSET_DRAW_NTH(11, 10) +DEF_VICON_COLORSET_DRAW_NTH(12, 11) +DEF_VICON_COLORSET_DRAW_NTH(13, 12) +DEF_VICON_COLORSET_DRAW_NTH(14, 13) +DEF_VICON_COLORSET_DRAW_NTH(15, 14) +DEF_VICON_COLORSET_DRAW_NTH(16, 15) +DEF_VICON_COLORSET_DRAW_NTH(17, 16) +DEF_VICON_COLORSET_DRAW_NTH(18, 17) +DEF_VICON_COLORSET_DRAW_NTH(19, 18) +DEF_VICON_COLORSET_DRAW_NTH(20, 19) + +#undef DEF_VICON_COLORSET_DRAW_NTH + #ifndef WITH_HEADLESS static void init_brush_icons(void) @@ -741,6 +798,27 @@ static void init_internal_icons(void) def_internal_vicon(VICO_KEYTYPE_BREAKDOWN_VEC, vicon_keytype_breakdown_draw); def_internal_vicon(VICO_KEYTYPE_EXTREME_VEC, vicon_keytype_extreme_draw); def_internal_vicon(VICO_KEYTYPE_JITTER_VEC, vicon_keytype_jitter_draw); + + def_internal_vicon(VICO_COLORSET_01_VEC, vicon_colorset_draw_01); + def_internal_vicon(VICO_COLORSET_02_VEC, vicon_colorset_draw_02); + def_internal_vicon(VICO_COLORSET_03_VEC, vicon_colorset_draw_03); + def_internal_vicon(VICO_COLORSET_04_VEC, vicon_colorset_draw_04); + def_internal_vicon(VICO_COLORSET_05_VEC, vicon_colorset_draw_05); + def_internal_vicon(VICO_COLORSET_06_VEC, vicon_colorset_draw_06); + def_internal_vicon(VICO_COLORSET_07_VEC, vicon_colorset_draw_07); + def_internal_vicon(VICO_COLORSET_08_VEC, vicon_colorset_draw_08); + def_internal_vicon(VICO_COLORSET_09_VEC, vicon_colorset_draw_09); + def_internal_vicon(VICO_COLORSET_10_VEC, vicon_colorset_draw_10); + def_internal_vicon(VICO_COLORSET_11_VEC, vicon_colorset_draw_11); + def_internal_vicon(VICO_COLORSET_12_VEC, vicon_colorset_draw_12); + def_internal_vicon(VICO_COLORSET_13_VEC, vicon_colorset_draw_13); + def_internal_vicon(VICO_COLORSET_14_VEC, vicon_colorset_draw_14); + def_internal_vicon(VICO_COLORSET_15_VEC, vicon_colorset_draw_15); + def_internal_vicon(VICO_COLORSET_16_VEC, vicon_colorset_draw_16); + def_internal_vicon(VICO_COLORSET_17_VEC, vicon_colorset_draw_17); + def_internal_vicon(VICO_COLORSET_18_VEC, vicon_colorset_draw_18); + def_internal_vicon(VICO_COLORSET_19_VEC, vicon_colorset_draw_19); + def_internal_vicon(VICO_COLORSET_20_VEC, vicon_colorset_draw_20); IMB_freeImBuf(b16buf); IMB_freeImBuf(b32buf); |