summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Herzog <karroffel@users.noreply.github.com>2017-07-10 22:59:02 +0200
committerGitHub <noreply@github.com>2017-07-10 22:59:02 +0200
commit93dcfe1246118f65d0ecf75445556afd7bed99da (patch)
tree6e410613c6059ac6cdcc7ec62dcf52b89ad9a8c3
parentaa52f7c8d413c475e32f98a4b6f19afffc55bdbd (diff)
parent9ef0d0f96e3340361629484fb8e3aadaacccfbf8 (diff)
Merge pull request #9559 from Noshyaar/pr-2
ScriptCreateDialog: Fix regressions from #9536
-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();
}