diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-11-29 16:50:03 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-11-29 16:50:03 +0100 |
commit | 5669834f8209c1c98890a44817f48fcdc33d0dd1 (patch) | |
tree | a71ab3af4061e64de79828fc76b5165b44b69f72 | |
parent | 87de4cc7c2483be4aa672e825175521aaeeae8bb (diff) | |
parent | 1da0a1270570b364d5f850c71610f75eca6eda5a (diff) |
Merge pull request #66995 from HolonProduction/main_window_bug
Fix a bug with main window `EditorPlugin`.
-rw-r--r-- | editor/editor_node.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 05a45f4bdb..d00a64f796 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -3356,7 +3356,9 @@ void EditorNode::add_editor_plugin(EditorPlugin *p_editor, bool p_config_changed void EditorNode::remove_editor_plugin(EditorPlugin *p_editor, bool p_config_changed) { if (p_editor->has_main_screen()) { - for (int i = 0; i < singleton->main_editor_buttons.size(); i++) { + // Remove the main editor button and update the bindings of + // all buttons behind it to point to the correct main window. + for (int i = singleton->main_editor_buttons.size() - 1; i >= 0; i--) { if (p_editor->get_name() == singleton->main_editor_buttons[i]->get_text()) { if (singleton->main_editor_buttons[i]->is_pressed()) { singleton->editor_select(EDITOR_SCRIPT); @@ -3366,6 +3368,9 @@ void EditorNode::remove_editor_plugin(EditorPlugin *p_editor, bool p_config_chan singleton->main_editor_buttons.remove_at(i); break; + } else { + singleton->main_editor_buttons[i]->disconnect("pressed", callable_mp(singleton, &EditorNode::editor_select)); + singleton->main_editor_buttons[i]->connect("pressed", callable_mp(singleton, &EditorNode::editor_select).bind(i - 1)); } } |