diff options
author | Hayden Leete <haydenleete@gmail.com> | 2023-03-09 16:54:17 +1300 |
---|---|---|
committer | Yuri Sizov <yuris@humnom.net> | 2023-03-14 13:59:04 +0100 |
commit | 26ab941507b11de491a11a24b5a1dd72a72082f5 (patch) | |
tree | 8d09f2a4ba5fe9d123ec715260b1a7f5b7644896 /editor | |
parent | 10424abb29709a9ef6c6761fc3c704ace0f642e8 (diff) |
Fix errors when closing floating docks
dock->get_index() on line 4463 was not behaving as expected
due to dock having an internal sibling, so now we just get the
index excluding internal nodes.
line 4742 would throw an error if you made multiple docks
floating then redocked the end docks first, but no longer
(cherry picked from commit 21578e0bb4f3dd99bb288a1d631b064fa76b884f)
Diffstat (limited to 'editor')
-rw-r--r-- | editor/editor_node.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 0b438d8896..385806a3a7 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -4750,8 +4750,8 @@ void EditorNode::_dock_floating_close_request(Control *p_control) { p_control->get_parent()->remove_child(p_control); dock_slot[window_slot]->add_child(p_control); - dock_slot[window_slot]->move_child(p_control, MIN((int)window->get_meta("dock_index"), dock_slot[window_slot]->get_tab_count())); - dock_slot[window_slot]->set_current_tab(window->get_meta("dock_index")); + dock_slot[window_slot]->move_child(p_control, MIN((int)window->get_meta("dock_index"), dock_slot[window_slot]->get_tab_count() - 1)); + dock_slot[window_slot]->set_current_tab(dock_slot[window_slot]->get_tab_idx_from_control(p_control)); dock_slot[window_slot]->set_tab_title(dock_slot[window_slot]->get_tab_idx_from_control(p_control), TTRGET(p_control->get_name())); window->queue_free(); @@ -4772,7 +4772,7 @@ void EditorNode::_dock_make_float() { Size2 dock_size = dock->get_size() + borders * 2; Point2 dock_screen_pos = dock->get_global_position() + get_tree()->get_root()->get_position() - borders; - int dock_index = dock->get_index(); + int dock_index = dock->get_index(false); dock_slot[dock_popup_selected_idx]->remove_child(dock); Window *window = memnew(Window); |