Port existing _notification code to use switch statements (part 1/3)

This commit is contained in:
jmb462 2022-02-16 00:52:32 +01:00 committed by Jean-Michel Bernard
parent f5b9cbaff6
commit dcd2a92af3
39 changed files with 1836 additions and 1666 deletions

View file

@ -46,10 +46,12 @@ bool ScriptServer::languages_finished = false;
ScriptEditRequestFunction ScriptServer::edit_request_func = nullptr;
void Script::_notification(int p_what) {
if (p_what == NOTIFICATION_POSTINITIALIZE) {
switch (p_what) {
case NOTIFICATION_POSTINITIALIZE: {
if (EngineDebugger::is_active()) {
EngineDebugger::get_script_debugger()->set_break_language(get_language());
}
} break;
}
}

View file

@ -562,8 +562,6 @@ void InputEventConfigurationDialog::_notification(int p_what) {
_update_input_list();
} break;
default:
break;
}
}
@ -1014,8 +1012,6 @@ void ActionMapEditor::_notification(int p_what) {
case NOTIFICATION_THEME_CHANGED: {
action_list_search->set_right_icon(get_theme_icon(SNAME("Search"), SNAME("EditorIcons")));
} break;
default:
break;
}
}

View file

@ -220,15 +220,22 @@ void AnimationBezierTrackEdit::_draw_line_clipped(const Vector2 &p_from, const V
}
void AnimationBezierTrackEdit::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE || p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
switch (p_what) {
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/animation_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning")));
} break;
case NOTIFICATION_ENTER_TREE: {
panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/animation_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning")));
[[fallthrough]];
}
if (p_what == NOTIFICATION_THEME_CHANGED || p_what == NOTIFICATION_ENTER_TREE) {
case NOTIFICATION_THEME_CHANGED: {
bezier_icon = get_theme_icon(SNAME("KeyBezierPoint"), SNAME("EditorIcons"));
bezier_handle_icon = get_theme_icon(SNAME("KeyBezierHandle"), SNAME("EditorIcons"));
selected_icon = get_theme_icon(SNAME("KeyBezierSelected"), SNAME("EditorIcons"));
}
if (p_what == NOTIFICATION_DRAW) {
} break;
case NOTIFICATION_DRAW: {
if (animation.is_null()) {
return;
}
@ -629,6 +636,7 @@ void AnimationBezierTrackEdit::_notification(int p_what) {
false,
Math::round(EDSCALE));
}
} break;
}
}

View file

