I could see how it could be useful, so my question would be how difficult would it be to add this as a feature. As you said, the engine can already read files from the package or directory, so it seems it wouldn't be too much work from the engine side.
As for the API, perhaps a Resource class could be introduced with a static method for look-up, and a global indexer:
Code: ags
This would avoid flooding the global namespace with more script o-names. The Resource* could then be used for:
Code: ags
Of course, with the asset manager the way it is it might make more sense (i.e., be simpler) to avoid having instances of resources altogether and just have a static Open method which returns null for non-existent resources. Just thought this type of API might give a better end-user representation of the resource files in the script (similar to how audio clips are represented).
Regarding what you said about populating the resources outside the editor, it would be relatively simple to add a Resources branch in the project tree, and a leaf could be added by selecting a file which would be cached in a similar fashion to AudioClips. The properties pane could be used to assign copy behavior (game or directory) and a name (defaulted to file name).
Overall it doesn't sound like a terrible addition to me. I was just thinking of a way the editor could allow the user to specify arbitrary files to copy to the Compiled folder (perhaps specifying platform too). This would definitely prove handy for that.
As for the API, perhaps a Resource class could be introduced with a static method for look-up, and a global indexer:
static Resource* Resource.GetResource(const string resourceName, [i]optional[/i] ResourceLocation=eResourceGameOrDirectory);
static int Resource.ResourceCount;
static Resource* Resources[];
This would avoid flooding the global namespace with more script o-names. The Resource* could then be used for:
File* Resource.Open();
readonly int ID;
readonly ResourceLocation Location;
readonly String Name;
Of course, with the asset manager the way it is it might make more sense (i.e., be simpler) to avoid having instances of resources altogether and just have a static Open method which returns null for non-existent resources. Just thought this type of API might give a better end-user representation of the resource files in the script (similar to how audio clips are represented).
Regarding what you said about populating the resources outside the editor, it would be relatively simple to add a Resources branch in the project tree, and a leaf could be added by selecting a file which would be cached in a similar fashion to AudioClips. The properties pane could be used to assign copy behavior (game or directory) and a name (defaulted to file name).
Overall it doesn't sound like a terrible addition to me. I was just thinking of a way the editor could allow the user to specify arbitrary files to copy to the Compiled folder (perhaps specifying platform too). This would definitely prove handy for that.