Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editor: Fix remove_control_from_dock fails when dock is floating. #83512

Merged
merged 1 commit into from
Oct 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions editor/editor_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set_window_enabled(false) will emit window_close_requested signal and the control will be back to editor's dock.

break;
}
}

Control *dock = nullptr;
for (int i = 0; i < DOCK_SLOT_MAX; i++) {
if (p_control->get_parent() == dock_slot[i]) {
Expand Down