Skip to content

Commit

Permalink
Register inner types
Browse files Browse the repository at this point in the history
  • Loading branch information
MrGVSV committed Apr 29, 2023
1 parent 00174e0 commit 68dbb4f
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 23 deletions.
6 changes: 6 additions & 0 deletions bevy_proto_backend/src/impls/bevy_impls/core_pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ pub(super) fn register(app: &mut App) {
NormalPrepass,
Tonemapping
);

// Can be removed if https://github.com/bevyengine/bevy/pull/5781 is ever merged
app.register_type::<BloomPrefilterSettingsInput>()
.register_type::<BloomCompositeModeInput>()
.register_type::<ClearColorConfigInput>()
.register_type::<Camera3dDepthLoadOpInput>();
}

impl_external_schematic! {
Expand Down
3 changes: 3 additions & 0 deletions bevy_proto_backend/src/impls/bevy_impls/pbr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ pub(super) fn register(app: &mut App) {
SpotLight,
Wireframe,
);

// Can be removed if https://github.com/bevyengine/bevy/pull/5781 is ever merged
app.register_type::<FogFalloffInput>();
}

impl_external_schematic! {
Expand Down
4 changes: 4 additions & 0 deletions bevy_proto_backend/src/impls/bevy_impls/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ use bevy_proto_derive::impl_external_schematic;

pub(super) fn register(app: &mut App) {
register_schematic!(app, Text, Text2dBounds);

// Can be removed if https://github.com/bevyengine/bevy/pull/5781 is ever merged
app.register_type::<BreakLineOnInput>()
.register_type::<TextAlignmentInput>();
}

impl_external_schematic! {
Expand Down
20 changes: 0 additions & 20 deletions bevy_proto_backend/src/impls/bevy_impls/transform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,6 @@ pub(super) fn register(app: &mut App) {
register_schematic!(app, Transform, GlobalTransform);
}

// FIXME: `TransformBundle` does not impl `Reflect`
// impl_external_schematic! {
// #[schematic(from = TransformBundleInput)]
// struct TransformBundle {}
// // ---
// #[derive(Reflect, FromReflect)]
// pub struct TransformBundleInput {
// local: Transform,
// global: GlobalTransform
// }
// impl From<TransformBundleInput> for TransformBundle {
// fn from(value: TransformBundleInput) -> Self {
// Self {
// local: value.local,
// global: value.global
// }
// }
// }
// }

impl_external_schematic! {
struct Transform {}
}
Expand Down
24 changes: 22 additions & 2 deletions bevy_proto_backend/src/impls/bevy_impls/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use bevy::ui::{
PositionType, RelativeCursorPosition, Size, Style, UiImage, UiRect, Val, ZIndex,
};

use crate::impls::macros::{from_to_default, register_schematic};
use crate::impls::macros::{from_to, from_to_default, register_schematic};
use crate::proto::ProtoAsset;
use bevy_proto_derive::impl_external_schematic;

Expand All @@ -27,6 +27,21 @@ pub(super) fn register(app: &mut App) {
Style,
UiImage,
);

// Can be removed if https://github.com/bevyengine/bevy/pull/5781 is ever merged
app.register_type::<AlignContentInput>()
.register_type::<AlignItemsInput>()
.register_type::<AlignSelfInput>()
.register_type::<DirectionInput>()
.register_type::<DisplayInput>()
.register_type::<FlexDirectionInput>()
.register_type::<FlexWrapInput>()
.register_type::<JustifyContentInput>()
.register_type::<PositionTypeInput>()
.register_type::<SizeInput>()
.register_type::<SizeInput>()
.register_type::<UiRectInput>()
.register_type::<ValInput>();
}

impl_external_schematic! {
Expand Down Expand Up @@ -155,11 +170,16 @@ impl_external_schematic! {
// ---
#[derive(Reflect, FromReflect)]
pub struct NodeInput;
from_to_default!(
from_to!(
Node,
NodeInput,
|_: Input| Self::default()
);
impl Default for NodeInput {
fn default() -> Self {
Self
}
}
}

impl_external_schematic! {
Expand Down
3 changes: 2 additions & 1 deletion bevy_proto_backend/src/impls/macros.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/// Registers the given types along with their respective [`ReflectSchematic`].
/// Registers the given types along with their respective input types and [`ReflectSchematic`].
#[macro_export]
#[doc(hidden)]
macro_rules! register_schematic {
Expand All @@ -7,6 +7,7 @@ macro_rules! register_schematic {
// Sanity check: ensure the type is actually registered
// before actually registering the `ReflectSchematic` type data
$app.register_type::<$ty>()
.register_type::<<$ty as $crate::schematics::Schematic>::Input>()
.register_type_data::<$ty, $crate::schematics::ReflectSchematic>();

)*
Expand Down

0 comments on commit 68dbb4f

Please sign in to comment.