Skip to content

Commit

Permalink
Solve a bug with main window plugins.
Browse files Browse the repository at this point in the history
When removing a main window plugin the bindings of the main window buttons was not changed to reflect the changed indices.
  • Loading branch information
HolonProduction committed Nov 29, 2022
1 parent 0c23a2c commit 1da0a12
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion editor/editor_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3426,7 +3426,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);
Expand All @@ -3436,6 +3438,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));
}
}

Expand Down

0 comments on commit 1da0a12

Please sign in to comment.