@ -1458,11 +1458,9 @@ int AnimationTimelineEdit::get_name_limit() const {
}
void AnimationTimelineEdit::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE || p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE: {
panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/animation_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning")));
}
if (p_what == NOTIFICATION_ENTER_TREE) {
add_track->set_icon(get_theme_icon(SNAME("Add"), SNAME("EditorIcons")));
loop->set_icon(get_theme_icon(SNAME("Loop"), SNAME("EditorIcons")));
time_icon->set_texture(get_theme_icon(SNAME("Time"), SNAME("EditorIcons")));
@ -1477,14 +1475,18 @@ void AnimationTimelineEdit::_notification(int p_what) {
add_track->get_popup()->add_icon_item(get_theme_icon(SNAME("KeyBezier"), SNAME("EditorIcons")), TTR("Bezier Curve Track"));
add_track->get_popup()->add_icon_item(get_theme_icon(SNAME("KeyAudio"), SNAME("EditorIcons")), TTR("Audio Playback Track"));
add_track->get_popup()->add_icon_item(get_theme_icon(SNAME("KeyAnimation"), SNAME("EditorIcons")), TTR("Animation Playback Track"));
}
} break;
if (p_what == NOTIFICATION_RESIZED) {
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/animation_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning")));
} break;
case NOTIFICATION_RESIZED: {
len_hb->set_position(Vector2(get_size().width - get_buttons_width(), 0));
len_hb->set_size(Size2(get_buttons_width(), get_size().height));
}
} break;
if (p_what == NOTIFICATION_DRAW) {
case NOTIFICATION_DRAW: {
int key_range = get_size().width - get_buttons_width() - get_name_limit();
if (!animation.is_valid()) {
@ -1650,6 +1652,7 @@ void AnimationTimelineEdit::_notification(int p_what) {
}
draw_line(Vector2(0, get_size().height), get_size(), linecolor, Math::round(EDSCALE));
} break;
}
}
@ -1942,7 +1945,8 @@ AnimationTimelineEdit::AnimationTimelineEdit() {
////////////////////////////////////
void AnimationTrackEdit::_notification(int p_what) {
if (p_what == NOTIFICATION_DRAW) {
switch (p_what) {
case NOTIFICATION_DRAW: {
if (animation.is_null()) {
return;
}
@ -2234,10 +2238,12 @@ void AnimationTrackEdit::_notification(int p_what) {
draw_line(Vector2(0, get_size().height), get_size(), drop_color, Math::round(EDSCALE));
}
}
}
} break;
if (p_what == NOTIFICATION_MOUSE_EXIT || p_what == NOTIFICATION_DRAG_END) {
case NOTIFICATION_MOUSE_EXIT:
case NOTIFICATION_DRAG_END: {
cancel_drop();
} break;
}
}
@ -3205,7 +3211,8 @@ AnimationTrackEdit *AnimationTrackEditPlugin::create_animation_track_edit(Object
///////////////////////////////////////
void AnimationTrackEditGroup::_notification(int p_what) {
if (p_what == NOTIFICATION_DRAW) {
switch (p_what) {
case NOTIFICATION_DRAW: {
Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
int separation = get_theme_constant(SNAME("hseparation"), SNAME("ItemList"));
@ -3239,6 +3246,7 @@ void AnimationTrackEditGroup::_notification(int p_what) {
Color accent = get_theme_color(SNAME("accent_color"), SNAME("Editor"));
draw_line(Point2(px, 0), Point2(px, get_size().height), accent, Math::round(2 * EDSCALE));
}
} break;
}
}
@ -4516,11 +4524,16 @@ MenuButton *AnimationTrackEditor::get_edit_menu() {
}
void AnimationTrackEditor::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE || p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
switch (p_what) {
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/animation_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning")));
}
} break;
if (p_what == NOTIFICATION_THEME_CHANGED || p_what == NOTIFICATION_ENTER_TREE) {
case NOTIFICATION_ENTER_TREE: {
panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/animation_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning")));
[[fallthrough]];
}
case NOTIFICATION_THEME_CHANGED: {
zoom_icon->set_texture(get_theme_icon(SNAME("Zoom"), SNAME("EditorIcons")));
bezier_edit_icon->set_icon(get_theme_icon(SNAME("EditBezier"), SNAME("EditorIcons")));
snap->set_icon(get_theme_icon(SNAME("Snap"), SNAME("EditorIcons")));
@ -4529,14 +4542,15 @@ void AnimationTrackEditor::_notification(int p_what) {
imported_anim_warning->set_icon(get_theme_icon(SNAME("NodeWarning"), SNAME("EditorIcons")));
main_panel->add_theme_style_override("panel", get_theme_stylebox(SNAME("bg"), SNAME("Tree")));
edit->get_popup()->set_item_icon(edit->get_popup()->get_item_index(EDIT_APPLY_RESET), get_theme_icon(SNAME("Reload"), SNAME("EditorIcons")));
}
} break;
if (p_what == NOTIFICATION_READY) {
case NOTIFICATION_READY: {
EditorNode::get_singleton()->get_editor_selection()->connect("selection_changed", callable_mp(this, &AnimationTrackEditor::_selection_changed));
}
} break;
if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
case NOTIFICATION_VISIBILITY_CHANGED: {
update_keying();
} break;
}
}

View file

@ -214,7 +214,8 @@ void AudioStreamPreviewGenerator::_bind_methods() {
AudioStreamPreviewGenerator *AudioStreamPreviewGenerator::singleton = nullptr;
void AudioStreamPreviewGenerator::_notification(int p_what) {
if (p_what == NOTIFICATION_PROCESS) {
switch (p_what) {
case NOTIFICATION_PROCESS: {
List<ObjectID> to_erase;
for (KeyValue<ObjectID, Preview> &E : previews) {
if (!E.value.generating.is_set()) {
@ -233,6 +234,7 @@ void AudioStreamPreviewGenerator::_notification(int p_what) {
previews.erase(to_erase.front()->get());
to_erase.pop_front();
}
} break;
}
}

View file

@ -85,29 +85,31 @@ GotoLineDialog::GotoLineDialog() {
}
void FindReplaceBar::_notification(int p_what) {
if (p_what == NOTIFICATION_READY) {
switch (p_what) {
case NOTIFICATION_READY:
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
find_prev->set_icon(get_theme_icon(SNAME("MoveUp"), SNAME("EditorIcons")));
find_next->set_icon(get_theme_icon(SNAME("MoveDown"), SNAME("EditorIcons")));
hide_button->set_normal_texture(get_theme_icon(SNAME("Close"), SNAME("EditorIcons")));
hide_button->set_hover_texture(get_theme_icon(SNAME("Close"), SNAME("EditorIcons")));
hide_button->set_pressed_texture(get_theme_icon(SNAME("Close"), SNAME("EditorIcons")));
hide_button->set_custom_minimum_size(hide_button->get_normal_texture()->get_size());
} else if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
} break;
case NOTIFICATION_VISIBILITY_CHANGED: {
set_process_unhandled_input(is_visible_in_tree());
} else if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
find_prev->set_icon(get_theme_icon(SNAME("MoveUp"), SNAME("EditorIcons")));
find_next->set_icon(get_theme_icon(SNAME("MoveDown"), SNAME("EditorIcons")));
hide_button->set_normal_texture(get_theme_icon(SNAME("Close"), SNAME("EditorIcons")));
hide_button->set_hover_texture(get_theme_icon(SNAME("Close"), SNAME("EditorIcons")));
hide_button->set_pressed_texture(get_theme_icon(SNAME("Close"), SNAME("EditorIcons")));
hide_button->set_custom_minimum_size(hide_button->get_normal_texture()->get_size());
} else if (p_what == NOTIFICATION_THEME_CHANGED) {
} break;
case NOTIFICATION_THEME_CHANGED: {
matches_label->add_theme_color_override("font_color", results_count > 0 ? get_theme_color(SNAME("font_color"), SNAME("Label")) : get_theme_color(SNAME("error_color"), SNAME("Editor")));
} else if (p_what == NOTIFICATION_PREDELETE) {
} break;
case NOTIFICATION_PREDELETE: {
if (base_text_editor) {
base_text_editor->remove_find_replace_bar();
base_text_editor = nullptr;
}
} break;
}
}
@ -1658,10 +1660,7 @@ void CodeTextEditor::_error_pressed(const Ref<InputEvent> &p_event) {
}
}
void CodeTextEditor::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: {
void CodeTextEditor::_update_status_bar_theme() {
error_button->set_icon(get_theme_icon(SNAME("StatusError"), SNAME("EditorIcons")));
error_button->add_theme_color_override("font_color", get_theme_color(SNAME("error_color"), SNAME("Editor")));
error_button->add_theme_font_override("font", get_theme_font(SNAME("status_source"), SNAME("EditorFonts")));
@ -1674,28 +1673,34 @@ void CodeTextEditor::_notification(int p_what) {
line_and_col_txt->add_theme_font_override("font", get_theme_font(SNAME("status_source"), SNAME("EditorFonts")));
line_and_col_txt->add_theme_font_size_override("font_size", get_theme_font_size(SNAME("status_source_size"), SNAME("EditorFonts")));
if (p_what == NOTIFICATION_ENTER_TREE) {
break;
}
void CodeTextEditor::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE: {
_update_status_bar_theme();
} break;
case NOTIFICATION_THEME_CHANGED: {
_update_status_bar_theme();
if (toggle_scripts_button->is_visible()) {
update_toggle_scripts_button();
}
_update_text_editor_theme();
} break;
case NOTIFICATION_VISIBILITY_CHANGED: {
if (toggle_scripts_button->is_visible()) {
update_toggle_scripts_button();
}
set_process_input(is_visible_in_tree());
} break;
case NOTIFICATION_PREDELETE: {
if (find_replace_bar) {
find_replace_bar->set_text_edit(nullptr);
}
} break;
default:
break;
}
}

View file

@ -189,6 +189,8 @@ class CodeTextEditor : public VBoxContainer {
void _set_show_warnings_panel(bool p_show);
void _error_pressed(const Ref<InputEvent> &p_event);
void _update_status_bar_theme();
void _delete_line(int p_line);
void _toggle_scripts_pressed();

View file

@ -277,8 +277,10 @@ void ConnectDialog::_update_ok_enabled() {
}
void ConnectDialog::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE: {
bind_editor->edit(cdbinds);
} break;
}
}
@ -938,6 +940,7 @@ void ConnectionsDock::_notification(int p_what) {
case NOTIFICATION_THEME_CHANGED: {
search_box->set_right_icon(get_theme_icon(SNAME("Search"), SNAME("EditorIcons")));
} break;
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
update_tree();
} break;

View file

@ -429,9 +429,11 @@ void CreateDialog::_notification(int p_what) {
connect("confirmed", callable_mp(this, &CreateDialog::_confirmed));
_update_theme();
} break;
case NOTIFICATION_EXIT_TREE: {
disconnect("confirmed", callable_mp(this, &CreateDialog::_confirmed));
} break;
case NOTIFICATION_VISIBILITY_CHANGED: {
if (is_visible()) {
search_box->call_deferred(SNAME("grab_focus")); // still not visible
@ -440,6 +442,7 @@ void CreateDialog::_notification(int p_what) {
EditorSettings::get_singleton()->get_project_metadata("dialog_bounds", "create_new_node", Rect2(get_position(), get_size()));
}
} break;
case NOTIFICATION_THEME_CHANGED: {
_update_theme();
} break;

View file

@ -42,12 +42,14 @@ DebugAdapterServer::DebugAdapterServer() {
void DebugAdapterServer::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_ENTER_TREE: {
start();
break;
case NOTIFICATION_EXIT_TREE:
} break;
case NOTIFICATION_EXIT_TREE: {
stop();
break;
} break;
case NOTIFICATION_INTERNAL_PROCESS: {
// The main loop can be run again during request processing, which modifies internal state of the protocol.
// Thus, "polling" is needed to prevent it from parsing other requests while the current one isn't finished.
@ -57,6 +59,7 @@ void DebugAdapterServer::_notification(int p_what) {
polling = false;
}
} break;
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
protocol._request_timeout = EditorSettings::get_singleton()->get("network/debug_adapter/request_timeout");
protocol._sync_breakpoints = EditorSettings::get_singleton()->get("network/debug_adapter/sync_breakpoints");

View file

@ -107,14 +107,13 @@ void EditorDebuggerInspector::_bind_methods() {
void EditorDebuggerInspector::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_POSTINITIALIZE:
case NOTIFICATION_POSTINITIALIZE: {
connect("object_id_selected", callable_mp(this, &EditorDebuggerInspector::_object_selected));
break;
case NOTIFICATION_ENTER_TREE:
} break;
case NOTIFICATION_ENTER_TREE: {
edit(variables);
break;
default:
break;
} break;
}
}

View file

@ -240,18 +240,17 @@ void EditorDebuggerNode::_notification(int p_what) {
tabs->add_theme_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox(SNAME("DebuggerPanel"), SNAME("EditorStyles")));
}
} break;
case NOTIFICATION_READY: {
_update_debug_options();
} break;
default:
break;
}
if (p_what != NOTIFICATION_PROCESS || !server.is_valid()) {
case NOTIFICATION_PROCESS: {
if (!server.is_valid()) {
return;
}
if (!server.is_valid() || !server->is_active()) {
if (!server->is_active()) {
stop();
return;
}
@ -347,6 +346,8 @@ void EditorDebuggerNode::_notification(int p_what) {
debugger->update_live_edit_root();
}
} break;
}
}
void EditorDebuggerNode::_debugger_stopped(int p_id) {

View file

@ -53,10 +53,12 @@ EditorDebuggerTree::EditorDebuggerTree() {
}
void EditorDebuggerTree::_notification(int p_what) {
if (p_what == NOTIFICATION_POSTINITIALIZE) {
switch (p_what) {
case NOTIFICATION_POSTINITIALIZE: {
connect("cell_selected", callable_mp(this, &EditorDebuggerTree::_scene_tree_selected));
connect("item_collapsed", callable_mp(this, &EditorDebuggerTree::_scene_tree_folded));
connect("item_rmb_selected", callable_mp(this, &EditorDebuggerTree::_scene_tree_rmb_selected));
} break;
}
}

View file

@ -39,7 +39,9 @@ void EditorNetworkProfiler::_bind_methods() {
}
void EditorNetworkProfiler::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: {
activate->set_icon(get_theme_icon(SNAME("Play"), SNAME("EditorIcons")));
clear_button->set_icon(get_theme_icon(SNAME("Clear"), SNAME("EditorIcons")));
incoming_bandwidth_text->set_right_icon(get_theme_icon(SNAME("ArrowDown"), SNAME("EditorIcons")));
@ -48,6 +50,7 @@ void EditorNetworkProfiler::_notification(int p_what) {
// This needs to be done here to set the faded color when the profiler is first opened
incoming_bandwidth_text->add_theme_color_override("font_uneditable_color", get_theme_color(SNAME("font_color"), SNAME("Editor")) * Color(1, 1, 1, 0.5));
outgoing_bandwidth_text->add_theme_color_override("font_uneditable_color", get_theme_color(SNAME("font_color"), SNAME("Editor")) * Color(1, 1, 1, 0.5));
} break;
}
}

View file

@ -393,9 +393,13 @@ void EditorProfiler::_clear_pressed() {
}
void EditorProfiler::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_LAYOUT_DIRECTION_CHANGED || p_what == NOTIFICATION_TRANSLATION_CHANGED) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED:
case NOTIFICATION_TRANSLATION_CHANGED: {
activate->set_icon(get_theme_icon(SNAME("Play"), SNAME("EditorIcons")));
clear_button->set_icon(get_theme_icon(SNAME("Clear"), SNAME("EditorIcons")));
} break;
}
}

