-
-
Notifications
You must be signed in to change notification settings - Fork 22.1k
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
Create .uid files in EditorFileSystem #101650
Conversation
} else { | ||
if (ResourceLoader::exists(file) && !ResourceLoader::has_custom_uid_support(file) && !FileAccess::exists(file + ".uid")) { | ||
Ref<FileAccess> f = FileAccess::open(file + ".uid", FileAccess::WRITE); | ||
if (f.is_valid()) { | ||
const ResourceUID::ID id = ResourceUID::get_singleton()->create_id(); | ||
ResourceUID::get_singleton()->add_id(id, file); | ||
f->store_line(ResourceUID::get_singleton()->id_to_text(id)); | ||
fi->uid = id; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The actual fix is here. The changes around are because of the fi
variable.
This comment was marked as resolved.
This comment was marked as resolved.
339ddb9
to
948bff0
Compare
It seems to solve the original problem. 👍 However (and I don't know if it's in the scope of this PR), when a script is moved, its path in the scene does not change. Which mean that if the original resource moved, the button "open script" will open a new file. The path never changes, even after scene reload or editor restart. |
@geowarin I can't reproduce this problem, both with and without this PR, so it's likely unrelated. Open a new issue. |
Except for the little comment above, everything looks good. |
948bff0
to
aa3048a
Compare
aa3048a
to
8aa3ee6
Compare
Thanks! |
Fixes #101591
Turns out the
ensure_uid_file()
method I once added was wrong, because EditorFileSystem has its own uid cache. The bug occured, because the new UID was not registered in the EditorFileSystem, which is used by ResourceSaver to determine UIDs when saving.I fixed the bug for scripts and shaders, but I see more places where FileInfo is created. There might be some edge case where either UID is not registered or .uid file is not created, idk.