From 37ddaef437db3f5c9467dc18f085c7143d26446e Mon Sep 17 00:00:00 2001 From: Carter Anderson Date: Wed, 18 Nov 2020 18:22:09 -0800 Subject: [PATCH 1/6] Bevy Reflection --- Cargo.toml | 22 +- assets/scenes/load_scene_example.scn | 54 +- crates/bevy_asset/Cargo.toml | 4 +- crates/bevy_asset/src/asset_server.rs | 3 +- crates/bevy_asset/src/assets.rs | 5 +- crates/bevy_asset/src/handle.rs | 22 +- crates/bevy_asset/src/info.rs | 3 +- crates/bevy_asset/src/lib.rs | 4 +- crates/bevy_asset/src/loader.rs | 2 +- crates/bevy_asset/src/path.rs | 11 +- crates/bevy_audio/Cargo.toml | 2 +- crates/bevy_audio/src/audio_source.rs | 2 +- crates/bevy_core/Cargo.toml | 5 +- crates/bevy_core/src/label.rs | 4 +- crates/bevy_core/src/lib.rs | 15 +- crates/bevy_core/src/time/timer.rs | 7 +- crates/bevy_derive/Cargo.toml | 1 - crates/bevy_derive/src/lib.rs | 12 - crates/bevy_derive/src/modules.rs | 3 - crates/bevy_diagnostic/Cargo.toml | 1 - crates/bevy_diagnostic/src/diagnostic.rs | 3 +- crates/bevy_ecs/src/core/serde.rs | 28 +- crates/bevy_gltf/Cargo.toml | 2 +- crates/bevy_internal/Cargo.toml | 3 +- crates/bevy_internal/src/default_plugins.rs | 4 +- crates/bevy_internal/src/lib.rs | 14 +- crates/bevy_internal/src/prelude.rs | 5 +- crates/bevy_math/Cargo.toml | 1 + crates/bevy_math/src/geometry.rs | 21 +- crates/bevy_pbr/Cargo.toml | 3 +- crates/bevy_pbr/src/lib.rs | 5 +- crates/bevy_pbr/src/light.rs | 5 +- crates/bevy_pbr/src/material.rs | 2 +- .../src/render_graph/forward_pipeline/mod.rs | 2 +- crates/bevy_property/Cargo.toml | 26 - .../bevy_property_derive/src/lib.rs | 431 --------- .../bevy_property/src/dynamic_properties.rs | 223 ----- .../impl_property/impl_property_bevy_ecs.rs | 24 - .../src/impl_property/impl_property_glam.rs | 8 - .../impl_property/impl_property_smallvec.rs | 50 - .../src/impl_property/impl_property_std.rs | 861 ------------------ crates/bevy_property/src/impl_property/mod.rs | 4 - crates/bevy_property/src/lib.rs | 21 - crates/bevy_property/src/properties.rs | 92 -- crates/bevy_property/src/property.rs | 55 -- crates/bevy_property/src/property_serde.rs | 545 ----------- crates/bevy_property/src/ron.rs | 15 - crates/bevy_property/src/type_registry.rs | 235 ----- crates/bevy_reflect/Cargo.toml | 36 + crates/bevy_reflect/README.md | 166 ++++ .../bevy_reflect_derive}/Cargo.toml | 5 +- .../bevy_reflect_derive/src/lib.rs | 751 +++++++++++++++ .../bevy_reflect_derive}/src/modules.rs | 26 +- .../bevy_reflect_derive/src/reflect_trait.rs | 66 ++ .../bevy_reflect_derive}/src/type_uuid.rs | 8 +- crates/bevy_reflect/src/impls/bevy_app.rs | 59 ++ crates/bevy_reflect/src/impls/bevy_ecs.rs | 217 +++++ crates/bevy_reflect/src/impls/glam.rs | 10 + crates/bevy_reflect/src/impls/smallvec.rs | 96 ++ crates/bevy_reflect/src/impls/std.rs | 201 ++++ crates/bevy_reflect/src/lib.rs | 323 +++++++ crates/bevy_reflect/src/list.rs | 178 ++++ crates/bevy_reflect/src/map.rs | 184 ++++ crates/bevy_reflect/src/path.rs | 376 ++++++++ crates/bevy_reflect/src/reflect.rs | 77 ++ crates/bevy_reflect/src/serde/de.rs | 403 ++++++++ crates/bevy_reflect/src/serde/mod.rs | 14 + crates/bevy_reflect/src/serde/ser.rs | 268 ++++++ crates/bevy_reflect/src/struct_trait.rs | 256 ++++++ crates/bevy_reflect/src/tuple_struct.rs | 212 +++++ crates/bevy_reflect/src/type_registry.rs | 325 +++++++ .../src/type_uuid.rs | 4 +- crates/bevy_render/Cargo.toml | 4 +- crates/bevy_render/src/camera/camera.rs | 8 +- crates/bevy_render/src/camera/projection.rs | 9 +- .../src/camera/visible_entities.rs | 6 +- crates/bevy_render/src/color.rs | 4 +- crates/bevy_render/src/colorspace.rs | 3 - crates/bevy_render/src/draw.rs | 6 +- crates/bevy_render/src/lib.rs | 32 +- crates/bevy_render/src/mesh/mesh.rs | 2 +- crates/bevy_render/src/pipeline/pipeline.rs | 2 +- .../src/pipeline/pipeline_compiler.rs | 6 +- .../src/pipeline/render_pipelines.rs | 9 +- .../src/pipeline/state_descriptors.rs | 6 +- .../src/pipeline/vertex_buffer_descriptor.rs | 5 +- crates/bevy_render/src/render_graph/base.rs | 4 +- crates/bevy_render/src/render_graph/node.rs | 2 +- .../src/renderer/render_resource/buffer.rs | 2 +- .../src/renderer/render_resource/texture.rs | 2 +- crates/bevy_render/src/shader/shader.rs | 2 +- crates/bevy_render/src/texture/texture.rs | 2 +- crates/bevy_scene/Cargo.toml | 3 +- crates/bevy_scene/src/dynamic_scene.rs | 61 +- crates/bevy_scene/src/scene.rs | 2 +- crates/bevy_scene/src/scene_loader.rs | 14 +- crates/bevy_scene/src/scene_spawner.rs | 61 +- crates/bevy_scene/src/serde.rs | 51 +- crates/bevy_sprite/Cargo.toml | 3 +- crates/bevy_sprite/src/color_material.rs | 2 +- crates/bevy_sprite/src/lib.rs | 3 +- crates/bevy_sprite/src/render/mod.rs | 2 +- crates/bevy_sprite/src/sprite.rs | 8 +- crates/bevy_sprite/src/texture_atlas.rs | 2 +- crates/bevy_text/Cargo.toml | 2 +- crates/bevy_text/src/font.rs | 2 +- crates/bevy_text/src/font_atlas_set.rs | 2 +- crates/bevy_transform/Cargo.toml | 3 +- .../bevy_transform/src/components/children.rs | 5 +- .../src/components/global_transform.rs | 7 +- .../bevy_transform/src/components/parent.rs | 8 +- .../src/components/transform.rs | 8 +- crates/bevy_transform/src/lib.rs | 12 +- crates/bevy_type_registry/Cargo.toml | 26 - crates/bevy_type_registry/src/lib.rs | 21 - .../bevy_type_registry/src/register_type.rs | 78 -- .../bevy_type_registry/src/type_registry.rs | 336 ------- crates/bevy_ui/Cargo.toml | 3 +- crates/bevy_ui/src/flex/convert.rs | 4 +- crates/bevy_ui/src/node.rs | 37 +- crates/bevy_ui/src/render/mod.rs | 2 +- crates/bevy_utils/Cargo.toml | 2 + crates/bevy_utils/src/lib.rs | 1 + crates/bevy_window/Cargo.toml | 2 - crates/bevy_window/src/window.rs | 2 +- examples/asset/custom_asset.rs | 2 +- examples/reflection/generic_reflection.rs | 28 + examples/reflection/reflection.rs | 94 ++ examples/reflection/reflection_types.rs | 95 ++ examples/reflection/trait_reflection.rs | 56 ++ examples/scene/properties.rs | 102 --- examples/scene/scene.rs | 37 +- examples/shader/array_texture.rs | 2 +- examples/shader/mesh_custom_attribute.rs | 2 +- examples/shader/shader_custom_material.rs | 2 +- examples/shader/shader_defs.rs | 2 +- examples/wasm/assets_wasm.rs | 2 +- tools/publish.sh | 5 +- 138 files changed, 4932 insertions(+), 3519 deletions(-) delete mode 100644 crates/bevy_property/Cargo.toml delete mode 100644 crates/bevy_property/bevy_property_derive/src/lib.rs delete mode 100644 crates/bevy_property/src/dynamic_properties.rs delete mode 100644 crates/bevy_property/src/impl_property/impl_property_bevy_ecs.rs delete mode 100644 crates/bevy_property/src/impl_property/impl_property_glam.rs delete mode 100644 crates/bevy_property/src/impl_property/impl_property_smallvec.rs delete mode 100644 crates/bevy_property/src/impl_property/impl_property_std.rs delete mode 100644 crates/bevy_property/src/impl_property/mod.rs delete mode 100644 crates/bevy_property/src/lib.rs delete mode 100644 crates/bevy_property/src/properties.rs delete mode 100644 crates/bevy_property/src/property.rs delete mode 100644 crates/bevy_property/src/property_serde.rs delete mode 100644 crates/bevy_property/src/ron.rs delete mode 100644 crates/bevy_property/src/type_registry.rs create mode 100644 crates/bevy_reflect/Cargo.toml create mode 100644 crates/bevy_reflect/README.md rename crates/{bevy_property/bevy_property_derive => bevy_reflect/bevy_reflect_derive}/Cargo.toml (73%) create mode 100644 crates/bevy_reflect/bevy_reflect_derive/src/lib.rs rename crates/{bevy_property/bevy_property_derive => bevy_reflect/bevy_reflect_derive}/src/modules.rs (57%) create mode 100644 crates/bevy_reflect/bevy_reflect_derive/src/reflect_trait.rs rename crates/{bevy_derive => bevy_reflect/bevy_reflect_derive}/src/type_uuid.rs (90%) create mode 100644 crates/bevy_reflect/src/impls/bevy_app.rs create mode 100644 crates/bevy_reflect/src/impls/bevy_ecs.rs create mode 100644 crates/bevy_reflect/src/impls/glam.rs create mode 100644 crates/bevy_reflect/src/impls/smallvec.rs create mode 100644 crates/bevy_reflect/src/impls/std.rs create mode 100644 crates/bevy_reflect/src/lib.rs create mode 100644 crates/bevy_reflect/src/list.rs create mode 100644 crates/bevy_reflect/src/map.rs create mode 100644 crates/bevy_reflect/src/path.rs create mode 100644 crates/bevy_reflect/src/reflect.rs create mode 100644 crates/bevy_reflect/src/serde/de.rs create mode 100644 crates/bevy_reflect/src/serde/mod.rs create mode 100644 crates/bevy_reflect/src/serde/ser.rs create mode 100644 crates/bevy_reflect/src/struct_trait.rs create mode 100644 crates/bevy_reflect/src/tuple_struct.rs create mode 100644 crates/bevy_reflect/src/type_registry.rs rename crates/{bevy_type_registry => bevy_reflect}/src/type_uuid.rs (78%) delete mode 100644 crates/bevy_type_registry/Cargo.toml delete mode 100644 crates/bevy_type_registry/src/lib.rs delete mode 100644 crates/bevy_type_registry/src/register_type.rs delete mode 100644 crates/bevy_type_registry/src/type_registry.rs create mode 100644 examples/reflection/generic_reflection.rs create mode 100644 examples/reflection/reflection.rs create mode 100644 examples/reflection/reflection_types.rs create mode 100644 examples/reflection/trait_reflection.rs delete mode 100644 examples/scene/properties.rs diff --git a/Cargo.toml b/Cargo.toml index ee26789e927da..bc85084c68c6f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -75,7 +75,7 @@ bevy_internal = {path = "crates/bevy_internal", version = "0.3.0", default-featu [dev-dependencies] anyhow = "1.0" rand = "0.7.3" -ron = "0.6" +ron = "0.6.2" serde = {version = "1", features = ["derive"]} [[example]] @@ -255,12 +255,24 @@ name = "touch_input_events" path = "examples/input/touch_input_events.rs" [[example]] -name = "scene" -path = "examples/scene/scene.rs" +name = "reflection" +path = "examples/reflection/reflection.rs" + +[[example]] +name = "reflection_types" +path = "examples/reflection/reflection_types.rs" + +[[example]] +name = "generic_reflection" +path = "examples/reflection/generic_reflection.rs" + +[[example]] +name = "trait_reflection" +path = "examples/reflection/trait_reflection.rs" [[example]] -name = "properties" -path = "examples/scene/properties.rs" +name = "scene" +path = "examples/scene/scene.rs" [[example]] name = "mesh_custom_attribute" diff --git a/assets/scenes/load_scene_example.scn b/assets/scenes/load_scene_example.scn index a68262197272b..5b3672715b2f4 100644 --- a/assets/scenes/load_scene_example.scn +++ b/assets/scenes/load_scene_example.scn @@ -3,16 +3,42 @@ entity: 0, components: [ { - "type": "ComponentB", - "map": { - "value": "hello", + "type": "bevy_transform::components::transform::Transform", + "struct": { + "translation": { + "type": "glam::f32::vec3::Vec3", + "value": (0.0, 0.0, 0.0), + }, + "rotation": { + "type": "glam::f32::quat::Quat", + "value": (0.0, 0.0, 0.0, 1.0), + }, + "scale": { + "type": "glam::f32::vec3::Vec3", + "value": (1.0, 1.0, 1.0), + }, }, }, { - "type": "ComponentA", - "map": { - "x": 1.0, - "y": 2.0, + "type": "scene::ComponentB", + "struct": { + "value": { + "type": "alloc::string::String", + "value": "hello", + }, + }, + }, + { + "type": "scene::ComponentA", + "struct": { + "x": { + "type": "f32", + "value": 1.0, + }, + "y": { + "type": "f32", + "value": 2.0, + }, }, }, ], @@ -21,10 +47,16 @@ entity: 1, components: [ { - "type": "ComponentA", - "map": { - "x": 3.0, - "y": 4.0, + "type": "scene::ComponentA", + "struct": { + "x": { + "type": "f32", + "value": 3.0, + }, + "y": { + "type": "f32", + "value": 4.0, + }, }, }, ], diff --git a/crates/bevy_asset/Cargo.toml b/crates/bevy_asset/Cargo.toml index d0ef595e9434d..31b5d9f075935 100644 --- a/crates/bevy_asset/Cargo.toml +++ b/crates/bevy_asset/Cargo.toml @@ -20,13 +20,11 @@ filesystem_watcher = ["notify"] # bevy bevy_app = { path = "../bevy_app", version = "0.3.0" } bevy_ecs = { path = "../bevy_ecs", version = "0.3.0" } +bevy_reflect = { path = "../bevy_reflect", version = "0.3.0", features = ["bevy"] } bevy_tasks = { path = "../bevy_tasks", version = "0.3.0" } -bevy_type_registry = { path = "../bevy_type_registry", version = "0.3.0" } -bevy_property = { path = "../bevy_property", version = "0.3.0" } bevy_utils = { path = "../bevy_utils", version = "0.3.0" } # other -uuid = { version = "0.8", features = ["v4", "serde"] } serde = { version = "1", features = ["derive"] } ron = "0.6.2" crossbeam-channel = "0.4.4" diff --git a/crates/bevy_asset/src/asset_server.rs b/crates/bevy_asset/src/asset_server.rs index eebda681cb369..90d1bc910bb93 100644 --- a/crates/bevy_asset/src/asset_server.rs +++ b/crates/bevy_asset/src/asset_server.rs @@ -7,12 +7,11 @@ use crate::{ use anyhow::Result; use bevy_ecs::Res; use bevy_tasks::TaskPool; -use bevy_utils::HashMap; +use bevy_utils::{HashMap, Uuid}; use crossbeam_channel::TryRecvError; use parking_lot::RwLock; use std::{collections::hash_map::Entry, path::Path, sync::Arc}; use thiserror::Error; -use uuid::Uuid; /// Errors that occur while loading assets with an AssetServer #[derive(Error, Debug)] diff --git a/crates/bevy_asset/src/assets.rs b/crates/bevy_asset/src/assets.rs index e3fd86c20a478..57f3e8e58d7ab 100644 --- a/crates/bevy_asset/src/assets.rs +++ b/crates/bevy_asset/src/assets.rs @@ -3,7 +3,6 @@ use crate::{ }; use bevy_app::{prelude::Events, AppBuilder}; use bevy_ecs::{FromResources, ResMut}; -use bevy_type_registry::RegisterType; use bevy_utils::HashMap; use crossbeam_channel::Sender; use std::fmt::Debug; @@ -15,6 +14,9 @@ pub enum AssetEvent { Removed { handle: Handle }, } +// SAFE: Only contains handles, which are Send. Come on rust ... be cool. +unsafe impl Send for AssetEvent {} + impl Debug for AssetEvent { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { @@ -218,7 +220,6 @@ impl AddAsset for AppBuilder { }; self.add_resource(assets) - .register_component::>() .add_system_to_stage(super::stage::ASSET_EVENTS, Assets::::asset_event_system) .add_system_to_stage(crate::stage::LOAD_ASSETS, update_asset_storage_system::) .add_event::>() diff --git a/crates/bevy_asset/src/handle.rs b/crates/bevy_asset/src/handle.rs index f028309197d37..f14aa5d228d88 100644 --- a/crates/bevy_asset/src/handle.rs +++ b/crates/bevy_asset/src/handle.rs @@ -5,20 +5,20 @@ use std::{ marker::PhantomData, }; -use bevy_property::{Properties, Property}; -use crossbeam_channel::{Receiver, Sender}; -use serde::{Deserialize, Serialize}; -use uuid::Uuid; - use crate::{ path::{AssetPath, AssetPathId}, Asset, Assets, }; +use bevy_reflect::{Reflect, ReflectDeserialize}; +use bevy_utils::Uuid; +use crossbeam_channel::{Receiver, Sender}; +use serde::{Deserialize, Serialize}; /// A unique, stable asset id #[derive( - Debug, Clone, Copy, Eq, PartialEq, Hash, Ord, PartialOrd, Serialize, Deserialize, Property, + Debug, Clone, Copy, Eq, PartialEq, Hash, Ord, PartialOrd, Serialize, Deserialize, Reflect, )] +#[reflect_value(Serialize, Deserialize, PartialEq, Hash)] pub enum HandleId { Id(Uuid, u64), AssetPathId(AssetPathId), @@ -56,15 +56,15 @@ impl HandleId { /// A handle into a specific Asset of type `T` /// /// Handles contain a unique id that corresponds to a specific asset in the [Assets](crate::Assets) collection. -#[derive(Properties)] +#[derive(Reflect)] pub struct Handle where T: 'static, { pub id: HandleId, - #[property(ignore)] + #[reflect(ignore)] handle_type: HandleType, - #[property(ignore)] + #[reflect(ignore)] marker: PhantomData, } @@ -184,7 +184,7 @@ impl From<&Handle> for HandleId { impl Hash for Handle { fn hash(&self, state: &mut H) { - self.id.hash(state); + Hash::hash(&self.id, state); } } @@ -311,7 +311,7 @@ impl From<&HandleUntyped> for HandleId { impl Hash for HandleUntyped { fn hash(&self, state: &mut H) { - self.id.hash(state); + Hash::hash(&self.id, state); } } diff --git a/crates/bevy_asset/src/info.rs b/crates/bevy_asset/src/info.rs index 506f09dbfe4f1..f781fa0eea66a 100644 --- a/crates/bevy_asset/src/info.rs +++ b/crates/bevy_asset/src/info.rs @@ -1,8 +1,7 @@ use crate::{path::AssetPath, LabelId}; -use bevy_utils::{HashMap, HashSet}; +use bevy_utils::{HashMap, HashSet, Uuid}; use serde::{Deserialize, Serialize}; use std::path::PathBuf; -use uuid::Uuid; #[derive(Clone, Debug, Serialize, Deserialize)] pub struct SourceMeta { diff --git a/crates/bevy_asset/src/lib.rs b/crates/bevy_asset/src/lib.rs index f97abe5e1826e..20941024edd70 100644 --- a/crates/bevy_asset/src/lib.rs +++ b/crates/bevy_asset/src/lib.rs @@ -13,6 +13,7 @@ mod path; pub use asset_server::*; pub use assets::*; +use bevy_reflect::RegisterTypeBuilder; use bevy_tasks::IoTaskPool; pub use handle::*; pub use info::*; @@ -31,7 +32,6 @@ pub mod prelude { } use bevy_app::{prelude::Plugin, AppBuilder}; -use bevy_type_registry::RegisterType; /// Adds support for Assets to an App. Assets are typed collections with change tracking, which are added as App Resources. /// Examples of assets: textures, sounds, 3d models, maps, scenes @@ -76,7 +76,7 @@ impl Plugin for AssetPlugin { app.add_stage_before(bevy_app::stage::PRE_UPDATE, stage::LOAD_ASSETS) .add_stage_after(bevy_app::stage::POST_UPDATE, stage::ASSET_EVENTS) .add_resource(asset_server) - .register_property::() + .register_type::() .add_system_to_stage( bevy_app::stage::PRE_UPDATE, asset_server::free_unused_assets_system, diff --git a/crates/bevy_asset/src/loader.rs b/crates/bevy_asset/src/loader.rs index 903f5efca9ec5..68bca038d055b 100644 --- a/crates/bevy_asset/src/loader.rs +++ b/crates/bevy_asset/src/loader.rs @@ -4,7 +4,7 @@ use crate::{ }; use anyhow::Result; use bevy_ecs::{Res, ResMut, Resource}; -use bevy_type_registry::{TypeUuid, TypeUuidDynamic}; +use bevy_reflect::{TypeUuid, TypeUuidDynamic}; use bevy_utils::{BoxedFuture, HashMap}; use crossbeam_channel::{Receiver, Sender}; use downcast_rs::{impl_downcast, Downcast}; diff --git a/crates/bevy_asset/src/path.rs b/crates/bevy_asset/src/path.rs index 89abed1547a6d..5a116c3608eb7 100644 --- a/crates/bevy_asset/src/path.rs +++ b/crates/bevy_asset/src/path.rs @@ -1,4 +1,4 @@ -use bevy_property::Property; +use bevy_reflect::{Reflect, ReflectDeserialize}; use bevy_utils::AHasher; use serde::{Deserialize, Serialize}; use std::{ @@ -58,18 +58,21 @@ impl<'a> AssetPath<'a> { } #[derive( - Debug, Clone, Copy, Eq, PartialEq, Hash, Ord, PartialOrd, Serialize, Deserialize, Property, + Debug, Clone, Copy, Eq, PartialEq, Hash, Ord, PartialOrd, Serialize, Deserialize, Reflect, )] +#[reflect_value(PartialEq, Hash, Serialize, Deserialize)] pub struct AssetPathId(SourcePathId, LabelId); #[derive( - Debug, Clone, Copy, Eq, PartialEq, Hash, Ord, PartialOrd, Serialize, Deserialize, Property, + Debug, Clone, Copy, Eq, PartialEq, Hash, Ord, PartialOrd, Serialize, Deserialize, Reflect, )] +#[reflect_value(PartialEq, Hash, Serialize, Deserialize)] pub struct SourcePathId(u64); #[derive( - Debug, Clone, Copy, Eq, PartialEq, Hash, Ord, PartialOrd, Serialize, Deserialize, Property, + Debug, Clone, Copy, Eq, PartialEq, Hash, Ord, PartialOrd, Serialize, Deserialize, Reflect, )] +#[reflect_value(PartialEq, Hash, Serialize, Deserialize)] pub struct LabelId(u64); impl<'a> From<&'a Path> for SourcePathId { diff --git a/crates/bevy_audio/Cargo.toml b/crates/bevy_audio/Cargo.toml index 5dac2083c43b5..b4517d9ef829b 100644 --- a/crates/bevy_audio/Cargo.toml +++ b/crates/bevy_audio/Cargo.toml @@ -17,7 +17,7 @@ keywords = ["bevy"] bevy_app = { path = "../bevy_app", version = "0.3.0" } bevy_asset = { path = "../bevy_asset", version = "0.3.0" } bevy_ecs = { path = "../bevy_ecs", version = "0.3.0" } -bevy_type_registry = { path = "../bevy_type_registry", version = "0.3.0" } +bevy_reflect = { path = "../bevy_reflect", version = "0.3.0", features = ["bevy"] } bevy_utils = { path = "../bevy_utils", version = "0.3.0" } # other diff --git a/crates/bevy_audio/src/audio_source.rs b/crates/bevy_audio/src/audio_source.rs index 7f36276a0001b..087640afc4543 100644 --- a/crates/bevy_audio/src/audio_source.rs +++ b/crates/bevy_audio/src/audio_source.rs @@ -1,6 +1,6 @@ use anyhow::Result; use bevy_asset::{AssetLoader, LoadContext, LoadedAsset}; -use bevy_type_registry::TypeUuid; +use bevy_reflect::TypeUuid; use bevy_utils::BoxedFuture; use std::{io::Cursor, sync::Arc}; diff --git a/crates/bevy_core/Cargo.toml b/crates/bevy_core/Cargo.toml index 57d677473a418..2e419c07a4d8b 100644 --- a/crates/bevy_core/Cargo.toml +++ b/crates/bevy_core/Cargo.toml @@ -17,8 +17,7 @@ keywords = ["bevy"] bevy_app = { path = "../bevy_app", version = "0.3.0" } bevy_derive = { path = "../bevy_derive", version = "0.3.0" } bevy_ecs = { path = "../bevy_ecs", version = "0.3.0" } -bevy_property = { path = "../bevy_property", version = "0.3.0" } -bevy_type_registry = { path = "../bevy_type_registry", version = "0.3.0" } bevy_math = { path = "../bevy_math", version = "0.3.0" } -bevy_utils = { path = "../bevy_utils", version = "0.3.0" } +bevy_reflect = { path = "../bevy_reflect", version = "0.3.0", features = ["bevy"] } bevy_tasks = { path = "../bevy_tasks", version = "0.3.0" } +bevy_utils = { path = "../bevy_utils", version = "0.3.0" } diff --git a/crates/bevy_core/src/label.rs b/crates/bevy_core/src/label.rs index e01aa170a536d..ebcceb490bc1e 100644 --- a/crates/bevy_core/src/label.rs +++ b/crates/bevy_core/src/label.rs @@ -1,5 +1,5 @@ use bevy_ecs::prelude::*; -use bevy_property::Properties; +use bevy_reflect::Reflect; use bevy_utils::{HashMap, HashSet}; use std::{ borrow::Cow, @@ -8,7 +8,7 @@ use std::{ }; /// A collection of labels -#[derive(Default, Properties)] +#[derive(Default, Reflect)] pub struct Labels { labels: HashSet>, } diff --git a/crates/bevy_core/src/lib.rs b/crates/bevy_core/src/lib.rs index 03edeef476a94..01339438be2f2 100644 --- a/crates/bevy_core/src/lib.rs +++ b/crates/bevy_core/src/lib.rs @@ -4,6 +4,9 @@ mod label; mod task_pool_options; mod time; +use std::ops::Range; + +use bevy_reflect::RegisterTypeBuilder; pub use bytes::*; pub use float_ord::*; pub use label::*; @@ -15,8 +18,6 @@ pub mod prelude { } use bevy_app::prelude::*; -use bevy_math::{Mat3, Mat4, Quat, Vec2, Vec3}; -use bevy_type_registry::RegisterType; /// Adds core functionality to Apps. #[derive(Default)] @@ -32,13 +33,9 @@ impl Plugin for CorePlugin { app.init_resource::