Open comods opened 2 years ago
Did you check the ResourcePreloader node? It can be used to preload resources from the editor, without requiring anyone to edit a script to preload a new resource.
The ResourcePreloader node will not let you link to a folder nor auto-import any new files added to that folder.
ResourcePreloader.add_resource(path, preload(path))
In a script you still need to use preload to get the resource to add to ResourcePreloader, but there is no preload(path) that returns an array of the preloads of all non .import files in that folder.
Note: No scene, json, tres, nor any other file file was edited; only a new file was added. (Besides compiler auto-import magic which may update some files that humans are not suppose to edit directly.)
Note: There are no git merge conflicts when the art team just adds a file.
Describe the project you are working on
When doing Game Jams, artists should just be able to drop .png files into an folder and Godot should preload all ".png"s from the folder into an array for instancing later.
Describe the problem or limitation you are having in your project
During a Game Jam artists can't add new art.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
ResourceArray preloadDirectory(constPath: String, constExtension: String) const
This should do all the Godot Editor tricks that preload(constPathFileExt: String) does like
You want the "constExtension: String" argument (without the preceding ".") so that you don't preload ".import" files.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
Setup project for Game Jam.
Artists can now add png files to the art folder and they will be preloaded and used without any other changes to the project.
If this enhancement will not be used often, can it be worked around with a few lines of script?
Can't do Godot Editor tricks that preload(constPathFileExt: String) does.
Is there a reason why this should be core and not an add-on in the asset library?
For Game Jams and Prototyping, having this in core would improve work flow and conversion rate of new users. Why should new users have to learn the Asset system or learn to use Directory command chain (that warns new users you can mess it up without multiple correct error checks) just to preload a folder into an array?