| 174 | } |
| 175 | |
| 176 | void EditorMainScreen::select(int p_index) { |
| 177 | if (EditorNode::get_singleton()->is_changing_scene()) { |
| 178 | return; |
| 179 | } |
| 180 | |
| 181 | ERR_FAIL_INDEX(p_index, editor_table.size()); |
| 182 | |
| 183 | if (!buttons[p_index]->is_visible()) { // Button hidden, no editor. |
| 184 | return; |
| 185 | } |
| 186 | |
| 187 | for (int i = 0; i < buttons.size(); i++) { |
| 188 | buttons[i]->set_pressed_no_signal(i == p_index); |
| 189 | } |
| 190 | |
| 191 | EditorPlugin *new_editor = editor_table[p_index]; |
| 192 | ERR_FAIL_NULL(new_editor); |
| 193 | |
| 194 | if (selected_plugin == new_editor) { |
| 195 | return; |
| 196 | } |
| 197 | |
| 198 | if (selected_plugin) { |
| 199 | selected_plugin->make_visible(false); |
| 200 | } |
| 201 | |
| 202 | selected_plugin = new_editor; |
| 203 | selected_plugin->make_visible(true); |
| 204 | selected_plugin->selected_notify(); |
| 205 | |
| 206 | EditorData &editor_data = EditorNode::get_editor_data(); |
| 207 | int plugin_count = editor_data.get_editor_plugin_count(); |
| 208 | for (int i = 0; i < plugin_count; i++) { |
| 209 | editor_data.get_editor_plugin(i)->notify_main_screen_changed(selected_plugin->get_plugin_name()); |
| 210 | } |
| 211 | |
| 212 | EditorNode::get_singleton()->update_distraction_free_mode(); |
| 213 | } |
| 214 | |
| 215 | int EditorMainScreen::get_selected_index() const { |
| 216 | for (int i = 0; i < editor_table.size(); i++) { |
no test coverage detected