Fix Pressing Escape doesn't exit freelook in the 3D editor

(cherry picked from commit 78dc310103)
This commit is contained in:
jsjtxietian 2024-08-05 14:13:48 +08:00 committed by Rémi Verschelde
parent 63ff665fd0
commit bba8f85945
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 5 additions and 0 deletions

View File

@ -2252,6 +2252,11 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &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);