diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2017-04-06 14:34:40 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-06 14:34:40 +0200 |
commit | 0ede0302ba15b672b4dc50d04f9eb737ff3b3dc3 (patch) | |
tree | c95faf791ae7bf80dc034b14d90a3e585107f2fa | |
parent | 1a33d5e06fa941d1acf219ef865dfb0425f302dd (diff) | |
parent | df7ca7864bc6d12ba1a9b80320d32f2a01ea8658 (diff) |
Merge pull request #8285 from Hinsbart/gdscript_default
Editor: Use GDScript as the default language in ScriptCreateDialog.
-rw-r--r-- | editor/script_create_dialog.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp index d1a8aa62e5..47c89419a0 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"); |