mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +00:00
Revert "Fix inspector follow focus when child is focused"
This reverts commit286d3ae415
. (cherry picked from commita375e77b85
)
This commit is contained in:
parent
f00048fa79
commit
f0e7fa783e
3 changed files with 10 additions and 14 deletions
|
@ -4530,14 +4530,6 @@ void EditorInspector::_node_removed(Node *p_node) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorInspector::_gui_focus_changed(Control *p_control) {
|
|
||||||
if (!is_visible_in_tree() && !is_following_focus()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Don't follow focus when the inspector nor any of its children is focused. Prevents potential jumping when gaining focus.
|
|
||||||
set_follow_focus(has_focus() || child_has_focus());
|
|
||||||
}
|
|
||||||
|
|
||||||
void EditorInspector::_update_current_favorites() {
|
void EditorInspector::_update_current_favorites() {
|
||||||
current_favorites.clear();
|
current_favorites.clear();
|
||||||
if (!can_favorite) {
|
if (!can_favorite) {
|
||||||
|
@ -4735,10 +4727,6 @@ void EditorInspector::_notification(int p_what) {
|
||||||
if (!is_sub_inspector()) {
|
if (!is_sub_inspector()) {
|
||||||
get_tree()->connect("node_removed", callable_mp(this, &EditorInspector::_node_removed));
|
get_tree()->connect("node_removed", callable_mp(this, &EditorInspector::_node_removed));
|
||||||
}
|
}
|
||||||
|
|
||||||
Viewport *viewport = get_viewport();
|
|
||||||
ERR_FAIL_NULL(viewport);
|
|
||||||
viewport->connect("gui_focus_changed", callable_mp(this, &EditorInspector::_gui_focus_changed));
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_PREDELETE: {
|
case NOTIFICATION_PREDELETE: {
|
||||||
|
@ -4821,6 +4809,15 @@ void EditorInspector::_notification(int p_what) {
|
||||||
update_tree();
|
update_tree();
|
||||||
}
|
}
|
||||||
} break;
|
} 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -606,7 +606,6 @@ class EditorInspector : public ScrollContainer {
|
||||||
void _clear_current_favorites();
|
void _clear_current_favorites();
|
||||||
|
|
||||||
void _node_removed(Node *p_node);
|
void _node_removed(Node *p_node);
|
||||||
void _gui_focus_changed(Control *p_control);
|
|
||||||
|
|
||||||
HashMap<StringName, int> per_array_page;
|
HashMap<StringName, int> per_array_page;
|
||||||
void _page_change_request(int p_new_page, const StringName &p_array_prefix);
|
void _page_change_request(int p_new_page, const StringName &p_array_prefix);
|
||||||
|
|
|
@ -82,6 +82,7 @@ private:
|
||||||
|
|
||||||
bool draw_focus_border = false;
|
bool draw_focus_border = false;
|
||||||
bool focus_border_is_drawn = false;
|
bool focus_border_is_drawn = false;
|
||||||
|
bool child_has_focus();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Size2 get_minimum_size() const override;
|
Size2 get_minimum_size() const override;
|
||||||
|
@ -98,7 +99,6 @@ protected:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void gui_input(const Ref<InputEvent> &p_gui_input) override;
|
virtual void gui_input(const Ref<InputEvent> &p_gui_input) override;
|
||||||
bool child_has_focus();
|
|
||||||
|
|
||||||
void set_h_scroll(int p_pos);
|
void set_h_scroll(int p_pos);
|
||||||
int get_h_scroll() const;
|
int get_h_scroll() const;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue