From 7f33a13ff9ff6b79437002ad7c2da5122d2f76be Mon Sep 17 00:00:00 2001 From: Dmitry Stepanov Date: Thu, 28 May 2026 21:50:17 +0300 Subject: [PATCH] merged `TypeUuidProvider` trait into `Reflect` --- editor/src/asset/creator.rs | 3 +- editor/src/asset/item.rs | 10 +- editor/src/asset/menu.rs | 17 +- editor/src/asset/preview/cache.rs | 3 +- editor/src/asset/preview/mod.rs | 22 +- editor/src/asset/selection.rs | 6 +- editor/src/asset/selector.rs | 28 +-- editor/src/audio/bus.rs | 27 +-- editor/src/interaction/gizmo/move_gizmo.rs | 3 + editor/src/interaction/gizmo/rotate_gizmo.rs | 5 + editor/src/interaction/gizmo/scale_gizmo.rs | 5 + editor/src/interaction/mod.rs | 16 +- editor/src/interaction/move_mode.rs | 17 +- editor/src/interaction/navmesh/mod.rs | 19 +- editor/src/interaction/plane.rs | 4 +- editor/src/interaction/rotate_mode.rs | 12 +- editor/src/interaction/scale_mode.rs | 12 +- editor/src/interaction/select_mode.rs | 12 +- editor/src/interaction/terrain.rs | 23 +- editor/src/lib.rs | 22 +- editor/src/light.rs | 1 + editor/src/menu/create.rs | 2 +- editor/src/menu/edit.rs | 2 +- editor/src/menu/file.rs | 3 +- editor/src/menu/help.rs | 2 +- editor/src/menu/mod.rs | 2 +- editor/src/menu/ui.rs | 2 +- editor/src/menu/utils.rs | 2 +- editor/src/menu/view.rs | 2 +- editor/src/message.rs | 2 +- editor/src/overlay.rs | 3 +- editor/src/plugins/absm/blendspace.rs | 17 +- editor/src/plugins/absm/canvas.rs | 11 +- editor/src/plugins/absm/connection.rs | 9 +- editor/src/plugins/absm/mod.rs | 4 +- editor/src/plugins/absm/node.rs | 17 +- editor/src/plugins/absm/segment.rs | 1 + editor/src/plugins/absm/selectable.rs | 1 + editor/src/plugins/absm/socket.rs | 12 +- .../src/plugins/absm/state_graph/context.rs | 2 +- .../src/plugins/absm/state_viewer/context.rs | 2 +- editor/src/plugins/absm/transition.rs | 8 +- editor/src/plugins/animation/mod.rs | 3 +- editor/src/plugins/animation/ruler.rs | 9 +- editor/src/plugins/animation/thumb.rs | 8 +- editor/src/plugins/animation/track.rs | 9 +- editor/src/plugins/collider/mod.rs | 32 ++- editor/src/plugins/collider/panel.rs | 4 +- editor/src/plugins/curve_editor.rs | 3 +- .../src/plugins/inspector/editors/dyntype.rs | 12 +- editor/src/plugins/inspector/editors/font.rs | 10 +- .../src/plugins/inspector/editors/handle.rs | 6 +- .../src/plugins/inspector/editors/resource.rs | 13 +- .../src/plugins/inspector/editors/script.rs | 12 +- .../plugins/inspector/editors/shader/field.rs | 6 +- .../plugins/inspector/editors/shader/mod.rs | 6 +- .../inspector/editors/spritesheet/mod.rs | 9 +- .../inspector/editors/spritesheet/window.rs | 9 +- .../src/plugins/inspector/editors/surface.rs | 6 +- .../src/plugins/inspector/editors/texture.rs | 9 +- editor/src/plugins/inspector/mod.rs | 3 +- editor/src/plugins/material/editor.rs | 11 +- editor/src/plugins/probe.rs | 15 +- editor/src/plugins/ragdoll.rs | 3 +- editor/src/plugins/settings.rs | 3 +- editor/src/plugins/stats.rs | 3 +- editor/src/plugins/tilemap/autotile.rs | 9 +- editor/src/plugins/tilemap/brush_macro.rs | 4 +- editor/src/plugins/tilemap/collider_editor.rs | 2 +- editor/src/plugins/tilemap/commands.rs | 12 +- editor/src/plugins/tilemap/handle_editor.rs | 9 +- editor/src/plugins/tilemap/handle_field.rs | 4 +- .../src/plugins/tilemap/interaction_mode.rs | 18 +- editor/src/plugins/tilemap/macro_inspector.rs | 1 + editor/src/plugins/tilemap/mod.rs | 7 +- editor/src/plugins/tilemap/palette.rs | 5 +- editor/src/plugins/tilemap/panel_preview.rs | 5 +- .../src/plugins/tilemap/tile_bounds_editor.rs | 6 +- editor/src/plugins/tilemap/tile_inspector.rs | 9 +- .../src/plugins/tilemap/tile_prop_editor.rs | 5 +- editor/src/plugins/tilemap/wfc.rs | 8 +- editor/src/scene/clipboard.rs | 2 +- editor/src/scene/commands/mod.rs | 1 + editor/src/scene/container.rs | 6 +- editor/src/scene/mod.rs | 4 +- editor/src/scene/nullscene.rs | 1 + editor/src/scene/property.rs | 16 +- editor/src/scene/selector.rs | 11 +- editor/src/settings/build.rs | 1 + editor/src/settings/camera.rs | 1 + editor/src/settings/debugging.rs | 1 + editor/src/settings/general.rs | 9 +- editor/src/settings/graphics.rs | 1 + editor/src/settings/keys.rs | 2 + editor/src/settings/log.rs | 1 + editor/src/settings/mod.rs | 1 + editor/src/settings/model.rs | 1 + editor/src/settings/move_mode.rs | 1 + editor/src/settings/navmesh.rs | 1 + editor/src/settings/rotate_mode.rs | 1 + editor/src/settings/selection.rs | 1 + editor/src/settings/windows.rs | 1 + editor/src/test/macros.rs | 5 +- editor/src/test/utils.rs | 3 +- editor/src/ui_scene/clipboard.rs | 2 +- editor/src/ui_scene/commands/mod.rs | 1 + editor/src/ui_scene/interaction/mod.rs | 12 +- editor/src/ui_scene/interaction/move_mode.rs | 15 +- editor/src/ui_scene/menu.rs | 2 +- editor/src/world/item.rs | 5 +- editor/src/world/menu.rs | 2 +- fyrox-animation/src/container.rs | 3 + fyrox-animation/src/lib.rs | 20 +- fyrox-animation/src/machine/layer.rs | 1 + fyrox-animation/src/machine/mask.rs | 1 + fyrox-animation/src/machine/mod.rs | 1 + fyrox-animation/src/machine/node/blend.rs | 19 +- .../src/machine/node/blendspace.rs | 11 +- fyrox-animation/src/machine/node/mod.rs | 2 + fyrox-animation/src/machine/node/play.rs | 1 + fyrox-animation/src/machine/parameter.rs | 11 +- fyrox-animation/src/machine/state.rs | 19 +- fyrox-animation/src/machine/transition.rs | 18 +- fyrox-animation/src/signal.rs | 1 + fyrox-animation/src/spritesheet/mod.rs | 27 +-- fyrox-animation/src/spritesheet/signal.rs | 4 +- fyrox-animation/src/track.rs | 2 + fyrox-animation/src/value.rs | 4 + fyrox-build-tools/src/build.rs | 2 +- fyrox-build-tools/src/export/mod.rs | 1 + fyrox-build-tools/src/lib.rs | 14 +- fyrox-core-derive/src/lib.rs | 10 - fyrox-core-derive/src/reflect.rs | 19 ++ fyrox-core-derive/src/reflect/args.rs | 2 + fyrox-core-derive/src/uuid.rs | 48 ----- fyrox-core-derive/tests/it/main.rs | 1 - fyrox-core-derive/tests/it/reflect.rs | 25 ++- fyrox-core-derive/tests/it/uuid.rs | 32 --- fyrox-core/src/color.rs | 5 +- fyrox-core/src/color_gradient.rs | 2 + fyrox-core/src/dyntype.rs | 21 +- fyrox-core/src/lib.rs | 7 +- fyrox-core/src/log.rs | 1 + fyrox-core/src/math/mod.rs | 9 +- fyrox-core/src/pool/handle.rs | 26 +-- fyrox-core/src/pool/mod.rs | 4 + fyrox-core/src/reflect/array.rs | 6 +- fyrox-core/src/reflect/impls.rs | 198 ++++++++++++++---- fyrox-core/src/reflect/macros.rs | 6 +- fyrox-core/src/reflect/map.rs | 3 +- fyrox-core/src/reflect/mod.rs | 42 +++- fyrox-core/src/sstorage.rs | 4 - fyrox-core/src/type_traits.rs | 124 ----------- fyrox-core/src/variable.rs | 14 +- fyrox-graph/src/constructor.rs | 7 +- fyrox-graph/src/lib.rs | 20 +- fyrox-graphics/src/gpu_program.rs | 25 +-- fyrox-graphics/src/lib.rs | 96 ++------- fyrox-impl/src/engine/mod.rs | 47 +++-- fyrox-impl/src/engine/task.rs | 7 +- fyrox-impl/src/plugin/mod.rs | 8 +- fyrox-impl/src/renderer/settings.rs | 12 +- fyrox-impl/src/resource/curve/loader.rs | 5 +- fyrox-impl/src/resource/curve/mod.rs | 16 +- fyrox-impl/src/resource/fbx/mod.rs | 3 +- fyrox-impl/src/resource/gltf/material.rs | 3 +- fyrox-impl/src/resource/gltf/mod.rs | 6 +- fyrox-impl/src/resource/model/loader.rs | 5 +- fyrox-impl/src/resource/model/mod.rs | 18 +- fyrox-impl/src/scene/animation/absm.rs | 14 +- fyrox-impl/src/scene/animation/mod.rs | 14 +- fyrox-impl/src/scene/base.rs | 25 ++- fyrox-impl/src/scene/camera.rs | 26 +-- fyrox-impl/src/scene/collider.rs | 35 ++-- fyrox-impl/src/scene/decal.rs | 14 +- fyrox-impl/src/scene/dim2/collider.rs | 31 +-- fyrox-impl/src/scene/dim2/joint.rs | 24 +-- fyrox-impl/src/scene/dim2/physics.rs | 1 + fyrox-impl/src/scene/dim2/rectangle.rs | 14 +- fyrox-impl/src/scene/dim2/rigidbody.rs | 14 +- fyrox-impl/src/scene/graph/mod.rs | 10 +- fyrox-impl/src/scene/graph/physics.rs | 6 +- fyrox-impl/src/scene/joint.rs | 26 +-- fyrox-impl/src/scene/light/directional.rs | 19 +- fyrox-impl/src/scene/light/mod.rs | 1 + fyrox-impl/src/scene/light/point.rs | 14 +- fyrox-impl/src/scene/light/spot.rs | 14 +- fyrox-impl/src/scene/mesh/buffer.rs | 6 + fyrox-impl/src/scene/mesh/mod.rs | 20 +- fyrox-impl/src/scene/mesh/surface.rs | 20 +- fyrox-impl/src/scene/mod.rs | 19 +- fyrox-impl/src/scene/navmesh.rs | 15 +- fyrox-impl/src/scene/node/container.rs | 1 + fyrox-impl/src/scene/node/mod.rs | 14 +- .../src/scene/particle_system/emitter/base.rs | 1 + .../scene/particle_system/emitter/cuboid.rs | 1 + .../scene/particle_system/emitter/cylinder.rs | 1 + .../src/scene/particle_system/emitter/mod.rs | 5 +- .../scene/particle_system/emitter/sphere.rs | 1 + fyrox-impl/src/scene/particle_system/mod.rs | 18 +- fyrox-impl/src/scene/pivot.rs | 14 +- fyrox-impl/src/scene/probe.rs | 22 +- fyrox-impl/src/scene/ragdoll.rs | 18 +- fyrox-impl/src/scene/rigidbody.rs | 23 +- fyrox-impl/src/scene/skybox.rs | 5 +- fyrox-impl/src/scene/sound/listener.rs | 14 +- fyrox-impl/src/scene/sound/mod.rs | 14 +- fyrox-impl/src/scene/sprite.rs | 14 +- .../src/scene/terrain/brushstroke/mod.rs | 12 +- fyrox-impl/src/scene/terrain/geometry.rs | 2 +- fyrox-impl/src/scene/terrain/mod.rs | 22 +- fyrox-impl/src/scene/tilemap/brush.rs | 14 +- fyrox-impl/src/scene/tilemap/data.rs | 13 +- fyrox-impl/src/scene/tilemap/mod.rs | 16 +- fyrox-impl/src/scene/tilemap/property.rs | 17 +- fyrox-impl/src/scene/tilemap/tile_collider.rs | 23 +- fyrox-impl/src/scene/tilemap/tile_source.rs | 6 +- fyrox-impl/src/scene/tilemap/tileset.rs | 21 +- fyrox-impl/src/scene/tilemap/transform.rs | 1 + fyrox-impl/src/scene/tilemap/update.rs | 3 +- fyrox-impl/src/scene/transform.rs | 1 + fyrox-impl/src/script/constructor.rs | 7 +- fyrox-impl/src/script/mod.rs | 52 ++--- fyrox-impl/src/utils/lightmap.rs | 4 +- fyrox-impl/src/utils/navmesh.rs | 1 + fyrox-material/src/lib.rs | 27 +-- fyrox-material/src/loader.rs | 5 +- fyrox-material/src/shader/loader.rs | 5 +- fyrox-material/src/shader/mod.rs | 23 +- fyrox-resource/src/builtin.rs | 13 +- fyrox-resource/src/constructor.rs | 20 +- fyrox-resource/src/graph.rs | 3 +- fyrox-resource/src/lib.rs | 65 +++--- fyrox-resource/src/loader.rs | 10 +- fyrox-resource/src/manager.rs | 39 ++-- fyrox-resource/src/metadata.rs | 3 +- fyrox-resource/src/registry.rs | 5 +- fyrox-resource/src/state.rs | 40 ++-- fyrox-resource/src/untyped.rs | 38 ++-- fyrox-scripts/src/camera.rs | 4 +- fyrox-scripts/src/lib.rs | 2 +- fyrox-sound/src/buffer/generic.rs | 2 + fyrox-sound/src/buffer/loader.rs | 5 +- fyrox-sound/src/buffer/mod.rs | 15 +- fyrox-sound/src/buffer/streaming.rs | 1 + fyrox-sound/src/bus.rs | 2 + fyrox-sound/src/context.rs | 10 +- fyrox-sound/src/dsp/filters.rs | 4 +- fyrox-sound/src/effects/filter.rs | 8 +- fyrox-sound/src/effects/mod.rs | 6 +- fyrox-sound/src/effects/reverb.rs | 1 + fyrox-sound/src/listener.rs | 1 + fyrox-sound/src/renderer/hrtf.rs | 15 +- fyrox-sound/src/renderer/mod.rs | 4 +- fyrox-sound/src/source.rs | 5 +- fyrox-texture/src/lib.rs | 59 ++---- fyrox-texture/src/loader.rs | 5 +- fyrox-ui/src/absm.rs | 32 +-- fyrox-ui/src/alignment.rs | 7 +- fyrox-ui/src/animation.rs | 12 +- fyrox-ui/src/bit.rs | 20 +- fyrox-ui/src/border.rs | 6 +- fyrox-ui/src/brush.rs | 7 +- fyrox-ui/src/build.rs | 8 +- fyrox-ui/src/button.rs | 9 +- fyrox-ui/src/canvas.rs | 9 +- fyrox-ui/src/check_box.rs | 5 +- fyrox-ui/src/color/gradient.rs | 17 +- fyrox-ui/src/color/mod.rs | 36 ++-- fyrox-ui/src/control.rs | 27 ++- fyrox-ui/src/curve/key.rs | 2 + fyrox-ui/src/curve/mod.rs | 13 +- fyrox-ui/src/decorator.rs | 11 +- fyrox-ui/src/dock/mod.rs | 9 +- fyrox-ui/src/dock/tile.rs | 11 +- fyrox-ui/src/dropdown_list.rs | 11 +- fyrox-ui/src/dropdown_menu.rs | 6 +- fyrox-ui/src/expander.rs | 9 +- fyrox-ui/src/file_browser/dialog.rs | 6 +- fyrox-ui/src/file_browser/field.rs | 9 +- fyrox-ui/src/file_browser/filter.rs | 2 + fyrox-ui/src/file_browser/menu.rs | 12 +- fyrox-ui/src/file_browser/mod.rs | 7 +- fyrox-ui/src/file_browser/selector.rs | 12 +- fyrox-ui/src/font/loader.rs | 5 +- fyrox-ui/src/font/mod.rs | 12 +- fyrox-ui/src/formatted_text.rs | 7 +- fyrox-ui/src/formatted_text/run.rs | 7 +- fyrox-ui/src/grid.rs | 15 +- fyrox-ui/src/image.rs | 6 +- fyrox-ui/src/input.rs | 8 +- fyrox-ui/src/inspector/editors/array.rs | 12 +- fyrox-ui/src/inspector/editors/collection.rs | 22 +- fyrox-ui/src/inspector/editors/enumeration.rs | 30 +-- fyrox-ui/src/inspector/editors/inherit.rs | 8 +- fyrox-ui/src/inspector/editors/mod.rs | 1 + fyrox-ui/src/inspector/editors/style.rs | 12 +- .../src/inspector/editors/texture_slice.rs | 13 +- fyrox-ui/src/inspector/mod.rs | 15 +- fyrox-ui/src/key.rs | 17 +- fyrox-ui/src/lib.rs | 25 ++- fyrox-ui/src/list_view.rs | 18 +- fyrox-ui/src/loader.rs | 8 +- fyrox-ui/src/matrix.rs | 26 +-- fyrox-ui/src/menu.rs | 30 ++- fyrox-ui/src/message.rs | 10 +- fyrox-ui/src/messagebox.rs | 9 +- fyrox-ui/src/navigation.rs | 9 +- fyrox-ui/src/nine_patch.rs | 11 +- fyrox-ui/src/node/container.rs | 1 + fyrox-ui/src/node/mod.rs | 16 +- fyrox-ui/src/numeric.rs | 20 +- fyrox-ui/src/path.rs | 12 +- fyrox-ui/src/popup.rs | 6 +- fyrox-ui/src/progress_bar.rs | 8 +- fyrox-ui/src/range.rs | 19 +- fyrox-ui/src/rect.rs | 22 +- fyrox-ui/src/screen.rs | 12 +- fyrox-ui/src/scroll_bar.rs | 9 +- fyrox-ui/src/scroll_panel.rs | 9 +- fyrox-ui/src/scroll_viewer.rs | 11 +- fyrox-ui/src/searchbar.rs | 9 +- fyrox-ui/src/selector.rs | 9 +- fyrox-ui/src/stack_panel.rs | 9 +- fyrox-ui/src/style/mod.rs | 22 +- fyrox-ui/src/style/resource.rs | 10 +- fyrox-ui/src/tab_control.rs | 12 +- fyrox-ui/src/text.rs | 10 +- fyrox-ui/src/text_box.rs | 16 +- fyrox-ui/src/thickness.rs | 1 + fyrox-ui/src/thumb.rs | 9 +- fyrox-ui/src/toggle.rs | 6 +- fyrox-ui/src/tree.rs | 16 +- fyrox-ui/src/utils.rs | 3 +- fyrox-ui/src/uuid.rs | 11 +- fyrox-ui/src/vec.rs | 39 +--- fyrox-ui/src/vector_image.rs | 11 +- fyrox-ui/src/widget.rs | 2 + fyrox-ui/src/window.rs | 12 +- fyrox-ui/src/wrap_panel.rs | 9 +- project-manager/src/main.rs | 2 +- project-manager/src/settings.rs | 1 + template-core/src/lib.rs | 6 +- 343 files changed, 1808 insertions(+), 2262 deletions(-) delete mode 100644 fyrox-core-derive/src/uuid.rs delete mode 100644 fyrox-core-derive/tests/it/uuid.rs delete mode 100644 fyrox-core/src/type_traits.rs diff --git a/editor/src/asset/creator.rs b/editor/src/asset/creator.rs index d9c60670d..0b04df38c 100644 --- a/editor/src/asset/creator.rs +++ b/editor/src/asset/creator.rs @@ -24,7 +24,7 @@ use crate::{ manager::ResourceManager, untyped::{ResourceKind, UntypedResource}, }, - core::{log::Log, make_pretty_type_name, pool::Handle, SafeLock, Uuid}, + core::{log::Log, make_pretty_type_name, pool::Handle, SafeLock}, engine::Engine, gui::{ button::{ButtonBuilder, ButtonMessage}, @@ -43,6 +43,7 @@ use crate::{ message::MessageSender, Message, }; +use fyrox::core::uuid::Uuid; use fyrox::gui::button::Button; use fyrox::gui::list_view::ListView; use fyrox::gui::text_box::TextBox; diff --git a/editor/src/asset/item.rs b/editor/src/asset/item.rs index 3566eb9ef..d88f9a9f4 100644 --- a/editor/src/asset/item.rs +++ b/editor/src/asset/item.rs @@ -26,8 +26,7 @@ use crate::{ asset::{manager::ResourceManager, untyped::UntypedResource, Resource, TypedResourceData}, core::{ algebra::Vector2, color::Color, futures::executor::block_on, make_relative_path, - parking_lot::lock_api::Mutex, pool::Handle, reflect::prelude::*, uuid_provider, - visitor::prelude::*, + parking_lot::lock_api::Mutex, pool::Handle, reflect::prelude::*, visitor::prelude::*, }, graph::SceneGraph, gui::{ @@ -81,7 +80,10 @@ impl MessageData for AssetItemMessage {} #[allow(dead_code)] #[derive(Debug, Clone, Visit, Reflect)] -#[reflect(derived_type = "UiNode")] +#[reflect( + derived_type = "UiNode", + type_uuid = "54f7d9c1-e707-4c8c-a5c9-3fc5cc80b545" +)] pub struct AssetItem { widget: Widget, pub path: PathBuf, @@ -254,8 +256,6 @@ impl DerefMut for AssetItem { } } -uuid_provider!(AssetItem = "54f7d9c1-e707-4c8c-a5c9-3fc5cc80b545"); - impl Control for AssetItem { fn draw(&self, drawing_context: &mut DrawingContext) { drawing_context.push_rect_filled(&self.bounding_rect(), None); diff --git a/editor/src/asset/menu.rs b/editor/src/asset/menu.rs index f02cfb562..41af9adf3 100644 --- a/editor/src/asset/menu.rs +++ b/editor/src/asset/menu.rs @@ -24,8 +24,7 @@ use crate::{ asset::manager::ResourceManager, core::{ futures::executor::block_on, log::Log, ok_or_return, pool::Handle, - pool::HandlesVecExtension, reflect::prelude::*, type_traits::prelude::*, - visitor::prelude::*, SafeLock, + pool::HandlesVecExtension, reflect::prelude::*, visitor::prelude::*, SafeLock, }, engine::Engine, graph::SceneGraph, @@ -62,9 +61,9 @@ use std::{ path::PathBuf, }; -#[derive(Clone, Visit, Reflect, Debug, TypeUuidProvider)] +#[derive(Clone, Visit, Reflect, Debug)] #[reflect(derived_type = "UiNode")] -#[type_uuid(id = "8c9934ad-b4e1-4c68-9876-f253e34c6667")] +#[reflect(type_uuid = "8c9934ad-b4e1-4c68-9876-f253e34c6667")] struct AssetRenameDialog { window: Window, name_field: Handle, @@ -437,18 +436,18 @@ impl AssetItemContextMenu { let loaders = engine.resource_manager.state().loaders.clone(); let loaders = loaders.lock(); - if let Some(loader) = - loaders.loader_for_data_type(data.type_uuid()) - { + if let Some(loader) = loaders.loader_for_data_type( + data.inner_ref().type_info_ref().type_uuid, + ) { if let Some(extension) = loader.extensions().first() { - if data.can_be_saved() { + if data.inner_ref().can_be_saved() { let final_copy_path = asset::make_unique_path( ®istry_path, path.to_str().unwrap(), extension, ); drop(loaders); - if data.save(&final_copy_path).is_ok() { + if data.inner_mut().save(&final_copy_path).is_ok() { engine .resource_manager .request_untyped(&final_copy_path); diff --git a/editor/src/asset/preview/cache.rs b/editor/src/asset/preview/cache.rs index e5cae74bd..0d9b9ff7a 100644 --- a/editor/src/asset/preview/cache.rs +++ b/editor/src/asset/preview/cache.rs @@ -25,7 +25,7 @@ use crate::{ }, fyrox::{ asset::untyped::UntypedResource, - core::{futures::executor::block_on, parking_lot::Mutex, pool::Handle, SafeLock, Uuid}, + core::{futures::executor::block_on, parking_lot::Mutex, pool::Handle, SafeLock}, engine::Engine, fxhash::FxHashMap, gui::UiNode, @@ -33,6 +33,7 @@ use crate::{ load_image, }; use fyrox::core::pool::ObjectOrVariant; +use fyrox::core::uuid::Uuid; use std::{ collections::VecDeque, sync::{mpsc::Receiver, Arc}, diff --git a/editor/src/asset/preview/mod.rs b/editor/src/asset/preview/mod.rs index 3511f9906..43aad5007 100644 --- a/editor/src/asset/preview/mod.rs +++ b/editor/src/asset/preview/mod.rs @@ -29,7 +29,6 @@ use crate::{ color::Color, pool::Handle, uuid::Uuid, - TypeUuidProvider, }, engine::{Engine, GraphicsContext}, fxhash::FxHashMap, @@ -63,6 +62,7 @@ use crate::{ }, load_image, }; +use fyrox::core::reflect::prelude::*; use fyrox::renderer::ui_renderer::UiRenderInfo; use image::{ColorType, GenericImage, Rgba}; @@ -74,16 +74,16 @@ pub struct AssetPreviewGeneratorsCollection { impl AssetPreviewGeneratorsCollection { pub fn new() -> Self { let mut this = Self::default(); - this.add(Texture::type_uuid(), TexturePreview); - this.add(Model::type_uuid(), ModelPreview); - this.add(SoundBuffer::type_uuid(), SoundPreview); - this.add(Shader::type_uuid(), ShaderPreview); - this.add(Material::type_uuid(), MaterialPreview); - this.add(HrirSphereResourceData::type_uuid(), HrirPreview); - this.add(CurveResourceState::type_uuid(), CurvePreview); - this.add(Font::type_uuid(), FontPreview); - this.add(UserInterface::type_uuid(), UserInterfacePreview); - this.add(SurfaceData::type_uuid(), SurfaceDataPreview); + this.add(Texture::type_info().type_uuid, TexturePreview); + this.add(Model::type_info().type_uuid, ModelPreview); + this.add(SoundBuffer::type_info().type_uuid, SoundPreview); + this.add(Shader::type_info().type_uuid, ShaderPreview); + this.add(Material::type_info().type_uuid, MaterialPreview); + this.add(HrirSphereResourceData::type_info().type_uuid, HrirPreview); + this.add(CurveResourceState::type_info().type_uuid, CurvePreview); + this.add(Font::type_info().type_uuid, FontPreview); + this.add(UserInterface::type_info().type_uuid, UserInterfacePreview); + this.add(SurfaceData::type_info().type_uuid, SurfaceDataPreview); this } diff --git a/editor/src/asset/selection.rs b/editor/src/asset/selection.rs index 420eef481..71c282372 100644 --- a/editor/src/asset/selection.rs +++ b/editor/src/asset/selection.rs @@ -62,7 +62,7 @@ impl SaveResourceCommand { fn save(&self) { let mut guard = self.resource.lock(); if let Some(data) = guard.state.data_mut() { - Log::verify(data.save(&self.path)); + Log::verify(data.inner_mut().save(&self.path)); } } } @@ -218,7 +218,7 @@ impl SelectionContainer for AssetSelection { if !self.resource_manager.is_built_in_resource(&resource) { if let Some(command) = make_command(args, move |_| { let mut guard = resource.lock(); - let data = &mut **guard.state.data_mut()?; + let data = guard.state.data_mut()?.inner_mut(); // SAFETY: This is safe, because the closure owns its own copy of // resource strong ref, and the entity getter is used only once per // do/undo/redo calls. @@ -277,7 +277,7 @@ impl SelectionContainer for AssetSelection { value, move |_| { let mut guard = resource.lock(); - let data = &mut **guard.state.data_mut()?; + let data = guard.state.data_mut()?.inner_mut(); // SAFETY: This is safe, because the closure owns its own copy of // resource strong ref, and the entity getter is used only once per // do/undo/redo calls. diff --git a/editor/src/asset/selector.rs b/editor/src/asset/selector.rs index 338186f6d..d94802312 100644 --- a/editor/src/asset/selector.rs +++ b/editor/src/asset/selector.rs @@ -31,7 +31,6 @@ use crate::{ pool::{Handle, HandlesVecExtension}, reflect::prelude::*, some_or_continue, - type_traits::prelude::*, visitor::prelude::*, PhantomDataSendSync, SafeLock, }, @@ -79,8 +78,8 @@ pub enum AssetSelectorMessage { } impl MessageData for AssetSelectorMessage {} -#[derive(Clone, Debug, Reflect, Visit, TypeUuidProvider)] -#[type_uuid(id = "aa4f0726-8d25-4c90-add1-92ba392310c6")] +#[derive(Clone, Debug, Reflect, Visit)] +#[reflect(type_uuid = "aa4f0726-8d25-4c90-add1-92ba392310c6")] struct Item { pub widget: Widget, image: Handle, @@ -230,8 +229,8 @@ impl ItemBuilder { } } -#[derive(Clone, Debug, Reflect, Visit, TypeUuidProvider)] -#[type_uuid(id = "970bb83b-51e8-48e7-8050-f97bf0ac470b")] +#[derive(Clone, Debug, Reflect, Visit)] +#[reflect(type_uuid = "970bb83b-51e8-48e7-8050-f97bf0ac470b")] pub struct AssetSelector { pub widget: Widget, list_view: Handle, @@ -321,10 +320,14 @@ impl<'a> AssetSelectorBuilder<'a> { supported_resource_paths.extend(state.built_in_resources.values().filter_map(|res| { let resource_state = res.resource.lock(); - if self - .asset_types - .contains(&resource_state.state.data_ref()?.type_uuid()) - { + if self.asset_types.contains( + &resource_state + .state + .data_ref()? + .inner_ref() + .type_info_ref() + .type_uuid, + ) { Some(res.id.clone()) } else { None @@ -384,8 +387,8 @@ impl<'a> AssetSelectorBuilder<'a> { } } -#[derive(Clone, Debug, Reflect, Visit, TypeUuidProvider)] -#[type_uuid(id = "c348ad3d-52a6-40ad-a5e4-bf63fefe1906")] +#[derive(Clone, Debug, Reflect, Visit)] +#[reflect(type_uuid = "c348ad3d-52a6-40ad-a5e4-bf63fefe1906")] pub struct AssetSelectorWindow { pub window: Window, selector: Handle, @@ -571,7 +574,7 @@ impl<'a> AssetSelectorWindowBuilder<'a> { .unwrap_or_default() .into(), ) - .with_asset_types(vec![::type_uuid()]) + .with_asset_types(vec![::type_info().type_uuid]) .build(icon_request_sender, resource_manager, &mut ui.build_ctx()); ui.send( @@ -588,6 +591,7 @@ impl<'a> AssetSelectorWindowBuilder<'a> { } #[derive(Reflect, Visit, Debug)] +#[reflect(type_uuid = "7839eb64-1e6e-4e40-a8fb-53c9d0945b16")] pub struct AssetSelectorMixin { pub selector: Cell>, pub select: Handle