#[derive(Reflect)] on GizmoConfig (#10483)

This commit is contained in:
Sludge 2023-11-11 22:26:41 +01:00 committed by GitHub
parent 2a036b658f
commit c505610358
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -37,7 +37,7 @@ use bevy_ecs::{
component::Component, component::Component,
entity::Entity, entity::Entity,
query::{ROQueryItem, Without}, query::{ROQueryItem, Without},
reflect::ReflectComponent, reflect::{ReflectComponent, ReflectResource},
schedule::IntoSystemConfigs, schedule::IntoSystemConfigs,
system::{ system::{
lifetimeless::{Read, SRes}, lifetimeless::{Read, SRes},
@ -77,7 +77,9 @@ impl Plugin for GizmoPlugin {
fn build(&self, app: &mut bevy_app::App) { fn build(&self, app: &mut bevy_app::App) {
load_internal_asset!(app, LINE_SHADER_HANDLE, "lines.wgsl", Shader::from_wgsl); load_internal_asset!(app, LINE_SHADER_HANDLE, "lines.wgsl", Shader::from_wgsl);
app.add_plugins(UniformComponentPlugin::<LineGizmoUniform>::default()) app.register_type::<GizmoConfig>()
.register_type::<AabbGizmoConfig>()
.add_plugins(UniformComponentPlugin::<LineGizmoUniform>::default())
.init_asset::<LineGizmo>() .init_asset::<LineGizmo>()
.add_plugins(RenderAssetPlugin::<LineGizmo>::default()) .add_plugins(RenderAssetPlugin::<LineGizmo>::default())
.init_resource::<LineGizmoHandles>() .init_resource::<LineGizmoHandles>()
@ -135,7 +137,8 @@ impl Plugin for GizmoPlugin {
} }
/// A [`Resource`] that stores configuration for gizmos. /// A [`Resource`] that stores configuration for gizmos.
#[derive(Resource, Clone)] #[derive(Resource, Clone, Reflect)]
#[reflect(Resource)]
pub struct GizmoConfig { pub struct GizmoConfig {
/// Set to `false` to stop drawing gizmos. /// Set to `false` to stop drawing gizmos.
/// ///
@ -188,7 +191,7 @@ impl Default for GizmoConfig {
} }
/// Configuration for drawing the [`Aabb`] component on entities. /// Configuration for drawing the [`Aabb`] component on entities.
#[derive(Clone, Default)] #[derive(Clone, Default, Reflect)]
pub struct AabbGizmoConfig { pub struct AabbGizmoConfig {
/// Draws all bounding boxes in the scene when set to `true`. /// Draws all bounding boxes in the scene when set to `true`.
/// ///