Theme: set default theme 'Flatty Dark Blueberry'

The theme is now stored in generated C code,
which can be extracted from existing user preferences.

This theme can then be used for version patching themes
instead of duplicating values

Note that theme versioning has been removed,
since minor changes from now on won't apply well on top of 2.7x theme.

Theme colors from interface_widgets.c have been removed too.
This commit is contained in:
2018-06-27 12:28:26 +02:00
parent 66298a99e3
commit eda770f884
8 changed files with 2105 additions and 1833 deletions

View File

@@ -28,7 +28,7 @@
* and keep comment above the defines.
* Use STRINGIFY() rather than defining with quotes */
#define BLENDER_VERSION 280
#define BLENDER_SUBVERSION 19
#define BLENDER_SUBVERSION 20
/* Several breakages with 280, e.g. collections vs layers */
#define BLENDER_MINVERSION 280
#define BLENDER_MINSUBVERSION 0

View File

@@ -163,6 +163,9 @@ struct BlendThumbnail *BLO_thumbnail_from_file(const char *filepath);
struct Main *BLO_main_from_memfile(struct MemFile *memfile, struct Main *bmain, struct Scene **r_scene);
/* datafiles (generated theme) */
extern const struct bTheme U_theme_default;
#ifdef __cplusplus
}
#endif

View File

@@ -47,6 +47,7 @@ set(INC_SYS
)
set(SRC
${CMAKE_SOURCE_DIR}/release/datafiles/userdef/userdef_default_theme.c
intern/blend_validate.c
intern/readblenentry.c
intern/readfile.c

View File

@@ -94,6 +94,13 @@ void BLO_update_defaults_userpref_blend(void)
#else
U.flag &= ~USER_SCRIPT_AUTOEXEC_DISABLE;
#endif
/* Ignore the theme saved in the blend file,
* instead use the theme from 'userdef_default_theme.c' */
{
bTheme *theme = U.themes.first;
memcpy(theme, &U_theme_default, sizeof(bTheme));
}
}
/**

View File

@@ -765,9 +765,6 @@ void ui_draw_widget_back(
void ui_draw_tooltip_background(uiStyle *UNUSED(style), uiBlock *block, rcti *rect);
extern void ui_draw_but(const struct bContext *C, ARegion *ar, struct uiStyle *style, uiBut *but, rcti *rect);
/* theme color init */
struct ThemeUI;
void ui_widget_color_init(struct ThemeUI *tui);
void ui_draw_menu_item(struct uiFontStyle *fstyle, rcti *rect, const char *name, int iconid, int state, bool use_sep);
void ui_draw_preview_item(struct uiFontStyle *fstyle, rcti *rect, const char *name, int iconid, int state);

View File

