diff options
author | Zae <zaevi@live.com> | 2023-10-18 01:14:26 +0800 |
---|---|---|
committer | Zae <zaevi@live.com> | 2023-10-18 01:14:26 +0800 |
commit | acf0d395c80f730b56673eb33a3e51ec3c3bbaae (patch) | |
tree | 961043c6b88e1500095be298cbe805e7c5b60e0d | |
parent | 30f2a6d611b1c9a3decae8964c5737e63e63ebce (diff) | |
download | redot-engine-acf0d395c80f730b56673eb33a3e51ec3c3bbaae.tar.gz |
Editor: Fix `remove_control_from_dock` fails when dock is floating.
-rw-r--r-- | editor/editor_node.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index dd3198954d..910d50e28e 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -5850,6 +5850,14 @@ void EditorNode::add_control_to_dock(DockSlot p_slot, Control *p_control) { } void EditorNode::remove_control_from_dock(Control *p_control) { + // If the dock is floating, close it first. + for (WindowWrapper *wrapper : floating_docks) { + if (p_control == wrapper->get_wrapped_control()) { + wrapper->set_window_enabled(false); + break; + } + } + Control *dock = nullptr; for (int i = 0; i < DOCK_SLOT_MAX; i++) { if (p_control->get_parent() == dock_slot[i]) { |