-
-
Notifications
You must be signed in to change notification settings - Fork 101
Description
Describe the project you are working on
This is a followup proposal about how Godot should store uid's
Describe the problem or limitation you are having in your project
I wrote this proposal based on the outcome of #4603 (comment)
With Godot 4.4-dev5, the UID files are created for each resource in the file system, which clutters the file system.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Background
The main reason is to support users who deliberately or unknowingly destroy their projects by moving or renaming resources that are dependent on scenes.
dev5 state
Moreover, introducing UIDs files won't help when users improperly handle their project resources.
Here's a small example that reduces this solution to absurdity:
To hide the UID files in VS or Rider as suggested here, moving individual resources would result in the UID files remaining in their old location.
This completely breaks this solution, and worse, when Godot restarts, a new UID is created while the original UID remains as a corpse in the filesystem.
Additionally, UIDs are being created for all resources and scripts, regardless of whether they are referenced by a scene.
Case study
I use Rider and restructure my project by moving scenes and associated scripts to other directories and renaming them if necessary.
This has no effect within Rider, the scripts are still valid and no error message about invalid script references in the scenes is displayed.
To test the scene, a Godot instance is started to execute the scene, but this would end with an error on invalid script path reference.
This means that Godot must ALWAYS first check all references in scenes when starting.
To resolve missing or invalid references, Godot must scan the file system and redefine the references.
So far so correct?
I would therefore suggest a service that A is executed when Godot is started and B is scheduled as a task at regular intervals.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
Implementation Strategy
The service should maintain file consistency through similarity matching:
File Tracking
- Create hash index of all script/resource files
- Parse scenes to extract script references
- Store original paths and relationships in one meta file (+ save copy)
Change Detection
- Scan the filesystem periodically
- Compare file contents using Jaccard similarity:
similarity = |A ∩ B| / |A ∪ B|
where A,B are sets of code lines - Threshold of 0.8 (80%) for match detection
- Prioritize paths with similar names/structure
Reference Management
- Update internal mapping on changes are detected
- Modify scene references automatically
- Keep backup of original paths
- Log all modifications
Error Handling
- Validate new references
- Enable rollback if needed
- Notify users of changes
- Provide manual override option
The service runs silently in editor background, only surfacing when user attention is required for ambiguous cases.
If this enhancement will not be used often, can it be worked around with a few lines of script?
--
Is there a reason why this should be core and not an add-on in the asset library?
handling uids are part of the core