-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Remove labeled_assets
from LoadedAsset
and ErasedLoadedAsset
#15481
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
Conversation
labeled_assets
from labeled_assets
from LoadedAsset
and ErasedLoadedAsset
ce7c284
to
8cc63f6
Compare
Just to make it clear what the rationale for this is. This makes implementing asset saving easier, since we don't need to deal with recursive types. We just have to borrow the root assets, and borrow the subassets and we're done. Without this PR, for each subasset, we'd need to create a new type like |
8cc63f6
to
27d20ba
Compare
Rebased after #15509. Nothing really affected. |
6ec0177
to
547a3df
Compare
Rebased since this PR was a little stale. I folded in the accidental doc comment fix into the first commit. |
547a3df
to
7a97f0a
Compare
Rebase after #15487 was merged, fairly trivial overall. This also had the funny side-effect that I could remove an |
a07a40e
to
69d600e
Compare
f930f32
to
d042534
Compare
This makes it clear that loaded assets are not recursive.
…"root" asset. Now that subassets can't have nested subassets, we can completely remove the `TransformedSubasset` type and just return a mutable borrow. It is now up to the asset to know how to link up the subassets.
This makes it much clearer when we access `complete_asset.asset` as opposed to `asset.asset` or `loaded_asset.asset`.
d042534
to
2b473ab
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like a reasonable change to me. Separating out concerns like this makes the total asset pipeline larger to comprehend, but overall simpler.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still mostly a bevy internals newbie, but I have been staring at the Asset code since yesterday and suspected that exactly this kind of refactor was possible. This looks like a bit improvement in clarity to me.
I've taken a look at this, and I'm relatively comfortable with what's going on here. I'd really like to see more tests and examples for assets to increase confidence in these sorts of changes, but the motivation here is really strong and I find this new model simpler to understand. Merging. |
…sset` (bevyengine#15481)" This reverts commit f176448.
# Objective - Fixes #18010. ## Solution - Revert the offending PRs! These are #15481 and #18013. We now no longer get an error if there are duplicate subassets. - In theory we could untangle #18013 from #15481, but that may be tricky, and may still introduce regressions. To avoid this worry (since we're already in RC mode), I am just reverting both. ## Testing - This is just a revert. --- ## Migration Guide <Remove the migration guides for #15481 and #18013> I will make a PR to the bevy_website repo after this is merged.
- Fixes #18010. - Revert the offending PRs! These are #15481 and #18013. We now no longer get an error if there are duplicate subassets. - In theory we could untangle #18013 from #15481, but that may be tricky, and may still introduce regressions. To avoid this worry (since we're already in RC mode), I am just reverting both. - This is just a revert. --- <Remove the migration guides for #15481 and #18013> I will make a PR to the bevy_website repo after this is merged.
Objective
Fixes #15417.
Solution
labeled_assets
fields fromLoadedAsset
andErasedLoadedAsset
.CompleteLoadedAsset
andCompleteErasedLoadedAsset
to hold thelabeled_subassets
.LoadContext::finish
ed, it produces aCompleteLoadedAsset
.CompleteLoadedAsset
is added to aLoadContext
(as a subasset), theirlabeled_assets
are merged, reporting any overlaps.One important detail to note: nested subassets with overlapping names could in theory have been used in the past for the purposes of asset preprocessing. Even though there was no way to access these "shadowed" nested subassets, asset preprocessing does get access to these nested subassets. This does not seem like a case we should support though. It is confusing at best.
Testing
Migration Guide
LoadedAsset
andErasedLoadedAsset
should be replaced withCompleteLoadedAsset
andCompleteErasedLoadedAsset
respectively.