summaryrefslogtreecommitdiff
path: root/editor/script_create_dialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/script_create_dialog.cpp')
-rw-r--r--editor/script_create_dialog.cpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp
index a982724d4c..959bb67e12 100644
--- a/editor/script_create_dialog.cpp
+++ b/editor/script_create_dialog.cpp
@@ -47,15 +47,14 @@ void ScriptCreateDialog::_notification(int p_what) {
case NOTIFICATION_ENTER_TREE: {
for (int i = 0; i < ScriptServer::get_language_count(); i++) {
String lang = ScriptServer::get_language(i)->get_type();
- Ref<Texture> lang_icon = get_icon(lang, "EditorIcons");
+ Ref<Texture2D> lang_icon = get_icon(lang, "EditorIcons");
if (lang_icon.is_valid()) {
language_menu->set_item_icon(i, lang_icon);
}
}
+
String last_lang = EditorSettings::get_singleton()->get_project_metadata("script_setup", "last_selected_language", "");
- Ref<Texture> last_lang_icon;
if (!last_lang.empty()) {
-
for (int i = 0; i < language_menu->get_item_count(); i++) {
if (language_menu->get_item_text(i) == last_lang) {
language_menu->select(i);
@@ -63,14 +62,10 @@ void ScriptCreateDialog::_notification(int p_what) {
break;
}
}
-
- last_lang_icon = get_icon(last_lang, "EditorIcons");
} else {
- last_lang_icon = language_menu->get_item_icon(default_language);
- }
- if (last_lang_icon.is_valid()) {
- language_menu->set_icon(last_lang_icon);
+ language_menu->select(default_language);
}
+
path_button->set_icon(get_icon("Folder", "EditorIcons"));
parent_browse_button->set_icon(get_icon("Folder", "EditorIcons"));
parent_search_button->set_icon(get_icon("ClassList", "EditorIcons"));
@@ -84,7 +79,9 @@ void ScriptCreateDialog::_path_hbox_sorted() {
int filename_start_pos = initial_bp.find_last("/") + 1;
int filename_end_pos = initial_bp.length();
- file_path->select(filename_start_pos, filename_end_pos);
+ if (!is_built_in) {
+ file_path->select(filename_start_pos, filename_end_pos);
+ }
// First set cursor to the end of line to scroll LineEdit view
// to the right and then set the actual cursor position.
@@ -335,7 +332,7 @@ void ScriptCreateDialog::_load_exist() {
return;
}
- emit_signal("script_created", p_script.get_ref_ptr());
+ emit_signal("script_created", p_script);
hide();
}
@@ -575,6 +572,10 @@ void ScriptCreateDialog::_browse_class_in_tree() {
void ScriptCreateDialog::_path_changed(const String &p_path) {
+ if (is_built_in) {
+ return;
+ }
+
is_path_valid = false;
is_new_script_created = true;