You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
Universalize UID support in all resource types
Ensures all resource types support UIDs in a project. This is required to fix: * Scripts and many other resource types can't be referenced by UID and when refactored the references are lost. * Path export properties can't use UID for unsupported types. * Refactoring problems when files are moved outside the editor (this PR effectively fixes it). * Editor properly refreshing paths if they changed externally while opened (as example, git update). This needs to be addressed in a subsequent PR, but this one effectively sets the prerequisites. Resource types that do not support UID will get a .uid file appended to them (this includes .gd, .gdshader, .gdextension, etc. files).
This commit is contained in:
@@ -1259,6 +1259,15 @@ void EditorFileSystem::_process_file_system(const ScannedDirectory *p_scan_dir,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (fi->uid == ResourceUID::INVALID_ID && ResourceLoader::exists(path) && !ResourceLoader::has_custom_uid_support(path) && !FileAccess::exists(path + ".uid")) {
|
||||
// Create a UID.
|
||||
Ref<FileAccess> f = FileAccess::open(path + ".uid", FileAccess::WRITE);
|
||||
if (f.is_valid()) {
|
||||
fi->uid = ResourceUID::get_singleton()->create_id();
|
||||
f->store_line(ResourceUID::get_singleton()->id_to_text(fi->uid));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (fi->uid != ResourceUID::INVALID_ID) {
|
||||
|
||||
Reference in New Issue
Block a user