Merge pull request #92972 from ogapo/pr/warn-on-duplicate-uids

Editor: Warn on UID duplicates
This commit is contained in:
Rémi Verschelde 2024-09-18 17:40:49 +02:00
commit 8ba3c2aeb4
No known key found for this signature in database
GPG Key ID: C3336907360768E1

View File

@ -1141,6 +1141,14 @@ void EditorFileSystem::_process_file_system(const ScannedDirectory *p_scan_dir,
if (fi->uid != ResourceUID::INVALID_ID) {
if (ResourceUID::get_singleton()->has_id(fi->uid)) {
// Restrict UID dupe warning to first-scan since we know there are no file moves going on yet.
if (first_scan) {
// Warn if we detect files with duplicate UIDs.
const String other_path = ResourceUID::get_singleton()->get_id_path(fi->uid);
if (other_path != path) {
WARN_PRINT(vformat("UID duplicate detected between %s and %s.", path, other_path));
}
}
ResourceUID::get_singleton()->set_id(fi->uid, path);
} else {
ResourceUID::get_singleton()->add_id(fi->uid, path);