@@ -2116,370 +2116,6 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB
/* *********************** widget types ************************************* */
static struct uiWidgetStateColors wcol_state_colors = {
{115, 190, 76, 255},
{90, 166, 51, 255},
{240, 235, 100, 255},
{215, 211, 75, 255},
{180, 0, 255, 255},
{153, 0, 230, 255},
{74, 137, 137, 255},
{49, 112, 112, 255},
0.5f, 0.0f
};
static struct uiWidgetColors wcol_num = {
{25, 25, 25, 255},
{180, 180, 180, 255},
{153, 153, 153, 255},
{90, 90, 90, 255},
{0, 0, 0, 255},
{255, 255, 255, 255},
1,
-20, 0,
0,
0.5f,
};
static struct uiWidgetColors wcol_numslider = {
{25, 25, 25, 255},
{180, 180, 180, 255},
{153, 153, 153, 255},
{128, 128, 128, 255},
{0, 0, 0, 255},
{255, 255, 255, 255},
1,
-20, 0,
0,
0.5f,
};
static struct uiWidgetColors wcol_text = {
{25, 25, 25, 255},
{153, 153, 153, 255},
{153, 153, 153, 255},
{90, 90, 90, 255},
{0, 0, 0, 255},
{255, 255, 255, 255},
1,
0, 25,
0,
0.2f,
};
static struct uiWidgetColors wcol_option = {
{0, 0, 0, 255},
{70, 70, 70, 255},
{70, 70, 70, 255},
{255, 255, 255, 255},
{0, 0, 0, 255},
{255, 255, 255, 255},
1,
15, -15,
0,
0.3333333f,
};
/* button that shows popup */
static struct uiWidgetColors wcol_menu = {
{0, 0, 0, 255},
{70, 70, 70, 255},
{70, 70, 70, 255},
{255, 255, 255, 255},
{255, 255, 255, 255},
{204, 204, 204, 255},
1,
15, -15,
0,
0.2f,
};
/* button that starts pulldown */
static struct uiWidgetColors wcol_pulldown = {
{0, 0, 0, 255},
{63, 63, 63, 255},
{86, 128, 194, 255},
{255, 255, 255, 255},
{0, 0, 0, 255},
{0, 0, 0, 255},
0,
25, -20,
0,
0.2f,
};
/* button inside menu */
static struct uiWidgetColors wcol_menu_item = {
{0, 0, 0, 255},
{0, 0, 0, 0},
{86, 128, 194, 255},
{172, 172, 172, 128},
{255, 255, 255, 255},
{0, 0, 0, 255},
1,
38, 0,
0,
0.2f,
};
/* backdrop menu + title text color */
static struct uiWidgetColors wcol_menu_back = {
{0, 0, 0, 255},
{25, 25, 25, 230},
{45, 45, 45, 230},
{100, 100, 100, 255},
{160, 160, 160, 255},
{255, 255, 255, 255},
0,
25, -20,
0,
0.25f,
};
/* pie menus */
static struct uiWidgetColors wcol_pie_menu = {
{10, 10, 10, 200},
{25, 25, 25, 230},
{140, 140, 140, 255},
{45, 45, 45, 230},
{160, 160, 160, 255},
{255, 255, 255, 255},
1,
10, -10,
0,
0.5f,
};
/* tooltip color */
static struct uiWidgetColors wcol_tooltip = {
{0, 0, 0, 255},
{25, 25, 25, 230},
{45, 45, 45, 230},
{100, 100, 100, 255},
{255, 255, 255, 255},
{255, 255, 255, 255},
0,
25, -20,
0,
0.25f,
};
static struct uiWidgetColors wcol_radio = {
{0, 0, 0, 255},
{70, 70, 70, 255},
{86, 128, 194, 255},
{255, 255, 255, 255},
{255, 255, 255, 255},
{0, 0, 0, 255},
1,
15, -15,
0,
0.2f,
};
static struct uiWidgetColors wcol_regular = {
{25, 25, 25, 255},
{153, 153, 153, 255},
{100, 100, 100, 255},
{25, 25, 25, 255},
{0, 0, 0, 255},
{255, 255, 255, 255},
0,
0, 0,
0,
0.25f,
};
static struct uiWidgetColors wcol_tool = {
{25, 25, 25, 255},
{153, 153, 153, 255},
{100, 100, 100, 255},
{25, 25, 25, 255},
{0, 0, 0, 255},
{255, 255, 255, 255},
1,
15, -15,
0,
0.2f,
};
static struct uiWidgetColors wcol_toolbar_item = {
.outline = {0x19, 0x19, 0x19, 0xff},
.inner = {0x46, 0x46, 0x46, 0xff},
.inner_sel = {0xcc, 0xcc, 0xcc, 0xff},
.item = {0x0, 0x0, 0x0, 0xff},
.text = {0xff, 0xff, 0xff, 0xff},
.text_sel = {0x33, 0x33, 0x33, 0xff},
.shaded = 0,
.shadetop = 0,
.shadedown = 0,
.alpha_check = 0,
.roundness = 0.3f,
};
static struct uiWidgetColors wcol_box = {
{25, 25, 25, 255},
{128, 128, 128, 255},
{100, 100, 100, 255},
{25, 25, 25, 255},
{0, 0, 0, 255},
{255, 255, 255, 255},
0,
0, 0,
0,
0.2f,
};
static struct uiWidgetColors wcol_toggle = {
{25, 25, 25, 255},
{153, 153, 153, 255},
{100, 100, 100, 255},
{25, 25, 25, 255},
{0, 0, 0, 255},
{255, 255, 255, 255},
0,
0, 0,
0,
0.25f,
};
static struct uiWidgetColors wcol_scroll = {
{50, 50, 50, 180},
{80, 80, 80, 180},
{100, 100, 100, 180},
{128, 128, 128, 255},
{0, 0, 0, 255},
{255, 255, 255, 255},
1,
5, -5,
0,
0.5f,
};
static struct uiWidgetColors wcol_progress = {
{0, 0, 0, 255},
{190, 190, 190, 255},
{100, 100, 100, 180},
{128, 128, 128, 255},
{0, 0, 0, 255},
{255, 255, 255, 255},
0,
0, 0,
0,
0.25f,
};
static struct uiWidgetColors wcol_list_item = {
{0, 0, 0, 255},
{0, 0, 0, 0},
{86, 128, 194, 255},
{90, 90, 90, 255},
{0, 0, 0, 255},
{255, 255, 255, 255},
0,
0, 0,
0,
0.2f,
};
struct uiWidgetColors wcol_tab = {
{60, 60, 60, 255},
{83, 83, 83, 255},
{114, 114, 114, 255},
{90, 90, 90, 255},
{0, 0, 0, 255},
{0, 0, 0, 255},
0,
0, 0,
0,
0.25f,
};
/* free wcol struct to play with */
static struct uiWidgetColors wcol_tmp = {
{0, 0, 0, 255},
{128, 128, 128, 255},
{100, 100, 100, 255},
{25, 25, 25, 255},
{0, 0, 0, 255},
{255, 255, 255, 255},
0,
0, 0,
0,
0.25f,
};
/* called for theme init (new theme) and versions */
void ui_widget_color_init(ThemeUI *tui)
{
tui->wcol_regular = wcol_regular;
tui->wcol_tool = wcol_tool;
tui->wcol_toolbar_item = wcol_toolbar_item;
tui->wcol_text = wcol_text;
tui->wcol_radio = wcol_radio;
tui->wcol_tab = wcol_tab;
tui->wcol_option = wcol_option;
tui->wcol_toggle = wcol_toggle;
tui->wcol_num = wcol_num;
tui->wcol_numslider = wcol_numslider;
tui->wcol_menu = wcol_menu;
tui->wcol_pulldown = wcol_pulldown;
tui->wcol_menu_back = wcol_menu_back;
tui->wcol_pie_menu = wcol_pie_menu;
tui->wcol_tooltip = wcol_tooltip;
tui->wcol_menu_item = wcol_menu_item;
tui->wcol_box = wcol_box;
tui->wcol_scroll = wcol_scroll;
tui->wcol_list_item = wcol_list_item;
tui->wcol_progress = wcol_progress;
tui->wcol_state = wcol_state_colors;
}
/* ************ button callbacks, state ***************** */
static void widget_state_blend(char cp[3], const char cpstate[3], const float fac)
@@ -3203,13 +2839,16 @@ static void ui_draw_but_HSV_v(uiBut *but, const rcti *rect)
round_box_edges(&wtb, UI_CNR_ALL, rect, rad);
/* setup temp colors */
wcol_tmp.outline[0] = wcol_tmp.outline[1] = wcol_tmp.outline[2] = 0;
wcol_tmp.inner[0] = wcol_tmp.inner[1] = wcol_tmp.inner[2] = 128;
wcol_tmp.shadetop = 127;
wcol_tmp.shadedown = -128;
wcol_tmp.shaded = 1;
widgetbase_draw(&wtb, &wcol_tmp);
widgetbase_draw(
&wtb,
&((uiWidgetColors){
.outline = {0, 0, 0, 255},
.inner = {128, 128, 128, 255},
.shadetop = 127,
.shadedown = -128,
.shaded = 1,
})
);
/* We are drawing on top of widget bases. Flush cache. */
glEnable(GL_BLEND);

File diff suppressed because it is too large Load Diff