summaryrefslogtreecommitdiffstats
path: root/editor/editor_dock_manager.cpp
diff options
context:
space:
mode:
authorkit <kitbdev@gmail.com>2024-05-02 17:24:59 -0400
committerkit <kitbdev@gmail.com>2024-05-10 14:55:42 -0400
commitfa0ee87bbf028fd10ee52505eeec63aea87c80e6 (patch)
tree692381e1245dd48723463654383ff0b1c0336383 /editor/editor_dock_manager.cpp
parent2ba22d1554ded08094e3869a83bd87487266ad38 (diff)
downloadredot-engine-fa0ee87bbf028fd10ee52505eeec63aea87c80e6.tar.gz
Keep docks menu open when opening dock
Diffstat (limited to 'editor/editor_dock_manager.cpp')
-rw-r--r--editor/editor_dock_manager.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/editor/editor_dock_manager.cpp b/editor/editor_dock_manager.cpp
index 4956fa867a..5106fae9c7 100644
--- a/editor/editor_dock_manager.cpp
+++ b/editor/editor_dock_manager.cpp
@@ -185,7 +185,15 @@ void EditorDockManager::_update_docks_menu() {
}
void EditorDockManager::_docks_menu_option(int p_id) {
- focus_dock(docks_menu_docks[p_id]);
+ Control *dock = docks_menu_docks[p_id];
+ ERR_FAIL_NULL(dock);
+ ERR_FAIL_COND_MSG(!all_docks.has(dock), vformat("Menu option for unknown dock '%s'.", dock->get_name()));
+ if (all_docks[dock].enabled && all_docks[dock].open) {
+ PopupMenu *parent_menu = Object::cast_to<PopupMenu>(docks_menu->get_parent());
+ ERR_FAIL_NULL(parent_menu);
+ parent_menu->hide();
+ }
+ focus_dock(dock);
}
void EditorDockManager::_window_close_request(WindowWrapper *p_wrapper) {
@@ -822,6 +830,7 @@ EditorDockManager::EditorDockManager() {
EditorNode::get_singleton()->get_gui_base()->add_child(dock_context_popup);
docks_menu = memnew(PopupMenu);
+ docks_menu->set_hide_on_item_selection(false);
docks_menu->connect("id_pressed", callable_mp(this, &EditorDockManager::_docks_menu_option));
EditorNode::get_singleton()->get_gui_base()->connect("theme_changed", callable_mp(this, &EditorDockManager::_update_docks_menu));
}