From bba8f85945db3b38af0cb18c7609e1d7431ca87b Mon Sep 17 00:00:00 2001 From: jsjtxietian Date: Mon, 5 Aug 2024 14:13:48 +0800 Subject: [PATCH] Fix Pressing Escape doesn't exit freelook in the 3D editor (cherry picked from commit 78dc310103d2f241fd38fed7895c0a2f0cc7508a) --- editor/plugins/node_3d_editor_plugin.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index 97d6010b541..11ee5a2455e 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -2252,6 +2252,11 @@ void Node3DEditorViewport::_sinput(const Ref &p_event) { } if (_edit.mode == TRANSFORM_NONE) { + if (_edit.gizmo.is_null() && is_freelook_active() && k->get_keycode() == Key::ESCAPE) { + set_freelook_active(false); + return; + } + if (_edit.gizmo.is_valid() && (k->get_keycode() == Key::ESCAPE || k->get_keycode() == Key::BACKSPACE)) { // Restore. _edit.gizmo->commit_handle(_edit.gizmo_handle, _edit.gizmo_handle_secondary, _edit.gizmo_initial_value, true);