bevy icon indicating copy to clipboard operation
bevy copied to clipboard

Add support for loading sub-assets as if they were separate files.

Open yodaldevoid opened this issue 1 year ago • 1 comments

Objective

The current AssetServer system does not support loading assets from inside of container assets that have no way of knowing what they might contain such as zip files or Doom-style WAD files. This aims to add support for this style of asset storage.

Fixes #3319

Solution

This implementation adds a way to defer loading internal assets (a.k.a. sub-assets) from a container asset's (a.k.a. super-asset) AssetLoader. These deferred loads are then loaded using the existing Asset loading system once the container asset's AssetLoader returns.

This system required changes to the existing AssetPath to allow the system to determine both the sub-asset's path for Asset IDs and to determine the right AssetLoader and the super-asset path to determine the file on the filesystem backing the sub-asset.


Changelog

Added

  • Added sub-asset support to AssetPath
  • Added ability to register sub-assets from an AssetLoader

yodaldevoid avatar Nov 07 '22 03:11 yodaldevoid

The one remaining CI failure is not due to my changes.

In fact it seems to be due to a slow rollout of releases by the smol team.

Edit: See #6538

yodaldevoid avatar Nov 10 '22 00:11 yodaldevoid

More dependency errors from unrelated dependencies.

yodaldevoid avatar Dec 14 '22 02:12 yodaldevoid

Given that the asset system is in flux right now / will almost certainly be replaced soon, I think we should put a pause on this until we have more certainty about the direction of the asset system. I'm currently working on an experimental rewrite and I'll try to consider this use case as a part of that. Lets leave this PR open to ensure this scenario is captured somewhere and we can revisit in a few weeks.

cart avatar Dec 16 '22 01:12 cart