Skip to content

Subasset Aliases #17984

Open
Open
@andriyDev

Description

@andriyDev

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 AssetLoaders 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:

let handle = asset_server.register_alias::<Animation>("dance_animation");

let other_handle = asset_server.load::<Animation>("dance_animation");
assert_eq!(handle, other_handle);

let target_handle = asset_server.load::<Animation>("some/internal/file/path.gltf#Animation1337");
asset_server.set_alias(handle, target_handle);
// `other_handle` refers to `target_handle`s animation when it loads.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-AssetsLoad files from disk to use for things like images, models, and soundsC-FeatureA new feature, making something new possibleD-ComplexQuite challenging from either a design or technical perspective. Ask for help!S-Needs-DesignThis issue requires design work to think about how it would best be accomplished

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions