Skip to content

Commit

Permalink
Fix reimporting textures after changing import project settings
Browse files Browse the repository at this point in the history
  • Loading branch information
akien-mga authored and Akeal committed Oct 16, 2024
1 parent f5a1d87 commit 83ccbce
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions editor/editor_file_system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ bool EditorFileSystem::_test_for_reimport(const String &p_path, bool p_only_impo
Error err;
Ref<FileAccess> f = FileAccess::open(p_path + ".import", FileAccess::READ, &err);

if (f.is_null()) { //no import file, do reimport
if (f.is_null()) { // No import file, reimport.
return true;
}

Expand Down Expand Up @@ -472,10 +472,15 @@ bool EditorFileSystem::_test_for_reimport(const String &p_path, bool p_only_impo
break;
} else if (err != OK) {
ERR_PRINT("ResourceFormatImporter::load - '" + p_path + ".import:" + itos(lines) + "' error '" + error_text + "'.");
return false; //parse error, try reimport manually (Avoid reimport loop on broken file)
// Parse error, skip and let user attempt manual reimport to avoid reimport loop.
return false;
}

if (!assign.is_empty()) {
if (assign == "valid" && value.operator bool() == false) {
// Invalid import (failed previous import), skip and let user attempt manual reimport to avoid reimport loop.
return false;
}
if (assign.begins_with("path")) {
to_check.push_back(value);
} else if (assign == "files") {
Expand All @@ -502,6 +507,11 @@ bool EditorFileSystem::_test_for_reimport(const String &p_path, bool p_only_impo
}
}

if (!ResourceFormatImporter::get_singleton()->are_import_settings_valid(p_path)) {
// Reimport settings are out of sync with project settings, reimport.
return true;
}

if (importer_name == "keep" || importer_name == "skip") {
return false; //keep mode, do not reimport
}
Expand Down

0 comments on commit 83ccbce

Please sign in to comment.