-
Notifications
You must be signed in to change notification settings - Fork 5
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
How to capture 1 frame? #2
Comments
Hi, if you just want to export a single frame you might be better of using Bevy’s internal |
Thanks for replying! |
So you’re saying, |
Oh, I'm sorry. I made a mistake.
My code is here:
So I tried to use resource to change state after spawn, but |
The issue is that you are attempting to despawn the entity on the same frame you are spawning it on. You have to wait one iteration for Bevy to add the entity to the #[derive(Component)]
pub struct ExportBundleMarker;
pub fn save_image(
mut commands: Commands,
mut export_sources: ResMut<Assets<ImageExportSource>>,
output_texture: ResMut<TextureHandle>,
input: Res<Input<KeyCode>>,
export_bundles: Query<Entity, With<ExportBundleMarker>>,
) {
if input.just_pressed(KeyCode::Space) {
commands.spawn((
ImageExportBundle {
source: export_sources.add(output_texture.texture.clone().into()),
settings: ImageExportSettings {
extension: "exr".into(),
..default()
},
},
ExportBundleMarker,
));
}
for bundle in &export_bundles {
commands.entity(bundle).despawn();
}
} You are currently exporting an HDR image (EXR), so please make sure to use |
On top of that, you forgot to add the |
Wow it works! Thank you for your kind explanation :) |
Hello, I want to render just one particular frame using bevy_image_export.
However, in this issue(#1) there is only a way to start and stop capturing.
Any hint is welcome!
The text was updated successfully, but these errors were encountered: