You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Merge pull request #110323 from bruvzg/csv_text
Open translation CSV in the text editor instead of printing errors.
This commit is contained in:
@@ -1556,7 +1556,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);
|
||||
@@ -7912,6 +7917,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);
|
||||
|
||||
@@ -477,6 +477,7 @@ private:
|
||||
SceneImportSettingsDialog *scene_import_settings = nullptr;
|
||||
AudioStreamImportSettingsDialog *audio_stream_import_settings = nullptr;
|
||||
|
||||
HashSet<String> force_textfile_extensions;
|
||||
HashSet<String> textfile_extensions;
|
||||
HashSet<String> other_file_extensions;
|
||||
HashSet<FileDialog *> file_dialogs;
|
||||
|
||||
Reference in New Issue
Block a user