View file

@ -423,13 +423,17 @@ void EditorVisualProfiler::_clear_pressed() {
}
void EditorVisualProfiler::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_LAYOUT_DIRECTION_CHANGED || p_what == NOTIFICATION_TRANSLATION_CHANGED) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED:
case NOTIFICATION_TRANSLATION_CHANGED: {
if (is_layout_rtl()) {
activate->set_icon(get_theme_icon(SNAME("PlayBackwards"), SNAME("EditorIcons")));
} else {
activate->set_icon(get_theme_icon(SNAME("Play"), SNAME("EditorIcons")));
}
clear_button->set_icon(get_theme_icon(SNAME("Clear"), SNAME("EditorIcons")));
} break;
}
}

View file

@ -796,8 +796,8 @@ void ScriptEditorDebugger::_notification(int p_what) {
search->set_right_icon(get_theme_icon(SNAME("Search"), SNAME("EditorIcons")));
reason->add_theme_color_override("font_color", get_theme_color(SNAME("error_color"), SNAME("Editor")));
} break;
case NOTIFICATION_PROCESS: {
if (is_session_active()) {
peer->poll();
@ -857,6 +857,7 @@ void ScriptEditorDebugger::_notification(int p_what) {
break;
};
} break;
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
if (tabs->has_theme_stylebox_override("panel")) {
tabs->add_theme_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox(SNAME("DebuggerPanel"), SNAME("EditorStyles")));

View file

@ -98,6 +98,7 @@ void EditorAudioBus::_notification(int p_what) {
update_bus();
set_process(true);
} break;
case NOTIFICATION_DRAW: {
if (is_master) {
draw_style_box(get_theme_stylebox(SNAME("disabled"), SNAME("Button")), Rect2(Vector2(), get_size()));
@ -113,6 +114,7 @@ void EditorAudioBus::_notification(int p_what) {
draw_rect(Rect2(Point2(), get_size()), accent, false);
}
} break;
case NOTIFICATION_PROCESS: {
if (cc != AudioServer::get_singleton()->get_bus_channels(get_index())) {
cc = AudioServer::get_singleton()->get_bus_channels(get_index());
@ -157,6 +159,7 @@ void EditorAudioBus::_notification(int p_what) {
}
}
} break;
case NOTIFICATION_VISIBILITY_CHANGED: {
for (int i = 0; i < CHANNELS_MAX; i++) {
channel[i].peak_l = -100;
@ -952,12 +955,14 @@ void EditorAudioBusDrop::_notification(int p_what) {
draw_rect(Rect2(Point2(), get_size()), accent, false);
}
} break;
case NOTIFICATION_MOUSE_ENTER: {
if (!hovering_drop) {
hovering_drop = true;
update();
}
} break;
case NOTIFICATION_MOUSE_EXIT:
case NOTIFICATION_DRAG_END: {
if (hovering_drop) {
@ -1017,15 +1022,18 @@ void EditorAudioBuses::_notification(int p_what) {
case NOTIFICATION_THEME_CHANGED: {
bus_scroll->add_theme_style_override("bg", get_theme_stylebox(SNAME("bg"), SNAME("Tree")));
} break;
case NOTIFICATION_READY: {
_update_buses();
} break;
case NOTIFICATION_DRAG_END: {
if (drop_end) {
drop_end->queue_delete();
drop_end = nullptr;
}
} break;
case NOTIFICATION_PROCESS: {
// Check if anything was edited.
bool edited = AudioServer::get_singleton()->is_edited();
@ -1401,6 +1409,7 @@ void EditorAudioMeterNotches::_notification(int p_what) {
case NOTIFICATION_THEME_CHANGED: {
notch_color = get_theme_color(SNAME("font_color"), SNAME("Editor"));
} break;
case NOTIFICATION_DRAW: {
_draw_audio_notches();
} break;

View file

@ -42,7 +42,8 @@
#define PREVIEW_LIST_MAX_SIZE 10
void EditorAutoloadSettings::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE: {
List<String> afn;
ResourceLoader::get_recognized_extensions_for_type("Script", &afn);
ResourceLoader::get_recognized_extensions_for_type("PackedScene", &afn);
@ -57,8 +58,11 @@ void EditorAutoloadSettings::_notification(int p_what) {
}
}
browse_button->set_icon(get_theme_icon(SNAME("Folder"), SNAME("EditorIcons")));
} else if (p_what == NOTIFICATION_THEME_CHANGED) {
} break;
case NOTIFICATION_THEME_CHANGED: {
browse_button->set_icon(get_theme_icon(SNAME("Folder"), SNAME("EditorIcons")));
} break;
}
}

View file

@ -79,7 +79,8 @@ void EditorDirDialog::reload(const String &p_path) {
}
void EditorDirDialog::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE: {
EditorFileSystem::get_singleton()->connect("filesystem_changed", callable_mp(this, &EditorDirDialog::reload), make_binds(""));
reload();
@ -90,18 +91,19 @@ void EditorDirDialog::_notification(int p_what) {
if (!EditorFileSystem::get_singleton()->is_connected("filesystem_changed", callable_mp(this, &EditorDirDialog::reload))) {
EditorFileSystem::get_singleton()->connect("filesystem_changed", callable_mp(this, &EditorDirDialog::reload), make_binds(""));
}
}
} break;
if (p_what == NOTIFICATION_EXIT_TREE) {
case NOTIFICATION_EXIT_TREE: {
if (EditorFileSystem::get_singleton()->is_connected("filesystem_changed", callable_mp(this, &EditorDirDialog::reload))) {
EditorFileSystem::get_singleton()->disconnect("filesystem_changed", callable_mp(this, &EditorDirDialog::reload));
}
}
} break;
if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
case NOTIFICATION_VISIBILITY_CHANGED: {
if (must_reload && is_visible()) {
reload();
}
} break;
}
}

View file

@ -1544,6 +1544,7 @@ void EditorExport::_notification(int p_what) {
case NOTIFICATION_ENTER_TREE: {
load_config();
} break;
case NOTIFICATION_PROCESS: {
update_export_presets();
} break;

View file

@ -309,7 +309,8 @@ EditorFeatureProfile::EditorFeatureProfile() {}
//////////////////////////
void EditorFeatureProfileManager::_notification(int p_what) {
if (p_what == NOTIFICATION_READY) {
switch (p_what) {
case NOTIFICATION_READY: {
current_profile = EDITOR_GET("_default_feature_profile");
if (!current_profile.is_empty()) {
current.instantiate();
@ -321,6 +322,7 @@ void EditorFeatureProfileManager::_notification(int p_what) {
}
}
_update_profile_list(current_profile);
} break;
}
}

View file

@ -69,9 +69,15 @@ VBoxContainer *EditorFileDialog::get_vbox() {
}
void EditorFileDialog::_notification(int p_what) {
if (p_what == NOTIFICATION_READY || p_what == NOTIFICATION_THEME_CHANGED || p_what == Control::NOTIFICATION_LAYOUT_DIRECTION_CHANGED || p_what == NOTIFICATION_TRANSLATION_CHANGED) {
switch (p_what) {
case NOTIFICATION_READY:
case NOTIFICATION_THEME_CHANGED:
case Control::NOTIFICATION_LAYOUT_DIRECTION_CHANGED:
case NOTIFICATION_TRANSLATION_CHANGED: {
_update_icons();
} else if (p_what == NOTIFICATION_PROCESS) {
} break;
case NOTIFICATION_PROCESS: {
if (preview_waiting) {
preview_wheel_timeout -= get_process_delta_time();
if (preview_wheel_timeout <= 0) {
@ -84,8 +90,9 @@ void EditorFileDialog::_notification(int p_what) {
preview_wheel_timeout = 0.1;
}
}
} break;
} else if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
bool is_showing_hidden = EditorSettings::get_singleton()->get("filesystem/file_dialog/show_hidden_files");
if (show_hidden_files != is_showing_hidden) {
set_show_hidden_files(is_showing_hidden);
@ -95,11 +102,15 @@ void EditorFileDialog::_notification(int p_what) {
_update_icons();
// DO NOT CALL UPDATE FILE LIST HERE, ALL HUNDREDS OF HIDDEN DIALOGS WILL RESPOND, CALL INVALIDATE INSTEAD
invalidate();
} else if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
} break;
case NOTIFICATION_VISIBILITY_CHANGED: {
if (!is_visible()) {
set_process_unhandled_input(false);
}
} else if (p_what == NOTIFICATION_WM_WINDOW_FOCUS_IN) {
} break;
case NOTIFICATION_WM_WINDOW_FOCUS_IN: {
// Check if the current directory was removed externally (much less likely to happen while editor window is focused).
String previous_dir = get_current_dir();
while (!dir_access->dir_exists(get_current_dir())) {
@ -111,6 +122,7 @@ void EditorFileDialog::_notification(int p_what) {
break;
}
}
} break;
}
}

View file

@ -1163,6 +1163,7 @@ void EditorFileSystem::_notification(int p_what) {
call_deferred(SNAME("scan")); //this should happen after every editor node entered the tree
} break;
case NOTIFICATION_EXIT_TREE: {
Thread &active_thread = thread.is_started() ? thread : thread_sources;
if (use_threads && active_thread.is_started()) {
@ -1184,8 +1185,8 @@ void EditorFileSystem::_notification(int p_what) {
}
filesystem = nullptr;
new_filesystem = nullptr;
} break;
case NOTIFICATION_PROCESS: {
if (use_threads) {
if (scanning_changes) {

View file

@ -1770,17 +1770,17 @@ void EditorHelp::_notification(int p_what) {
_wait_for_thread();
_update_doc();
} break;
case NOTIFICATION_THEME_CHANGED: {
if (is_inside_tree()) {
_class_desc_resized(true);
}
update_toggle_scripts_button();
} break;
case NOTIFICATION_VISIBILITY_CHANGED:
case NOTIFICATION_VISIBILITY_CHANGED: {
update_toggle_scripts_button();
break;
default:
break;
} break;
}
}
@ -2041,6 +2041,7 @@ void FindBar::_notification(int p_what) {
hide_button->set_custom_minimum_size(hide_button->get_normal_texture()->get_size());
matches_label->add_theme_color_override("font_color", results_count > 0 ? get_theme_color(SNAME("font_color"), SNAME("Label")) : get_theme_color(SNAME("error_color"), SNAME("Editor")));
} break;
case NOTIFICATION_VISIBILITY_CHANGED: {
set_process_unhandled_input(is_visible_in_tree());
} break;

View file

@ -111,9 +111,11 @@ void EditorHelpSearch::_notification(int p_what) {
EditorSettings::get_singleton()->set_project_metadata("dialog_bounds", "search_help", Rect2(get_position(), get_size()));
}
} break;
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
_update_icons();
} break;
case NOTIFICATION_ENTER_TREE: {
connect("confirmed", callable_mp(this, &EditorHelpSearch::_confirmed));
_update_icons();

View file

@ -103,7 +103,8 @@ void EditorProperty::emit_changed(const StringName &p_property, const Variant &p
}
void EditorProperty::_notification(int p_what) {
if (p_what == NOTIFICATION_SORT_CHILDREN) {
switch (p_what) {
case NOTIFICATION_SORT_CHILDREN: {
Size2 size = get_size();
Rect2 rect;
Rect2 bottom_rect;
@ -214,9 +215,9 @@ void EditorProperty::_notification(int p_what) {
}
update(); //need to redraw text
}
} break;
if (p_what == NOTIFICATION_DRAW) {
case NOTIFICATION_DRAW: {
Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Tree"));
int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Tree"));
Color dark_color = get_theme_color(SNAME("dark_color_2"), SNAME("Editor"));
@ -378,6 +379,7 @@ void EditorProperty::_notification(int p_what) {
} else {
delete_rect = Rect2();
}
} break;
}
}
@ -1078,7 +1080,8 @@ void EditorInspectorPlugin::_bind_methods() {
////////////////////////////////////////////////
void EditorInspectorCategory::_notification(int p_what) {
if (p_what == NOTIFICATION_DRAW) {
switch (p_what) {
case NOTIFICATION_DRAW: {
Ref<StyleBox> sb = get_theme_stylebox(SNAME("prop_category_style"), SNAME("Editor"));
draw_style_box(sb, Rect2(Vector2(), get_size()));
@ -1102,6 +1105,7 @@ void EditorInspectorCategory::_notification(int p_what) {
Color color = get_theme_color(SNAME("font_color"), SNAME("Tree"));
draw_string(font, Point2(ofs, font->get_ascent(font_size) + (get_size().height - font->get_height(font_size)) / 2).floor(), label, HORIZONTAL_ALIGNMENT_LEFT, get_size().width, font_size, color);
} break;
}
}
@ -1152,6 +1156,7 @@ void EditorInspectorSection::_notification(int p_what) {
case NOTIFICATION_THEME_CHANGED: {
update_minimum_size();
} break;
case NOTIFICATION_SORT_CHILDREN: {
if (!vbox_added) {
return;
@ -1205,6 +1210,7 @@ void EditorInspectorSection::_notification(int p_what) {
fit_child_in_rect(c, Rect2(offset, size));
}
} break;
case NOTIFICATION_DRAW: {
// Get the section header font.
Ref<Font> font = get_theme_font(SNAME("bold"), SNAME("EditorFonts"));
@ -1299,6 +1305,7 @@ void EditorInspectorSection::_notification(int p_what) {
draw_style_box(section_indent_style, indent_rect);
}
} break;
case NOTIFICATION_DRAG_BEGIN: {
Dictionary dd = get_viewport()->gui_get_drag_data();
@ -1317,10 +1324,12 @@ void EditorInspectorSection::_notification(int p_what) {
dropping = children_can_drop;
update();
} break;
case NOTIFICATION_DRAG_END: {
dropping = false;
update();
} break;
case NOTIFICATION_MOUSE_ENTER: {
if (dropping) {
dropping_unfold_timer->start();
@ -2025,6 +2034,7 @@ void EditorInspectorArray::_notification(int p_what) {
add_button->set_icon(get_theme_icon(SNAME("Add"), SNAME("EditorIcons")));
update_minimum_size();
} break;
case NOTIFICATION_DRAG_BEGIN: {
Dictionary dict = get_viewport()->gui_get_drag_data();
if (dict.has("type") && dict["type"] == "property_array_element" && String(dict["property_array_prefix"]) == array_element_prefix) {
@ -2032,6 +2042,7 @@ void EditorInspectorArray::_notification(int p_what) {
control_dropping->update();
}
} break;
case NOTIFICATION_DRAG_END: {
if (dropping) {
dropping = false;
@ -2183,11 +2194,14 @@ void EditorPaginator::update(int p_page, int p_max_page) {
}
void EditorPaginator::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: {
first_page_button->set_icon(get_theme_icon(SNAME("PageFirst"), SNAME("EditorIcons")));
prev_page_button->set_icon(get_theme_icon(SNAME("PagePrevious"), SNAME("EditorIcons")));
next_page_button->set_icon(get_theme_icon(SNAME("PageNext"), SNAME("EditorIcons")));
last_page_button->set_icon(get_theme_icon(SNAME("PageLast"), SNAME("EditorIcons")));
} break;
}
}
@ -3426,32 +3440,35 @@ void EditorInspector::_node_removed(Node *p_node) {
}
void EditorInspector::_notification(int p_what) {
if (p_what == NOTIFICATION_READY) {
switch (p_what) {
case NOTIFICATION_READY: {
EditorFeatureProfileManager::get_singleton()->connect("current_feature_profile_changed", callable_mp(this, &EditorInspector::_feature_profile_changed));
set_process(is_visible_in_tree());
_update_inspector_bg();
}
} break;
if (p_what == NOTIFICATION_ENTER_TREE) {
case NOTIFICATION_ENTER_TREE: {
if (!sub_inspector) {
get_tree()->connect("node_removed", callable_mp(this, &EditorInspector::_node_removed));
}
}
if (p_what == NOTIFICATION_PREDELETE) {
} break;
case NOTIFICATION_PREDELETE: {
edit(nullptr); //just in case
}
if (p_what == NOTIFICATION_EXIT_TREE) {
} break;
case NOTIFICATION_EXIT_TREE: {
if (!sub_inspector) {
get_tree()->disconnect("node_removed", callable_mp(this, &EditorInspector::_node_removed));
}
edit(nullptr);
}
} break;
if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
case NOTIFICATION_VISIBILITY_CHANGED: {
set_process(is_visible_in_tree());
}
} break;
if (p_what == NOTIFICATION_PROCESS) {
case NOTIFICATION_PROCESS: {
if (update_scroll_request >= 0) {
get_v_scroll_bar()->call_deferred(SNAME("set_value"), update_scroll_request);
update_scroll_request = -1;
@ -3494,12 +3511,13 @@ void EditorInspector::_notification(int p_what) {
}
changing--;
}
} break;
if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
_update_inspector_bg();
update_tree();
} break;
}
}

View file

@ -93,12 +93,11 @@ void EditorLog::_notification(int p_what) {
_update_theme();
_load_state();
} break;
case NOTIFICATION_THEME_CHANGED: {
_update_theme();
_rebuild_log();
} break;
default:
break;
}
}

View file

@ -849,11 +849,14 @@ void EditorPlugin::_editor_project_settings_changed() {
emit_signal(SNAME("project_settings_changed"));
}
void EditorPlugin::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE: {
EditorNode::get_singleton()->connect("project_settings_changed", callable_mp(this, &EditorPlugin::_editor_project_settings_changed));
}
if (p_what == NOTIFICATION_EXIT_TREE) {
} break;
case NOTIFICATION_EXIT_TREE: {
EditorNode::get_singleton()->disconnect("project_settings_changed", callable_mp(this, &EditorPlugin::_editor_project_settings_changed));
} break;
}
}

View file

@ -39,11 +39,15 @@
#include "scene/gui/margin_container.h"
void EditorPluginSettings::_notification(int p_what) {
if (p_what == NOTIFICATION_WM_WINDOW_FOCUS_IN) {
switch (p_what) {
case NOTIFICATION_WM_WINDOW_FOCUS_IN: {
update_plugins();
} else if (p_what == Node::NOTIFICATION_READY) {
} break;
case Node::NOTIFICATION_READY: {
plugin_config_dialog->connect("plugin_ready", Callable(EditorNode::get_singleton(), "_on_plugin_ready"));
plugin_list->connect("button_pressed", callable_mp(this, &EditorPluginSettings::_cell_button_pressed));
} break;
}
}

View file

@ -166,7 +166,6 @@ void EditorPropertyMultilineText::_notification(int p_what) {
Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
text->set_custom_minimum_size(Vector2(0, font->get_height(font_size) * 6));
} break;
}
}
@ -294,11 +293,11 @@ void EditorPropertyTextEnum::_bind_methods() {
void EditorPropertyTextEnum::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED:
case NOTIFICATION_THEME_CHANGED: {
edit_button->set_icon(get_theme_icon(SNAME("Edit"), SNAME("EditorIcons")));
accept_button->set_icon(get_theme_icon(SNAME("ImportCheck"), SNAME("EditorIcons")));
cancel_button->set_icon(get_theme_icon(SNAME("ImportFail"), SNAME("EditorIcons")));
break;
} break;
}
}
@ -374,8 +373,11 @@ void EditorPropertyLocale::setup(const String &p_hint_text) {
}
void EditorPropertyLocale::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: {
locale_edit->set_icon(get_theme_icon(SNAME("Translation"), SNAME("EditorIcons")));
} break;
}
}
@ -467,8 +469,11 @@ void EditorPropertyPath::set_save_mode() {
}
void EditorPropertyPath::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: {
path_edit->set_icon(get_theme_icon(SNAME("Folder"), SNAME("EditorIcons")));
} break;
}
}
@ -1065,9 +1070,6 @@ void EditorPropertyLayersGrid::_notification(int p_what) {
update();
}
} break;
default:
break;
}
}
@ -1619,11 +1621,14 @@ void EditorPropertyVector2::update_property() {
}
void EditorPropertyVector2::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: {
const Color *colors = _get_property_colors();
for (int i = 0; i < 2; i++) {
spin[i]->set_custom_label_color(true, colors[i]);
}
} break;
}
}
@ -1710,11 +1715,14 @@ void EditorPropertyRect2::update_property() {
}
void EditorPropertyRect2::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: {
const Color *colors = _get_property_colors();
for (int i = 0; i < 4; i++) {
spin[i]->set_custom_label_color(true, colors[i % 2]);
}
} break;
}
}
@ -1836,11 +1844,14 @@ Vector3 EditorPropertyVector3::get_vector() {
}
void EditorPropertyVector3::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: {
const Color *colors = _get_property_colors();
for (int i = 0; i < 3; i++) {
spin[i]->set_custom_label_color(true, colors[i]);
}
} break;
}
}
@ -1923,11 +1934,14 @@ void EditorPropertyVector2i::update_property() {
}
void EditorPropertyVector2i::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: {
const Color *colors = _get_property_colors();
for (int i = 0; i < 2; i++) {
spin[i]->set_custom_label_color(true, colors[i]);
}
} break;
}
}
@ -2014,11 +2028,14 @@ void EditorPropertyRect2i::update_property() {
}
void EditorPropertyRect2i::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: {
const Color *colors = _get_property_colors();
for (int i = 0; i < 4; i++) {
spin[i]->set_custom_label_color(true, colors[i % 2]);
}
} break;
}
}
@ -2113,11 +2130,14 @@ void EditorPropertyVector3i::update_property() {
}
void EditorPropertyVector3i::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: {
const Color *colors = _get_property_colors();
for (int i = 0; i < 3; i++) {
spin[i]->set_custom_label_color(true, colors[i]);
}
} break;
}
}
@ -2203,11 +2223,14 @@ void EditorPropertyPlane::update_property() {
}
void EditorPropertyPlane::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: {
const Color *colors = _get_property_colors();
for (int i = 0; i < 4; i++) {
spin[i]->set_custom_label_color(true, colors[i]);
}
} break;
}
}
@ -2294,11 +2317,14 @@ void EditorPropertyQuaternion::update_property() {
}
void EditorPropertyQuaternion::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: {
const Color *colors = _get_property_colors();
for (int i = 0; i < 4; i++) {
spin[i]->set_custom_label_color(true, colors[i]);
}
} break;
}
}
@ -2388,11 +2414,14 @@ void EditorPropertyAABB::update_property() {
}
void EditorPropertyAABB::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: {
const Color *colors = _get_property_colors();
for (int i = 0; i < 6; i++) {
spin[i]->set_custom_label_color(true, colors[i % 3]);
}
} break;
}
}
@ -2469,7 +2498,9 @@ void EditorPropertyTransform2D::update_property() {
}
void EditorPropertyTransform2D::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: {
const Color *colors = _get_property_colors();
for (int i = 0; i < 6; i++) {
// For Transform2D, use the 4th color (cyan) for the origin vector.
@ -2479,6 +2510,7 @@ void EditorPropertyTransform2D::_notification(int p_what) {
spin[i]->set_custom_label_color(true, colors[i % 3]);
}
}
} break;
}
}
@ -2562,11 +2594,14 @@ void EditorPropertyBasis::update_property() {
}
void EditorPropertyBasis::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: {
const Color *colors = _get_property_colors();
for (int i = 0; i < 9; i++) {
spin[i]->set_custom_label_color(true, colors[i % 3]);
}
} break;
}
}
@ -2656,11 +2691,14 @@ void EditorPropertyTransform3D::update_using_transform(Transform3D p_transform)
}
void EditorPropertyTransform3D::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: {
const Color *colors = _get_property_colors();
for (int i = 0; i < 12; i++) {
spin[i]->set_custom_label_color(true, colors[i % 4]);
}
} break;
}
}
@ -2902,9 +2940,12 @@ void EditorPropertyNodePath::setup(const NodePath &p_base_hint, Vector<StringNam
}
void EditorPropertyNodePath::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: {
Ref<Texture2D> t = get_theme_icon(SNAME("Clear"), SNAME("EditorIcons"));
clear->set_icon(t);
} break;
}
}

