1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-11 13:10:58 +00:00

Fix undoredo handling in some dialogs

This commit is contained in:
kobewi
2024-07-03 15:14:51 +02:00
parent 6a13fdcae3
commit 681769e2c9
7 changed files with 66 additions and 28 deletions

View File

@@ -235,28 +235,17 @@ void ProjectSettingsEditor::_select_type(Variant::Type p_type) {
}
void ProjectSettingsEditor::shortcut_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
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(vformat(TTR("Undo: %s"), action), EditorLog::MSG_TYPE_EDITOR);
}
undo_redo->undo();
EditorNode::get_singleton()->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(vformat(TTR("Redo: %s"), action), EditorLog::MSG_TYPE_EDITOR);
}
EditorNode::get_singleton()->redo();
handled = true;
}