From d0437d5052092aca46e511e6a26042634326b113 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A3=8E=E9=9D=92=E5=B1=B1?= Date: Wed, 26 Feb 2025 16:26:03 +0800 Subject: [PATCH] Revert "Fix inspector jumping when gaining focus" This reverts commit 922642440132bf7b070a16240c3a21d119584403. --- doc/classes/EditorInspector.xml | 1 + editor/editor_inspector.cpp | 15 +++------------ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/doc/classes/EditorInspector.xml b/doc/classes/EditorInspector.xml index 644cbe5b581..0bbd55f0075 100644 --- a/doc/classes/EditorInspector.xml +++ b/doc/classes/EditorInspector.xml @@ -51,6 +51,7 @@ + diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index 2a4ca11e650..824e288a43e 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -3046,7 +3046,6 @@ void EditorInspector::update_tree() { int current_focusable = -1; // Temporarily disable focus following on the root inspector to avoid jumping while the inspector is updating. - bool was_following = get_root_inspector()->is_following_focus(); get_root_inspector()->set_follow_focus(false); if (property_focusable != -1) { @@ -3075,7 +3074,7 @@ void EditorInspector::update_tree() { _clear(!object); if (!object) { - get_root_inspector()->set_follow_focus(was_following); + get_root_inspector()->set_follow_focus(true); return; } @@ -3954,7 +3953,7 @@ void EditorInspector::update_tree() { EditorNode::get_singleton()->hide_unused_editors(); } - get_root_inspector()->set_follow_focus(was_following); + get_root_inspector()->set_follow_focus(true); } void EditorInspector::update_property(const String &p_prop) { @@ -4807,15 +4806,6 @@ void EditorInspector::_notification(int p_what) { update_tree(); } } break; - - case NOTIFICATION_FOCUS_ENTER: { - set_follow_focus(true); - } break; - - case NOTIFICATION_FOCUS_EXIT: { - // Don't follow focus when the inspector is not focused. Prevents potential jumping when gaining focus. - set_follow_focus(false); - } break; } } @@ -4972,6 +4962,7 @@ EditorInspector::EditorInspector() { base_vbox->add_child(main_vbox); set_horizontal_scroll_mode(SCROLL_MODE_DISABLED); + set_follow_focus(true); changing = 0; search_box = nullptr;