From df7ca7864bc6d12ba1a9b80320d32f2a01ea8658 Mon Sep 17 00:00:00 2001 From: Andreas Haas Date: Thu, 6 Apr 2017 13:40:00 +0200 Subject: [PATCH] Editor: Use GDScript as the default language in ScriptCreateDialog. --- editor/script_create_dialog.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp index d1a8aa62e5d..47c89419a05 100644 --- a/editor/script_create_dialog.cpp +++ b/editor/script_create_dialog.cpp @@ -359,20 +359,28 @@ ScriptCreateDialog::ScriptCreateDialog() { language_menu = memnew(OptionButton); vb->add_margin_child(TTR("Language"), language_menu); + int default_lang = 0; for (int i = 0; i < ScriptServer::get_language_count(); i++) { - language_menu->add_item(ScriptServer::get_language(i)->get_name()); + String lang = ScriptServer::get_language(i)->get_name(); + language_menu->add_item(lang); + if (lang == "GDScript") { + default_lang = i; + } } editor_settings = EditorSettings::get_singleton(); String last_selected_language = editor_settings->get_project_metadata("script_setup", "last_selected_language", ""); - if (last_selected_language != "") - for (int i = 0; i < language_menu->get_item_count(); i++) + if (last_selected_language != "") { + for (int i = 0; i < language_menu->get_item_count(); i++) { if (language_menu->get_item_text(i) == last_selected_language) { language_menu->select(i); break; - } else - language_menu->select(0); + } + } + } else { + language_menu->select(default_lang); + } language_menu->connect("item_selected", this, "_lang_changed");