Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix reimporting assets with csv in the project #92320

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion core/io/resource_importer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,21 @@ Error ResourceFormatImporter::_get_path_and_type(const String &p_path, PathAndTy
}
#endif

if (r_path_and_type.path.is_empty() || r_path_and_type.type.is_empty()) {
if (r_path_and_type.type.is_empty()) {
return ERR_FILE_CORRUPT;
}
if (r_path_and_type.path.is_empty()) {
// Some importers may not write files to the .godot folder, so the path can be empty.
if (r_path_and_type.importer.is_empty()) {
return ERR_FILE_CORRUPT;
}

// It's only invalid if the extension for the importer is not empty.
Ref<ResourceImporter> importer = get_importer_by_name(r_path_and_type.importer);
if (importer.is_null() || !importer->get_save_extension().is_empty()) {
KoBeWi marked this conversation as resolved.
Show resolved Hide resolved
return ERR_FILE_CORRUPT;
}
}
return OK;
}

Expand Down
13 changes: 11 additions & 2 deletions editor/editor_file_system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2398,18 +2398,23 @@ void EditorFileSystem::reimport_files(const Vector<String> &p_files) {
int from = 0;
for (int i = 0; i < reimport_files.size(); i++) {
if (groups_to_reimport.has(reimport_files[i].path)) {
from = i + 1;
continue;
}

if (use_multiple_threads && reimport_files[i].threaded) {
if (i + 1 == reimport_files.size() || reimport_files[i + 1].importer != reimport_files[from].importer) {
if (i + 1 == reimport_files.size() || reimport_files[i + 1].importer != reimport_files[from].importer || groups_to_reimport.has(reimport_files[i + 1].path)) {
if (from - i == 0) {
// Single file, do not use threads.
pr.step(reimport_files[i].path.get_file(), i);
_reimport_file(reimport_files[i].path);
} else {
Ref<ResourceImporter> importer = ResourceFormatImporter::get_singleton()->get_importer_by_name(reimport_files[from].importer);
ERR_CONTINUE(!importer.is_valid());
if (importer.is_null()) {
ERR_PRINT(vformat("Invalid importer for \"%s\".", reimport_files[from].importer));
from = i + 1;
continue;
}

importer->import_threaded_begin();

Expand Down Expand Up @@ -2439,6 +2444,10 @@ void EditorFileSystem::reimport_files(const Vector<String> &p_files) {
} else {
pr.step(reimport_files[i].path.get_file(), i);
_reimport_file(reimport_files[i].path);

// We need to increment the counter, maybe the next file is multithreaded
// and doesn't have the same importer.
from = i + 1;
}
}

Expand Down
Loading