MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / add_main_plugin

Method add_main_plugin

editor/editor_main_screen.cpp:267–290  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

265}
266
267void 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
292void EditorMainScreen::remove_main_plugin(EditorPlugin *p_editor) {
293 // Remove the main editor button and update the bindings of

Callers 1

add_editor_pluginMethod · 0.80

Calls 15

get_plugin_iconMethod · 0.80
set_button_iconMethod · 0.80
connect_changedMethod · 0.80
connectMethod · 0.65
sizeMethod · 0.65
set_toggle_modeMethod · 0.45
set_nameMethod · 0.45
get_plugin_nameMethod · 0.45
set_textMethod · 0.45
is_nullMethod · 0.45
is_validMethod · 0.45

Tested by

no test coverage detected