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

Method _notification

editor/editor_main_screen.cpp:49–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47#include "scene/gui/button.h"
48
49void EditorMainScreen::_notification(int p_what) {
50 switch (p_what) {
51 case NOTIFICATION_READY: {
52 if (EDITOR_3D < buttons.size() && buttons[EDITOR_3D]->is_visible()) {
53 // If the 3D editor is enabled, use this as the default.
54 select(EDITOR_3D);
55 return;
56 }
57
58 // Switch to the first main screen plugin that is enabled. Usually this is
59 // 2D, but may be subsequent ones if 2D is disabled in the feature profile.
60 for (int i = 0; i < buttons.size(); i++) {
61 Button *editor_button = buttons[i];
62 if (editor_button->is_visible()) {
63 select(i);
64 return;
65 }
66 }
67
68 select(-1);
69 } break;
70 case NOTIFICATION_THEME_CHANGED: {
71 for (int i = 0; i < buttons.size(); i++) {
72 Button *tb = buttons[i];
73 EditorPlugin *p_editor = editor_table[i];
74 Ref<Texture2D> icon = p_editor->get_plugin_icon();
75
76 if (icon.is_valid()) {
77 tb->set_button_icon(icon);
78 } else if (has_theme_icon(p_editor->get_plugin_name(), EditorStringName(EditorIcons))) {
79 tb->set_button_icon(get_theme_icon(p_editor->get_plugin_name(), EditorStringName(EditorIcons)));
80 }
81 }
82 } break;
83 }
84}
85
86void EditorMainScreen::set_button_container(HBoxContainer *p_button_hb) {
87 button_hb = p_button_hb;

Callers

nothing calls this directly

Calls 6

get_plugin_iconMethod · 0.80
set_button_iconMethod · 0.80
sizeMethod · 0.65
is_visibleMethod · 0.45
is_validMethod · 0.45
get_plugin_nameMethod · 0.45

Tested by

no test coverage detected