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

Missing registrations #11736

Merged
merged 6 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions crates/bevy_core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ fn register_rust_types(app: &mut App) {
.register_type::<HashSet<String>>()
.register_type::<Option<String>>()
.register_type::<Option<bool>>()
.register_type::<Option<f32>>()
Copy link
Member

Choose a reason for hiding this comment

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

Non-blocking: While we're here, we could also consider registering the ReflectSerialize and ReflectDeserialize for all of these Option types.

Copy link
Member

Choose a reason for hiding this comment

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

Also, it seems like the GetTypeRegistration impl for Option<T> doesn't register ReflectDefault when it definitely could. If you want, you could add that as well. But definitely not necessary for the sake of this PR.

Copy link
Member

Choose a reason for hiding this comment

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

Non-blocking: Should we also register other Option primitives? Like Option<usize>, etc.?

.register_type::<Option<f64>>()
.register_type::<Vec<f32>>()
.register_type::<Cow<'static, str>>()
.register_type::<Cow<'static, Path>>()
.register_type::<Duration>()
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_pbr/src/fog.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::ReflectComponent;
use bevy_ecs::prelude::*;
use bevy_math::Vec3;
use bevy_reflect::Reflect;
use bevy_reflect::{std_traits::ReflectDefault, Reflect};
use bevy_render::{color::Color, extract_component::ExtractComponent, prelude::Camera};

/// Configures the “classic” computer graphics [distance fog](https://en.wikipedia.org/wiki/Distance_fog) effect,
Expand Down Expand Up @@ -49,7 +49,7 @@ use bevy_render::{color::Color, extract_component::ExtractComponent, prelude::Ca
/// [`StandardMaterial`](crate::StandardMaterial) instances via the `fog_enabled` flag.
#[derive(Debug, Clone, Component, Reflect, ExtractComponent)]
#[extract_component_filter(With<Camera>)]
#[reflect(Component)]
#[reflect(Component, Default)]
pub struct FogSettings {
/// The color of the fog effect.
///
Expand Down
4 changes: 4 additions & 0 deletions crates/bevy_pbr/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,11 @@ impl Plugin for PbrPlugin {
.register_type::<PointLight>()
.register_type::<PointLightShadowMap>()
.register_type::<SpotLight>()
.register_type::<FogSettings>()
.register_type::<FogFalloff>()
.register_type::<ShadowFilteringMethod>()
.register_type::<ParallaxMappingMethod>()
.register_type::<OpaqueRendererMethod>()
.init_resource::<AmbientLight>()
.init_resource::<GlobalVisiblePointLights>()
.init_resource::<DirectionalLightShadowMap>()
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_pbr/src/light.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ impl Default for DirectionalLightShadowMap {
/// }.into();
/// ```
#[derive(Component, Clone, Debug, Reflect)]
#[reflect(Component)]
#[reflect(Component, Default)]
pub struct CascadeShadowConfig {
/// The (positive) distance to the far boundary of each cascade.
pub bounds: Vec<f32>,
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_render/src/view/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use crate::{
use bevy_app::{App, Plugin};
use bevy_ecs::prelude::*;
use bevy_math::{Mat4, UVec4, Vec3, Vec4, Vec4Swizzles};
use bevy_reflect::Reflect;
use bevy_reflect::{std_traits::ReflectDefault, Reflect};
use bevy_transform::components::GlobalTransform;
use bevy_utils::HashMap;
use std::sync::{
Expand Down Expand Up @@ -129,7 +129,7 @@ impl ExtractedView {

/// Configures basic color grading parameters to adjust the image appearance. Grading is applied just before/after tonemapping for a given [`Camera`](crate::camera::Camera) entity.
#[derive(Component, Reflect, Debug, Copy, Clone, ShaderType)]
#[reflect(Component)]
#[reflect(Component, Default)]
pub struct ColorGrading {
/// Exposure value (EV) offset, measured in stops.
pub exposure: f32,
Expand Down
2 changes: 0 additions & 2 deletions crates/bevy_ui/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,6 @@ impl Plugin for UiPlugin {
.register_type::<JustifyItems>()
.register_type::<JustifySelf>()
.register_type::<Node>()
// NOTE: used by Style::aspect_ratio
.register_type::<Option<f32>>()
.register_type::<Overflow>()
.register_type::<OverflowAxis>()
.register_type::<PositionType>()
Expand Down