Skip to content
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

Translation CSV importer produces invalid or duplicate UIDs #103118

Closed
lyuma opened this issue Feb 21, 2025 · 2 comments · Fixed by #103120
Closed

Translation CSV importer produces invalid or duplicate UIDs #103118

lyuma opened this issue Feb 21, 2025 · 2 comments · Fixed by #103120

Comments

@lyuma
Copy link
Contributor

lyuma commented Feb 21, 2025

Tested versions

  • Reproducible in all 4.4.beta (tested in 4.4beta4)
  • Not present in 4.3 or earlier.

System information

Godot v4.4.beta4 - Windows 10 (build 19045) - Single-window, 2 monitors - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3090 (NVIDIA; 32.0.15.6094) - Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz (16 threads)

Issue description

Two bugs with the translation csv importer. Both of these are regression in Godot 4.4 due to the new consistent UID hashing added in PR #97363

First, it can produce negative UIDs, which will serialize as uid://<invalid>. Negative UIDs are currently not permitted for text serialization, though they work fine in binary serialization.

Second, it does not check if the UID already exists in the project. This causes a few glitches which are hard to verify, for example referencing one file may reference the wrong copy (it might be random which gets referenced due to the nature of duplicate UIDs in Godot).

Also, note that reproducing this in a fresh project will not be obvious, because Godot caches incorrect UIDs due to a bug with how ResourceSaver::set_uid() interacts with the editor's UID cache. You must close the editor and delete .godot to observe the new UIDs. This whole thing with set_uid probably belongs in its own issue.

Steps to reproduce

  1. Open attached MRP.
  2. Open reference_duplicate_uid.tscn and press ctrl-s to resave scene.
  3. Open reference_duplicate_uid.tscnin text editor and note that bothtest_translation.es.translationandtest_translation.es_1.translation` have the same UIDs
  4. Open translation_ref.tscn and press ctrl-s to resave scene
  5. Check translation_ref.tscn in text editor and note uid://<invalid> for test_translation.en.translation

Optional steps to demonstrate that the invalid only happens on .tscn but not .scn:
6. Open translation_ref.scn and press ctrl-s to resave scene. This will not produce an invalid uid, but we cannot read this in a text editor.
7. Rename .en.translation outside godot and then open both translation_ref.scn and translation_ref.tscn The only occurs for .tscn because binary resources permit negative UIDs. The .scn version will update the reference correctly.

Minimal reproduction project (MRP)

translation_csv_uids.zip

@KoBeWi
Copy link
Member

KoBeWi commented Feb 21, 2025

note that bothtest_translation.es.translationandtest_translation.es_1.translation` have the same UIDs

Can't reproduce this one.

Image

@lyuma
Copy link
Contributor Author

lyuma commented Feb 21, 2025

.es might have been regenerated. Jf you rename .es to .es_2 then close godot and delete .godot, then es_1 and es_2 will have the same uid.

It is very confusing and hard to demonstrate due to the bug affecting uid_cache.bin when set_uid is used, but I was able to reproduce this on 4.4beta4 even if I did not document the steps exactly right
(I was able to see that the uid for .es_1 annd .es_2 are w801unt... and probably .es too if you clear the uid cache)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants