-
-
Notifications
You must be signed in to change notification settings - Fork 21.9k
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
CSV import: Generate positive UID for .translation and follow renames #103120
Conversation
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.
Looks correct, but the comments above should be addressed.
7131b52
to
bb5bf26
Compare
Added an if to avoid a redundant set_uid. The way I'm resolving the conflict here is to prefer saving to whatever path has the matching uid, rather than generating a new uid. I think the usecase is users might move their generated .translation files to a folder, and that should be okay now since the UID for a given .translation is deterministic. Re: real collision, we're talking 1 in 2^64 per file. I think the probability is something like if every human on earth made a few Godot projects for the next 100 years, you might get one collision ever. My opinion is this is not worth worrying about, since the consequence of a UID collision in the worst case is also not too bad. Also, this risk affects all code using UIDs, not just translation. Rather than add a special case for 1 in 2^64 collision, we should change ResourceUID or ResourceSaver to emit an error if a collision is detected or uid:// or any other type of UID mismatch happens, which would have caught this bug much sooner. |
Mask with INT64_MAX to avoid negative UIDs which cause bugs. If the generated .translation UID is already in use (renamed), overwrite that file instead.
bb5bf26
to
f2ad430
Compare
Thanks! |
oh, .translation files generates .uid files? these files are tipically ignored in git because they are autogenerated from csv 🤔 but makes total sense to ensure the uid remains unique across different devices never tought of it👍 |
Fixes #103118
Mask with INT64_MAX to avoid negative UIDs which cause bugs.
If the generated .translation UID is already in use (renamed), overwrite that file instead.