Skip to content

Commit

Permalink
Use Asset Path Extension for AssetLoader Disambiguation (#11644)
Browse files Browse the repository at this point in the history
# Objective

- Fixes #11638
- See
[here](#11638 (comment))
for details on the cause of this issue.

## Solution

- Modified `AssetLoaders` to capture possibility of multiple
`AssetLoader` registrations operating on the same `Asset` type, but
different extensions.
- Added an algorithm which will attempt to resolve via `AssetLoader`
name, then `Asset` type, then by extension. If at any point multiple
loaders fit a particular criteria, the next criteria is used as a tie
breaker.
  • Loading branch information
bushrat011899 authored Feb 12, 2024
1 parent 87add56 commit 7b5a4ec
Show file tree
Hide file tree
Showing 3 changed files with 884 additions and 167 deletions.
1 change: 1 addition & 0 deletions crates/bevy_asset/src/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ pub trait AssetLoader: Send + Sync + 'static {
) -> BoxedFuture<'a, Result<Self::Asset, Self::Error>>;

/// Returns a list of extensions supported by this [`AssetLoader`], without the preceding dot.
/// Note that users of this [`AssetLoader`] may choose to load files with a non-matching extension.
fn extensions(&self) -> &[&str] {
&[]
}
Expand Down
Loading

0 comments on commit 7b5a4ec

Please sign in to comment.