Skip to content

Commit 0f172b1

Browse files
committed
Merge pull request #94975 from akien-mga/fix-reimport-textures-with-changed-settings
Fix reimporting textures after changing import project settings
2 parents e2be29c + 5914023 commit 0f172b1

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

editor/editor_file_system.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ bool EditorFileSystem::_test_for_reimport(const String &p_path, bool p_only_impo
438438
Error err;
439439
Ref<FileAccess> f = FileAccess::open(p_path + ".import", FileAccess::READ, &err);
440440

441-
if (f.is_null()) { //no import file, do reimport
441+
if (f.is_null()) { // No import file, reimport.
442442
return true;
443443
}
444444

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

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

510+
if (!ResourceFormatImporter::get_singleton()->are_import_settings_valid(p_path)) {
511+
// Reimport settings are out of sync with project settings, reimport.
512+
return true;
513+
}
514+
505515
if (importer_name == "keep" || importer_name == "skip") {
506516
return false; //keep mode, do not reimport
507517
}

0 commit comments

Comments
 (0)