summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/editor_node.cpp35
-rw-r--r--editor/editor_settings.cpp29
-rw-r--r--editor/editor_settings.h5
-rw-r--r--editor/editor_settings_dialog.cpp12
4 files changed, 66 insertions, 15 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index ddb9c93f04..ef744d8ece 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -701,22 +701,29 @@ void EditorNode::_notification(int p_what) {
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
scene_tabs->set_tab_close_display_policy((bool(EDITOR_GET("interface/scene_tabs/always_show_close_button")) ? TabBar::CLOSE_BUTTON_SHOW_ALWAYS : TabBar::CLOSE_BUTTON_SHOW_ACTIVE_ONLY));
- theme = create_custom_theme(theme_base->get_theme());
- theme_base->set_theme(theme);
- gui_base->set_theme(theme);
+ bool theme_changed =
+ EditorSettings::get_singleton()->check_changed_settings_in_group("interface/theme") ||
+ EditorSettings::get_singleton()->check_changed_settings_in_group("text_editor/theme");
- gui_base->add_theme_style_override("panel", gui_base->get_theme_stylebox(SNAME("Background"), SNAME("EditorStyles")));
- scene_root_parent->add_theme_style_override("panel", gui_base->get_theme_stylebox(SNAME("Content"), SNAME("EditorStyles")));
- bottom_panel->add_theme_style_override("panel", gui_base->get_theme_stylebox(SNAME("panel"), SNAME("TabContainer")));
- scene_tabs->add_theme_style_override("tab_selected", gui_base->get_theme_stylebox(SNAME("SceneTabFG"), SNAME("EditorStyles")));
- scene_tabs->add_theme_style_override("tab_unselected", gui_base->get_theme_stylebox(SNAME("SceneTabBG"), SNAME("EditorStyles")));
-
- file_menu->add_theme_style_override("hover", gui_base->get_theme_stylebox(SNAME("MenuHover"), SNAME("EditorStyles")));
- project_menu->add_theme_style_override("hover", gui_base->get_theme_stylebox(SNAME("MenuHover"), SNAME("EditorStyles")));
- debug_menu->add_theme_style_override("hover", gui_base->get_theme_stylebox(SNAME("MenuHover"), SNAME("EditorStyles")));
- settings_menu->add_theme_style_override("hover", gui_base->get_theme_stylebox(SNAME("MenuHover"), SNAME("EditorStyles")));
- help_menu->add_theme_style_override("hover", gui_base->get_theme_stylebox(SNAME("MenuHover"), SNAME("EditorStyles")));
+ if (theme_changed) {
+ theme = create_custom_theme(theme_base->get_theme());
+
+ theme_base->set_theme(theme);
+ gui_base->set_theme(theme);
+
+ gui_base->add_theme_style_override("panel", gui_base->get_theme_stylebox(SNAME("Background"), SNAME("EditorStyles")));
+ scene_root_parent->add_theme_style_override("panel", gui_base->get_theme_stylebox(SNAME("Content"), SNAME("EditorStyles")));
+ bottom_panel->add_theme_style_override("panel", gui_base->get_theme_stylebox(SNAME("panel"), SNAME("TabContainer")));
+ scene_tabs->add_theme_style_override("tab_selected", gui_base->get_theme_stylebox(SNAME("SceneTabFG"), SNAME("EditorStyles")));
+ scene_tabs->add_theme_style_override("tab_unselected", gui_base->get_theme_stylebox(SNAME("SceneTabBG"), SNAME("EditorStyles")));
+
+ file_menu->add_theme_style_override("hover", gui_base->get_theme_stylebox(SNAME("MenuHover"), SNAME("EditorStyles")));
+ project_menu->add_theme_style_override("hover", gui_base->get_theme_stylebox(SNAME("MenuHover"), SNAME("EditorStyles")));
+ debug_menu->add_theme_style_override("hover", gui_base->get_theme_stylebox(SNAME("MenuHover"), SNAME("EditorStyles")));
+ settings_menu->add_theme_style_override("hover", gui_base->get_theme_stylebox(SNAME("MenuHover"), SNAME("EditorStyles")));
+ help_menu->add_theme_style_override("hover", gui_base->get_theme_stylebox(SNAME("MenuHover"), SNAME("EditorStyles")));
+ }
if (EDITOR_GET("interface/scene_tabs/resize_if_many_tabs")) {
scene_tabs->set_min_width(int(EDITOR_GET("interface/scene_tabs/minimum_width")) * EDSCALE);
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index 6bd11fcdd6..0135b33bca 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -63,6 +63,7 @@ bool EditorSettings::_set(const StringName &p_name, const Variant &p_value) {
bool changed = _set_only(p_name, p_value);
if (changed) {
+ changed_settings.insert(p_name);
emit_signal(SNAME("settings_changed"));
}
return true;
@@ -941,10 +942,34 @@ void EditorSettings::save() {
if (err != OK) {
ERR_PRINT("Error saving editor settings to " + singleton->config_file_path);
} else {
+ singleton->changed_settings.clear();
print_verbose("EditorSettings: Save OK!");
}
}
+Array EditorSettings::get_changed_settings() const {
+ Array arr;
+ for (const String &setting : changed_settings) {
+ arr.push_back(setting);
+ }
+
+ return arr;
+}
+
+bool EditorSettings::check_changed_settings_in_group(const String &p_setting_prefix) const {
+ for (const String &setting : changed_settings) {
+ if (setting.begins_with(p_setting_prefix)) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+void EditorSettings::mark_setting_changed(const String &p_setting) {
+ changed_settings.insert(p_setting);
+}
+
void EditorSettings::destroy() {
if (!singleton.ptr()) {
return;
@@ -1621,6 +1646,10 @@ void EditorSettings::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_builtin_action_override", "name", "actions_list"), &EditorSettings::set_builtin_action_override);
+ ClassDB::bind_method(D_METHOD("check_changed_settings_in_group", "setting_prefix"), &EditorSettings::check_changed_settings_in_group);
+ ClassDB::bind_method(D_METHOD("get_changed_settings"), &EditorSettings::get_changed_settings);
+ ClassDB::bind_method(D_METHOD("mark_setting_changed", "setting"), &EditorSettings::mark_setting_changed);
+
ADD_SIGNAL(MethodInfo("settings_changed"));
BIND_CONSTANT(NOTIFICATION_EDITOR_SETTINGS_CHANGED);
diff --git a/editor/editor_settings.h b/editor/editor_settings.h
index f0fec3acc7..65723a24f8 100644
--- a/editor/editor_settings.h
+++ b/editor/editor_settings.h
@@ -77,6 +77,8 @@ private:
static Ref<EditorSettings> singleton;
+ Set<String> changed_settings;
+
HashMap<String, PropertyInfo> hints;
HashMap<String, VariantContainer> props;
int last_order;
@@ -140,6 +142,9 @@ public:
bool property_can_revert(const String &p_setting);
Variant property_get_revert(const String &p_setting);
void add_property_hint(const PropertyInfo &p_hint);
+ Array get_changed_settings() const;
+ bool check_changed_settings_in_group(const String &p_setting_prefix) const;
+ void mark_setting_changed(const String &p_setting);
void set_resource_clipboard(const Ref<Resource> &p_resource) { clipboard = p_resource; }
Ref<Resource> get_resource_clipboard() const { return clipboard; }
diff --git a/editor/editor_settings_dialog.cpp b/editor/editor_settings_dialog.cpp
index 75bba64e2e..ed2134a056 100644
--- a/editor/editor_settings_dialog.cpp
+++ b/editor/editor_settings_dialog.cpp
@@ -136,7 +136,13 @@ void EditorSettingsDialog::_notification(int p_what) {
_update_icons();
// Update theme colors.
inspector->update_category_list();
- _update_shortcuts();
+
+ bool update_shortcuts_tab =
+ EditorSettings::get_singleton()->check_changed_settings_in_group("shortcuts") ||
+ EditorSettings::get_singleton()->check_changed_settings_in_group("builtin_action_overrides");
+ if (update_shortcuts_tab) {
+ _update_shortcuts();
+ }
} break;
}
}
@@ -215,6 +221,8 @@ void EditorSettingsDialog::_update_builtin_action(const String &p_name, const Ar
Array old_input_array = EditorSettings::get_singleton()->get_builtin_action_overrides(p_name);
undo_redo->create_action(TTR("Edit Built-in Action") + " '" + p_name + "'");
+ undo_redo->add_do_method(EditorSettings::get_singleton(), "mark_setting_changed", "builtin_action_overrides");
+ undo_redo->add_undo_method(EditorSettings::get_singleton(), "mark_setting_changed", "builtin_action_overrides");
undo_redo->add_do_method(EditorSettings::get_singleton(), "set_builtin_action_override", p_name, p_events);
undo_redo->add_undo_method(EditorSettings::get_singleton(), "set_builtin_action_override", p_name, old_input_array);
undo_redo->add_do_method(this, "_settings_changed");
@@ -230,6 +238,8 @@ void EditorSettingsDialog::_update_shortcut_events(const String &p_path, const A
undo_redo->create_action(TTR("Edit Shortcut") + " '" + p_path + "'");
undo_redo->add_do_method(current_sc.ptr(), "set_events", p_events);
undo_redo->add_undo_method(current_sc.ptr(), "set_events", current_sc->get_events());
+ undo_redo->add_do_method(EditorSettings::get_singleton(), "mark_setting_changed", "shortcuts");
+ undo_redo->add_undo_method(EditorSettings::get_singleton(), "mark_setting_changed", "shortcuts");
undo_redo->add_do_method(this, "_update_shortcuts");
undo_redo->add_undo_method(this, "_update_shortcuts");
undo_redo->add_do_method(this, "_settings_changed");