Move TextureAtlas and friends into bevy_image#17219
Merged
alice-i-cecile merged 3 commits intobevyengine:mainfrom Jan 7, 2025
Merged
Move TextureAtlas and friends into bevy_image#17219alice-i-cecile merged 3 commits intobevyengine:mainfrom
TextureAtlas and friends into bevy_image#17219alice-i-cecile merged 3 commits intobevyengine:mainfrom
Conversation
kristoff3r
approved these changes
Jan 7, 2025
eero-lehtinen
approved these changes
Jan 7, 2025
ickshonpe
approved these changes
Jan 7, 2025
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
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
TextureAtlasand friends without needing to depend onbevy_sprite.TextureAtlassupport to custom cursors in Support texture atlases in CustomCursor::Image #17121 by allowingbevy_winitto depend onbevy_imageinstead ofbevy_spritewhich is a non-starter.Solution
TextureAtlas,TextureAtlasBuilder,TextureAtlasSources,TextureAtlasLayoutandDynamicTextureAtlasBuilderintobevy_image.bevy_imagenamedTextureAtlasPluginwhich allows us to registerTextureAtlasandTextureAtlasLayoutwhich was previously done inSpritePlugin. SinceSpritePlugindid the registration previously, we just need to make it addTextureAtlasPlugin.Testing
Migration Guide
The following types have been moved from
bevy_spritetobevy_image:TextureAtlas,TextureAtlasBuilder,TextureAtlasSources,TextureAtlasLayoutandDynamicTextureAtlasBuilder.If you are using the
bevycrate, 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
bevyprelude to import these types (e.g.use bevy::prelude::*), you don't need to change anything.If you are using the
bevy_spritesubcrate, be sure to addbevy_imageas a dependency if you do not already have it, and be sure to update your import paths.