1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-06 12:20:30 +00:00

Merge pull request #99904 from kitbdev/fix-load-floating-dock

Fix loading layout with floating dock in single window mode and fix `restore_windows_on_load`
This commit is contained in:
Thaddeus Crews
2024-12-30 08:58:52 -06:00
3 changed files with 5 additions and 5 deletions

View File

@@ -520,12 +520,12 @@ void EditorDockManager::save_docks_to_config(Ref<ConfigFile> p_layout, const Str
FileSystemDock::get_singleton()->save_layout_to_config(p_layout, p_section);
}
void EditorDockManager::load_docks_from_config(Ref<ConfigFile> p_layout, const String &p_section) {
void EditorDockManager::load_docks_from_config(Ref<ConfigFile> 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<String, Control *> dock_map;
@@ -554,7 +554,7 @@ void EditorDockManager::load_docks_from_config(Ref<ConfigFile> 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)) {

View File

@@ -143,7 +143,7 @@ public:
PopupMenu *get_docks_menu();
void save_docks_to_config(Ref<ConfigFile> p_layout, const String &p_section) const;
void load_docks_from_config(Ref<ConfigFile> p_layout, const String &p_section);
void load_docks_from_config(Ref<ConfigFile> 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);

View File

@@ -5293,7 +5293,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);