Fix script icon not showing at startup bug

(cherry picked from commit 032b0e5899)
This commit is contained in:
SkyJJ 2020-02-15 00:37:04 +01:00 committed by Rémi Verschelde
parent f6d2bbdeab
commit 9091e8d839
1 changed files with 4 additions and 9 deletions

View File

@ -52,10 +52,9 @@ void ScriptCreateDialog::_notification(int p_what) {
language_menu->set_item_icon(i, lang_icon); language_menu->set_item_icon(i, lang_icon);
} }
} }
String last_lang = EditorSettings::get_singleton()->get_project_metadata("script_setup", "last_selected_language", "");
Ref<Texture> 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++) { for (int i = 0; i < language_menu->get_item_count(); i++) {
if (language_menu->get_item_text(i) == last_lang) { if (language_menu->get_item_text(i) == last_lang) {
language_menu->select(i); language_menu->select(i);
@ -63,14 +62,10 @@ void ScriptCreateDialog::_notification(int p_what) {
break; break;
} }
} }
last_lang_icon = get_icon(last_lang, "EditorIcons");
} else { } else {
last_lang_icon = language_menu->get_item_icon(default_language); language_menu->select(default_language);
}
if (last_lang_icon.is_valid()) {
language_menu->set_icon(last_lang_icon);
} }
path_button->set_icon(get_icon("Folder", "EditorIcons")); path_button->set_icon(get_icon("Folder", "EditorIcons"));
parent_browse_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")); parent_search_button->set_icon(get_icon("ClassList", "EditorIcons"));