From 4e1f534c1e4b4fef34a5fdaa15f5f54b5bc4d111 Mon Sep 17 00:00:00 2001 From: kit Date: Sun, 1 Dec 2024 14:06:22 -0500 Subject: [PATCH] Fix loading floating dock in single window mode Fix restore_windows_on_load setting preventing loading layouts with floating docks --- editor/editor_dock_manager.cpp | 6 +++--- editor/editor_dock_manager.h | 2 +- editor/editor_node.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/editor/editor_dock_manager.cpp b/editor/editor_dock_manager.cpp index bad683bf134..3f2093aa65a 100644 --- a/editor/editor_dock_manager.cpp +++ b/editor/editor_dock_manager.cpp @@ -520,12 +520,12 @@ void EditorDockManager::save_docks_to_config(Ref p_layout, const Str FileSystemDock::get_singleton()->save_layout_to_config(p_layout, p_section); } -void EditorDockManager::load_docks_from_config(Ref p_layout, const String &p_section) { +void EditorDockManager::load_docks_from_config(Ref p_layout, const String &p_section, bool p_first_load) { Dictionary floating_docks_dump = p_layout->get_value(p_section, "dock_floating", Dictionary()); Array dock_bottom = p_layout->get_value(p_section, "dock_bottom", Array()); Array closed_docks = p_layout->get_value(p_section, "dock_closed", Array()); - bool restore_window_on_load = EDITOR_GET("interface/multi_window/restore_windows_on_load"); + bool allow_floating_docks = EditorNode::get_singleton()->is_multi_window_enabled() && (!p_first_load || EDITOR_GET("interface/multi_window/restore_windows_on_load")); // Store the docks by name for easy lookup. HashMap dock_map; @@ -554,7 +554,7 @@ void EditorDockManager::load_docks_from_config(Ref p_layout, const S continue; } bool at_bottom = false; - if (restore_window_on_load && floating_docks_dump.has(name)) { + if (allow_floating_docks && floating_docks_dump.has(name)) { all_docks[dock].previous_at_bottom = dock_bottom.has(name); _restore_dock_to_saved_window(dock, floating_docks_dump[name]); } else if (dock_bottom.has(name)) { diff --git a/editor/editor_dock_manager.h b/editor/editor_dock_manager.h index 1e6b413d146..d750d6b24e9 100644 --- a/editor/editor_dock_manager.h +++ b/editor/editor_dock_manager.h @@ -143,7 +143,7 @@ public: PopupMenu *get_docks_menu(); void save_docks_to_config(Ref p_layout, const String &p_section) const; - void load_docks_from_config(Ref p_layout, const String &p_section); + void load_docks_from_config(Ref p_layout, const String &p_section, bool p_first_load = false); void set_dock_enabled(Control *p_dock, bool p_enabled); void close_dock(Control *p_dock); diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 222696a6084..7be7fbe6664 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -5282,7 +5282,7 @@ void EditorNode::_load_editor_layout() { } } else { ep.step(TTR("Loading docks..."), 1, true); - editor_dock_manager->load_docks_from_config(config, "docks"); + editor_dock_manager->load_docks_from_config(config, "docks", true); ep.step(TTR("Reopening scenes..."), 2, true); _load_open_scenes_from_config(config);