-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
AssetIo::root_path
#2147
Comments
How do you propose handling |
It could be as simple as returning an Another solution would instead support something like pub fn load_folder_where<F>(dir: &Path, f: F) -> Result<Vec<HandleUntyped>, AssetServerError>
where
F: FnMut(&Path) -> bool To address the specific problem mentioned on discord. Though I'm in favor of the former. |
from the original discussion in discord, I think a nice solution would be to have a way to load only assets of a certain type from a folder |
When I brought this up on Discord initially, the goal was to allow for finer control over batch loaded assets. One of the other proposed ideas was to provide support for globbed paths (i.e. The envisioned use case would be an metadata load step at initialization. For example, building an metadata index of all available characters or levels in the game without loading them all into memory at startup. Example assets directory structure:
Having a metadata asset like a JSON/RON file that is loaded at startup and then points to where to load associated assets. In this example, When asset bundles/compressed archives are supported, this may be necessary to support a plug-and-play modding scheme. |
Currently |
WorkaroundCurrently it's possible to use the InterestI find that |
Sure, but If I want it to work with
Do you have an I/O example for which there might not be a root path to load resources? |
Well, for one, the meaning of Here I'm assuming you want to read whatever is in the |
Makes sense...
I assumed that using |
So I agree with you, instead of
|
What problem does this solve or what need does it fill?
It is useful to get the asset directory path however, currently this is only achievable via the
AssetServerSettings
which is a little unintuitive.What solution would you like?
The
AssetIo
trait should expose aroot_dir
function (or something similar to that nameasset_root_dir
) which returns a&Path
(orOption<&Path>
) to the asset directory.This spawned form this discussion.
It should also be noted that this would need to be based on #2123 since this PR exposes an
asset_io()
method onAssetServer
.What alternative(s) have you considered?
Use the
AssetServerSettings
resource or manually use "assets/" (though this is not reliable).Additional context
Ideally the API would be something like:
The text was updated successfully, but these errors were encountered: