@export_file
need to allow you to keep the old behavior of setting it as res path instead of uid if desired (breaking change!)
#104379
Labels
Milestone
Tested versions
System information
Godot v4.4.stable (4c311cb) - Freedesktop SDK 24.08 (Flatpak runtime) on X11 - X11 display driver, Multi-window, 2 monitors - OpenGL 3 (Compatibility) - Mesa Intel(R) HD Graphics 5500 (BDW GT2) - Intel(R) Core(TM) i5-5300U CPU @ 2.30GHz (4 threads)
Issue description
The change to how
@export_file
works is a breaking change!I was relying on the res path structure (changing .ogg extension of an audio file to an external .mp3 on web platform, which I'm playing via JS to avoid the audio issues on single thread and to stream it out of the pck).
This is bad because there's no indication that the actual path is an uid now unless you inspect the tscn -- the inspector still shows it as a res path, and since it's a string type, of course you'd expect it to retain its previous behavior consistent with
@export_dir
.I can understand the reasoning for it is to update on refactoring, but I wish this was handled differently (e.g. keep track of it somehow, e.g. by adding a uid "metadata" instead of replacing it with a uid).
Since that's how it is now, please at least do these:
1. Document it properly
Docs for
@export_file
still say it's a "path to a file". An uid is not what one would expect from this wording.More importantly, please add this as a breaking change in Upgrading from Godot 4.3 to Godot 4.4 docs page.
2. Please let us decide if we want an uid or path
There's valid use cases for preferring a res path too!
If possible, I suggest adding a parameter on
@export_file
to keep the old behavior if desired. E.g:3. Add a project setting so we can choose the default mode
This would apply when
@export_file
doesn't specify the parameter, so we can keep the old behavior when upgrading to Godot 4.4.You can make it by res path by default (for upgrading projects) but set it to uid on new projects.
4. Please add clarity in the inspector
Add some UI in the inspector so we can know if its a uid or res path.
E.g. a checkbox so we can toggle between uid or res path.
Or if it's not toggleable directly, an icon that shows when it's actually an uid.
Or maybe show it as the uid and show the inferred res path on hover in a tooltip or below the field.
Steps to reproduce
Just make a script with
@export_file
and set a project file in the inspector.Look at the tscn and notice it's actually a uid, even though the inspector say it's a res path.
If you were relying on the previous behavior, your project will break on 4.4.
Example use cases that break:
Minimal reproduction project (MRP)
N/A
The text was updated successfully, but these errors were encountered: