-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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 by Bors] - Added offset
parameter to TextureAtlas::from_grid_with_padding
#4836
Closed
Conversation
This file contains 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
More compatible with a fairly common format of padded sprite-sheets, in which half the padding value occurs before the first sprite box begins.
FraserLee
changed the title
Added
Added May 24, 2022
offset
parameter to TextureAtlas::from_grid_with_paddingoffset
parameter to TextureAtlas::from_grid_with_padding
forgot a trailing space
alice-i-cecile
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
labels
May 25, 2022
alice-i-cecile
added
the
M-Needs-Migration-Guide
A breaking change to Bevy's public API that needs to be noted in a migration guide
label
May 30, 2022
alice-i-cecile
requested changes
May 30, 2022
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.
Tiny doc nit for clarity, then this LGTM. This is technically a breaking change; can you add a tiny note for the migration guide?
@alice-i-cecile's suggestion, & one other of the same type.
I've edited the PR description. Lmk if there's anywhere else you'd like me to write a note for it :) |
bors r+ |
alice-i-cecile
added
the
S-Ready-For-Final-Review
This PR has been approved by the community. It's ready for a maintainer to consider merging it
label
May 30, 2022
alice-i-cecile
approved these changes
May 30, 2022
bors bot
pushed a commit
that referenced
this pull request
May 30, 2022
…4836) # Objective Increase compatibility with a fairly common format of padded spritesheets, in which half the padding value occurs before the first sprite box begins. The original behaviour falls out when `Vec2::ZERO` is used for `offset`. See below unity screenshot for an example of a spritesheet with padding ![Screen Shot 2022-05-24 at 4 11 49 PM](https://user-images.githubusercontent.com/30442265/170123682-287e5733-b69d-452b-b2e6-46d8d29293fb.png) ## Solution Tiny change to `crates/bevy_sprite/src/texture_atlas.rs` ## Migration Guide Calls to `TextureAtlas::from_grid_with_padding` should be modified to include a new parameter, which can be set to `Vec2::ZERO` to retain old behaviour. ```rust from_grid_with_padding(texture, tile_size, columns, rows, padding) | V from_grid_with_padding(texture, tile_size, columns, rows, padding, Vec2::ZERO) ``` Co-authored-by: FraserLee <[email protected]>
bors
bot
changed the title
Added
[Merged by Bors] - Added May 30, 2022
offset
parameter to TextureAtlas::from_grid_with_padding
offset
parameter to TextureAtlas::from_grid_with_padding
james7132
pushed a commit
to james7132/bevy
that referenced
this pull request
Jun 7, 2022
…evyengine#4836) # Objective Increase compatibility with a fairly common format of padded spritesheets, in which half the padding value occurs before the first sprite box begins. The original behaviour falls out when `Vec2::ZERO` is used for `offset`. See below unity screenshot for an example of a spritesheet with padding ![Screen Shot 2022-05-24 at 4 11 49 PM](https://user-images.githubusercontent.com/30442265/170123682-287e5733-b69d-452b-b2e6-46d8d29293fb.png) ## Solution Tiny change to `crates/bevy_sprite/src/texture_atlas.rs` ## Migration Guide Calls to `TextureAtlas::from_grid_with_padding` should be modified to include a new parameter, which can be set to `Vec2::ZERO` to retain old behaviour. ```rust from_grid_with_padding(texture, tile_size, columns, rows, padding) | V from_grid_with_padding(texture, tile_size, columns, rows, padding, Vec2::ZERO) ``` Co-authored-by: FraserLee <[email protected]>
bors bot
pushed a commit
that referenced
this pull request
Sep 24, 2022
…id through option arguments (#6057) This is an adoption of #3775 This merges `TextureAtlas` `from_grid_with_padding` into `from_grid` , adding optional padding and optional offset. Since the orignal PR, the offset had already been added to from_grid_with_padding through #4836 ## Changelog - Added `padding` and `offset` arguments to `TextureAtlas::from_grid` - Removed `TextureAtlas::from_grid_with_padding` ## Migration Guide `TextureAtlas::from_grid_with_padding` was merged into `from_grid` which takes two additional parameters for padding and an offset. ``` // 0.8 TextureAtlas::from_grid(texture_handle, Vec2::new(24.0, 24.0), 7, 1); // 0.9 TextureAtlas::from_grid(texture_handle, Vec2::new(24.0, 24.0), 7, 1, None, None) // 0.8 TextureAtlas::from_grid_with_padding(texture_handle, Vec2::new(24.0, 24.0), 7, 1, Vec2::new(4.0, 4.0)); // 0.9 TextureAtlas::from_grid(texture_handle, Vec2::new(24.0, 24.0), 7, 1, Some(Vec2::new(4.0, 4.0)), None) ``` Co-authored-by: olefish <[email protected]>
bors bot
pushed a commit
that referenced
this pull request
Sep 24, 2022
…id through option arguments (#6057) This is an adoption of #3775 This merges `TextureAtlas` `from_grid_with_padding` into `from_grid` , adding optional padding and optional offset. Since the orignal PR, the offset had already been added to from_grid_with_padding through #4836 ## Changelog - Added `padding` and `offset` arguments to `TextureAtlas::from_grid` - Removed `TextureAtlas::from_grid_with_padding` ## Migration Guide `TextureAtlas::from_grid_with_padding` was merged into `from_grid` which takes two additional parameters for padding and an offset. ``` // 0.8 TextureAtlas::from_grid(texture_handle, Vec2::new(24.0, 24.0), 7, 1); // 0.9 TextureAtlas::from_grid(texture_handle, Vec2::new(24.0, 24.0), 7, 1, None, None) // 0.8 TextureAtlas::from_grid_with_padding(texture_handle, Vec2::new(24.0, 24.0), 7, 1, Vec2::new(4.0, 4.0)); // 0.9 TextureAtlas::from_grid(texture_handle, Vec2::new(24.0, 24.0), 7, 1, Some(Vec2::new(4.0, 4.0)), None) ``` Co-authored-by: olefish <[email protected]>
james7132
pushed a commit
to james7132/bevy
that referenced
this pull request
Oct 19, 2022
…id through option arguments (bevyengine#6057) This is an adoption of bevyengine#3775 This merges `TextureAtlas` `from_grid_with_padding` into `from_grid` , adding optional padding and optional offset. Since the orignal PR, the offset had already been added to from_grid_with_padding through bevyengine#4836 ## Changelog - Added `padding` and `offset` arguments to `TextureAtlas::from_grid` - Removed `TextureAtlas::from_grid_with_padding` ## Migration Guide `TextureAtlas::from_grid_with_padding` was merged into `from_grid` which takes two additional parameters for padding and an offset. ``` // 0.8 TextureAtlas::from_grid(texture_handle, Vec2::new(24.0, 24.0), 7, 1); // 0.9 TextureAtlas::from_grid(texture_handle, Vec2::new(24.0, 24.0), 7, 1, None, None) // 0.8 TextureAtlas::from_grid_with_padding(texture_handle, Vec2::new(24.0, 24.0), 7, 1, Vec2::new(4.0, 4.0)); // 0.9 TextureAtlas::from_grid(texture_handle, Vec2::new(24.0, 24.0), 7, 1, Some(Vec2::new(4.0, 4.0)), None) ``` Co-authored-by: olefish <[email protected]>
james7132
pushed a commit
to james7132/bevy
that referenced
this pull request
Oct 28, 2022
…id through option arguments (bevyengine#6057) This is an adoption of bevyengine#3775 This merges `TextureAtlas` `from_grid_with_padding` into `from_grid` , adding optional padding and optional offset. Since the orignal PR, the offset had already been added to from_grid_with_padding through bevyengine#4836 ## Changelog - Added `padding` and `offset` arguments to `TextureAtlas::from_grid` - Removed `TextureAtlas::from_grid_with_padding` ## Migration Guide `TextureAtlas::from_grid_with_padding` was merged into `from_grid` which takes two additional parameters for padding and an offset. ``` // 0.8 TextureAtlas::from_grid(texture_handle, Vec2::new(24.0, 24.0), 7, 1); // 0.9 TextureAtlas::from_grid(texture_handle, Vec2::new(24.0, 24.0), 7, 1, None, None) // 0.8 TextureAtlas::from_grid_with_padding(texture_handle, Vec2::new(24.0, 24.0), 7, 1, Vec2::new(4.0, 4.0)); // 0.9 TextureAtlas::from_grid(texture_handle, Vec2::new(24.0, 24.0), 7, 1, Some(Vec2::new(4.0, 4.0)), None) ``` Co-authored-by: olefish <[email protected]>
ItsDoot
pushed a commit
to ItsDoot/bevy
that referenced
this pull request
Feb 1, 2023
…id through option arguments (bevyengine#6057) This is an adoption of bevyengine#3775 This merges `TextureAtlas` `from_grid_with_padding` into `from_grid` , adding optional padding and optional offset. Since the orignal PR, the offset had already been added to from_grid_with_padding through bevyengine#4836 ## Changelog - Added `padding` and `offset` arguments to `TextureAtlas::from_grid` - Removed `TextureAtlas::from_grid_with_padding` ## Migration Guide `TextureAtlas::from_grid_with_padding` was merged into `from_grid` which takes two additional parameters for padding and an offset. ``` // 0.8 TextureAtlas::from_grid(texture_handle, Vec2::new(24.0, 24.0), 7, 1); // 0.9 TextureAtlas::from_grid(texture_handle, Vec2::new(24.0, 24.0), 7, 1, None, None) // 0.8 TextureAtlas::from_grid_with_padding(texture_handle, Vec2::new(24.0, 24.0), 7, 1, Vec2::new(4.0, 4.0)); // 0.9 TextureAtlas::from_grid(texture_handle, Vec2::new(24.0, 24.0), 7, 1, Some(Vec2::new(4.0, 4.0)), None) ``` Co-authored-by: olefish <[email protected]>
ItsDoot
pushed a commit
to ItsDoot/bevy
that referenced
this pull request
Feb 1, 2023
…evyengine#4836) # Objective Increase compatibility with a fairly common format of padded spritesheets, in which half the padding value occurs before the first sprite box begins. The original behaviour falls out when `Vec2::ZERO` is used for `offset`. See below unity screenshot for an example of a spritesheet with padding ![Screen Shot 2022-05-24 at 4 11 49 PM](https://user-images.githubusercontent.com/30442265/170123682-287e5733-b69d-452b-b2e6-46d8d29293fb.png) ## Solution Tiny change to `crates/bevy_sprite/src/texture_atlas.rs` ## Migration Guide Calls to `TextureAtlas::from_grid_with_padding` should be modified to include a new parameter, which can be set to `Vec2::ZERO` to retain old behaviour. ```rust from_grid_with_padding(texture, tile_size, columns, rows, padding) | V from_grid_with_padding(texture, tile_size, columns, rows, padding, Vec2::ZERO) ``` Co-authored-by: FraserLee <[email protected]>
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
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
Increase compatibility with a fairly common format of padded spritesheets, in which half the padding value occurs before the first sprite box begins. The original behaviour falls out when
Vec2::ZERO
is used foroffset
.See below unity screenshot for an example of a spritesheet with padding
Solution
Tiny change to
crates/bevy_sprite/src/texture_atlas.rs
Migration Guide
Calls to
TextureAtlas::from_grid_with_padding
should be modified to include a new parameter, which can be set toVec2::ZERO
to retain old behaviour.