diff --git a/editor/gui/editor_bottom_panel.cpp b/editor/gui/editor_bottom_panel.cpp index f27d5c29919..1a51ea2285f 100644 --- a/editor/gui/editor_bottom_panel.cpp +++ b/editor/gui/editor_bottom_panel.cpp @@ -100,6 +100,15 @@ void EditorBottomPanel::_update_disabled_buttons() { right_button->set_disabled(h_scroll->get_value() + h_scroll->get_page() == h_scroll->get_max()); } +void EditorBottomPanel::_ensure_control_visible(ObjectID p_id) { + Control *c = ObjectDB::get_instance(p_id); + if (!c) { + return; + } + + button_scroll->ensure_control_visible(c); +} + void EditorBottomPanel::_switch_to_item(bool p_visible, int p_idx, bool p_ignore_lock) { ERR_FAIL_INDEX(p_idx, items.size()); @@ -134,7 +143,7 @@ void EditorBottomPanel::_switch_to_item(bool p_visible, int p_idx, bool p_ignore if (expand_button->is_pressed()) { EditorNode::get_top_split()->hide(); } - callable_mp(button_scroll, &ScrollContainer::ensure_control_visible).call_deferred(items[p_idx].button); + callable_mp(this, &EditorBottomPanel::_ensure_control_visible).call_deferred(items[p_idx].button->get_instance_id()); } else { add_theme_style_override(SceneStringName(panel), get_theme_stylebox(SNAME("BottomPanel"), EditorStringName(EditorStyles))); items[p_idx].button->set_pressed_no_signal(false); diff --git a/editor/gui/editor_bottom_panel.h b/editor/gui/editor_bottom_panel.h index 45152b9771b..72e540341e4 100644 --- a/editor/gui/editor_bottom_panel.h +++ b/editor/gui/editor_bottom_panel.h @@ -69,6 +69,7 @@ class EditorBottomPanel : public PanelContainer { void _scroll(bool p_right); void _update_scroll_buttons(); void _update_disabled_buttons(); + void _ensure_control_visible(ObjectID p_id); bool _button_drag_hover(const Vector2 &, const Variant &, Button *p_button, Control *p_control);