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 base_theme; @@ -449,21 +451,21 @@ void ThemeEditor::_theme_menu_cbk(int p_option) { base_theme->get_icon_list(type, &icons); for (List::Element *E = icons.front(); E; E = E->next()) { - theme->set_icon(E->get(), type, Ref()); + theme->set_icon(E->get(), type, import ? base_theme->get_icon(E->get(), type) : Ref()); } List shaders; base_theme->get_shader_list(type, &shaders); for (List::Element *E = shaders.front(); E; E = E->next()) { - theme->set_shader(E->get(), type, Ref()); + theme->set_shader(E->get(), type, import ? base_theme->get_shader(E->get(), type) : Ref()); } List styleboxs; base_theme->get_stylebox_list(type, &styleboxs); for (List::Element *E = styleboxs.front(); E; E = E->next()) { - theme->set_stylebox(E->get(), type, Ref()); + theme->set_stylebox(E->get(), type, import ? base_theme->get_stylebox(E->get(), type) : Ref()); } List fonts; @@ -477,14 +479,14 @@ void ThemeEditor::_theme_menu_cbk(int p_option) { base_theme->get_color_list(type, &colors); for (List::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 constants; base_theme->get_constant_list(type, &constants); for (List::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;