From 9091e8d83929c2db2888431e72ee109ed4417a6d Mon Sep 17 00:00:00 2001 From: SkyJJ Date: Sat, 15 Feb 2020 00:37:04 +0100 Subject: [PATCH] Fix script icon not showing at startup bug (cherry picked from commit 032b0e5899e8e680f8f75d79adacc077d9b914a5) --- editor/script_create_dialog.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp index c4627e66273..032edf065c3 100644 --- a/editor/script_create_dialog.cpp +++ b/editor/script_create_dialog.cpp @@ -52,10 +52,9 @@ void ScriptCreateDialog::_notification(int p_what) { language_menu->set_item_icon(i, lang_icon); } } - String last_lang = EditorSettings::get_singleton()->get_project_metadata("script_setup", "last_selected_language", ""); - Ref last_lang_icon; - if (!last_lang.empty()) { + String last_lang = EditorSettings::get_singleton()->get_project_metadata("script_setup", "last_selected_language", ""); + if (!last_lang.empty()) { for (int i = 0; i < language_menu->get_item_count(); i++) { if (language_menu->get_item_text(i) == last_lang) { language_menu->select(i); @@ -63,14 +62,10 @@ void ScriptCreateDialog::_notification(int p_what) { break; } } - - last_lang_icon = get_icon(last_lang, "EditorIcons"); } else { - last_lang_icon = language_menu->get_item_icon(default_language); - } - if (last_lang_icon.is_valid()) { - language_menu->set_icon(last_lang_icon); + language_menu->select(default_language); } + path_button->set_icon(get_icon("Folder", "EditorIcons")); parent_browse_button->set_icon(get_icon("Folder", "EditorIcons")); parent_search_button->set_icon(get_icon("ClassList", "EditorIcons"));