From 798e1c54986f564a1acca93d4bb85b53013583c1 Mon Sep 17 00:00:00 2001 From: andriyDev Date: Mon, 5 May 2025 16:56:22 -0700 Subject: [PATCH] Move initializing the `ScreenshotToScreenPipeline` to the `ScreenshotPlugin`. (#18524) # Objective - Minor cleanup. - This seems to have been introduced in #8336. There is no discussion about it I can see, there's no comment explaining why this is here and not in `ScreenshotPlugin`. This seems to have just been misplaced. ## Solution - Move this to the ScreenshotPlugin! ## Testing - The screenshot example still works at least on desktop. --- crates/bevy_render/src/view/window/mod.rs | 8 +------- crates/bevy_render/src/view/window/screenshot.rs | 1 + 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/crates/bevy_render/src/view/window/mod.rs b/crates/bevy_render/src/view/window/mod.rs index c3fc6e5516..9d94fdc7d1 100644 --- a/crates/bevy_render/src/view/window/mod.rs +++ b/crates/bevy_render/src/view/window/mod.rs @@ -21,7 +21,7 @@ use wgpu::{ pub mod screenshot; -use screenshot::{ScreenshotPlugin, ScreenshotToScreenPipeline}; +use screenshot::ScreenshotPlugin; pub struct WindowRenderPlugin; @@ -43,12 +43,6 @@ impl Plugin for WindowRenderPlugin { .add_systems(Render, prepare_windows.in_set(RenderSet::ManageViews)); } } - - fn finish(&self, app: &mut App) { - if let Some(render_app) = app.get_sub_app_mut(RenderApp) { - render_app.init_resource::(); - } - } } pub struct ExtractedWindow { diff --git a/crates/bevy_render/src/view/window/screenshot.rs b/crates/bevy_render/src/view/window/screenshot.rs index 6e223eedaf..5522f6d763 100644 --- a/crates/bevy_render/src/view/window/screenshot.rs +++ b/crates/bevy_render/src/view/window/screenshot.rs @@ -425,6 +425,7 @@ impl Plugin for ScreenshotPlugin { .init_resource::() .init_resource::() .init_resource::>() + .init_resource::() .add_systems(ExtractSchedule, extract_screenshots.ambiguous_with_all()) .add_systems( Render,