Skip to content
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

Deprecate LoadAndSave Asset Processor #15090

Conversation

bushrat011899
Copy link
Contributor

Objective

Solution

  • Added IdentityAssetTransformer<A> which is an AssetTransformer which infallibly returns the input Asset unmodified.
  • Replaced LoadAndSave and LoadAndSaveSettings with type definitions linking back to LoadTransformAndSave and LoadTransformAndSaveSettings respectively.
  • Marked LoadAndSave and LoadAndSaveSettings as depreciated with a migration guide included, hinting to the user to use the underlying type instead.

Testing

  • Ran CI locally

Migration Guide

  • Replace LoadAndSave<L, S> with LoadTransformAndSave<L, IdentityAssetTransformer<<L as AssetLoader>::Asset>, S>
  • Replace LoadAndSaveSettings<L, S> with LoadTransformAndSaveSettings<L, (), S>

Replaced `LoadAndSave` and `LoadAndSaveSettings` with type definitions linking back to `LoadTransformAndSave` and `LoadTransformAndSaveSettings` respectively. These type definitions have then been marked as depreciated to encourage users to transition to the underlying type.
@bushrat011899 bushrat011899 added A-Assets Load files from disk to use for things like images, models, and sounds C-Usability A targeted quality-of-life change that makes Bevy easier to use M-Needs-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Sep 8, 2024
Copy link
Member

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to make this a bit more discoverable in the docs, but I agree with this direction :)

Copy link
Contributor

@JMS55 JMS55 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved once Alice's comments on docs are addressed

crates/bevy_render/src/texture/mod.rs Show resolved Hide resolved
crates/bevy_asset/src/transformer.rs Show resolved Hide resolved
@alice-i-cecile
Copy link
Member

I think that adding the IdentityAssetTransformer is nice for an easy migration path, and there are cases (e.g. file format conversion) where you may want to simply glue together a prewritten loader and a prewritten saver.

Explicitly linking to `IdentityAssetTransformer` and explaining under what circumstances you may wish to use it.
Copy link
Member

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice docs; I particularly like the advice on refactoring to split apart asset transformation.

@alice-i-cecile alice-i-cecile added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Sep 8, 2024
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Sep 9, 2024
@alice-i-cecile alice-i-cecile changed the title Depreciate LoadAndSave Asset Processor Deprecate LoadAndSave Asset Processor Sep 9, 2024
Merged via the queue into bevyengine:main with commit dac4a5b Sep 9, 2024
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Assets Load files from disk to use for things like images, models, and sounds C-Usability A targeted quality-of-life change that makes Bevy easier to use D-Straightforward Simple bug fixes and API improvements, docs, test and examples M-Needs-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deprecate LoadAndSave asset processor
3 participants