From 4b817a565cab8af648c88cfc7ab6481e86ee3625 Mon Sep 17 00:00:00 2001 From: Aaron Record Date: Fri, 29 Jul 2022 23:35:34 -0600 Subject: Remove NOTIFICATION_ENTER_TREE when paired with NOTIFICATION_THEME_CHANGED --- editor/shader_create_dialog.cpp | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) (limited to 'editor/shader_create_dialog.cpp') diff --git a/editor/shader_create_dialog.cpp b/editor/shader_create_dialog.cpp index 8c4a231e8a..fc7fff325c 100644 --- a/editor/shader_create_dialog.cpp +++ b/editor/shader_create_dialog.cpp @@ -47,8 +47,6 @@ enum ShaderType { void ShaderCreateDialog::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: { - _update_theme(); - String last_lang = EditorSettings::get_singleton()->get_project_metadata("shader_setup", "last_selected_language", ""); if (!last_lang.is_empty()) { for (int i = 0; i < type_menu->get_item_count(); i++) { @@ -67,29 +65,25 @@ void ShaderCreateDialog::_notification(int p_what) { } break; case NOTIFICATION_THEME_CHANGED: { - _update_theme(); - } break; - } -} + Ref shader_icon = gc->get_theme_icon(SNAME("Shader"), SNAME("EditorIcons")); + if (shader_icon.is_valid()) { + type_menu->set_item_icon(0, shader_icon); + } -void ShaderCreateDialog::_update_theme() { - Ref shader_icon = gc->get_theme_icon(SNAME("Shader"), SNAME("EditorIcons")); - if (shader_icon.is_valid()) { - type_menu->set_item_icon(0, shader_icon); - } + Ref visual_shader_icon = gc->get_theme_icon(SNAME("VisualShader"), SNAME("EditorIcons")); + if (visual_shader_icon.is_valid()) { + type_menu->set_item_icon(1, visual_shader_icon); + } - Ref visual_shader_icon = gc->get_theme_icon(SNAME("VisualShader"), SNAME("EditorIcons")); - if (visual_shader_icon.is_valid()) { - type_menu->set_item_icon(1, visual_shader_icon); - } + Ref include_icon = gc->get_theme_icon(SNAME("TextFile"), SNAME("EditorIcons")); + if (include_icon.is_valid()) { + type_menu->set_item_icon(2, include_icon); + } - Ref include_icon = gc->get_theme_icon(SNAME("TextFile"), SNAME("EditorIcons")); - if (include_icon.is_valid()) { - type_menu->set_item_icon(2, include_icon); + path_button->set_icon(get_theme_icon(SNAME("Folder"), SNAME("EditorIcons"))); + status_panel->add_theme_style_override("panel", get_theme_stylebox(SNAME("bg"), SNAME("Tree"))); + } break; } - - path_button->set_icon(get_theme_icon(SNAME("Folder"), SNAME("EditorIcons"))); - status_panel->add_theme_style_override("panel", get_theme_stylebox(SNAME("bg"), SNAME("Tree"))); } void ShaderCreateDialog::_update_language_info() { -- cgit v1.2.3