summaryrefslogtreecommitdiff
path: root/editor/project_settings_editor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/project_settings_editor.cpp')
-rw-r--r--editor/project_settings_editor.cpp94
1 files changed, 67 insertions, 27 deletions
diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp
index bcc597d595..bedae4f8a9 100644
--- a/editor/project_settings_editor.cpp
+++ b/editor/project_settings_editor.cpp
@@ -32,6 +32,7 @@
#include "core/config/project_settings.h"
#include "editor/editor_export.h"
+#include "editor/editor_log.h"
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
@@ -47,7 +48,8 @@ void ProjectSettingsEditor::popup_project_settings() {
}
_add_feature_overrides();
- inspector->update_category_list();
+ general_settings_inspector->update_category_list();
+ set_process_unhandled_input(true);
localization_editor->update_translations();
autoload_settings->update_autoload();
@@ -74,7 +76,7 @@ void ProjectSettingsEditor::_setting_edited(const String &p_name) {
void ProjectSettingsEditor::_advanced_toggled(bool p_button_pressed) {
EditorSettings::get_singleton()->set_project_metadata("project_settings", "advanced_mode", p_button_pressed);
- inspector->set_restrict_to_basic_settings(!p_button_pressed);
+ general_settings_inspector->set_restrict_to_basic_settings(!p_button_pressed);
}
void ProjectSettingsEditor::_setting_selected(const String &p_path) {
@@ -82,7 +84,7 @@ void ProjectSettingsEditor::_setting_selected(const String &p_path) {
return;
}
- property_box->set_text(inspector->get_current_section() + "/" + p_path);
+ property_box->set_text(general_settings_inspector->get_current_section() + "/" + p_path);
_update_property_box(); // set_text doesn't trigger text_changed
}
@@ -99,13 +101,13 @@ void ProjectSettingsEditor::_add_setting() {
undo_redo->add_do_property(ps, setting, value);
undo_redo->add_undo_property(ps, setting, ps->has_setting(setting) ? ps->get(setting) : Variant());
- undo_redo->add_do_method(inspector, "update_category_list");
- undo_redo->add_undo_method(inspector, "update_category_list");
+ undo_redo->add_do_method(general_settings_inspector, "update_category_list");
+ undo_redo->add_undo_method(general_settings_inspector, "update_category_list");
undo_redo->add_do_method(this, "queue_save");
undo_redo->add_undo_method(this, "queue_save");
undo_redo->commit_action();
- inspector->set_current_section(setting.get_slice("/", 1));
+ general_settings_inspector->set_current_section(setting.get_slice("/", 1));
add_button->release_focus();
}
@@ -120,8 +122,8 @@ void ProjectSettingsEditor::_delete_setting() {
undo_redo->add_undo_method(ps, "set", setting, value);
undo_redo->add_undo_method(ps, "set_order", setting, order);
- undo_redo->add_do_method(inspector, "update_category_list");
- undo_redo->add_undo_method(inspector, "update_category_list");
+ undo_redo->add_do_method(general_settings_inspector, "update_category_list");
+ undo_redo->add_undo_method(general_settings_inspector, "update_category_list");
undo_redo->add_do_method(this, "queue_save");
undo_redo->add_undo_method(this, "queue_save");
@@ -200,6 +202,44 @@ void ProjectSettingsEditor::_select_type(Variant::Type p_type) {
type_box->select(type_box->get_item_index(p_type));
}
+void ProjectSettingsEditor::unhandled_input(const Ref<InputEvent> &p_event) {
+ ERR_FAIL_COND(p_event.is_null());
+
+ const Ref<InputEventKey> k = p_event;
+
+ if (k.is_valid() && k->is_pressed()) {
+ bool handled = false;
+
+ if (ED_IS_SHORTCUT("ui_undo", p_event)) {
+ String action = undo_redo->get_current_action_name();
+ if (!action.is_empty()) {
+ EditorNode::get_log()->add_message("Undo: " + action, EditorLog::MSG_TYPE_EDITOR);
+ }
+ undo_redo->undo();
+ handled = true;
+ }
+
+ if (ED_IS_SHORTCUT("ui_redo", p_event)) {
+ undo_redo->redo();
+ String action = undo_redo->get_current_action_name();
+ if (!action.is_empty()) {
+ EditorNode::get_log()->add_message("Redo: " + action, EditorLog::MSG_TYPE_EDITOR);
+ }
+ handled = true;
+ }
+
+ if (k->get_keycode_with_modifiers() == (KeyModifierMask::CMD | Key::F)) {
+ search_box->grab_focus();
+ search_box->select_all();
+ handled = true;
+ }
+
+ if (handled) {
+ set_input_as_handled();
+ }
+ }
+}
+
String ProjectSettingsEditor::_get_setting_name() const {
String name = property_box->get_text().strip_edges();
if (name.find("/") == -1) {
@@ -463,7 +503,7 @@ void ProjectSettingsEditor::_update_action_map_editor() {
actions.push_back(action_info);
}
- action_map->update_action_list(actions);
+ action_map_editor->update_action_list(actions);
}
void ProjectSettingsEditor::_update_theme() {
@@ -482,7 +522,7 @@ void ProjectSettingsEditor::_notification(int p_what) {
}
} break;
case NOTIFICATION_ENTER_TREE: {
- inspector->edit(ps);
+ general_settings_inspector->edit(ps);
_update_action_map_editor();
_update_theme();
} break;
@@ -569,14 +609,14 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
del_button->connect("pressed", callable_mp(this, &ProjectSettingsEditor::_delete_setting));
header->add_child(del_button);
- inspector = memnew(SectionedInspector);
- inspector->get_inspector()->set_undo_redo(EditorNode::get_singleton()->get_undo_redo());
- inspector->set_v_size_flags(Control::SIZE_EXPAND_FILL);
- inspector->register_search_box(search_box);
- inspector->get_inspector()->connect("property_selected", callable_mp(this, &ProjectSettingsEditor::_setting_selected));
- inspector->get_inspector()->connect("property_edited", callable_mp(this, &ProjectSettingsEditor::_setting_edited));
- inspector->get_inspector()->connect("restart_requested", callable_mp(this, &ProjectSettingsEditor::_editor_restart_request));
- general_editor->add_child(inspector);
+ general_settings_inspector = memnew(SectionedInspector);
+ general_settings_inspector->get_inspector()->set_undo_redo(EditorNode::get_singleton()->get_undo_redo());
+ general_settings_inspector->set_v_size_flags(Control::SIZE_EXPAND_FILL);
+ general_settings_inspector->register_search_box(search_box);
+ general_settings_inspector->get_inspector()->connect("property_selected", callable_mp(this, &ProjectSettingsEditor::_setting_selected));
+ general_settings_inspector->get_inspector()->connect("property_edited", callable_mp(this, &ProjectSettingsEditor::_setting_edited));
+ general_settings_inspector->get_inspector()->connect("restart_requested", callable_mp(this, &ProjectSettingsEditor::_editor_restart_request));
+ general_editor->add_child(general_settings_inspector);
restart_container = memnew(PanelContainer);
general_editor->add_child(restart_container);
@@ -604,14 +644,14 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
restart_close_button->connect("pressed", callable_mp(this, &ProjectSettingsEditor::_editor_restart_close));
restart_hb->add_child(restart_close_button);
- action_map = memnew(ActionMapEditor);
- action_map->set_name(TTR("Input Map"));
- action_map->connect("action_added", callable_mp(this, &ProjectSettingsEditor::_action_added));
- action_map->connect("action_edited", callable_mp(this, &ProjectSettingsEditor::_action_edited));
- action_map->connect("action_removed", callable_mp(this, &ProjectSettingsEditor::_action_removed));
- action_map->connect("action_renamed", callable_mp(this, &ProjectSettingsEditor::_action_renamed));
- action_map->connect("action_reordered", callable_mp(this, &ProjectSettingsEditor::_action_reordered));
- tab_container->add_child(action_map);
+ action_map_editor = memnew(ActionMapEditor);
+ action_map_editor->set_name(TTR("Input Map"));
+ action_map_editor->connect("action_added", callable_mp(this, &ProjectSettingsEditor::_action_added));
+ action_map_editor->connect("action_edited", callable_mp(this, &ProjectSettingsEditor::_action_edited));
+ action_map_editor->connect("action_removed", callable_mp(this, &ProjectSettingsEditor::_action_removed));
+ action_map_editor->connect("action_renamed", callable_mp(this, &ProjectSettingsEditor::_action_renamed));
+ action_map_editor->connect("action_reordered", callable_mp(this, &ProjectSettingsEditor::_action_reordered));
+ tab_container->add_child(action_map_editor);
localization_editor = memnew(LocalizationEditor);
localization_editor->set_name(TTR("Localization"));
@@ -647,7 +687,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
advanced->set_pressed(true);
}
- inspector->set_restrict_to_basic_settings(!use_advanced);
+ general_settings_inspector->set_restrict_to_basic_settings(!use_advanced);
import_defaults_editor = memnew(ImportDefaultsEditor);
import_defaults_editor->set_name(TTR("Import Defaults"));