Subasset Aliases
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 171
Description
## What problem does this solve or what need does it fill?
Today, every subasset must have exactly one label. While this is unambiguous, there are some cases where it would be much more convenient to have multiple ways to identify a subasset. For example, GLTF subassets are referenced by index (e.g., `my.gltf#Mesh0/Primitive0`). While these are unique, it can be difficult to know what is the correct index, as much editors use names for meshes. It would be nice to say something like `my.gltf#MeshCharacterBody/Primitive0` or soemthing to that effect (where `CharacterBody` is the name of the mesh in the GLTF file).
## What solution would you like?
We should allow `AssetLoader`s to provide aliases for a subasset, and for loading an asset to "resolve" into a particular asset.
## What alternative(s) have you considered?
Figure out another way to "lookup" the correct subassets from GLTFs. This would likely mean hand-crafting a solution for each kind of asset that needs this feature.
Also, it would be nice if we could even extend this to regular assets. For example:
```rust
let handle = asset_server.register_alias::("dance_animation");
let other_handle = asset_server.load::("dance_animation");
assert_eq!(handle, other_handle);
let target_handle = asset_server.load::("some/internal/file/path.gltf#Animation1337");
asset_server.set_alias(handle, target_handle);
// `other_handle` refers to `target_handle`s animation when it loads.
```
Contributor guide
Research direction
Start by reading the `AssetLoader` and `asset_server` APIs named in the issue, and trace how subasset labels are currently used when loading assets. Done means loaders can provide subasset aliases and loading resolves them to the intended asset; the issue also raises aliases for regular assets, so clarify whether that broader scope is included.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- game-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100