Editor: Use GDScript as the default language in ScriptCreateDialog.

This commit is contained in:
Andreas Haas 2017-04-06 13:40:00 +02:00
parent ab02206f18
commit df7ca7864b
No known key found for this signature in database
GPG Key ID: B5FFAE1B65FBD2E1

View File

@ -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");