From 62b2cdab326aece374cf10da1517b86bef384fd6 Mon Sep 17 00:00:00 2001 From: Blazepaws <157802762+blazepaws@users.noreply.github.com> Date: Sun, 15 Sep 2024 17:09:28 +0200 Subject: [PATCH] Reflect derived traits on all components and resources: bevy_hierarchy (#15219) Solves https://github.com/bevyengine/bevy/issues/15187 for bevy_hierarchy --- crates/bevy_hierarchy/src/components/children.rs | 4 ++-- crates/bevy_hierarchy/src/components/parent.rs | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/crates/bevy_hierarchy/src/components/children.rs b/crates/bevy_hierarchy/src/components/children.rs index 5a53462d82..ee2fb5578a 100644 --- a/crates/bevy_hierarchy/src/components/children.rs +++ b/crates/bevy_hierarchy/src/components/children.rs @@ -1,5 +1,5 @@ #[cfg(feature = "reflect")] -use bevy_ecs::reflect::{ReflectComponent, ReflectMapEntities}; +use bevy_ecs::reflect::{ReflectComponent, ReflectFromWorld, ReflectMapEntities}; use bevy_ecs::{ component::Component, entity::{Entity, EntityMapper, MapEntities}, @@ -25,7 +25,7 @@ use std::ops::Deref; /// [`BuildChildren::with_children`]: crate::child_builder::BuildChildren::with_children #[derive(Component, Debug)] #[cfg_attr(feature = "reflect", derive(bevy_reflect::Reflect))] -#[cfg_attr(feature = "reflect", reflect(Component, MapEntities))] +#[cfg_attr(feature = "reflect", reflect(Component, MapEntities, Debug, FromWorld))] pub struct Children(pub(crate) SmallVec<[Entity; 8]>); impl MapEntities for Children { diff --git a/crates/bevy_hierarchy/src/components/parent.rs b/crates/bevy_hierarchy/src/components/parent.rs index 99d8e45460..ce7e061ab4 100644 --- a/crates/bevy_hierarchy/src/components/parent.rs +++ b/crates/bevy_hierarchy/src/components/parent.rs @@ -1,5 +1,5 @@ #[cfg(feature = "reflect")] -use bevy_ecs::reflect::{ReflectComponent, ReflectMapEntities}; +use bevy_ecs::reflect::{ReflectComponent, ReflectFromWorld, ReflectMapEntities}; use bevy_ecs::{ component::Component, entity::{Entity, EntityMapper, MapEntities}, @@ -23,7 +23,10 @@ use std::ops::Deref; /// [`BuildChildren::with_children`]: crate::child_builder::BuildChildren::with_children #[derive(Component, Debug, Eq, PartialEq)] #[cfg_attr(feature = "reflect", derive(bevy_reflect::Reflect))] -#[cfg_attr(feature = "reflect", reflect(Component, MapEntities, PartialEq))] +#[cfg_attr( + feature = "reflect", + reflect(Component, MapEntities, PartialEq, Debug, FromWorld) +)] pub struct Parent(pub(crate) Entity); impl Parent {