浏览代码

Fix loading floating dock in single window mode
Fix restore_windows_on_load setting preventing loading layouts with floating docks

kit 9 月之前
父节点
当前提交
4e1f534c1e
共有 3 个文件被更改,包括 5 次插入5 次删除
  1. 3 3
      editor/editor_dock_manager.cpp
  2. 1 1
      editor/editor_dock_manager.h
  3. 1 1
      editor/editor_node.cpp

+ 3 - 3
editor/editor_dock_manager.cpp

@@ -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);
 	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());
 	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 dock_bottom = p_layout->get_value(p_section, "dock_bottom", Array());
 	Array closed_docks = p_layout->get_value(p_section, "dock_closed", 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.
 	// Store the docks by name for easy lookup.
 	HashMap<String, Control *> dock_map;
 	HashMap<String, Control *> dock_map;
@@ -554,7 +554,7 @@ void EditorDockManager::load_docks_from_config(Ref<ConfigFile> p_layout, const S
 				continue;
 				continue;
 			}
 			}
 			bool at_bottom = false;
 			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);
 				all_docks[dock].previous_at_bottom = dock_bottom.has(name);
 				_restore_dock_to_saved_window(dock, floating_docks_dump[name]);
 				_restore_dock_to_saved_window(dock, floating_docks_dump[name]);
 			} else if (dock_bottom.has(name)) {
 			} else if (dock_bottom.has(name)) {

+ 1 - 1
editor/editor_dock_manager.h

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

+ 1 - 1
editor/editor_node.cpp

@@ -5282,7 +5282,7 @@ void EditorNode::_load_editor_layout() {
 		}
 		}
 	} else {
 	} else {
 		ep.step(TTR("Loading docks..."), 1, true);
 		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);
 		ep.step(TTR("Reopening scenes..."), 2, true);
 		_load_open_scenes_from_config(config);
 		_load_open_scenes_from_config(config);