From 83de94f9f93d44cbb71250bf8b22d2876df2c754 Mon Sep 17 00:00:00 2001 From: Nicola Papale Date: Sun, 11 Jun 2023 01:19:39 +0200 Subject: [PATCH] Register a few missed reflect components (#8807) # Objective - Some reflect components weren't properly registered. ## Solution - We register them - I also sorted the register lines in `Plugin::build` in `bevy_ui` ### Note How I did I find them: - I picked up the list of `Component`s from the `Component` trait page in rustdoc. - Then I tried to register all of them. Removing the registration when it doesn't implement `Reflect` to pass compilation. - Then I added `app.register_type_data::()`, for all Reflect components. It panics if `T` is not registered. - I repeated the last line N times until bevy stopped panicking at startup --- ## Changelog - Register the following components: `PrimaryWindow` `Fxaa` `FogSettings` `NotShadowCaster` `NotShadowReceiver` `CalculatedClip` `RelativeCursorPosition` --- crates/bevy_core_pipeline/src/fxaa/mod.rs | 1 + crates/bevy_pbr/src/lib.rs | 2 ++ crates/bevy_pbr/src/render/fog.rs | 1 + crates/bevy_ui/src/lib.rs | 12 +++++++----- crates/bevy_window/src/lib.rs | 1 + 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/crates/bevy_core_pipeline/src/fxaa/mod.rs b/crates/bevy_core_pipeline/src/fxaa/mod.rs index 28dfd35966..4ddcb84e21 100644 --- a/crates/bevy_core_pipeline/src/fxaa/mod.rs +++ b/crates/bevy_core_pipeline/src/fxaa/mod.rs @@ -86,6 +86,7 @@ impl Plugin for FxaaPlugin { fn build(&self, app: &mut App) { load_internal_asset!(app, FXAA_SHADER_HANDLE, "fxaa.wgsl", Shader::from_wgsl); + app.register_type::(); app.add_plugin(ExtractComponentPlugin::::default()); let render_app = match app.get_sub_app_mut(RenderApp) { diff --git a/crates/bevy_pbr/src/lib.rs b/crates/bevy_pbr/src/lib.rs index cf33d33e33..9cbed8922c 100644 --- a/crates/bevy_pbr/src/lib.rs +++ b/crates/bevy_pbr/src/lib.rs @@ -174,6 +174,8 @@ impl Plugin for PbrPlugin { .register_type::() .register_type::() .register_type::() + .register_type::() + .register_type::() .register_type::() .register_type::() .register_type::() diff --git a/crates/bevy_pbr/src/render/fog.rs b/crates/bevy_pbr/src/render/fog.rs index efa9a4c15f..bd58605899 100644 --- a/crates/bevy_pbr/src/render/fog.rs +++ b/crates/bevy_pbr/src/render/fog.rs @@ -137,6 +137,7 @@ impl Plugin for FogPlugin { fn build(&self, app: &mut App) { load_internal_asset!(app, FOG_SHADER_HANDLE, "fog.wgsl", Shader::from_wgsl); + app.register_type::(); app.add_plugin(ExtractComponentPlugin::::default()); if let Ok(render_app) = app.get_sub_app_mut(RenderApp) { diff --git a/crates/bevy_ui/src/lib.rs b/crates/bevy_ui/src/lib.rs index 3cc3c9b157..b48e771449 100644 --- a/crates/bevy_ui/src/lib.rs +++ b/crates/bevy_ui/src/lib.rs @@ -88,35 +88,37 @@ impl Plugin for UiPlugin { .register_type::() .register_type::() .register_type::() + .register_type::() + .register_type::() .register_type::() .register_type::() .register_type::() .register_type::() .register_type::() + .register_type::() .register_type::() .register_type::() .register_type::() - .register_type::() - .register_type::() .register_type::() .register_type::() .register_type::() .register_type::() .register_type::() - .register_type::() // NOTE: used by Style::aspect_ratio .register_type::>() .register_type::() .register_type::() .register_type::() - .register_type::() + .register_type::() + .register_type::() .register_type::