1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-08 12:40:44 +00:00

-added missing .inc files

-Made it possible to change the editor theme
-Added two options to theme editor plugin to create empty template themes and editor themes
-Make sure that saved themes to .tres keep the null theme fields, to make it easier to keep those when saving/loading the theme
This commit is contained in:
Juan Linietsky
2016-06-17 01:13:23 -03:00
parent 816b3fa94d
commit f0d9245ecf
22 changed files with 38696 additions and 164963 deletions

View File

@@ -454,11 +454,73 @@ void ThemeEditor::_dialog_cbk() {
void ThemeEditor::_theme_menu_cbk(int p_option) {
if (p_option==POPUP_CREATE_TEMPLATE) {
if (p_option==POPUP_CREATE_EMPTY || p_option==POPUP_CREATE_EDITOR_EMPTY) {
file_dialog->set_mode(EditorFileDialog::MODE_SAVE_FILE);
file_dialog->set_current_path("custom.theme");
file_dialog->popup_centered_ratio();
Ref<Theme> base_theme;
if (p_option==POPUP_CREATE_EMPTY) {
base_theme = Theme::get_default();
} else {
base_theme = EditorNode::get_singleton()->get_theme_base()->get_theme();
}
{
List<StringName> types;
base_theme->get_type_list(&types);
for (List<StringName>::Element *T=types.front();T;T=T->next()) {
StringName type = T->get();
List<StringName> icons;
base_theme->get_icon_list(type,&icons);
for (List<StringName>::Element *E=icons.front();E;E=E->next()) {
theme->set_icon(E->get(),type,Ref<Texture>());
}
List<StringName> shaders;
base_theme->get_shader_list(type,&shaders);
for (List<StringName>::Element *E=shaders.front();E;E=E->next()) {
theme->set_shader(E->get(),type,Ref<Shader>());
}
List<StringName> styleboxs;
base_theme->get_stylebox_list(type,&styleboxs);
for (List<StringName>::Element *E=styleboxs.front();E;E=E->next()) {
theme->set_stylebox(E->get(),type,Ref<StyleBox>());
}
List<StringName> fonts;
base_theme->get_font_list(type,&fonts);
for (List<StringName>::Element *E=fonts.front();E;E=E->next()) {
theme->set_font(E->get(),type,Ref<Font>());
}
List<StringName> colors;
base_theme->get_color_list(type,&colors);
for (List<StringName>::Element *E=colors.front();E;E=E->next()) {
theme->set_color(E->get(),type,Color());
}
List<StringName> constants;
base_theme->get_constant_list(type,&constants);
for (List<StringName>::Element *E=constants.front();E;E=E->next()) {
theme->set_constant(E->get(),type,base_theme->get_constant(type,E->get()));
}
}
}
return;
}
@@ -602,7 +664,9 @@ ThemeEditor::ThemeEditor() {
theme_menu->get_popup()->add_item(TTR("Remove Item"),POPUP_REMOVE);
theme_menu->get_popup()->add_item(TTR("Remove Class Items"),POPUP_CLASS_REMOVE);
theme_menu->get_popup()->add_separator();
theme_menu->get_popup()->add_item(TTR("Create Template"),POPUP_CREATE_TEMPLATE);
theme_menu->get_popup()->add_item(TTR("Create Empty Template"),POPUP_CREATE_EMPTY);
theme_menu->get_popup()->add_item(TTR("Create Empty Editor Template"),POPUP_CREATE_EDITOR_EMPTY);
hb_menu->add_child(theme_menu);
theme_menu->get_popup()->connect("item_pressed", this,"_theme_menu_cbk");