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

Usability methods for RenderTargets and image handles #10736

Merged

Conversation

torsteingrindvik
Copy link
Contributor

@torsteingrindvik torsteingrindvik commented Nov 25, 2023

Objective

In my code I use a lot of images as render targets.
I'd like some convenience methods for working with this type.

Solution

  • Allow .into() to construct a RenderTarget
  • Add .as_image()

Changelog

Added

  • RenderTarget can be constructed via .into() on a Handle<Image>
  • RenderTarget new method: as_image

Signed-off-by: Torstein Grindvik <torstein.grindvik@muybridge.com>
@alice-i-cecile alice-i-cecile added A-Rendering Drawing game state to the screen C-Usability A targeted quality-of-life change that makes Bevy easier to use labels Nov 26, 2023
@alice-i-cecile alice-i-cecile changed the title RenderTarget image handle additions Usability methods for RenderTargets and image handles Nov 26, 2023
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.

Not totally sold on having an infallible version here, but that's fine.

@torsteingrindvik
Copy link
Contributor Author

Not totally sold on having an infallible version here, but that's fine.

I was on the fence myself but included it due to Bevy having several APIs which panic if user assumptions fail: get_resource vs resource, get_sub_app vs sub_app etc.

But it's not that important to have so let me know if you'd rather have me remove it.

@alice-i-cecile
Copy link
Member

Yeah let's remove it. We tend to include them only in cases where it's a) very hard to accidentally panic b) the API is very high-traffic.

Torstein Grindvik added 2 commits November 28, 2023 10:28
Signed-off-by: Torstein Grindvik <torstein.grindvik@muybridge.com>
Signed-off-by: Torstein Grindvik <torstein.grindvik@muybridge.com>
@torsteingrindvik
Copy link
Contributor Author

Yeah let's remove it. We tend to include them only in cases where it's a) very hard to accidentally panic b) the API is very high-traffic.

That makes sense to me.
Changed it now

Copy link
Contributor

@thepackett thepackett left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@alice-i-cecile 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 Jan 4, 2024
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Jan 4, 2024
Merged via the queue into bevyengine:main with commit 99c43fa Jan 4, 2024
23 checks passed
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 C-Usability A targeted quality-of-life change that makes Bevy easier to use 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.

3 participants