diff options
-rw-r--r-- | editor/plugins/theme_editor_plugin.cpp | 16 | ||||
-rw-r--r-- | editor/plugins/theme_editor_plugin.h | 3 |
2 files changed, 11 insertions, 8 deletions
diff --git a/editor/plugins/theme_editor_plugin.cpp b/editor/plugins/theme_editor_plugin.cpp index 02ead3aee8..7f956b01ff 100644 --- a/editor/plugins/theme_editor_plugin.cpp +++ b/editor/plugins/theme_editor_plugin.cpp @@ -427,7 +427,9 @@ void ThemeEditor::_dialog_cbk() { void ThemeEditor::_theme_menu_cbk(int p_option) { - if (p_option == POPUP_CREATE_EMPTY || p_option == POPUP_CREATE_EDITOR_EMPTY) { + if (p_option == POPUP_CREATE_EMPTY || p_option == POPUP_CREATE_EDITOR_EMPTY || p_option == POPUP_IMPORT_EDITOR_THEME) { + + bool import = (p_option == POPUP_IMPORT_EDITOR_THEME); Ref<Theme> base_theme; @@ -449,21 +451,21 @@ void ThemeEditor::_theme_menu_cbk(int p_option) { 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>()); + theme->set_icon(E->get(), type, import ? base_theme->get_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>()); + theme->set_shader(E->get(), type, import ? base_theme->get_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>()); + theme->set_stylebox(E->get(), type, import ? base_theme->get_stylebox(E->get(), type) : Ref<StyleBox>()); } List<StringName> fonts; @@ -477,14 +479,14 @@ void ThemeEditor::_theme_menu_cbk(int p_option) { 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()); + theme->set_color(E->get(), type, import ? base_theme->get_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())); + theme->set_constant(E->get(), type, base_theme->get_constant(E->get(), type)); } } } @@ -639,7 +641,7 @@ ThemeEditor::ThemeEditor() { theme_menu->get_popup()->add_separator(); 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); - + theme_menu->get_popup()->add_item(TTR("Create From Current Editor Theme"), POPUP_IMPORT_EDITOR_THEME); add_child(theme_menu); theme_menu->set_position(Vector2(3, 3) * EDSCALE); theme_menu->get_popup()->connect("id_pressed", this, "_theme_menu_cbk"); diff --git a/editor/plugins/theme_editor_plugin.h b/editor/plugins/theme_editor_plugin.h index 16b2da94d1..4d46282ba1 100644 --- a/editor/plugins/theme_editor_plugin.h +++ b/editor/plugins/theme_editor_plugin.h @@ -69,7 +69,8 @@ class ThemeEditor : public Control { POPUP_REMOVE, POPUP_CLASS_REMOVE, POPUP_CREATE_EMPTY, - POPUP_CREATE_EDITOR_EMPTY + POPUP_CREATE_EDITOR_EMPTY, + POPUP_IMPORT_EDITOR_THEME }; int popup_mode; |