Reflect derived traits on all components and resources: bevy_hierarchy (#15219)

Solves https://github.com/bevyengine/bevy/issues/15187 for
bevy_hierarchy
This commit is contained in:
Blazepaws 2024-09-15 17:09:28 +02:00 committed by GitHub
parent e718bbd55c
commit 62b2cdab32
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 4 deletions

View file

@ -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 {

View file

@ -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 {