1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Open translation CSV in the text editor instead of printing errors.

This commit is contained in:
Pāvels Nadtočajevs
2025-09-08 12:21:39 +03:00
parent 9283328fe7
commit 9318466183
2 changed files with 9 additions and 1 deletions

View File

@@ -1528,7 +1528,12 @@ Error EditorNode::load_resource(const String &p_resource, bool p_ignore_broken_d
Error err;
Ref<Resource> res;
if (ResourceLoader::exists(p_resource, "")) {
if (force_textfile_extensions.has(p_resource.get_extension())) {
res = ResourceCache::get_ref(p_resource);
if (res.is_null() || !res->is_class("TextFile")) {
res = ScriptEditor::get_singleton()->open_file(p_resource);
}
} else if (ResourceLoader::exists(p_resource, "")) {
res = ResourceLoader::load(p_resource, "", ResourceFormatLoader::CACHE_MODE_REUSE, &err);
} else if (textfile_extensions.has(p_resource.get_extension())) {
res = ScriptEditor::get_singleton()->open_file(p_resource);
@@ -7825,6 +7830,8 @@ EditorNode::EditorNode() {
other_file_extensions.insert(E);
}
force_textfile_extensions.insert("csv"); // CSV translation source, has `Translation` resource type, but not loadable as resource.
resource_preview = memnew(EditorResourcePreview);
add_child(resource_preview);
progress_dialog = memnew(ProgressDialog);