Skip to content

Commit

Permalink
Add missing #[reflect(Component, Default)] to SceneRoot and `Dyna…
Browse files Browse the repository at this point in the history
…micSceneRoot`. (#16816)

Someone forgot to add these, and I need them since I spawn these
components in my [glXF] files.

[glXF]: https://github.com/pcwalton/bevy-glxf-loader/
  • Loading branch information
pcwalton authored Dec 15, 2024
1 parent 622ca0d commit f360b88
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions crates/bevy_scene/src/components.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
use bevy_asset::Handle;
use bevy_derive::{Deref, DerefMut};
use bevy_ecs::component::{require, Component};
use bevy_reflect::Reflect;
use bevy_ecs::{
component::{require, Component},
prelude::ReflectComponent,
};
use bevy_reflect::{prelude::ReflectDefault, Reflect};
use bevy_transform::components::Transform;
use derive_more::derive::From;

Expand All @@ -13,13 +16,15 @@ use crate::{DynamicScene, Scene};
/// Adding this component will spawn the scene as a child of that entity.
/// Once it's spawned, the entity will have a [`SceneInstance`](crate::SceneInstance) component.
#[derive(Component, Clone, Debug, Default, Deref, DerefMut, Reflect, PartialEq, Eq, From)]
#[reflect(Component, Default, Debug, PartialEq)]
#[require(Transform)]
#[cfg_attr(feature = "bevy_render", require(Visibility))]
pub struct SceneRoot(pub Handle<Scene>);

/// Adding this component will spawn the scene as a child of that entity.
/// Once it's spawned, the entity will have a [`SceneInstance`](crate::SceneInstance) component.
#[derive(Component, Clone, Debug, Default, Deref, DerefMut, Reflect, PartialEq, Eq, From)]
#[reflect(Component, Default, Debug, PartialEq)]
#[require(Transform)]
#[cfg_attr(feature = "bevy_render", require(Visibility))]
pub struct DynamicSceneRoot(pub Handle<DynamicScene>);

0 comments on commit f360b88

Please sign in to comment.