| 265 | } |
| 266 | |
| 267 | void EditorMainScreen::add_main_plugin(EditorPlugin *p_editor) { |
| 268 | Button *tb = memnew(Button); |
| 269 | tb->set_toggle_mode(true); |
| 270 | tb->set_theme_type_variation("MainScreenButton"); |
| 271 | tb->set_name(p_editor->get_plugin_name()); |
| 272 | tb->set_text(p_editor->get_plugin_name()); |
| 273 | |
| 274 | Ref<Texture2D> icon = p_editor->get_plugin_icon(); |
| 275 | if (icon.is_null() && has_theme_icon(p_editor->get_plugin_name(), EditorStringName(EditorIcons))) { |
| 276 | icon = get_editor_theme_icon(p_editor->get_plugin_name()); |
| 277 | } |
| 278 | if (icon.is_valid()) { |
| 279 | tb->set_button_icon(icon); |
| 280 | // Make sure the control is updated if the icon is reimported. |
| 281 | icon->connect_changed(callable_mp((Control *)tb, &Control::update_minimum_size)); |
| 282 | } |
| 283 | |
| 284 | tb->connect(SceneStringName(pressed), callable_mp(this, &EditorMainScreen::select).bind(buttons.size())); |
| 285 | |
| 286 | buttons.push_back(tb); |
| 287 | button_hb->add_child(tb); |
| 288 | editor_table.push_back(p_editor); |
| 289 | main_editor_plugins.insert(p_editor->get_plugin_name(), p_editor); |
| 290 | } |
| 291 | |
| 292 | void EditorMainScreen::remove_main_plugin(EditorPlugin *p_editor) { |
| 293 | // Remove the main editor button and update the bindings of |
no test coverage detected