mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +00:00
Fix default script name in ScriptCreateDialog
It would default either to '.gd' when created from the script editor, or to 'res:///NodeName.gd' (three '/') when created from the scene tree dock.
This commit is contained in:
parent
c7fc3dcab3
commit
fb77cdf2f2
3 changed files with 16 additions and 17 deletions
|
@ -56,6 +56,7 @@ void ScriptCreateDialog::config(const String &p_base_name, const String &p_base_
|
|||
class_name->deselect();
|
||||
parent_name->set_text(p_base_name);
|
||||
parent_name->deselect();
|
||||
|
||||
if (p_base_path != "") {
|
||||
initial_bp = p_base_path.get_basename();
|
||||
file_path->set_text(initial_bp + "." + ScriptServer::get_language(language_menu->get_selected())->get_extension());
|
||||
|
@ -359,7 +360,7 @@ void ScriptCreateDialog::_path_changed(const String &p_path) {
|
|||
|
||||
is_path_valid = false;
|
||||
is_new_script_created = true;
|
||||
String p = p_path;
|
||||
String p = p_path.strip_edges();
|
||||
|
||||
if (p == "") {
|
||||
_msg_path_valid(false, TTR("Path is empty"));
|
||||
|
@ -367,6 +368,12 @@ void ScriptCreateDialog::_path_changed(const String &p_path) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (p.get_file().get_basename() == "") {
|
||||
_msg_path_valid(false, TTR("Filename is empty"));
|
||||
_update_dialog();
|
||||
return;
|
||||
}
|
||||
|
||||
p = ProjectSettings::get_singleton()->localize_path(p);
|
||||
if (!p.begins_with("res://")) {
|
||||
_msg_path_valid(false, TTR("Path is not local"));
|
||||
|
@ -443,12 +450,6 @@ void ScriptCreateDialog::_path_changed(const String &p_path) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (p.get_file().get_basename() == "") {
|
||||
_msg_path_valid(false, TTR("Filename is empty"));
|
||||
_update_dialog();
|
||||
return;
|
||||
}
|
||||
|
||||
/* All checks passed */
|
||||
|
||||
is_path_valid = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue