feat: updated godot version

This commit is contained in:
Sara Gerretsen 2026-04-04 19:38:56 +02:00
parent 0c508b0831
commit 42b028dbb5
4694 changed files with 236470 additions and 401376 deletions

View file

@ -32,10 +32,7 @@
#include "core/config/project_settings.h"
#include "core/io/file_access.h"
#include "core/io/resource_loader.h"
#include "core/io/resource_saver.h"
#include "core/object/callable_mp.h"
#include "core/object/class_db.h"
#include "editor/editor_node.h"
#include "editor/editor_string_names.h"
#include "editor/file_system/editor_file_system.h"
@ -240,28 +237,28 @@ String ScriptCreateDialog::_validate_path(const String &p_path, bool p_file_must
}
if (p.is_empty()) {
return TTRC("Path is empty.");
return TTR("Path is empty.");
}
if (p.get_file().get_basename().is_empty()) {
return TTRC("Filename is empty.");
return TTR("Filename is empty.");
}
if (!p.get_file().get_basename().is_valid_filename()) {
return TTRC("Filename is invalid.");
return TTR("Filename is invalid.");
}
if (p.get_file().begins_with(".")) {
return TTRC("Name begins with a dot.");
return TTR("Name begins with a dot.");
}
p = ProjectSettings::get_singleton()->localize_path(p);
if (!p.begins_with("res://")) {
return TTRC("Path is not local.");
return TTR("Path is not local.");
}
{
Ref<DirAccess> da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
if (da->change_dir(p.get_base_dir()) != OK) {
return TTRC("Base path is invalid.");
return TTR("Base path is invalid.");
}
}
@ -269,9 +266,9 @@ String ScriptCreateDialog::_validate_path(const String &p_path, bool p_file_must
// Check if file exists.
Ref<DirAccess> da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
if (da->dir_exists(p)) {
return TTRC("A directory with the same name exists.");
return TTR("A directory with the same name exists.");
} else if (p_file_must_exist && !da->file_exists(p)) {
return TTRC("File does not exist.");
return TTR("File does not exist.");
}
}
@ -301,10 +298,10 @@ String ScriptCreateDialog::_validate_path(const String &p_path, bool p_file_must
}
if (!found) {
return TTRC("Invalid extension.");
return TTR("Invalid extension.");
}
if (!match) {
return TTRC("Extension doesn't match chosen language.");
return TTR("Extension doesn't match chosen language.");
}
// Let ScriptLanguage do custom validation.
@ -415,9 +412,6 @@ void ScriptCreateDialog::_load_exist() {
void ScriptCreateDialog::_language_changed(int l) {
language = ScriptServer::get_language(l);
if (language == nullptr) {
return;
}
can_inherit_from_file = language->can_inherit_from_file();
supports_built_in = language->supports_builtin_mode();
@ -532,9 +526,6 @@ void ScriptCreateDialog::_path_changed(const String &p_path) {
}
void ScriptCreateDialog::_update_template_menu() {
if (language == nullptr) {
return;
}
bool is_language_using_templates = language->is_using_templates();
template_menu->set_disabled(false);
template_menu->clear();
@ -628,15 +619,15 @@ void ScriptCreateDialog::_update_dialog() {
// Is script path/name valid (order from top to bottom)?
if (!is_built_in && !is_path_valid) {
validation_panel->set_message(MSG_ID_SCRIPT, TTRC("Invalid path."), EditorValidationPanel::MSG_ERROR);
validation_panel->set_message(MSG_ID_SCRIPT, TTR("Invalid path."), EditorValidationPanel::MSG_ERROR);
}
if (!is_parent_name_valid && is_new_script_created) {
validation_panel->set_message(MSG_ID_SCRIPT, TTRC("Invalid inherited parent name or path."), EditorValidationPanel::MSG_ERROR);
validation_panel->set_message(MSG_ID_SCRIPT, TTR("Invalid inherited parent name or path."), EditorValidationPanel::MSG_ERROR);
}
if (validation_panel->is_valid() && !is_new_script_created) {
validation_panel->set_message(MSG_ID_SCRIPT, TTRC("File exists, it will be reused."), EditorValidationPanel::MSG_OK);
validation_panel->set_message(MSG_ID_SCRIPT, TTR("File exists, it will be reused."), EditorValidationPanel::MSG_OK);
}
if (!is_built_in && !path_error.is_empty()) {
@ -666,9 +657,9 @@ void ScriptCreateDialog::_update_dialog() {
// Is Script created or loaded from existing file?
if (is_built_in) {
validation_panel->set_message(MSG_ID_BUILT_IN, TTRC("Note: Built-in scripts have some limitations and can't be edited using an external editor."), EditorValidationPanel::MSG_INFO, false);
validation_panel->set_message(MSG_ID_BUILT_IN, TTR("Note: Built-in scripts have some limitations and can't be edited using an external editor."), EditorValidationPanel::MSG_INFO, false);
} else if (file_path->get_text().get_file().get_basename() == parent_name->get_text()) {
validation_panel->set_message(MSG_ID_BUILT_IN, TTRC("Warning: Having the script name be the same as a built-in type is usually not desired."), EditorValidationPanel::MSG_WARNING, false);
validation_panel->set_message(MSG_ID_BUILT_IN, TTR("Warning: Having the script name be the same as a built-in type is usually not desired."), EditorValidationPanel::MSG_WARNING, false);
}
path_controls[0]->set_visible(!is_built_in);
@ -687,16 +678,16 @@ void ScriptCreateDialog::_update_dialog() {
if (is_new_file) {
if (is_built_in) {
validation_panel->set_message(MSG_ID_PATH, TTRC("Built-in script (into scene file)."), EditorValidationPanel::MSG_OK);
validation_panel->set_message(MSG_ID_PATH, TTR("Built-in script (into scene file)."), EditorValidationPanel::MSG_OK);
}
} else {
template_inactive_message = TTRC("Using existing script file.");
if (load_enabled) {
if (is_path_valid) {
validation_panel->set_message(MSG_ID_PATH, TTRC("Will load an existing script file."), EditorValidationPanel::MSG_OK);
validation_panel->set_message(MSG_ID_PATH, TTR("Will load an existing script file."), EditorValidationPanel::MSG_OK);
}
} else {
validation_panel->set_message(MSG_ID_PATH, TTRC("Script file already exists."), EditorValidationPanel::MSG_ERROR);
validation_panel->set_message(MSG_ID_PATH, TTR("Script file already exists."), EditorValidationPanel::MSG_ERROR);
}
}
@ -852,7 +843,7 @@ String ScriptCreateDialog::_get_script_origin_label(const ScriptLanguage::Templa
void ScriptCreateDialog::_bind_methods() {
ClassDB::bind_method(D_METHOD("config", "inherits", "path", "built_in_enabled", "load_enabled"), &ScriptCreateDialog::config, DEFVAL(true), DEFVAL(true));
ADD_SIGNAL(MethodInfo("script_created", PropertyInfo(Variant::OBJECT, "script", PROPERTY_HINT_RESOURCE_TYPE, Script::get_class_static())));
ADD_SIGNAL(MethodInfo("script_created", PropertyInfo(Variant::OBJECT, "script", PROPERTY_HINT_RESOURCE_TYPE, "Script")));
}
ScriptCreateDialog::ScriptCreateDialog() {
@ -869,8 +860,8 @@ ScriptCreateDialog::ScriptCreateDialog() {
/* Information Messages Field */
validation_panel = memnew(EditorValidationPanel);
validation_panel->add_line(MSG_ID_SCRIPT, TTRC("Script path/name is valid."));
validation_panel->add_line(MSG_ID_PATH, TTRC("Will create a new script file."));
validation_panel->add_line(MSG_ID_SCRIPT, TTR("Script path/name is valid."));
validation_panel->add_line(MSG_ID_PATH, TTR("Will create a new script file."));
validation_panel->add_line(MSG_ID_BUILT_IN);
validation_panel->add_line(MSG_ID_TEMPLATE);
validation_panel->set_update_callback(callable_mp(this, &ScriptCreateDialog::_update_dialog));
@ -906,18 +897,8 @@ ScriptCreateDialog::ScriptCreateDialog() {
default_language = i;
}
}
if (ScriptServer::get_language_count() == 0) {
// Edge Case 1: No scripting languages exist at all.
get_ok_button()->set_disabled(true); // Explicitly disable the confirmation button to prevent downstream crashes.
language_menu->set_disabled(true);
language_menu->set_auto_translate_mode(AUTO_TRANSLATE_MODE_ALWAYS);
language_menu->add_item(TTR("No Scripting Languages Available"));
} else if (default_language >= 0) {
// Normal Case: GDScript is available, select it.
if (default_language >= 0) {
language_menu->select(default_language);
} else {
// Edge Case 2: Languages exist (like C#), but GDScript is disabled.
language_menu->select(0);
}
language_menu->connect(SceneStringName(item_selected), callable_mp(this, &ScriptCreateDialog::_language_changed));