summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorPoommetee Ketson <poommetee@protonmail.com>2017-07-08 18:33:25 +0700
committerPoommetee Ketson <poommetee@protonmail.com>2017-07-09 13:36:57 +0700
commit9ef0d0f96e3340361629484fb8e3aadaacccfbf8 (patch)
tree5b75ca6521d9c9a745bfee23339f1c72124c50b6 /editor
parentfdcac7be02e119e5fdc43bd650921d799e65b8ef (diff)
ScriptCreateDialog: Fix regressions from #9536
Diffstat (limited to 'editor')
-rw-r--r--editor/script_create_dialog.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp
index 47675bcffe..4a9b64639b 100644
--- a/editor/script_create_dialog.cpp
+++ b/editor/script_create_dialog.cpp
@@ -58,7 +58,6 @@ void ScriptCreateDialog::config(const String &p_base_name, const String &p_base_
file_path->set_text("");
}
_lang_changed(current_language);
- _template_changed(template_menu->get_selected());
_parent_name_changed(parent_name->get_text());
_class_name_changed("");
_path_changed(file_path->get_text());
@@ -246,25 +245,31 @@ void ScriptCreateDialog::_lang_changed(int l) {
bool use_templates = language->is_using_templates();
template_menu->set_disabled(!use_templates);
+ template_menu->clear();
if (use_templates) {
+
template_list = EditorSettings::get_singleton()->get_script_templates(language->get_extension());
String last_lang = EditorSettings::get_singleton()->get_project_metadata("script_setup", "last_selected_language", "");
String last_template = EditorSettings::get_singleton()->get_project_metadata("script_setup", "last_selected_template", "");
- template_menu->clear();
template_menu->add_item(TTR("Default"));
for (int i = 0; i < template_list.size(); i++) {
String s = template_list[i].capitalize();
template_menu->add_item(s);
- if (language_menu->get_item_text(l) == last_lang && last_template == s) {
+ if (language_menu->get_item_text(language_menu->get_selected()) == last_lang && last_template == s) {
template_menu->select(i + 1);
}
}
- _template_changed(template_menu->get_selected());
- EditorSettings::get_singleton()->set_project_metadata("script_setup", "last_selected_language", language_menu->get_item_text(l));
+ } else {
+
+ template_menu->add_item(TTR("N/A"));
+ script_template = "";
}
+ _template_changed(template_menu->get_selected());
+ EditorSettings::get_singleton()->set_project_metadata("script_setup", "last_selected_language", language_menu->get_item_text(language_menu->get_selected()));
+
_update_dialog();
}