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

bevy_image not available with bevy default-features=false #16563

Open
KirmesBude opened this issue Nov 30, 2024 · 2 comments
Open

bevy_image not available with bevy default-features=false #16563

KirmesBude opened this issue Nov 30, 2024 · 2 comments
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior D-Straightforward Simple bug fixes and API improvements, docs, test and examples P-Compile-Failure A failure to compile Bevy apps S-Ready-For-Implementation This issue is ready for an implementation PR. Go for it!
Milestone

Comments

@KirmesBude
Copy link
Contributor

KirmesBude commented Nov 30, 2024

Bevy version

0.15.0

What you did

I am using Image and TextureFormatPixelInfo from bevy_image (respective bevy::image) and I want to only include only the relevant bevy parts by depending on bevy and setting deafult-features=false. rust-analyzer is suggesting the following import bevy::image::Image, but I get this error message when building:

error[E0432]: unresolved import `bevy::image`
  --> src/asset_loader.rs:11:5
   |
11 |     image::{Image, TextureFormatPixelInfo},
   |     ^^^^^ could not find `image` in `bevy`

For more information about this error, try `rustc --explain E0432`.
error: could not compile `bevy_titan` (lib) due to 1 previous error

What went wrong

I am not sure. There is no bevy_image feature, but I would have expected bevy_sprite (which is a feature I enable) to pull in bevy_image (and obviously I can still functionally use Image, just not directly because I can not import it).
See KirmesBude/bevy_titan@4c64775 for my specific reproducible issue.

Workaround: Enable any image feature e.g. "png"

@KirmesBude KirmesBude added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Nov 30, 2024
@BenjaminBrienen BenjaminBrienen added A-Rendering Drawing game state to the screen S-Ready-For-Implementation This issue is ready for an implementation PR. Go for it! P-Compile-Failure A failure to compile Bevy apps D-Straightforward Simple bug fixes and API improvements, docs, test and examples and removed S-Needs-Triage This issue needs to be labelled labels Nov 30, 2024
@mockersf mockersf added this to the 0.15.1 milestone Nov 30, 2024
@djeedai
Copy link
Contributor

djeedai commented Nov 30, 2024

+1, this blocks Hanabi.

onkoe added a commit to onkoe/bevy_atmosphere that referenced this issue Dec 4, 2024
NOTE: this currently uses the `png` feature in bevy, but that's not
needed! it only works around this issue:
bevyengine/bevy#16563
@cart
Copy link
Member

cart commented Dec 10, 2024

The problem is that we didn't wire up the optional bevy_image dependency to the top level bevy crate. This should definitely be fixed in a patch release. There is a better workaround than forcing a feature like png. Just add a manual dependency on bevy_internal and set the optional feature there.

[dependencies]
bevy = { version = "0.15", default-features = false }
bevy_internal = { version = "0.15", features = [ "bevy_image" ]}

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-Bug An unexpected or incorrect behavior D-Straightforward Simple bug fixes and API improvements, docs, test and examples P-Compile-Failure A failure to compile Bevy apps S-Ready-For-Implementation This issue is ready for an implementation PR. Go for it!
Projects
None yet
Development

No branches or pull requests

5 participants