fix load floating dock layout

This commit is contained in:
kit 2023-10-03 15:36:53 -04:00
parent f5696c311c
commit 349da99476

View file

@ -4663,6 +4663,7 @@ void EditorNode::_dock_make_float(Control *p_dock, int p_slot_index, bool p_show
wrapper->set_meta("dock_slot", p_slot_index); wrapper->set_meta("dock_slot", p_slot_index);
wrapper->set_meta("dock_index", dock_index); wrapper->set_meta("dock_index", dock_index);
wrapper->set_meta("dock_name", p_dock->get_name().operator String()); wrapper->set_meta("dock_name", p_dock->get_name().operator String());
p_dock->show();
wrapper->connect("window_close_requested", callable_mp(this, &EditorNode::_dock_floating_close_request).bind(wrapper)); wrapper->connect("window_close_requested", callable_mp(this, &EditorNode::_dock_floating_close_request).bind(wrapper));
@ -5166,14 +5167,16 @@ void EditorNode::_load_docks_from_config(Ref<ConfigFile> p_layout, const String
if (wrapper->get_meta("dock_name") == name) { if (wrapper->get_meta("dock_name") == name) {
if (restore_window_on_load && floating_docks_dump.has(name)) { if (restore_window_on_load && floating_docks_dump.has(name)) {
_restore_floating_dock(floating_docks_dump[name], wrapper, i); _restore_floating_dock(floating_docks_dump[name], wrapper, i);
return;
} else { } else {
_dock_floating_close_request(wrapper); atidx = wrapper->get_meta("dock_slot");
atidx = wrapper->get_meta("dock_index"); node = wrapper->get_wrapped_control();
wrapper->set_window_enabled(false);
} }
break;
} }
} }
}
if (!node) {
// Well, it's not anywhere. // Well, it's not anywhere.
continue; continue;
} }
@ -5196,7 +5199,7 @@ void EditorNode::_load_docks_from_config(Ref<ConfigFile> p_layout, const String
if (restore_window_on_load && floating_docks_dump.has(name)) { if (restore_window_on_load && floating_docks_dump.has(name)) {
_restore_floating_dock(floating_docks_dump[name], node, i); _restore_floating_dock(floating_docks_dump[name], node, i);
} else if (wrapper) { } else if (wrapper) {
_dock_floating_close_request(wrapper); wrapper->set_window_enabled(false);
} }
} }