-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Move TextureAtlas
and friends into bevy_image
#17219
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kristoff3r
approved these changes
Jan 7, 2025
eero-lehtinen
approved these changes
Jan 7, 2025
ickshonpe
approved these changes
Jan 7, 2025
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'd like to remove the bevy_sprite
dependency from bevy_ui
completely as well, this seems like a good first step.
Don't see any problems with these changes, all the examples still work fine.
alice-i-cecile
approved these changes
Jan 7, 2025
mrchantey
pushed a commit
to mrchantey/bevy
that referenced
this pull request
Feb 4, 2025
# Objective - Allow other crates to use `TextureAtlas` and friends without needing to depend on `bevy_sprite`. - Specifically, this allows adding `TextureAtlas` support to custom cursors in bevyengine#17121 by allowing `bevy_winit` to depend on `bevy_image` instead of `bevy_sprite` which is a [non-starter]. [non-starter]: bevyengine#17121 (comment) ## Solution - Move `TextureAtlas`, `TextureAtlasBuilder`, `TextureAtlasSources`, `TextureAtlasLayout` and `DynamicTextureAtlasBuilder` into `bevy_image`. - Add a new plugin to `bevy_image` named `TextureAtlasPlugin` which allows us to register `TextureAtlas` and `TextureAtlasLayout` which was previously done in `SpritePlugin`. Since `SpritePlugin` did the registration previously, we just need to make it add `TextureAtlasPlugin`. ## Testing - CI builds it. - I also ran multiple examples which hopefully covered any issues: ``` $ cargo run --example sprite $ cargo run --example text $ cargo run --example ui_texture_atlas $ cargo run --example sprite_animation $ cargo run --example sprite_sheet $ cargo run --example sprite_picking ``` --- ## Migration Guide The following types have been moved from `bevy_sprite` to `bevy_image`: `TextureAtlas`, `TextureAtlasBuilder`, `TextureAtlasSources`, `TextureAtlasLayout` and `DynamicTextureAtlasBuilder`. If you are using the `bevy` crate, and were importing these types directly (e.g. before `use bevy::sprite::TextureAtlas`), be sure to update your import paths (e.g. after `use bevy::image::TextureAtlas`) If you are using the `bevy` prelude to import these types (e.g. `use bevy::prelude::*`), you don't need to change anything. If you are using the `bevy_sprite` subcrate, be sure to add `bevy_image` as a dependency if you do not already have it, and be sure to update your import paths.
github-merge-queue bot
pushed a commit
that referenced
this pull request
Mar 18, 2025
# Objective - #17219 introduced a circular dependency between bevy_image and bevy_sprite for documentation ## Solution - Remove the circular dependency - Simplify the doc example
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-Rendering
Drawing game state to the screen
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Objective
TextureAtlas
and friends without needing to depend onbevy_sprite
.TextureAtlas
support to custom cursors in Support texture atlases in CustomCursor::Image #17121 by allowingbevy_winit
to depend onbevy_image
instead ofbevy_sprite
which is a non-starter.Solution
TextureAtlas
,TextureAtlasBuilder
,TextureAtlasSources
,TextureAtlasLayout
andDynamicTextureAtlasBuilder
intobevy_image
.bevy_image
namedTextureAtlasPlugin
which allows us to registerTextureAtlas
andTextureAtlasLayout
which was previously done inSpritePlugin
. SinceSpritePlugin
did the registration previously, we just need to make it addTextureAtlasPlugin
.Testing
Migration Guide
The following types have been moved from
bevy_sprite
tobevy_image
:TextureAtlas
,TextureAtlasBuilder
,TextureAtlasSources
,TextureAtlasLayout
andDynamicTextureAtlasBuilder
.If you are using the
bevy
crate, and were importing these types directly (e.g. beforeuse bevy::sprite::TextureAtlas
), be sure to update your import paths (e.g. afteruse bevy::image::TextureAtlas
)If you are using the
bevy
prelude to import these types (e.g.use bevy::prelude::*
), you don't need to change anything.If you are using the
bevy_sprite
subcrate, be sure to addbevy_image
as a dependency if you do not already have it, and be sure to update your import paths.