View file

@ -504,7 +504,9 @@ void EditorPropertyArray::drop_data_fw(const Point2 &p_point, const Variant &p_d
}
void EditorPropertyArray::_notification(int p_what) {
if (p_what == NOTIFICATION_THEME_CHANGED || p_what == NOTIFICATION_ENTER_TREE) {
switch (p_what) {
case NOTIFICATION_THEME_CHANGED:
case NOTIFICATION_ENTER_TREE: {
change_type->clear();
for (int i = 0; i < Variant::VARIANT_MAX; i++) {
String type = Variant::get_type_name(Variant::Type(i));
@ -516,22 +518,23 @@ void EditorPropertyArray::_notification(int p_what) {
if (Object::cast_to<Button>(button_add_item)) {
button_add_item->set_icon(get_theme_icon(SNAME("Add"), SNAME("EditorIcons")));
}
}
} break;
if (p_what == NOTIFICATION_DRAG_BEGIN) {
case NOTIFICATION_DRAG_BEGIN: {
if (is_visible_in_tree()) {
if (_is_drop_valid(get_viewport()->gui_get_drag_data())) {
dropping = true;
edit->update();
}
}
}
} break;
if (p_what == NOTIFICATION_DRAG_END) {
case NOTIFICATION_DRAG_END: {
if (dropping) {
dropping = false;
edit->update();
}
} break;
}
}
@ -1151,7 +1154,9 @@ void EditorPropertyDictionary::_object_id_selected(const StringName &p_property,
}
void EditorPropertyDictionary::_notification(int p_what) {
if (p_what == NOTIFICATION_THEME_CHANGED || p_what == NOTIFICATION_ENTER_TREE) {
switch (p_what) {
case NOTIFICATION_THEME_CHANGED:
case NOTIFICATION_ENTER_TREE: {
change_type->clear();
for (int i = 0; i < Variant::VARIANT_MAX; i++) {
String type = Variant::get_type_name(Variant::Type(i));
@ -1163,6 +1168,7 @@ void EditorPropertyDictionary::_notification(int p_what) {
if (Object::cast_to<Button>(button_add_item)) {
button_add_item->set_icon(get_theme_icon(SNAME("Add"), SNAME("EditorIcons")));
}
} break;
}
}

View file

@ -35,7 +35,8 @@
#include "editor/editor_scale.h"
void EditorRunNative::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE: {
for (int i = 0; i < EditorExport::get_singleton()->get_export_platform_count(); i++) {
Ref<EditorExportPlatform> eep = EditorExport::get_singleton()->get_export_platform(i);
if (eep.is_null()) {
@ -60,9 +61,9 @@ void EditorRunNative::_notification(int p_what) {
}
}
}
}
} break;
if (p_what == NOTIFICATION_PROCESS) {
case NOTIFICATION_PROCESS: {
bool changed = EditorExport::get_singleton()->poll_export_platforms() || first;
if (changed) {
@ -90,6 +91,7 @@ void EditorRunNative::_notification(int p_what) {
first = false;
}
} break;
}
}

View file

@ -121,14 +121,17 @@ void EditorSettingsDialog::_notification(int p_what) {
set_process_unhandled_input(false);
}
} break;
case NOTIFICATION_READY: {
undo_redo->set_method_notify_callback(EditorDebuggerNode::_method_changeds, nullptr);
undo_redo->set_property_notify_callback(EditorDebuggerNode::_property_changeds, nullptr);
undo_redo->set_commit_notify_callback(_undo_redo_callback, this);
} break;
case NOTIFICATION_ENTER_TREE: {
_update_icons();
} break;
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
_update_icons();
// Update theme colors.

View file

@ -430,47 +430,49 @@ void EditorSpinSlider::_draw_spin_slider() {
void EditorSpinSlider::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED:
case NOTIFICATION_THEME_CHANGED: {
_update_value_input_stylebox();
break;
} break;
case NOTIFICATION_INTERNAL_PROCESS:
case NOTIFICATION_INTERNAL_PROCESS: {
if (value_input_dirty) {
value_input_dirty = false;
value_input->set_text(get_text_value());
}
set_process_internal(false);
break;
} break;
case NOTIFICATION_DRAW:
case NOTIFICATION_DRAW: {
_draw_spin_slider();
break;
} break;
case NOTIFICATION_WM_WINDOW_FOCUS_IN:
case NOTIFICATION_WM_WINDOW_FOCUS_OUT:
case NOTIFICATION_EXIT_TREE:
case NOTIFICATION_EXIT_TREE: {
if (grabbing_spinner) {
grabber->hide();
Input::get_singleton()->set_mouse_mode(Input::MOUSE_MODE_VISIBLE);
grabbing_spinner = false;
grabbing_spinner_attempt = false;
}
break;
} break;
case NOTIFICATION_MOUSE_ENTER:
case NOTIFICATION_MOUSE_ENTER: {
mouse_over_spin = true;
update();
break;
case NOTIFICATION_MOUSE_EXIT:
} break;
case NOTIFICATION_MOUSE_EXIT: {
mouse_over_spin = false;
update();
break;
case NOTIFICATION_FOCUS_ENTER:
} break;
case NOTIFICATION_FOCUS_ENTER: {
if ((Input::get_singleton()->is_action_pressed("ui_focus_next") || Input::get_singleton()->is_action_pressed("ui_focus_prev")) && !value_input_just_closed) {
_focus_entered();
}
value_input_just_closed = false;
break;
} break;
}
}

View file

@ -104,6 +104,7 @@ void EditorToaster::_notification(int p_what) {
main_button->update();
}
} break;
case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED: {
if (vbox_container->is_visible()) {
@ -134,12 +135,11 @@ void EditorToaster::_notification(int p_what) {
main_button->update();
disable_notifications_button->update();
} break;
case NOTIFICATION_TRANSFORM_CHANGED: {
_update_vbox_position();
_update_disable_notifications_button();
} break;
default:
break;
}
}

View file

@ -144,12 +144,10 @@ void EditorZoomWidget::set_zoom_by_increments(int p_increment_count, bool p_inte
void EditorZoomWidget::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_THEME_CHANGED:
case NOTIFICATION_THEME_CHANGED: {
zoom_minus->set_icon(get_theme_icon(SNAME("ZoomLess"), SNAME("EditorIcons")));
zoom_plus->set_icon(get_theme_icon(SNAME("ZoomMore"), SNAME("EditorIcons")));
break;
default:
break;
} break;
}
}

View file

@ -103,9 +103,11 @@ void FindInFiles::set_filter(const Set<String> &exts) {
_extension_filter = exts;
}
void FindInFiles::_notification(int p_notification) {
if (p_notification == NOTIFICATION_PROCESS) {
void FindInFiles::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_PROCESS: {
_process();
} break;
}
}
@ -456,7 +458,8 @@ Set<String> FindInFilesDialog::get_filter() const {
}
void FindInFilesDialog::_notification(int p_what) {
if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
switch (p_what) {
case NOTIFICATION_VISIBILITY_CHANGED: {
if (is_visible()) {
// Doesn't work more than once if not deferred...
_search_text_line_edit->call_deferred(SNAME("grab_focus"));
@ -476,6 +479,7 @@ void FindInFilesDialog::_notification(int p_what) {
_filters_container->add_child(cb);
}
}
} break;
}
}
@ -687,11 +691,15 @@ void FindInFilesPanel::stop_search() {
}
void FindInFilesPanel::_notification(int p_what) {
if (p_what == NOTIFICATION_PROCESS) {
switch (p_what) {
case NOTIFICATION_PROCESS: {
_progress_bar->set_as_ratio(_finder->get_progress());
} else if (p_what == NOTIFICATION_THEME_CHANGED) {
} break;
case NOTIFICATION_THEME_CHANGED: {
_search_text_label->add_theme_font_override("font", get_theme_font(SNAME("source"), SNAME("EditorFonts")));
_results_display->add_theme_font_override("font", get_theme_font(SNAME("source"), SNAME("EditorFonts")));
} break;
}
}

View file

@ -60,7 +60,7 @@ public:
float get_progress() const;
protected:
void _notification(int p_notification);
void _notification(int p_what);
static void _bind_methods();