finished with PartialEq impls

This commit is contained in:
Dmitry Stepanov
2026-06-11 12:05:30 +03:00
parent b0113664fa
commit 806c3ed297
130 changed files with 524 additions and 371 deletions
+4 -4
View File
@@ -26,7 +26,7 @@ use crate::{
asset::{manager::ResourceManager, untyped::UntypedResource, Resource, TypedResourceData}, asset::{manager::ResourceManager, untyped::UntypedResource, Resource, TypedResourceData},
core::{ core::{
algebra::Vector2, color::Color, futures::executor::block_on, make_relative_path, algebra::Vector2, color::Color, futures::executor::block_on, make_relative_path,
parking_lot::lock_api::Mutex, pool::Handle, reflect::prelude::*, visitor::prelude::*, pool::Handle, reflect::prelude::*, visitor::prelude::*,
}, },
graph::SceneGraph, graph::SceneGraph,
gui::{ gui::{
@@ -54,10 +54,10 @@ use fyrox::core::ok_or_return;
use fyrox::gui::border::Border; use fyrox::gui::border::Border;
use fyrox::gui::image::Image; use fyrox::gui::image::Image;
use fyrox::gui::message::MessageData; use fyrox::gui::message::MessageData;
use fyrox::gui::widget::UserData;
use std::{ use std::{
ops::{Deref, DerefMut}, ops::{Deref, DerefMut},
path::{Path, PathBuf}, path::{Path, PathBuf},
sync::Arc,
}; };
pub const DEFAULT_SIZE: f32 = 60.0; pub const DEFAULT_SIZE: f32 = 60.0;
@@ -79,7 +79,7 @@ pub enum AssetItemMessage {
impl MessageData for AssetItemMessage {} impl MessageData for AssetItemMessage {}
#[allow(dead_code)] #[allow(dead_code)]
#[derive(Debug, Clone, Visit, Reflect)] #[derive(Debug, Clone, Visit, PartialEq, Reflect)]
#[reflect( #[reflect(
derived_type = "UiNode", derived_type = "UiNode",
type_uuid = "54f7d9c1-e707-4c8c-a5c9-3fc5cc80b545" type_uuid = "54f7d9c1-e707-4c8c-a5c9-3fc5cc80b545"
@@ -432,7 +432,7 @@ impl AssetItemBuilder {
let item = AssetItem { let item = AssetItem {
widget: self widget: self
.widget_builder .widget_builder
.with_user_data(Arc::new(Mutex::new(self.path.clone()))) .with_user_data(UserData::new(self.path.clone()))
.with_margin(Thickness::uniform(1.0)) .with_margin(Thickness::uniform(1.0))
.with_allow_drag(true) .with_allow_drag(true)
.with_allow_drop(true) .with_allow_drop(true)
+1 -1
View File
@@ -61,7 +61,7 @@ use std::{
path::PathBuf, path::PathBuf,
}; };
#[derive(Clone, Visit, Reflect, Debug)] #[derive(Clone, Visit, PartialEq, Reflect, Debug)]
#[reflect(derived_type = "UiNode")] #[reflect(derived_type = "UiNode")]
#[reflect(type_uuid = "8c9934ad-b4e1-4c68-9876-f253e34c6667")] #[reflect(type_uuid = "8c9934ad-b4e1-4c68-9876-f253e34c6667")]
struct AssetRenameDialog { struct AssetRenameDialog {
+4 -4
View File
@@ -79,7 +79,7 @@ pub enum AssetSelectorMessage {
impl MessageData for AssetSelectorMessage {} impl MessageData for AssetSelectorMessage {}
#[derive(Clone, Debug, Reflect, Visit)] #[derive(Clone, Debug, Reflect, Visit)]
#[reflect(type_uuid = "aa4f0726-8d25-4c90-add1-92ba392310c6")] #[reflect(type_uuid = "aa4f0726-8d25-4c90-add1-92ba392310c6", non_comparable)]
struct Item { struct Item {
pub widget: Widget, pub widget: Widget,
image: Handle<Image>, image: Handle<Image>,
@@ -229,7 +229,7 @@ impl ItemBuilder {
} }
} }
#[derive(Clone, Debug, Reflect, Visit)] #[derive(Clone, Debug, PartialEq, Reflect, Visit)]
#[reflect(type_uuid = "970bb83b-51e8-48e7-8050-f97bf0ac470b")] #[reflect(type_uuid = "970bb83b-51e8-48e7-8050-f97bf0ac470b")]
pub struct AssetSelector { pub struct AssetSelector {
pub widget: Widget, pub widget: Widget,
@@ -387,7 +387,7 @@ impl<'a> AssetSelectorBuilder<'a> {
} }
} }
#[derive(Clone, Debug, Reflect, Visit)] #[derive(Clone, Debug, PartialEq, Reflect, Visit)]
#[reflect(type_uuid = "c348ad3d-52a6-40ad-a5e4-bf63fefe1906")] #[reflect(type_uuid = "c348ad3d-52a6-40ad-a5e4-bf63fefe1906")]
pub struct AssetSelectorWindow { pub struct AssetSelectorWindow {
pub window: Window, pub window: Window,
@@ -591,7 +591,7 @@ impl<'a> AssetSelectorWindowBuilder<'a> {
} }
#[derive(Reflect, Visit, Debug)] #[derive(Reflect, Visit, Debug)]
#[reflect(type_uuid = "7839eb64-1e6e-4e40-a8fb-53c9d0945b16")] #[reflect(type_uuid = "7839eb64-1e6e-4e40-a8fb-53c9d0945b16", non_comparable)]
pub struct AssetSelectorMixin<T: TypedResourceData> { pub struct AssetSelectorMixin<T: TypedResourceData> {
pub selector: Cell<Handle<AssetSelectorWindow>>, pub selector: Cell<Handle<AssetSelectorWindow>>,
pub select: Handle<Button>, pub select: Handle<Button>,
+1 -1
View File
@@ -47,7 +47,7 @@ pub enum AudioBusViewMessage {
} }
impl MessageData for AudioBusViewMessage {} impl MessageData for AudioBusViewMessage {}
#[derive(Clone, Visit, Reflect, Debug)] #[derive(Clone, Visit, PartialEq, Reflect, Debug)]
#[reflect( #[reflect(
derived_type = "UiNode", derived_type = "UiNode",
type_uuid = "5439e3a9-096a-4155-922c-ed57a76a46f3" type_uuid = "5439e3a9-096a-4155-922c-ed57a76a46f3"
+1 -1
View File
@@ -52,7 +52,7 @@ use fyrox::scene::camera::Camera;
use fyrox::scene::mesh::Mesh; use fyrox::scene::mesh::Mesh;
use fyrox::scene::pivot::Pivot; use fyrox::scene::pivot::Pivot;
#[derive(Reflect, Debug, Clone)] #[derive(PartialEq, Reflect, Debug, Clone)]
#[reflect(type_uuid = "060abe31-ce96-4696-aa5d-e44e9639df0e")] #[reflect(type_uuid = "060abe31-ce96-4696-aa5d-e44e9639df0e")]
pub struct MoveGizmo { pub struct MoveGizmo {
pub origin: Handle<Pivot>, pub origin: Handle<Pivot>,
+2 -2
View File
@@ -51,7 +51,7 @@ use fyrox::scene::camera::Camera;
use fyrox::scene::mesh::Mesh; use fyrox::scene::mesh::Mesh;
use fyrox::scene::pivot::Pivot; use fyrox::scene::pivot::Pivot;
#[derive(Reflect, Debug)] #[derive(PartialEq, Reflect, Debug)]
#[reflect(non_cloneable, type_uuid = "5ef2c27b-18af-458d-9549-1395f0869551")] #[reflect(non_cloneable, type_uuid = "5ef2c27b-18af-458d-9549-1395f0869551")]
pub enum RotateGizmoMode { pub enum RotateGizmoMode {
Pitch, Pitch,
@@ -59,7 +59,7 @@ pub enum RotateGizmoMode {
Roll, Roll,
} }
#[derive(Reflect, Debug)] #[derive(PartialEq, Reflect, Debug)]
#[reflect(non_cloneable, type_uuid = "36fc1ea4-33cd-4108-ae61-bab544f8ac02")] #[reflect(non_cloneable, type_uuid = "36fc1ea4-33cd-4108-ae61-bab544f8ac02")]
pub struct RotationGizmo { pub struct RotationGizmo {
mode: RotateGizmoMode, mode: RotateGizmoMode,
+2 -2
View File
@@ -49,7 +49,7 @@ use fyrox::core::reflect::prelude::*;
use fyrox::scene::camera::Camera; use fyrox::scene::camera::Camera;
use fyrox::scene::mesh::Mesh; use fyrox::scene::mesh::Mesh;
#[derive(Reflect, Debug)] #[derive(PartialEq, Reflect, Debug)]
#[reflect(non_cloneable, type_uuid = "0555e074-bbd8-4753-a2ab-56d7092251c1")] #[reflect(non_cloneable, type_uuid = "0555e074-bbd8-4753-a2ab-56d7092251c1")]
pub enum ScaleGizmoMode { pub enum ScaleGizmoMode {
None, None,
@@ -59,7 +59,7 @@ pub enum ScaleGizmoMode {
Uniform, Uniform,
} }
#[derive(Reflect, Debug)] #[derive(PartialEq, Reflect, Debug)]
#[reflect(non_cloneable, type_uuid = "c8827bb2-1aac-41e7-b2c1-ba04e0dc59e0")] #[reflect(non_cloneable, type_uuid = "c8827bb2-1aac-41e7-b2c1-ba04e0dc59e0")]
pub struct ScaleGizmo { pub struct ScaleGizmo {
mode: ScaleGizmoMode, mode: ScaleGizmoMode,
+3 -3
View File
@@ -52,7 +52,7 @@ use crate::{
use fyrox::core::some_or_return; use fyrox::core::some_or_return;
use fyrox::gui::button::Button; use fyrox::gui::button::Button;
#[derive(Reflect, Debug, Clone)] #[derive(PartialEq, Reflect, Debug, Clone)]
#[reflect(type_uuid = "067c67e2-865b-4112-8d60-133ee1e1883a")] #[reflect(type_uuid = "067c67e2-865b-4112-8d60-133ee1e1883a")]
struct Entry { struct Entry {
node: Handle<Node>, node: Handle<Node>,
@@ -62,7 +62,7 @@ struct Entry {
new_local_position: Vector3<f32>, new_local_position: Vector3<f32>,
} }
#[derive(Reflect, Debug, Clone)] #[derive(PartialEq, Reflect, Debug, Clone)]
#[reflect(type_uuid = "f50af953-308e-40e8-85ae-48c905ba5f46")] #[reflect(type_uuid = "f50af953-308e-40e8-85ae-48c905ba5f46")]
struct MoveContext { struct MoveContext {
#[reflect(hidden)] #[reflect(hidden)]
@@ -280,7 +280,7 @@ impl MoveContext {
} }
} }
#[derive(Reflect, Debug, Clone)] #[derive(PartialEq, Reflect, Debug, Clone)]
#[reflect(type_uuid = "067c67e2-865b-4112-8d60-133ee1e1883a")] #[reflect(type_uuid = "067c67e2-865b-4112-8d60-133ee1e1883a")]
pub struct MoveInteractionMode { pub struct MoveInteractionMode {
move_context: Option<MoveContext>, move_context: Option<MoveContext>,
+2 -2
View File
@@ -198,7 +198,7 @@ impl NavmeshPanel {
} }
} }
#[derive(Reflect, Debug)] #[derive(PartialEq, Reflect, Debug)]
#[reflect( #[reflect(
non_cloneable, non_cloneable,
type_uuid = "986eb5f1-5f17-4373-bffb-1e213e7c97e5", type_uuid = "986eb5f1-5f17-4373-bffb-1e213e7c97e5",
@@ -220,7 +220,7 @@ impl DragContext {
} }
} }
#[derive(Reflect, Debug)] #[derive(PartialEq, Reflect, Debug)]
#[reflect(non_cloneable, type_uuid = "a8ed875d-0932-400d-b5b0-e0dcfb78c6c1")] #[reflect(non_cloneable, type_uuid = "a8ed875d-0932-400d-b5b0-e0dcfb78c6c1")]
pub struct EditNavmeshMode { pub struct EditNavmeshMode {
move_gizmo: MoveGizmo, move_gizmo: MoveGizmo,
+1 -1
View File
@@ -22,7 +22,7 @@ use crate::fyrox::core::{algebra::Vector3, math::plane::Plane, num_traits::Zero}
use fyrox::core::reflect::prelude::*; use fyrox::core::reflect::prelude::*;
use strum_macros::EnumIter; use strum_macros::EnumIter;
#[derive(Copy, Clone, Debug, EnumIter, Reflect)] #[derive(Copy, Clone, PartialEq, Debug, EnumIter, Reflect)]
#[reflect(type_uuid = "f50af953-308e-40e8-85ae-48c905ba5f46")] #[reflect(type_uuid = "f50af953-308e-40e8-85ae-48c905ba5f46")]
pub enum PlaneKind { pub enum PlaneKind {
X, X,
+1 -1
View File
@@ -47,7 +47,7 @@ use crate::{
}; };
use fyrox::gui::button::Button; use fyrox::gui::button::Button;
#[derive(Reflect, Debug)] #[derive(PartialEq, Reflect, Debug)]
#[reflect(non_cloneable, type_uuid = "37f20364-feb5-4731-8c19-c3df922818d6")] #[reflect(non_cloneable, type_uuid = "37f20364-feb5-4731-8c19-c3df922818d6")]
pub struct RotateInteractionMode { pub struct RotateInteractionMode {
initial_rotations: Vec<UnitQuaternion<f32>>, initial_rotations: Vec<UnitQuaternion<f32>>,
+1 -1
View File
@@ -44,7 +44,7 @@ use crate::{
}; };
use fyrox::gui::button::Button; use fyrox::gui::button::Button;
#[derive(Reflect, Debug)] #[derive(PartialEq, Reflect, Debug)]
#[reflect(non_cloneable, type_uuid = "64b4da1a-5d0f-49e1-9f48-011165cd1ec5")] #[reflect(non_cloneable, type_uuid = "64b4da1a-5d0f-49e1-9f48-011165cd1ec5")]
pub struct ScaleInteractionMode { pub struct ScaleInteractionMode {
initial_scales: Vec<Vector3<f32>>, initial_scales: Vec<Vector3<f32>>,
+1 -1
View File
@@ -41,7 +41,7 @@ use fyrox::gui::button::Button;
use fyrox::gui::image::Image; use fyrox::gui::image::Image;
use fyrox::gui::widget::WidgetMessage; use fyrox::gui::widget::WidgetMessage;
#[derive(Reflect, Debug)] #[derive(PartialEq, Reflect, Debug)]
#[reflect(non_cloneable, type_uuid = "bab9ce8c-d679-4c49-beb9-f5a8482e0678")] #[reflect(non_cloneable, type_uuid = "bab9ce8c-d679-4c49-beb9-f5a8482e0678")]
pub struct SelectInteractionMode { pub struct SelectInteractionMode {
preview: Handle<Image>, preview: Handle<Image>,
+3 -1
View File
@@ -106,7 +106,7 @@ fn handle_undo_chunks(undo_chunks: UndoData, sender: &MessageSender) {
} }
} }
#[derive(Reflect)] #[derive(PartialEq, Reflect)]
#[reflect( #[reflect(
non_cloneable, non_cloneable,
type_uuid = "bc19eff3-3e3a-49c0-9a9d-17d36fccc34e", type_uuid = "bc19eff3-3e3a-49c0-9a9d-17d36fccc34e",
@@ -243,6 +243,7 @@ impl TerrainInteractionMode {
} }
} }
#[derive(PartialEq)]
pub struct BrushGizmo { pub struct BrushGizmo {
brush: Handle<Mesh>, brush: Handle<Mesh>,
} }
@@ -558,6 +559,7 @@ impl InteractionMode for TerrainInteractionMode {
} }
} }
#[derive(PartialEq)]
struct BrushPanel { struct BrushPanel {
window: Handle<Window>, window: Handle<Window>,
inspector: Handle<Inspector>, inspector: Handle<Inspector>,
+1 -1
View File
@@ -55,7 +55,7 @@ use std::{
}, },
}; };
#[derive(Reflect, Clone, Debug)] #[derive(PartialEq, Reflect, Clone, Debug)]
#[reflect(type_uuid = "86eed637-0d96-4ad2-9566-a451f0b00237")] #[reflect(type_uuid = "86eed637-0d96-4ad2-9566-a451f0b00237")]
struct LightmapperSettings { struct LightmapperSettings {
/// Name of the property in a material that will be modified in all materials for all surfaces /// Name of the property in a material that will be modified in all materials for all surfaces
+2 -3
View File
@@ -41,13 +41,12 @@ use crate::{
settings::{recent::RecentFiles, Settings}, settings::{recent::RecentFiles, Settings},
Engine, Message, Mode, Panels, SaveSceneConfirmationDialogAction, Engine, Message, Mode, Panels, SaveSceneConfirmationDialogAction,
}; };
use fyrox::core::parking_lot::Mutex;
use fyrox::core::uuid::{uuid, Uuid}; use fyrox::core::uuid::{uuid, Uuid};
use fyrox::graph::SceneGraph; use fyrox::graph::SceneGraph;
use fyrox::gui::file_browser::FileSelector; use fyrox::gui::file_browser::FileSelector;
use fyrox::gui::menu::MenuItem; use fyrox::gui::menu::MenuItem;
use fyrox::gui::messagebox::MessageBox; use fyrox::gui::messagebox::MessageBox;
use std::sync::Arc; use fyrox::gui::widget::UserData;
use std::{path::PathBuf, sync::mpsc::Sender}; use std::{path::PathBuf, sync::mpsc::Sender};
pub struct FileMenu { pub struct FileMenu {
@@ -82,7 +81,7 @@ fn make_recent_files_items(
.iter() .iter()
.map(|f| { .map(|f| {
let item = create_menu_item(f.to_string_lossy().as_ref(), Uuid::new_v4(), vec![], ctx); let item = create_menu_item(f.to_string_lossy().as_ref(), Uuid::new_v4(), vec![], ctx);
ctx[item].user_data = Some(Arc::new(Mutex::new(RecentFile(f.to_path_buf())))); ctx[item].user_data = Some(UserData::new(RecentFile(f.to_path_buf())));
item item
}) })
.collect::<Vec<_>>() .collect::<Vec<_>>()
+6
View File
@@ -128,6 +128,12 @@ pub enum Message {
#[reflect(hide_all, type_uuid = "86eed637-0d96-4ad2-9566-a451f0b00237")] #[reflect(hide_all, type_uuid = "86eed637-0d96-4ad2-9566-a451f0b00237")]
pub struct MessageSender(pub Sender<Message>); pub struct MessageSender(pub Sender<Message>);
impl PartialEq for MessageSender {
fn eq(&self, _other: &Self) -> bool {
true
}
}
impl Default for MessageSender { impl Default for MessageSender {
fn default() -> Self { fn default() -> Self {
let (rx, _) = channel(); let (rx, _) = channel();
+4 -4
View File
@@ -89,7 +89,7 @@ impl MessageData for BlendSpaceFieldMessage {
} }
} }
#[derive(Clone, Visit, Reflect, Debug)] #[derive(Clone, Visit, PartialEq, Reflect, Debug)]
#[reflect(type_uuid = "5cdb0ab3-b6fd-41c3-a6c4-d1178346eb81")] #[reflect(type_uuid = "5cdb0ab3-b6fd-41c3-a6c4-d1178346eb81")]
struct ContextMenu { struct ContextMenu {
#[visit(skip)] #[visit(skip)]
@@ -101,13 +101,13 @@ struct ContextMenu {
remove_point: Handle<MenuItem>, remove_point: Handle<MenuItem>,
} }
#[derive(Clone)] #[derive(PartialEq, Clone)]
enum DragContext { enum DragContext {
SamplingPoint, SamplingPoint,
Point { point: usize }, Point { point: usize },
} }
#[derive(Clone, Visit, Reflect)] #[derive(Clone, Visit, PartialEq, Reflect)]
#[reflect( #[reflect(
derived_type = "UiNode", derived_type = "UiNode",
type_uuid = "854a7c2d-3ccd-4331-95e1-956a3a035bd0" type_uuid = "854a7c2d-3ccd-4331-95e1-956a3a035bd0"
@@ -557,7 +557,7 @@ pub enum BlendSpaceFieldPointMessage {
} }
impl MessageData for BlendSpaceFieldPointMessage {} impl MessageData for BlendSpaceFieldPointMessage {}
#[derive(Clone, Visit, Reflect, Debug)] #[derive(Clone, Visit, PartialEq, Reflect, Debug)]
#[reflect( #[reflect(
derived_type = "UiNode", derived_type = "UiNode",
type_uuid = "22c215c1-ff23-4a64-9aa7-640b5014a78b" type_uuid = "22c215c1-ff23-4a64-9aa7-640b5014a78b"
+1 -1
View File
@@ -113,7 +113,7 @@ impl MessageData for AbsmCanvasMessage {
} }
} }
#[derive(Clone, Visit, Reflect, Debug)] #[derive(Clone, Visit, PartialEq, Reflect, Debug)]
#[reflect( #[reflect(
derived_type = "UiNode", derived_type = "UiNode",
type_uuid = "100b1c33-d017-4fe6-95e7-e1daf310ef27" type_uuid = "100b1c33-d017-4fe6-95e7-e1daf310ef27"
+1 -1
View File
@@ -43,7 +43,7 @@ use fyrox::material::MaterialResource;
const PICKED_BRUSH: Brush = Brush::Solid(Color::opaque(100, 100, 100)); const PICKED_BRUSH: Brush = Brush::Solid(Color::opaque(100, 100, 100));
const NORMAL_BRUSH: Brush = Brush::Solid(Color::opaque(80, 80, 80)); const NORMAL_BRUSH: Brush = Brush::Solid(Color::opaque(80, 80, 80));
#[derive(Debug, Clone, Visit, Reflect)] #[derive(Debug, Clone, Visit, PartialEq, Reflect)]
#[reflect( #[reflect(
derived_type = "UiNode", derived_type = "UiNode",
type_uuid = "c802b6fa-a5ef-4464-a097-749c731ffde0" type_uuid = "c802b6fa-a5ef-4464-a097-749c731ffde0"
+3 -2
View File
@@ -48,7 +48,7 @@ use std::{
ops::{Deref, DerefMut}, ops::{Deref, DerefMut},
}; };
#[derive(Clone, Debug, Visit, Reflect)] #[derive(Clone, Debug, Visit, PartialEq, Reflect)]
#[reflect(type_uuid = "1a5d0042-3607-4fcb-88c6-025a0bce6111")] #[reflect(type_uuid = "1a5d0042-3607-4fcb-88c6-025a0bce6111")]
pub struct AbsmBaseNode { pub struct AbsmBaseNode {
pub input_sockets: Vec<Handle<Socket>>, pub input_sockets: Vec<Handle<Socket>>,
@@ -58,7 +58,8 @@ pub struct AbsmBaseNode {
#[derive(Visit, Reflect)] #[derive(Visit, Reflect)]
#[reflect( #[reflect(
derived_type = "UiNode", derived_type = "UiNode",
type_uuid = "15bc1a7e-a385-46e0-a65c-7e9c014b4a1d" type_uuid = "15bc1a7e-a385-46e0-a65c-7e9c014b4a1d",
non_comparable
)] )]
pub struct AbsmNode<T> pub struct AbsmNode<T>
where where
+1 -1
View File
@@ -31,7 +31,7 @@ pub enum SegmentMessage {
} }
impl MessageData for SegmentMessage {} impl MessageData for SegmentMessage {}
#[derive(Debug, Clone, Reflect, Visit)] #[derive(Debug, Clone, Reflect, PartialEq, Visit)]
#[reflect(type_uuid = "fda5a731-e927-40e5-9d96-e19104fbb63e")] #[reflect(type_uuid = "fda5a731-e927-40e5-9d96-e19104fbb63e")]
pub struct Segment { pub struct Segment {
pub source: Handle<UiNode>, pub source: Handle<UiNode>,
+1 -1
View File
@@ -53,7 +53,7 @@ pub enum SocketDirection {
Output, Output,
} }
#[derive(Clone, Debug, Visit, Reflect)] #[derive(Clone, Debug, Visit, PartialEq, Reflect)]
#[reflect( #[reflect(
derived_type = "UiNode", derived_type = "UiNode",
type_uuid = "a6c0473e-7073-4e91-a681-cf88795af52a" type_uuid = "a6c0473e-7073-4e91-a681-cf88795af52a"
+1 -1
View File
@@ -54,7 +54,7 @@ pub enum TransitionMessage {
} }
impl MessageData for TransitionMessage {} impl MessageData for TransitionMessage {}
#[derive(Clone, Debug, Visit, Reflect)] #[derive(Clone, Debug, Visit, PartialEq, Reflect)]
#[reflect( #[reflect(
derived_type = "UiNode", derived_type = "UiNode",
type_uuid = "01798aee-8fe5-4480-a69d-8e5b95c3cc96" type_uuid = "01798aee-8fe5-4480-a69d-8e5b95c3cc96"
+4 -4
View File
@@ -65,7 +65,7 @@ pub enum RulerMessage {
} }
impl MessageData for RulerMessage {} impl MessageData for RulerMessage {}
#[derive(Clone)] #[derive(PartialEq, Clone)]
struct ContextMenu { struct ContextMenu {
menu: RcUiNodeHandle, menu: RcUiNodeHandle,
add_signal: Handle<MenuItem>, add_signal: Handle<MenuItem>,
@@ -148,18 +148,18 @@ impl SignalView {
const SIZE: f32 = 10.0; const SIZE: f32 = 10.0;
} }
#[derive(Clone)] #[derive(PartialEq, Clone)]
enum DragEntity { enum DragEntity {
TimePosition, TimePosition,
Signal(Uuid), Signal(Uuid),
} }
#[derive(Clone)] #[derive(PartialEq, Clone)]
struct DragContext { struct DragContext {
entity: DragEntity, entity: DragEntity,
} }
#[derive(Clone, Visit, Reflect)] #[derive(Clone, Visit, PartialEq, Reflect)]
#[reflect( #[reflect(
derived_type = "UiNode", derived_type = "UiNode",
type_uuid = "98655c9b-428f-4977-a478-ad3674cc66d4" type_uuid = "98655c9b-428f-4977-a478-ad3674cc66d4"
+1 -1
View File
@@ -51,7 +51,7 @@ pub enum ThumbMessage {
} }
impl MessageData for ThumbMessage {} impl MessageData for ThumbMessage {}
#[derive(Clone, Visit, Reflect, Debug)] #[derive(Clone, Visit, PartialEq, Reflect, Debug)]
#[reflect( #[reflect(
derived_type = "UiNode", derived_type = "UiNode",
type_uuid = "820ba009-54e0-4050-ba7e-28f1f5b40429" type_uuid = "820ba009-54e0-4050-ba7e-28f1f5b40429"
+5 -5
View File
@@ -31,7 +31,6 @@ use crate::{
log::Log, log::Log,
math::curve::{CurveKey, CurveKeyKind}, math::curve::{CurveKey, CurveKeyKind},
ok_or_continue, ok_or_continue,
parking_lot::Mutex,
pool::{ErasedHandle, Handle}, pool::{ErasedHandle, Handle},
reflect::{prelude::*, Reflect}, reflect::{prelude::*, Reflect},
some_or_return, some_or_return,
@@ -103,12 +102,13 @@ use crate::{
utils::{self}, utils::{self},
}; };
use fyrox::core::warn; use fyrox::core::warn;
use fyrox::gui::widget::UserData;
use std::{ use std::{
any::{Any, TypeId}, any::{Any, TypeId},
cmp::Ordering, cmp::Ordering,
collections::hash_map::Entry, collections::hash_map::Entry,
ops::{Deref, DerefMut}, ops::{Deref, DerefMut},
sync::{mpsc::Sender, Arc}, sync::mpsc::Sender,
}; };
#[derive(PartialEq, Eq)] #[derive(PartialEq, Eq)]
@@ -346,7 +346,7 @@ pub enum TrackViewMessage {
} }
impl MessageData for TrackViewMessage {} impl MessageData for TrackViewMessage {}
#[derive(Clone, Debug, Reflect, Visit)] #[derive(Clone, Debug, PartialEq, Reflect, Visit)]
#[reflect( #[reflect(
derived_type = "UiNode", derived_type = "UiNode",
type_uuid = "c1e930da-d55d-492e-b87b-16c1adf03319" type_uuid = "c1e930da-d55d-492e-b87b-16c1adf03319"
@@ -1560,9 +1560,9 @@ impl TrackList {
}; };
let curve_view = TreeBuilder::new( let curve_view = TreeBuilder::new(
WidgetBuilder::new().with_user_data(Arc::new(Mutex::new( WidgetBuilder::new().with_user_data(UserData::new(
CurveViewData { id: curve.id() }, CurveViewData { id: curve.id() },
))), )),
) )
.with_content( .with_content(
GridBuilder::new( GridBuilder::new(
+8 -4
View File
@@ -298,7 +298,7 @@ fn make_handle(scene: &mut Scene, root: Handle<Pivot>, visible: bool) -> Handle<
handle handle
} }
#[derive(Copy, Clone, Reflect, Debug)] #[derive(Copy, Clone, PartialEq, Reflect, Debug)]
#[reflect(non_cloneable, type_uuid = "42b19406-299d-4c3d-a7e3-77b41817ae71")] #[reflect(non_cloneable, type_uuid = "42b19406-299d-4c3d-a7e3-77b41817ae71")]
enum ShapeHandleValue { enum ShapeHandleValue {
Scalar(f32), Scalar(f32),
@@ -323,14 +323,14 @@ impl ShapeHandleValue {
} }
} }
#[derive(Clone, Reflect, Debug)] #[derive(Clone, PartialEq, Reflect, Debug)]
#[reflect(non_cloneable, type_uuid = "70d6130f-da5d-4f14-bbfd-0744927053a0")] #[reflect(non_cloneable, type_uuid = "70d6130f-da5d-4f14-bbfd-0744927053a0")]
enum ColliderInitialShape { enum ColliderInitialShape {
TwoD(dim2::collider::ColliderShape), TwoD(dim2::collider::ColliderShape),
ThreeD(ColliderShape), ThreeD(ColliderShape),
} }
#[derive(Reflect, Debug)] #[derive(PartialEq, Reflect, Debug)]
#[reflect(non_cloneable, type_uuid = "e9aac4a5-0755-4d94-94ff-dfa37b40d5ca")] #[reflect(non_cloneable, type_uuid = "e9aac4a5-0755-4d94-94ff-dfa37b40d5ca")]
struct DragContext { struct DragContext {
handle: Handle<Sprite>, handle: Handle<Sprite>,
@@ -344,7 +344,11 @@ struct DragContext {
} }
#[derive(Reflect)] #[derive(Reflect)]
#[reflect(non_cloneable, type_uuid = "a012dd4c-ce6d-4e7e-8879-fd8eddaa9677")] #[reflect(
non_cloneable,
non_comparable,
type_uuid = "a012dd4c-ce6d-4e7e-8879-fd8eddaa9677"
)]
pub struct ColliderShapeInteractionMode { pub struct ColliderShapeInteractionMode {
collider: Handle<Node>, collider: Handle<Node>,
#[reflect(hidden)] #[reflect(hidden)]
+1 -1
View File
@@ -61,7 +61,7 @@ use crate::{
}; };
use std::{fmt::Debug, path::PathBuf}; use std::{fmt::Debug, path::PathBuf};
#[derive(Reflect, Clone, Debug)] #[derive(PartialEq, Reflect, Clone, Debug)]
#[reflect(type_uuid = "f29aa9c7-e0c4-4602-8588-3e8a20ab7cdc")] #[reflect(type_uuid = "f29aa9c7-e0c4-4602-8588-3e8a20ab7cdc")]
pub struct CurveEditorContext {} pub struct CurveEditorContext {}
@@ -23,7 +23,7 @@ use crate::{
core::dyntype::{DynTypeConstructorContainer, DynTypeContainer}, core::dyntype::{DynTypeConstructorContainer, DynTypeContainer},
graph::SceneGraph, graph::SceneGraph,
gui::{ gui::{
core::{parking_lot::Mutex, pool::Handle, reflect::prelude::*, visitor::prelude::*}, core::{pool::Handle, reflect::prelude::*, visitor::prelude::*},
dropdown_list::{DropdownList, DropdownListBuilder, DropdownListMessage}, dropdown_list::{DropdownList, DropdownListBuilder, DropdownListMessage},
grid::{GridBuilder, GridDimension}, grid::{GridBuilder, GridDimension},
inspector::InspectorContextArgs, inspector::InspectorContextArgs,
@@ -34,8 +34,8 @@ use crate::{
PropertyEditorMessageContext, PropertyEditorTranslationContext, PropertyEditorMessageContext, PropertyEditorTranslationContext,
}, },
make_expander_container, FieldAction, Inspector, InspectorBuilder, make_expander_container, FieldAction, Inspector, InspectorBuilder,
InspectorContext, InspectorEnvironment, InspectorError, InspectorMessage, InspectorContext, InspectorError, InspectorMessage, PropertyChanged,
PropertyChanged, PropertyFilter, PropertyFilter,
}, },
message::MessageData, message::MessageData,
message::{MessageDirection, UiMessage}, message::{MessageDirection, UiMessage},
@@ -48,6 +48,7 @@ use crate::{
}; };
use fyrox::core::dyntype::DynTypeWrapper; use fyrox::core::dyntype::DynTypeWrapper;
use fyrox::gui::inspector::InspectorEnvironmentContainer; use fyrox::gui::inspector::InspectorEnvironmentContainer;
use fyrox::gui::widget::UserData;
use std::{ use std::{
any::TypeId, any::TypeId,
cell::Cell, cell::Cell,
@@ -62,7 +63,7 @@ pub enum DynTypePropertyEditorMessage {
} }
impl MessageData for DynTypePropertyEditorMessage {} impl MessageData for DynTypePropertyEditorMessage {}
#[derive(Clone, Debug, Visit, Reflect)] #[derive(Clone, Debug, Visit, PartialEq, Reflect)]
#[reflect( #[reflect(
derived_type = "UiNode", derived_type = "UiNode",
type_uuid = "f43c3bfb-8b39-4cc0-be77-04141a45822e" type_uuid = "f43c3bfb-8b39-4cc0-be77-04141a45822e"
@@ -192,13 +193,13 @@ fn create_items(
) -> Vec<Handle<UiNode>> { ) -> Vec<Handle<UiNode>> {
let mut items = vec![{ let mut items = vec![{
let empty = make_dropdown_list_option(ctx, "<Not Set>"); let empty = make_dropdown_list_option(ctx, "<Not Set>");
ctx[empty].user_data = Some(Arc::new(Mutex::new(Uuid::default()))); ctx[empty].user_data = Some(UserData::new(Uuid::default()));
empty empty
}]; }];
items.extend(constructors.inner().iter().map(|(type_uuid, constructor)| { items.extend(constructors.inner().iter().map(|(type_uuid, constructor)| {
let item = make_dropdown_list_option(ctx, &constructor.name); let item = make_dropdown_list_option(ctx, &constructor.name);
ctx[item].user_data = Some(Arc::new(Mutex::new(*type_uuid))); ctx[item].user_data = Some(UserData::new(*type_uuid));
item item
})); }));
+1 -1
View File
@@ -54,7 +54,7 @@ use std::{
ops::{Deref, DerefMut}, ops::{Deref, DerefMut},
}; };
#[derive(Clone, Visit, Reflect)] #[derive(Clone, Visit, PartialEq, Reflect)]
#[reflect( #[reflect(
derived_type = "UiNode", derived_type = "UiNode",
type_uuid = "5db49479-ff89-49b8-a038-0766253d6493" type_uuid = "5db49479-ff89-49b8-a038-0766253d6493"
@@ -105,8 +105,11 @@ pub struct HandlePropertyEditorHierarchyMessage(pub HierarchyNode);
impl MessageData for HandlePropertyEditorHierarchyMessage {} impl MessageData for HandlePropertyEditorHierarchyMessage {}
#[derive(Visit, Reflect)] #[derive(Visit, Reflect)]
#[reflect(type_uuid = "3ceca8c1-c365-4f03-a413-062f8f3cd685")] #[reflect(
#[reflect(derived_type = "UiNode")] non_comparable,
derived_type = "UiNode",
type_uuid = "3ceca8c1-c365-4f03-a413-062f8f3cd685"
)]
pub struct HandlePropertyEditor<T: Reflect> { pub struct HandlePropertyEditor<T: Reflect> {
widget: Widget, widget: Widget,
text: Handle<Text>, text: Handle<Text>,
@@ -117,7 +117,8 @@ pub type ResourceLoaderCallback<T> = Arc<
#[derive(Visit, Reflect)] #[derive(Visit, Reflect)]
#[reflect( #[reflect(
derived_type = "UiNode", derived_type = "UiNode",
type_uuid = "5179b3b9-855f-43a6-b23a-831129fee1cf" type_uuid = "5179b3b9-855f-43a6-b23a-831129fee1cf",
non_comparable
)] )]
pub struct ResourceField<T> pub struct ResourceField<T>
where where
+7 -10
View File
@@ -19,7 +19,7 @@
// SOFTWARE. // SOFTWARE.
use crate::fyrox::{ use crate::fyrox::{
core::{log::Log, parking_lot::Mutex, pool::Handle, reflect::prelude::*, visitor::prelude::*}, core::{log::Log, pool::Handle, reflect::prelude::*, visitor::prelude::*},
engine::SerializationContext, engine::SerializationContext,
graph::SceneGraph, graph::SceneGraph,
gui::{ gui::{
@@ -33,8 +33,7 @@ use crate::fyrox::{
PropertyEditorMessageContext, PropertyEditorTranslationContext, PropertyEditorMessageContext, PropertyEditorTranslationContext,
}, },
make_expander_container, FieldAction, Inspector, InspectorBuilder, InspectorContext, make_expander_container, FieldAction, Inspector, InspectorBuilder, InspectorContext,
InspectorEnvironment, InspectorError, InspectorMessage, PropertyChanged, InspectorError, InspectorMessage, PropertyChanged, PropertyFilter,
PropertyFilter,
}, },
message::{MessageDirection, UiMessage}, message::{MessageDirection, UiMessage},
text::TextBuilder, text::TextBuilder,
@@ -54,6 +53,7 @@ use fyrox::gui::button::Button;
use fyrox::gui::inspector::{InspectorContextArgs, InspectorEnvironmentContainer}; use fyrox::gui::inspector::{InspectorContextArgs, InspectorEnvironmentContainer};
use fyrox::gui::message::MessageData; use fyrox::gui::message::MessageData;
use fyrox::gui::utils::make_dropdown_list_option; use fyrox::gui::utils::make_dropdown_list_option;
use fyrox::gui::widget::UserData;
use fyrox::gui::{Thickness, VerticalAlignment}; use fyrox::gui::{Thickness, VerticalAlignment};
use std::{ use std::{
any::TypeId, any::TypeId,
@@ -69,7 +69,7 @@ pub enum ScriptPropertyEditorMessage {
} }
impl MessageData for ScriptPropertyEditorMessage {} impl MessageData for ScriptPropertyEditorMessage {}
#[derive(Clone, Debug, Visit, Reflect)] #[derive(Clone, Debug, Visit, PartialEq, Reflect)]
#[reflect( #[reflect(
derived_type = "UiNode", derived_type = "UiNode",
type_uuid = "f43c3bfb-8b39-4cc0-be77-04141a45822e" type_uuid = "f43c3bfb-8b39-4cc0-be77-04141a45822e"
@@ -267,10 +267,7 @@ fn create_items(
) -> Vec<Handle<UiNode>> { ) -> Vec<Handle<UiNode>> {
let mut items = vec![{ let mut items = vec![{
let empty = make_dropdown_list_option(ctx, "<No Script>"); let empty = make_dropdown_list_option(ctx, "<No Script>");
ctx[empty].user_data = Some(Arc::new(Mutex::new(( ctx[empty].user_data = Some(UserData::new((Uuid::default(), Option::<String>::None)));
Uuid::default(),
Option::<String>::None,
))));
empty empty
}]; }];
@@ -278,10 +275,10 @@ fn create_items(
|(type_uuid, constructor)| { |(type_uuid, constructor)| {
let item = make_dropdown_list_option(ctx, &constructor.name); let item = make_dropdown_list_option(ctx, &constructor.name);
ctx[item].user_data = Some(Arc::new(Mutex::new(( ctx[item].user_data = Some(UserData::new((
*type_uuid, *type_uuid,
Some(constructor.source_path.to_string()), Some(constructor.source_path.to_string()),
)))); )));
item item
}, },
@@ -45,7 +45,7 @@ use crate::{
use fyrox::gui::button::Button; use fyrox::gui::button::Button;
use std::{any::TypeId, cell::RefCell}; use std::{any::TypeId, cell::RefCell};
#[derive(Default, Clone, Visit, Reflect, Debug)] #[derive(Default, Clone, Visit, PartialEq, Reflect, Debug)]
#[reflect(type_uuid = "f2024683-812e-4e0d-8065-7d168a82cce6")] #[reflect(type_uuid = "f2024683-812e-4e0d-8065-7d168a82cce6")]
#[reflect(derived_type = "UiNode")] #[reflect(derived_type = "UiNode")]
pub struct ShaderSourceCodeEditorField { pub struct ShaderSourceCodeEditorField {
@@ -42,7 +42,7 @@ pub enum ShaderSourceCodeEditorMessage {
} }
impl MessageData for ShaderSourceCodeEditorMessage {} impl MessageData for ShaderSourceCodeEditorMessage {}
#[derive(Default, Clone, Visit, Reflect, Debug)] #[derive(Default, Clone, Visit, PartialEq, Reflect, Debug)]
#[reflect(type_uuid = "c2e0bdcc-28a6-4141-93b5-5dad50c8b29c")] #[reflect(type_uuid = "c2e0bdcc-28a6-4141-93b5-5dad50c8b29c")]
#[reflect(derived_type = "UiNode")] #[reflect(derived_type = "UiNode")]
pub struct ShaderSourceCodeEditor { pub struct ShaderSourceCodeEditor {
@@ -57,7 +57,7 @@ pub enum SpriteSheetFramesPropertyEditorMessage {
} }
impl MessageData for SpriteSheetFramesPropertyEditorMessage {} impl MessageData for SpriteSheetFramesPropertyEditorMessage {}
#[derive(Clone, Debug, Reflect, Visit)] #[derive(Clone, Debug, PartialEq, Reflect, Visit)]
#[reflect( #[reflect(
derived_type = "UiNode", derived_type = "UiNode",
type_uuid = "8994228d-6106-4e41-872c-5191840badcc" type_uuid = "8994228d-6106-4e41-872c-5191840badcc"
@@ -20,10 +20,7 @@
use crate::fyrox::graph::SceneGraph; use crate::fyrox::graph::SceneGraph;
use crate::fyrox::{ use crate::fyrox::{
core::{ core::{algebra::Vector2, pool::Handle, reflect::prelude::*, visitor::prelude::*},
algebra::Vector2, parking_lot::Mutex, pool::Handle, reflect::prelude::*,
visitor::prelude::*,
},
gui::{ gui::{
border::BorderBuilder, border::BorderBuilder,
button::{ButtonBuilder, ButtonMessage}, button::{ButtonBuilder, ButtonMessage},
@@ -54,12 +51,13 @@ use fyrox::gui::image::Image;
use fyrox::gui::numeric::NumericUpDown; use fyrox::gui::numeric::NumericUpDown;
use fyrox::gui::style::resource::StyleResourceExt; use fyrox::gui::style::resource::StyleResourceExt;
use fyrox::gui::style::Style; use fyrox::gui::style::Style;
use fyrox::gui::widget::UserData;
use std::{ use std::{
ops::{Deref, DerefMut}, ops::{Deref, DerefMut},
sync::{mpsc::Sender, Arc}, sync::mpsc::Sender,
}; };
#[derive(Clone, Visit, Reflect, Debug)] #[derive(Clone, Visit, PartialEq, Reflect, Debug)]
#[reflect( #[reflect(
derived_type = "UiNode", derived_type = "UiNode",
type_uuid = "55607fe0-2996-418d-ad31-a5b96fdfa4b7" type_uuid = "55607fe0-2996-418d-ad31-a5b96fdfa4b7"
@@ -206,7 +204,7 @@ fn make_grid(
.with_height(16.0) .with_height(16.0)
.on_row(i as usize) .on_row(i as usize)
.on_column(j as usize) .on_column(j as usize)
.with_user_data(Arc::new(Mutex::new(cell_position))), .with_user_data(UserData::new(cell_position)),
) )
.checked(Some(container.iter().any(|pos| *pos == cell_position))) .checked(Some(container.iter().any(|pos| *pos == cell_position)))
.build(ctx), .build(ctx),
@@ -68,8 +68,11 @@ pub enum SurfaceDataPropertyEditorMessage {
impl MessageData for SurfaceDataPropertyEditorMessage {} impl MessageData for SurfaceDataPropertyEditorMessage {}
#[derive(Clone, Visit, Reflect, Debug)] #[derive(Clone, Visit, Reflect, Debug)]
#[reflect(type_uuid = "8461a183-4fd4-4f74-a4f4-7fd8e84bf423")] #[reflect(
#[reflect(derived_type = "UiNode")] type_uuid = "8461a183-4fd4-4f74-a4f4-7fd8e84bf423",
derived_type = "UiNode",
non_comparable
)]
#[allow(dead_code)] #[allow(dead_code)]
pub struct SurfaceDataPropertyEditor { pub struct SurfaceDataPropertyEditor {
widget: Widget, widget: Widget,
@@ -61,7 +61,8 @@ use std::{
#[derive(Clone, Visit, Reflect)] #[derive(Clone, Visit, Reflect)]
#[reflect( #[reflect(
derived_type = "UiNode", derived_type = "UiNode",
type_uuid = "5db49479-ff89-49b8-a038-0766253d6493" type_uuid = "5db49479-ff89-49b8-a038-0766253d6493",
non_comparable
)] )]
pub struct TextureEditor { pub struct TextureEditor {
widget: Widget, widget: Widget,
+7 -3
View File
@@ -68,7 +68,7 @@ use std::{any::Any, sync::mpsc::Sender, sync::Arc};
pub mod editors; pub mod editors;
pub mod handlers; pub mod handlers;
#[derive(Clone, Reflect, Debug)] #[derive(Clone, PartialEq, Reflect, Debug)]
#[reflect(type_uuid = "e617f0b6-fb5f-4e41-85c2-9dbb1869af30")] #[reflect(type_uuid = "e617f0b6-fb5f-4e41-85c2-9dbb1869af30")]
pub struct AnimationDefinition { pub struct AnimationDefinition {
name: String, name: String,
@@ -76,7 +76,11 @@ pub struct AnimationDefinition {
} }
#[derive(Reflect, Clone, Debug)] #[derive(Reflect, Clone, Debug)]
#[reflect(non_cloneable, type_uuid = "ff4bc6f3-a735-47d8-b455-f9fd6354bd5f")] #[reflect(
non_cloneable,
non_comparable,
type_uuid = "ff4bc6f3-a735-47d8-b455-f9fd6354bd5f"
)]
pub struct EditorEnvironment { pub struct EditorEnvironment {
pub resource_manager: ResourceManager, pub resource_manager: ResourceManager,
#[reflect(hidden)] #[reflect(hidden)]
@@ -345,7 +349,7 @@ impl InspectorPlugin {
object: obj, object: obj,
ctx: &mut ui.build_ctx(), ctx: &mut ui.build_ctx(),
definition_container: property_editors, definition_container: property_editors,
environment: Some(environment), environment: Some(InspectorEnvironmentContainer(environment)),
layer_index: 0, layer_index: 0,
generate_property_string_values: true, generate_property_string_values: true,
filter: Default::default(), filter: Default::default(),
+2 -1
View File
@@ -74,7 +74,8 @@ impl MessageData for MaterialFieldMessage {}
#[derive(Clone, Visit, Reflect)] #[derive(Clone, Visit, Reflect)]
#[reflect( #[reflect(
derived_type = "UiNode", derived_type = "UiNode",
type_uuid = "d3fa0a7c-52d6-4cca-885e-0db8b18542e2" type_uuid = "d3fa0a7c-52d6-4cca-885e-0db8b18542e2",
non_comparable
)] )]
pub struct MaterialFieldEditor { pub struct MaterialFieldEditor {
widget: Widget, widget: Widget,
+3 -2
View File
@@ -92,10 +92,11 @@ use crate::{
}; };
use fyrox::gui::dock::DockingManager; use fyrox::gui::dock::DockingManager;
use fyrox::gui::stack_panel::StackPanel; use fyrox::gui::stack_panel::StackPanel;
use fyrox::gui::widget::UserData;
use fyrox::gui::window::Window; use fyrox::gui::window::Window;
use std::{ use std::{
path::PathBuf, path::PathBuf,
sync::{mpsc::Receiver, mpsc::Sender, Arc}, sync::{mpsc::Receiver, mpsc::Sender},
}; };
pub mod editor; pub mod editor;
@@ -461,7 +462,7 @@ impl MaterialEditor {
let editor = TextureEditorBuilder::new( let editor = TextureEditorBuilder::new(
WidgetBuilder::new() WidgetBuilder::new()
.with_height(28.0) .with_height(28.0)
.with_user_data(Arc::new(Mutex::new(resource.name.clone()))) .with_user_data(UserData::new(resource.name.clone()))
.with_allow_drop(true) .with_allow_drop(true)
.with_tooltip(make_simple_tooltip(ctx, &path)), .with_tooltip(make_simple_tooltip(ctx, &path)),
) )
+2 -2
View File
@@ -138,14 +138,14 @@ impl ReflectionProbePreviewControlPanel {
} }
} }
#[derive(Reflect, Debug)] #[derive(PartialEq, Reflect, Debug)]
#[reflect(non_cloneable, type_uuid = "9a535782-87a9-4407-8d12-a723d67e179d")] #[reflect(non_cloneable, type_uuid = "9a535782-87a9-4407-8d12-a723d67e179d")]
struct DragContext { struct DragContext {
new_position: Vector3<f32>, new_position: Vector3<f32>,
plane_kind: PlaneKind, plane_kind: PlaneKind,
} }
#[derive(Reflect, Debug)] #[derive(PartialEq, Reflect, Debug)]
#[reflect(non_cloneable, type_uuid = "d8fd164c-523c-447a-93ab-e86f2d71eed6")] #[reflect(non_cloneable, type_uuid = "d8fd164c-523c-447a-93ab-e86f2d71eed6")]
pub struct ReflectionProbeInteractionMode { pub struct ReflectionProbeInteractionMode {
probe: Handle<ReflectionProbe>, probe: Handle<ReflectionProbe>,
+1 -1
View File
@@ -74,7 +74,7 @@ use fyrox::scene::joint::Joint;
use fyrox::scene::ragdoll::Ragdoll; use fyrox::scene::ragdoll::Ragdoll;
use std::{ops::Range, sync::Arc}; use std::{ops::Range, sync::Arc};
#[derive(Reflect, Clone, Debug)] #[derive(PartialEq, Reflect, Clone, Debug)]
#[reflect(type_uuid = "07d73807-1716-4ea6-bef4-91903c214f7e")] #[reflect(type_uuid = "07d73807-1716-4ea6-bef4-91903c214f7e")]
pub struct RagdollPreset { pub struct RagdollPreset {
/// A handle of a hips (pelvis) bone. /// A handle of a hips (pelvis) bone.
+15 -16
View File
@@ -23,9 +23,7 @@
use crate::menu::create_menu_item_shortcut; use crate::menu::create_menu_item_shortcut;
use crate::{ use crate::{
fyrox::{ fyrox::{
core::{ core::{log::Log, pool::Handle, reflect::Reflect, some_or_return},
log::Log, parking_lot::lock_api::Mutex, pool::Handle, reflect::Reflect, some_or_return,
},
engine::Engine, engine::Engine,
graph::SceneGraph, graph::SceneGraph,
gui::{ gui::{
@@ -61,6 +59,7 @@ use fyrox::gui::scroll_viewer::ScrollViewer;
use fyrox::gui::searchbar::SearchBar; use fyrox::gui::searchbar::SearchBar;
use fyrox::gui::stack_panel::StackPanel; use fyrox::gui::stack_panel::StackPanel;
use fyrox::gui::text_box::EmptyTextPlaceholder; use fyrox::gui::text_box::EmptyTextPlaceholder;
use fyrox::gui::widget::UserData;
use fyrox::gui::window::{Window, WindowAlignment}; use fyrox::gui::window::{Window, WindowAlignment};
use rust_fuzzy_search::fuzzy_compare; use rust_fuzzy_search::fuzzy_compare;
use std::sync::Arc; use std::sync::Arc;
@@ -224,19 +223,19 @@ impl SettingsWindow {
base_path: Default::default(), base_path: Default::default(),
has_parent_object: false, has_parent_object: false,
}); });
let groups = let groups = context
context .entries
.entries .iter()
.iter() .map(|entry| {
.map(|entry| { ButtonBuilder::new(
ButtonBuilder::new(WidgetBuilder::new().with_user_data(Arc::new(Mutex::new( WidgetBuilder::new()
GroupName(entry.property_tag.clone()), .with_user_data(UserData::new(GroupName(entry.property_tag.clone()))),
)))) )
.with_text(&entry.property_display_name) .with_text(&entry.property_display_name)
.build(ctx) .build(ctx)
.to_base() .to_base()
}) })
.collect::<Vec<_>>(); .collect::<Vec<_>>();
ui.send(self.groups, WidgetMessage::ReplaceChildren(groups)); ui.send(self.groups, WidgetMessage::ReplaceChildren(groups));
ui.send(self.inspector, InspectorMessage::Context(context)); ui.send(self.inspector, InspectorMessage::Context(context));
} }
+3 -3
View File
@@ -116,7 +116,7 @@ pub struct AutoTileMacro {
autotiler: TileSetAutoTiler, autotiler: TileSetAutoTiler,
} }
#[derive(Default, Debug, Clone, Reflect)] #[derive(Default, Debug, PartialEq, Clone, Reflect)]
#[reflect(type_uuid = "e50fa366-145d-4491-8126-acdd162031ea")] #[reflect(type_uuid = "e50fa366-145d-4491-8126-acdd162031ea")]
struct CellData { struct CellData {
terrain_id: TileTerrainId, terrain_id: TileTerrainId,
@@ -138,7 +138,7 @@ impl Visit for CellData {
} }
} }
#[derive(Debug, Default, Clone, Visit, Reflect)] #[derive(Debug, Default, Clone, PartialEq, Visit, Reflect)]
#[reflect(type_uuid = "b320543d-3df0-43fd-b0d9-60a398f49853")] #[reflect(type_uuid = "b320543d-3df0-43fd-b0d9-60a398f49853")]
pub(super) struct AutoTileInstance { pub(super) struct AutoTileInstance {
frequency_property: Option<TileSetPropertyF32>, frequency_property: Option<TileSetPropertyF32>,
@@ -151,7 +151,7 @@ pub(super) struct AutoTileInstance {
widgets: InstanceCellWidgets, widgets: InstanceCellWidgets,
} }
#[derive(Debug, Default, Clone)] #[derive(Debug, Default, PartialEq, Clone)]
struct InstanceCellWidgets { struct InstanceCellWidgets {
handle: Handle<UiNode>, handle: Handle<UiNode>,
value_field: MacroPropertyValueField, value_field: MacroPropertyValueField,
+11 -4
View File
@@ -20,10 +20,11 @@
use super::*; use super::*;
use crate::command::{Command, CommandContext, CommandTrait}; use crate::command::{Command, CommandContext, CommandTrait};
use fyrox::asset::TypedResourceData;
use fyrox::gui::dropdown_list::DropdownList; use fyrox::gui::dropdown_list::DropdownList;
use fyrox::gui::message::{DeliveryMode, MessageData}; use fyrox::gui::message::{DeliveryMode, MessageData};
use fyrox::{ use fyrox::{
asset::{untyped::UntypedResource, Resource, ResourceData, ResourceDataRef}, asset::{untyped::UntypedResource, Resource, ResourceDataRef},
core::{ core::{
futures::executor::block_on, futures::executor::block_on,
log::Log, log::Log,
@@ -54,6 +55,12 @@ const UNKNOWN_PROPERTY: &str = "UNKNOWN PROPERTY";
#[derive(Default, Clone)] #[derive(Default, Clone)]
pub struct BrushMacroListRef(Arc<Mutex<BrushMacroList>>); pub struct BrushMacroListRef(Arc<Mutex<BrushMacroList>>);
impl PartialEq for BrushMacroListRef {
fn eq(&self, other: &Self) -> bool {
Arc::ptr_eq(&self.0, &other.0)
}
}
impl BrushMacroListRef { impl BrushMacroListRef {
/// Create a new reference and assign it to point to the given macro list. /// Create a new reference and assign it to point to the given macro list.
pub fn new(list: BrushMacroList) -> Self { pub fn new(list: BrushMacroList) -> Self {
@@ -128,7 +135,7 @@ impl BrushMacroInstance {
/// A typed reference to the configuration resource. /// A typed reference to the configuration resource.
pub fn settings<T>(&self) -> Option<Resource<T>> pub fn settings<T>(&self) -> Option<Resource<T>>
where where
T: ResourceData + Default, T: TypedResourceData,
{ {
self.settings.as_ref()?.try_cast() self.settings.as_ref()?.try_cast()
} }
@@ -211,7 +218,7 @@ impl BrushMacroCellContext {
/// A typed reference to the configuration resource. /// A typed reference to the configuration resource.
pub fn settings<T>(&self) -> Option<Resource<T>> pub fn settings<T>(&self) -> Option<Resource<T>>
where where
T: ResourceData + Default, T: TypedResourceData,
{ {
self.settings.as_ref()?.try_cast() self.settings.as_ref()?.try_cast()
} }
@@ -651,7 +658,7 @@ impl TileSetPropertyMessage {
/// A field that allows the user to choose a property value from a [`TileSet`]. /// A field that allows the user to choose a property value from a [`TileSet`].
/// The property is represented as a [`TileSetPropertyValueElement`] internally, but the user /// The property is represented as a [`TileSetPropertyValueElement`] internally, but the user
/// is given a dropdown list of value names if possible. /// is given a dropdown list of value names if possible.
#[derive(Debug, Default, Clone)] #[derive(Debug, Default, PartialEq, Clone)]
pub struct MacroPropertyValueField { pub struct MacroPropertyValueField {
handle: Handle<UiNode>, handle: Handle<UiNode>,
textbox: Handle<UiNode>, textbox: Handle<UiNode>,
+1 -1
View File
@@ -76,7 +76,7 @@ impl MessageData for TileDefinitionHandleEditorMessage {}
/// pair is the page coordinates and the second pair is the tile coordinates. /// pair is the page coordinates and the second pair is the tile coordinates.
/// When editing the handle, one need merely type four integers. Whatever /// When editing the handle, one need merely type four integers. Whatever
/// characters separate the integers are ignored, so "1 2 3 4" would be accepted. /// characters separate the integers are ignored, so "1 2 3 4" would be accepted.
#[derive(Clone, Debug, Visit, Reflect)] #[derive(Clone, Debug, Visit, PartialEq, Reflect)]
#[reflect(derived_type = "UiNode")] #[reflect(derived_type = "UiNode")]
#[reflect(type_uuid = "60146cf0-33e3-4757-8e66-e7196324271f")] #[reflect(type_uuid = "60146cf0-33e3-4757-8e66-e7196324271f")]
pub struct TileDefinitionHandleEditor { pub struct TileDefinitionHandleEditor {
+1 -1
View File
@@ -53,7 +53,7 @@ impl MessageData for TileHandleEditorMessage {}
/// pair is the page coordinates and the second pair is the tile coordinates. /// pair is the page coordinates and the second pair is the tile coordinates.
/// When editing the handle, one need merely type four integers. Whatever /// When editing the handle, one need merely type four integers. Whatever
/// characters separate the integers are ignored, so "1 2 3 4" would be accepted. /// characters separate the integers are ignored, so "1 2 3 4" would be accepted.
#[derive(Debug, Default, Clone, Visit, Reflect)] #[derive(Debug, Default, Clone, Visit, PartialEq, Reflect)]
#[reflect(type_uuid = "86513074-461d-4583-a214-fb84f5aacac1")] #[reflect(type_uuid = "86513074-461d-4583-a214-fb84f5aacac1")]
#[reflect(derived_type = "UiNode")] #[reflect(derived_type = "UiNode")]
pub struct TileHandleField { pub struct TileHandleField {
@@ -20,12 +20,14 @@
//! The [`InteractionMode`] for editing a tile map. //! The [`InteractionMode`] for editing a tile map.
use super::*;
use crate::{ use crate::{
command::{Command, CommandGroup}, command::{Command, CommandGroup},
make_color_material, make_color_material,
}; };
use commands::{MoveMapTileCommand, SetMapTilesCommand}; use commands::{MoveMapTileCommand, SetMapTilesCommand};
use fyrox::gui::button::Button; use fyrox::gui::button::Button;
use fyrox::scene::tilemap::{TileMapEffectRef, TileMapEffectRefContainer};
use fyrox::{ use fyrox::{
asset::untyped::UntypedResource, asset::untyped::UntypedResource,
core::reflect::prelude::*, core::reflect::prelude::*,
@@ -41,8 +43,6 @@ use fyrox::{
}; };
use std::fmt::Formatter; use std::fmt::Formatter;
use super::*;
const CURSOR_COLOR: Color = Color::from_rgba(255, 255, 255, 30); const CURSOR_COLOR: Color = Color::from_rgba(255, 255, 255, 30);
const SELECT_COLOR: Color = Color::from_rgba(255, 255, 0, 200); const SELECT_COLOR: Color = Color::from_rgba(255, 255, 0, 200);
const ERASE_COLOR: Color = Color::from_rgba(255, 0, 0, 255); const ERASE_COLOR: Color = Color::from_rgba(255, 0, 0, 255);
@@ -64,6 +64,7 @@ enum MouseMode {
#[derive(Reflect)] #[derive(Reflect)]
#[reflect( #[reflect(
non_cloneable, non_cloneable,
non_comparable,
type_uuid = "33fa8ef9-a29c-45d4-a493-79571edd870a", type_uuid = "33fa8ef9-a29c-45d4-a493-79571edd870a",
hide_all hide_all
)] )]
@@ -172,15 +173,15 @@ impl TileMapInteractionMode {
pub fn on_tile_map_selected(&mut self, tile_map: &mut TileMap) { pub fn on_tile_map_selected(&mut self, tile_map: &mut TileMap) {
tile_map.before_effects.clear(); tile_map.before_effects.clear();
tile_map.before_effects.extend([ tile_map.before_effects.extend([
self.overlay_effect.clone() as TileMapEffectRef, TileMapEffectRefContainer(self.overlay_effect.clone() as TileMapEffectRef),
self.update_effect.clone() as TileMapEffectRef, TileMapEffectRefContainer(self.update_effect.clone() as TileMapEffectRef),
self.erase_effect.clone() as TileMapEffectRef, TileMapEffectRefContainer(self.erase_effect.clone() as TileMapEffectRef),
]); ]);
tile_map.after_effects.clear(); tile_map.after_effects.clear();
tile_map.after_effects.extend([ tile_map.after_effects.extend([
self.cursor_effect.clone() as TileMapEffectRef, TileMapEffectRefContainer(self.cursor_effect.clone() as TileMapEffectRef),
self.erase_select_effect.clone() as TileMapEffectRef, TileMapEffectRefContainer(self.erase_select_effect.clone() as TileMapEffectRef),
self.select_effect.clone() as TileMapEffectRef, TileMapEffectRefContainer(self.select_effect.clone() as TileMapEffectRef),
]); ]);
} }
fn pick_grid( fn pick_grid(
@@ -40,7 +40,7 @@ const CELL_WITH_MACRO_COLOR: Color = Color::DARK_SLATE_BLUE;
const CELL_WITHOUT_MACRO_COLOR: Color = Color::opaque(50, 50, 50); const CELL_WITHOUT_MACRO_COLOR: Color = Color::opaque(50, 50, 50);
#[derive(Visit, Clone, Reflect)] #[derive(Visit, Clone, Reflect)]
#[reflect(type_uuid = "b003f118-4dda-4529-a791-ad20860c124d")] #[reflect(type_uuid = "b003f118-4dda-4529-a791-ad20860c124d", non_comparable)]
pub struct MacroInspector { pub struct MacroInspector {
handle: Handle<UiNode>, handle: Handle<UiNode>,
content: Handle<UiNode>, content: Handle<UiNode>,
+1 -1
View File
@@ -59,7 +59,7 @@ use fyrox::gui::text::TextBuilder;
use fyrox::gui::{message::KeyCode, texture::TextureResource}; use fyrox::gui::{message::KeyCode, texture::TextureResource};
use fyrox::gui::{HorizontalAlignment, VerticalAlignment}; use fyrox::gui::{HorizontalAlignment, VerticalAlignment};
use fyrox::scene::tilemap::tileset::{TileSetPropertyLayer, ELEMENT_MATCH_HIGHLIGHT_COLOR}; use fyrox::scene::tilemap::tileset::{TileSetPropertyLayer, ELEMENT_MATCH_HIGHLIGHT_COLOR};
use fyrox::scene::tilemap::{StampElement, TileMapEffectRef}; use fyrox::scene::tilemap::StampElement;
pub use handle_editor::*; pub use handle_editor::*;
use handle_field::*; use handle_field::*;
use interaction_mode::*; use interaction_mode::*;
+6 -3
View File
@@ -165,8 +165,11 @@ fn calc_slice_coord(position: f32, step: f32) -> usize {
/// Displays a scrollable grid of till cells, with options to allow the tiles /// Displays a scrollable grid of till cells, with options to allow the tiles
/// to be selected, dragged, and edits in various ways. /// to be selected, dragged, and edits in various ways.
#[derive(Clone, Visit, Reflect)] #[derive(Clone, Visit, Reflect)]
#[reflect(type_uuid = "5356a864-c026-4bd7-a4b1-30bacf77d8fa")] #[reflect(
#[reflect(derived_type = "UiNode")] derived_type = "UiNode",
type_uuid = "5356a864-c026-4bd7-a4b1-30bacf77d8fa",
non_comparable
)]
pub struct PaletteWidget { pub struct PaletteWidget {
widget: Widget, widget: Widget,
#[visit(skip)] #[visit(skip)]
@@ -278,7 +281,7 @@ impl Debug for PaletteWidget {
type PaletteTriangleData = (Vec<Point2<f32>>, Vec<[u32; 3]>); type PaletteTriangleData = (Vec<Point2<f32>>, Vec<[u32; 3]>);
#[derive(Debug, Clone)] #[derive(Debug, PartialEq, Clone)]
struct ColliderHighlight { struct ColliderHighlight {
position: Vector2<i32>, position: Vector2<i32>,
color: Color, color: Color,
+5 -2
View File
@@ -50,8 +50,11 @@ use fyrox::material::MaterialResource;
/// currently selected tile stamp, including whatever transformations have been applied /// currently selected tile stamp, including whatever transformations have been applied
/// to the stamp. /// to the stamp.
#[derive(Clone, Debug, Visit, Reflect)] #[derive(Clone, Debug, Visit, Reflect)]
#[reflect(type_uuid = "5356a864-c026-4bd7-a4b1-30bacf77d8fa")] #[reflect(
#[reflect(derived_type = "UiNode")] non_comparable,
derived_type = "UiNode",
type_uuid = "5356a864-c026-4bd7-a4b1-30bacf77d8fa"
)]
pub struct PanelPreview { pub struct PanelPreview {
widget: Widget, widget: Widget,
/// The tile editing state that is shared with palette widgets, the tile map interaction mode, /// The tile editing state that is shared with palette widgets, the tile map interaction mode,
@@ -46,7 +46,7 @@ pub enum TileBoundsMessage {
} }
impl MessageData for TileBoundsMessage {} impl MessageData for TileBoundsMessage {}
#[derive(Clone, Default, Debug, Visit, Reflect)] #[derive(Clone, Default, Debug, Visit, PartialEq, Reflect)]
#[reflect(type_uuid = "1e600103-6516-4c5a-a30b-f90f64fc9623")] #[reflect(type_uuid = "1e600103-6516-4c5a-a30b-f90f64fc9623")]
#[reflect(derived_type = "UiNode")] #[reflect(derived_type = "UiNode")]
pub struct TileBoundsEditor { pub struct TileBoundsEditor {
+4 -4
View File
@@ -544,7 +544,7 @@ fn find_collider_value(
.unwrap_or_default() .unwrap_or_default()
} }
#[derive(Clone, Default, Debug, Visit, Reflect)] #[derive(Clone, Default, Debug, Visit, PartialEq, Reflect)]
#[reflect(type_uuid = "9c65682b-0160-443c-95fc-0b88f86a497b")] #[reflect(type_uuid = "9c65682b-0160-443c-95fc-0b88f86a497b")]
struct InspectorField { struct InspectorField {
handle: Handle<Grid>, handle: Handle<Grid>,
@@ -572,7 +572,7 @@ impl InspectorField {
/// Object that keeps track of the editors for all the property layers. /// Object that keeps track of the editors for all the property layers.
#[derive(Clone, Default, Visit, Reflect)] #[derive(Clone, Default, Visit, Reflect)]
#[reflect(type_uuid = "89171a35-a7e7-4ce7-a017-124e8eec5746")] #[reflect(type_uuid = "89171a35-a7e7-4ce7-a017-124e8eec5746", non_comparable)]
struct PropertyEditors { struct PropertyEditors {
handle: Handle<UiNode>, handle: Handle<UiNode>,
content: Handle<UiNode>, content: Handle<UiNode>,
@@ -646,7 +646,7 @@ impl PropertyEditors {
/// Object that keeps track of the editors for all the collider layers. /// Object that keeps track of the editors for all the collider layers.
#[derive(Clone, Default, Visit, Reflect)] #[derive(Clone, Default, Visit, Reflect)]
#[reflect(type_uuid = "97acc27d-c6fc-491b-9faa-6ad2f124f126")] #[reflect(type_uuid = "97acc27d-c6fc-491b-9faa-6ad2f124f126", non_comparable)]
struct ColliderEditors { struct ColliderEditors {
handle: Handle<UiNode>, handle: Handle<UiNode>,
content: Handle<UiNode>, content: Handle<UiNode>,
@@ -719,7 +719,7 @@ impl ColliderEditors {
} }
#[derive(Visit, Reflect, Clone)] #[derive(Visit, Reflect, Clone)]
#[reflect(type_uuid = "cd0f6716-3d7c-4c39-a2aa-98274ca6efa2")] #[reflect(type_uuid = "cd0f6716-3d7c-4c39-a2aa-98274ca6efa2", non_comparable)]
pub struct TileInspector { pub struct TileInspector {
handle: Handle<UiNode>, handle: Handle<UiNode>,
/// The shared state that represents the user's currently selected tool and tiles. /// The shared state that represents the user's currently selected tool and tiles.
+1 -1
View File
@@ -71,7 +71,7 @@ pub struct WfcMacro {
current_terrain: TileTerrainId, current_terrain: TileTerrainId,
} }
#[derive(Debug, Clone, Visit, Reflect)] #[derive(Debug, Clone, PartialEq, Visit, Reflect)]
#[reflect(type_uuid = "24f9947e-f58b-4623-ad14-cb21cd09297e")] #[reflect(type_uuid = "24f9947e-f58b-4623-ad14-cb21cd09297e")]
pub(super) struct WfcInstance { pub(super) struct WfcInstance {
frequency_property: Option<TileSetPropertyF32>, frequency_property: Option<TileSetPropertyF32>,
+5 -2
View File
@@ -46,8 +46,11 @@ pub mod sound_context;
pub mod terrain; pub mod terrain;
#[derive(Reflect, Debug)] #[derive(Reflect, Debug)]
#[reflect(non_cloneable)] #[reflect(
#[reflect(type_uuid = "4dd03d8c-b0c9-43a2-871c-55e5fd603afd")] type_uuid = "4dd03d8c-b0c9-43a2-871c-55e5fd603afd",
non_cloneable,
non_comparable
)]
pub struct GameSceneContext { pub struct GameSceneContext {
pub selection: &'static mut Selection, pub selection: &'static mut Selection,
pub scene: &'static mut Scene, pub scene: &'static mut Scene,
+1 -1
View File
@@ -29,7 +29,7 @@ use super::*;
/// The [`CommandContext`] that is used when the current scene is the /// The [`CommandContext`] that is used when the current scene is the
/// null scene. /// null scene.
#[derive(Reflect, Debug)] #[derive(PartialEq, Reflect, Debug)]
#[reflect(non_cloneable)] #[reflect(non_cloneable)]
#[reflect(type_uuid = "09ba866d-db75-46fb-938b-b3cc583f4469")] #[reflect(type_uuid = "09ba866d-db75-46fb-938b-b3cc583f4469")]
pub struct NullSceneContext { pub struct NullSceneContext {
+7 -7
View File
@@ -20,8 +20,8 @@
use crate::fyrox::{ use crate::fyrox::{
core::{ core::{
make_pretty_type_name, parking_lot::Mutex, pool::Handle, reflect::prelude::*, make_pretty_type_name, pool::Handle, reflect::prelude::*, sstorage::ImmutableString,
sstorage::ImmutableString, visitor::prelude::*, visitor::prelude::*,
}, },
fxhash::FxHashSet, fxhash::FxHashSet,
graph::SceneGraph, graph::SceneGraph,
@@ -50,10 +50,10 @@ use fyrox::gui::style::resource::StyleResourceExt;
use fyrox::gui::style::Style; use fyrox::gui::style::Style;
use fyrox::gui::text_box::EmptyTextPlaceholder; use fyrox::gui::text_box::EmptyTextPlaceholder;
use fyrox::gui::tree::TreeRoot; use fyrox::gui::tree::TreeRoot;
use fyrox::gui::widget::UserData;
use std::{ use std::{
any::TypeId, any::TypeId,
ops::{Deref, DerefMut}, ops::{Deref, DerefMut},
sync::Arc,
}; };
#[derive(Debug, Clone, PartialEq, Eq)] #[derive(Debug, Clone, PartialEq, Eq)]
@@ -140,13 +140,13 @@ impl PropertyDescriptor {
make_pretty_type_name(&self.type_name) make_pretty_type_name(&self.type_name)
); );
TreeBuilder::new(WidgetBuilder::new().with_user_data(Arc::new(Mutex::new( TreeBuilder::new(WidgetBuilder::new().with_user_data(UserData::new(
PropertyDescriptorData { PropertyDescriptorData {
name: name.clone(), name: name.clone(),
path: self.path.clone(), path: self.path.clone(),
type_id: self.type_id, type_id: self.type_id,
}, },
)))) )))
.with_items(items) .with_items(items)
.with_content( .with_content(
TextBuilder::new(WidgetBuilder::new().with_margin(Thickness::uniform(1.0))) TextBuilder::new(WidgetBuilder::new().with_margin(Thickness::uniform(1.0)))
@@ -290,7 +290,7 @@ where
descriptors descriptors
} }
#[derive(Clone, Visit, Reflect, Debug)] #[derive(Clone, Visit, PartialEq, Reflect, Debug)]
#[reflect( #[reflect(
derived_type = "UiNode", derived_type = "UiNode",
type_uuid = "8e58e123-48a1-4e18-9e90-fd35a1669bdc" type_uuid = "8e58e123-48a1-4e18-9e90-fd35a1669bdc"
@@ -480,7 +480,7 @@ impl PropertySelectorBuilder {
} }
} }
#[derive(Clone, Visit, Reflect, Debug)] #[derive(Clone, Visit, PartialEq, Reflect, Debug)]
#[reflect( #[reflect(
derived_type = "UiNode", derived_type = "UiNode",
type_uuid = "725e4a10-eca6-4345-9833-d54dae2f20f2" type_uuid = "725e4a10-eca6-4345-9833-d54dae2f20f2"
+10 -15
View File
@@ -20,10 +20,7 @@
use crate::{ use crate::{
fyrox::{ fyrox::{
core::{ core::{pool::ErasedHandle, pool::Handle, reflect::prelude::*, visitor::prelude::*},
parking_lot::Mutex, pool::ErasedHandle, pool::Handle, reflect::prelude::*,
visitor::prelude::*,
},
fxhash::FxHashSet, fxhash::FxHashSet,
graph::{NodeWrapper, SceneGraph}, graph::{NodeWrapper, SceneGraph},
gui::{ gui::{
@@ -55,12 +52,12 @@ use fyrox::gui::scroll_viewer::ScrollViewer;
use fyrox::gui::searchbar::SearchBar; use fyrox::gui::searchbar::SearchBar;
use fyrox::gui::text_box::EmptyTextPlaceholder; use fyrox::gui::text_box::EmptyTextPlaceholder;
use fyrox::gui::tree::TreeRoot; use fyrox::gui::tree::TreeRoot;
use fyrox::gui::widget::UserData;
use std::hash::{Hash, Hasher}; use std::hash::{Hash, Hasher};
use std::{ use std::{
any::{Any, TypeId}, any::{Any, TypeId},
fmt::Debug, fmt::Debug,
ops::{Deref, DerefMut}, ops::{Deref, DerefMut},
sync::Arc,
}; };
#[derive(Eq, Clone, Debug, PartialEq)] #[derive(Eq, Clone, Debug, PartialEq)]
@@ -135,14 +132,12 @@ impl HierarchyNode {
ctx.style.property(Style::BRUSH_LIGHT) ctx.style.property(Style::BRUSH_LIGHT)
}; };
TreeBuilder::new( TreeBuilder::new(WidgetBuilder::new().with_user_data(UserData::new(TreeData {
WidgetBuilder::new().with_user_data(Arc::new(Mutex::new(TreeData { name: self.name.clone(),
name: self.name.clone(), handle: self.handle,
handle: self.handle, inner_type_id: self.inner_type_id,
inner_type_id: self.inner_type_id, derived_type_ids: self.derived_type_ids.clone(),
derived_type_ids: self.derived_type_ids.clone(), })))
}))),
)
.with_items( .with_items(
self.children self.children
.iter() .iter()
@@ -207,7 +202,7 @@ struct TreeData {
pub derived_type_ids: Vec<TypeId>, pub derived_type_ids: Vec<TypeId>,
} }
#[derive(Debug, Clone, Visit, Reflect)] #[derive(Debug, Clone,PartialEq, Visit, Reflect)]
#[reflect(derived_type = "UiNode")] #[reflect(derived_type = "UiNode")]
#[reflect(type_uuid = "1d718f90-323c-492d-b057-98d47495900a")] #[reflect(type_uuid = "1d718f90-323c-492d-b057-98d47495900a")]
pub struct NodeSelector { pub struct NodeSelector {
@@ -428,7 +423,7 @@ impl NodeSelectorBuilder {
} }
} }
#[derive(Debug, Clone, Visit, Reflect)] #[derive(Debug, Clone,PartialEq, Visit, Reflect)]
#[reflect(type_uuid = "5bb00f15-d6ec-4f0e-af7e-9472b0e290b4")] #[reflect(type_uuid = "5bb00f15-d6ec-4f0e-af7e-9472b0e290b4")]
#[reflect(derived_type = "UiNode")] #[reflect(derived_type = "UiNode")]
pub struct NodeSelectorWindow { pub struct NodeSelectorWindow {
+2 -2
View File
@@ -56,7 +56,7 @@ use crate::{
GameScene, Message, GameScene, Message,
}; };
use fyrox::gui::inspector::editors::inspectable::InspectablePropertyEditorDefinition; use fyrox::gui::inspector::editors::inspectable::InspectablePropertyEditorDefinition;
use fyrox::gui::inspector::Inspector; use fyrox::gui::inspector::{Inspector, InspectorEnvironmentContainer};
use std::sync::{mpsc::Sender, Arc}; use std::sync::{mpsc::Sender, Arc};
pub struct SceneSettingsWindow { pub struct SceneSettingsWindow {
@@ -160,7 +160,7 @@ impl SceneSettingsWindow {
object, object,
ctx: &mut ui.build_ctx(), ctx: &mut ui.build_ctx(),
definition_container: self.property_definitions.clone(), definition_container: self.property_definitions.clone(),
environment: Some(environment), environment: Some(InspectorEnvironmentContainer(environment)),
layer_index: 0, layer_index: 0,
generate_property_string_values: false, generate_property_string_values: false,
filter: PropertyFilter::new(|property| { filter: PropertyFilter::new(|property| {
+9
View File
@@ -40,6 +40,15 @@ pub struct UiSceneContext {
pub clipboard: &'static mut Clipboard, pub clipboard: &'static mut Clipboard,
} }
impl PartialEq for UiSceneContext {
fn eq(&self, other: &Self) -> bool {
std::ptr::addr_eq(self.ui, other.ui)
&& std::ptr::addr_eq(self.selection, other.selection)
&& std::ptr::addr_eq(self.clipboard, other.clipboard)
&& self.message_sender == other.message_sender
}
}
impl UiSceneContext { impl UiSceneContext {
pub fn exec<'a, F>( pub fn exec<'a, F>(
ui: &'a mut UserInterface, ui: &'a mut UserInterface,
+1 -1
View File
@@ -43,7 +43,7 @@ use fyrox::gui::image::Image;
pub mod move_mode; pub mod move_mode;
#[derive(Reflect, Clone, Debug)] #[derive(PartialEq, Reflect, Clone, Debug)]
#[reflect(type_uuid = "12e550dc-0fb2-4a45-8060-fa363db3e197")] #[reflect(type_uuid = "12e550dc-0fb2-4a45-8060-fa363db3e197")]
pub struct UiSelectInteractionMode { pub struct UiSelectInteractionMode {
preview: Handle<Image>, preview: Handle<Image>,
+3 -3
View File
@@ -34,7 +34,7 @@ use crate::{
}; };
use fyrox::gui::button::Button; use fyrox::gui::button::Button;
#[derive(Reflect, Debug, Clone)] #[derive(PartialEq, Reflect, Debug, Clone)]
#[reflect(type_uuid = "05a1b439-d354-45b1-9014-10393c5ba35d")] #[reflect(type_uuid = "05a1b439-d354-45b1-9014-10393c5ba35d")]
struct Entry { struct Entry {
widget: Handle<UiNode>, widget: Handle<UiNode>,
@@ -43,13 +43,13 @@ struct Entry {
delta: Vector2<f32>, delta: Vector2<f32>,
} }
#[derive(Reflect, Debug, Clone)] #[derive(PartialEq, Reflect, Debug, Clone)]
#[reflect(type_uuid = "c9b6b3d6-ade9-4da2-a5e7-48893f24d97f")] #[reflect(type_uuid = "c9b6b3d6-ade9-4da2-a5e7-48893f24d97f")]
struct MoveContext { struct MoveContext {
entries: Vec<Entry>, entries: Vec<Entry>,
} }
#[derive(Reflect, Debug, Clone)] #[derive(PartialEq, Reflect, Debug, Clone)]
#[reflect(type_uuid = "e5c09b04-5c31-4044-ac48-5227ab4a4b83")] #[reflect(type_uuid = "e5c09b04-5c31-4044-ac48-5227ab4a4b83")]
pub struct MoveWidgetsInteractionMode { pub struct MoveWidgetsInteractionMode {
move_context: Option<MoveContext>, move_context: Option<MoveContext>,
+2 -2
View File
@@ -62,7 +62,7 @@ pub enum SceneItemMessage {
} }
impl MessageData for SceneItemMessage {} impl MessageData for SceneItemMessage {}
#[derive(Copy, Clone)] #[derive(Copy, PartialEq, Clone)]
pub enum DropAnchor { pub enum DropAnchor {
Side { Side {
visual_offset: f32, visual_offset: f32,
@@ -71,7 +71,7 @@ pub enum DropAnchor {
OnTop, OnTop,
} }
#[derive(Visit, Reflect)] #[derive(Visit, PartialEq, Reflect)]
#[reflect(derived_type = "UiNode")] #[reflect(derived_type = "UiNode")]
#[reflect(type_uuid = "16f35257-a250-413b-ab51-b1ad086a3a9c")] #[reflect(type_uuid = "16f35257-a250-413b-ab51-b1ad086a3a9c")]
pub struct SceneItem { pub struct SceneItem {
+1 -1
View File
@@ -119,7 +119,7 @@ pub trait PatternSource {
/// to fit with the new terrain of this cell. This object specifies whether that should /// to fit with the new terrain of this cell. This object specifies whether that should
/// be done. Cells that are added this way keep their current terrain, but their pattern /// be done. Cells that are added this way keep their current terrain, but their pattern
/// may change. /// may change.
#[derive(Debug, Default, Clone, Copy)] #[derive(Debug, Default, Clone, PartialEq, Copy)]
pub struct ConstraintFillRules { pub struct ConstraintFillRules {
/// True if adjacent cells should be automatically added to the autotiling constraint /// True if adjacent cells should be automatically added to the autotiling constraint
/// so that they may be modified. /// so that they may be modified.
+1 -1
View File
@@ -49,7 +49,7 @@ pub struct BuildOutput {
pub type BuildResult = Result<BuildOutput, String>; pub type BuildResult = Result<BuildOutput, String>;
#[derive(Reflect, Debug, Clone)] #[derive(PartialEq, Reflect, Debug, Clone)]
#[reflect(type_uuid = "b1387e05-fb9f-48d8-8776-5b1d2993fa1a")] #[reflect(type_uuid = "b1387e05-fb9f-48d8-8776-5b1d2993fa1a")]
pub struct ExportOptions { pub struct ExportOptions {
#[reflect(hidden)] #[reflect(hidden)]
+1 -1
View File
@@ -43,7 +43,7 @@ clap = { version = "4", features = ["derive"] }
winit = { version = "0.30", features = ["serde"] } winit = { version = "0.30", features = ["serde"] }
half = { version = "2.2.1", features = ["bytemuck"] } half = { version = "2.2.1", features = ["bytemuck"] }
base64 = "0.22.1" base64 = "0.22.1"
uvgen = "0.3.0" uvgen = "0.4.0"
lightmap = "0.6.0" lightmap = "0.6.0"
libloading = "0.9" libloading = "0.9"
gltf = { version = "1.4.0", default-features = false, features = ["names", "utils", "extras", "KHR_materials_emissive_strength"] } gltf = { version = "1.4.0", default-features = false, features = ["names", "utils", "extras", "KHR_materials_emissive_strength"] }
+9 -8
View File
@@ -149,8 +149,9 @@ use winit::{
#[reflect( #[reflect(
hide_all, hide_all,
non_cloneable, non_cloneable,
non_comparable,
type_uuid = "1973a8c9-6ac6-48a2-bca1-9b4f3cce0774" type_uuid = "1973a8c9-6ac6-48a2-bca1-9b4f3cce0774"
)] // TODO )]
pub struct SerializationContext { pub struct SerializationContext {
/// A node constructor container. /// A node constructor container.
pub node_constructors: NodeConstructorContainer, pub node_constructors: NodeConstructorContainer,
@@ -2926,7 +2927,7 @@ mod test {
} }
#[derive(Debug, Clone, Reflect, Visit)] #[derive(Debug, Clone, Reflect, Visit)]
#[reflect(type_uuid = "2569de84-d4b2-427d-969b-d5c7b31a0ba6")] #[reflect(type_uuid = "2569de84-d4b2-427d-969b-d5c7b31a0ba6", non_comparable)]
struct MyScript { struct MyScript {
#[reflect(hidden)] #[reflect(hidden)]
#[visit(skip)] #[visit(skip)]
@@ -2993,7 +2994,7 @@ mod test {
} }
#[derive(Debug, Clone, Reflect, Visit)] #[derive(Debug, Clone, Reflect, Visit)]
#[reflect(type_uuid = "1cebacd9-b500-4753-93be-39db344add21")] #[reflect(type_uuid = "1cebacd9-b500-4753-93be-39db344add21", non_comparable)]
struct MySubScript { struct MySubScript {
#[reflect(hidden)] #[reflect(hidden)]
#[visit(skip)] #[visit(skip)]
@@ -3152,7 +3153,7 @@ mod test {
} }
#[derive(Debug, Clone, Reflect, Visit)] #[derive(Debug, Clone, Reflect, Visit)]
#[reflect(type_uuid = "bf2976ad-f41d-4de6-9a32-b1a293956058")] #[reflect(type_uuid = "bf2976ad-f41d-4de6-9a32-b1a293956058", non_comparable)]
struct ScriptListeningToMessages { struct ScriptListeningToMessages {
index: u32, index: u32,
#[reflect(hidden)] #[reflect(hidden)]
@@ -3202,7 +3203,7 @@ mod test {
} }
} }
#[derive(Debug, Clone, Reflect, Visit)] #[derive(Debug, Clone, PartialEq, Reflect, Visit)]
#[reflect(type_uuid = "6bcbf9b4-9546-42d3-965a-de055ab85475")] #[reflect(type_uuid = "6bcbf9b4-9546-42d3-965a-de055ab85475")]
struct ScriptSendingMessages { struct ScriptSendingMessages {
index: u32, index: u32,
@@ -3392,7 +3393,7 @@ mod test {
} }
#[derive(Clone, Debug, Reflect, Visit)] #[derive(Clone, Debug, Reflect, Visit)]
#[reflect(type_uuid = "9bcbf9b4-9546-42d3-965a-de055ab85475")] #[reflect(type_uuid = "9bcbf9b4-9546-42d3-965a-de055ab85475", non_comparable)]
pub struct ScriptThatDeletesItself { pub struct ScriptThatDeletesItself {
#[reflect(hidden)] #[reflect(hidden)]
#[visit(skip)] #[visit(skip)]
@@ -3433,7 +3434,7 @@ mod test {
} }
#[derive(Clone, Debug, Reflect, Visit)] #[derive(Clone, Debug, Reflect, Visit)]
#[reflect(type_uuid = "9bcbf9b4-9546-42d3-965a-de055ab85475")] #[reflect(type_uuid = "9bcbf9b4-9546-42d3-965a-de055ab85475", non_comparable)]
pub struct ScriptThatAddsScripts { pub struct ScriptThatAddsScripts {
num: usize, num: usize,
#[reflect(hidden)] #[reflect(hidden)]
@@ -3482,7 +3483,7 @@ mod test {
} }
#[derive(Clone, Debug, Reflect, Visit)] #[derive(Clone, Debug, Reflect, Visit)]
#[reflect(type_uuid = "9bcbf9b4-9546-42d3-965a-de055ab85475")] #[reflect(type_uuid = "9bcbf9b4-9546-42d3-965a-de055ab85475", non_comparable)]
pub struct SimpleScript { pub struct SimpleScript {
stuff: usize, stuff: usize,
#[reflect(hidden)] #[reflect(hidden)]
+1 -1
View File
@@ -72,7 +72,7 @@ impl From<VisitError> for CurveResourceError {
} }
/// State of the [`CurveResource`] /// State of the [`CurveResource`]
#[derive(Debug, Clone, Visit, Default, Reflect)] #[derive(Debug, Clone, Visit, Default, PartialEq, Reflect)]
#[reflect(type_uuid = "f28b949f-28a2-4b68-9089-59c234f58b6b")] #[reflect(type_uuid = "f28b949f-28a2-4b68-9089-59c234f58b6b")]
pub struct CurveResourceState { pub struct CurveResourceState {
/// Actual curve. /// Actual curve.
+1 -1
View File
@@ -81,7 +81,7 @@ use uuid::uuid;
pub mod loader; pub mod loader;
/// See module docs. /// See module docs.
#[derive(Debug, Clone, Visit, Reflect)] #[derive(Debug, PartialEq, Clone, Visit, Reflect)]
#[reflect(type_uuid = "44cd768f-b4ca-4804-a98c-0adf85577ada")] #[reflect(type_uuid = "44cd768f-b4ca-4804-a98c-0adf85577ada")]
pub struct Model { pub struct Model {
#[visit(skip)] #[visit(skip)]
+1 -1
View File
@@ -219,7 +219,7 @@ type AnimationPlayerHandle = InheritableVariable<Handle<AnimationPlayer>>;
/// .build(graph) /// .build(graph)
/// } /// }
/// ``` /// ```
#[derive(Visit, Reflect, Clone, Debug, Default)] #[derive(Visit, PartialEq, Reflect, Clone, Debug, Default)]
#[reflect( #[reflect(
derived_type = "Node", derived_type = "Node",
type_uuid = "4b08c753-2a10-41e3-8fb2-4fd0517e86bc" type_uuid = "4b08c753-2a10-41e3-8fb2-4fd0517e86bc"
+1 -1
View File
@@ -242,7 +242,7 @@ impl BoundValueCollectionExt for BoundValueCollection {
/// The example creates a bounce animation first - it is a simple animation that animates position of a given node /// The example creates a bounce animation first - it is a simple animation that animates position of a given node
/// (`animated_node`). Only then it creates an animation player node with an animation container with a single animation. /// (`animated_node`). Only then it creates an animation player node with an animation container with a single animation.
/// To understand why this is so complicated, see the docs of [`Animation`]. /// To understand why this is so complicated, see the docs of [`Animation`].
#[derive(Visit, Reflect, Clone, Debug)] #[derive(Visit, PartialEq, Reflect, Clone, Debug)]
#[reflect( #[reflect(
derived_type = "Node", derived_type = "Node",
type_uuid = "44d1c94e-354f-4f9a-b918-9d31c28aa16a" type_uuid = "44d1c94e-354f-4f9a-b918-9d31c28aa16a"
+52 -28
View File
@@ -237,7 +237,7 @@ impl Visit for SceneNodeId {
} }
/// A script container record. /// A script container record.
#[derive(Clone, Reflect, Debug, Default)] #[derive(Clone, Reflect, Debug, PartialEq, Default)]
#[reflect(type_uuid = "51bc577b-5a50-4a97-9b31-eda2f3d46c9d")] #[reflect(type_uuid = "51bc577b-5a50-4a97-9b31-eda2f3d46c9d")]
pub struct ScriptRecord { pub struct ScriptRecord {
// Script is wrapped into `Option` to be able to do take-return trick to bypass borrow checker // Script is wrapped into `Option` to be able to do take-return trick to bypass borrow checker
@@ -326,6 +326,12 @@ impl<T: Visit> Visit for TrackedProperty<T> {
} }
} }
impl<T: PartialEq> PartialEq for TrackedProperty<T> {
fn eq(&self, other: &Self) -> bool {
self.property == other.property
}
}
impl<T> Deref for TrackedProperty<T> { impl<T> Deref for TrackedProperty<T> {
type Target = T; type Target = T;
@@ -346,6 +352,18 @@ impl<T> DerefMut for TrackedProperty<T> {
} }
} }
#[derive(Debug, Clone)]
struct MessageSenders {
script_message_sender: Sender<NodeScriptMessage>,
message_sender: Sender<NodeMessage>,
}
impl PartialEq for MessageSenders {
fn eq(&self, _other: &Self) -> bool {
true
}
}
/// Base scene graph node is a simplest possible node, it is used to build more complex ones using composition. /// Base scene graph node is a simplest possible node, it is used to build more complex ones using composition.
/// It contains all fundamental properties for each scene graph nodes, like local and global transforms, name, /// It contains all fundamental properties for each scene graph nodes, like local and global transforms, name,
/// lifetime, etc. Base node is a building block for all complex node hierarchies - it contains list of children /// lifetime, etc. Base node is a building block for all complex node hierarchies - it contains list of children
@@ -366,17 +384,14 @@ impl<T> DerefMut for TrackedProperty<T> {
/// .build(graph) /// .build(graph)
/// } /// }
/// ``` /// ```
#[derive(Debug, Reflect, Clone)] #[derive(Debug, Reflect, PartialEq, Clone)]
#[reflect(type_uuid = "5bf7fb77-fd50-4b92-83d7-27153b7da531")] #[reflect(type_uuid = "5bf7fb77-fd50-4b92-83d7-27153b7da531")]
pub struct Base { pub struct Base {
#[reflect(hidden)] #[reflect(hidden)]
self_handle: Handle<Node>, self_handle: Handle<Node>,
#[reflect(hidden)] #[reflect(hidden)]
script_message_sender: Option<Sender<NodeScriptMessage>>, senders: Option<MessageSenders>,
#[reflect(hidden)]
message_sender: Option<Sender<NodeMessage>>,
// Name is not inheritable, because property inheritance works bad with external 3D models. // Name is not inheritable, because property inheritance works bad with external 3D models.
// They use names to search "original" nodes. // They use names to search "original" nodes.
@@ -509,8 +524,10 @@ impl Base {
script_message_sender: Sender<NodeScriptMessage>, script_message_sender: Sender<NodeScriptMessage>,
) { ) {
self.self_handle = self_handle; self.self_handle = self_handle;
self.message_sender = Some(message_sender.clone()); self.senders = Some(MessageSenders {
self.script_message_sender = Some(script_message_sender); message_sender: message_sender.clone(),
script_message_sender,
});
self.local_transform self.local_transform
.set_message_data(message_sender.clone(), self_handle); .set_message_data(message_sender.clone(), self_handle);
self.visibility self.visibility
@@ -523,10 +540,10 @@ impl Base {
} }
fn notify(&self, node: Handle<Node>, kind: NodeMessageKind) { fn notify(&self, node: Handle<Node>, kind: NodeMessageKind) {
let Some(sender) = self.message_sender.as_ref() else { let Some(senders) = self.senders.as_ref() else {
return; return;
}; };
Log::verify(sender.send(NodeMessage::new(node, kind))); Log::verify(senders.message_sender.send(NodeMessage::new(node, kind)));
} }
/// Returns shared reference to local transform of a node, can be used to fetch /// Returns shared reference to local transform of a node, can be used to fetch
@@ -866,12 +883,14 @@ impl Base {
// We might be in a middle of a script method execution, where script is temporarily // We might be in a middle of a script method execution, where script is temporarily
// extracted from the array. // extracted from the array.
if let Some(script) = entry.take() { if let Some(script) = entry.take() {
if let Some(sender) = self.script_message_sender.as_ref() { if let Some(senders) = self.senders.as_ref() {
Log::verify(sender.send(NodeScriptMessage::DestroyScript { Log::verify(senders.script_message_sender.send(
script, NodeScriptMessage::DestroyScript {
handle: self.self_handle, script,
script_index: index, handle: self.self_handle,
})); script_index: index,
},
));
} else { } else {
Log::warn(format!( Log::warn(format!(
"There is a script instance on a node {}, but no message sender. \ "There is a script instance on a node {}, but no message sender. \
@@ -901,12 +920,14 @@ impl Base {
if let Some(entry) = self.scripts.get_mut(index) { if let Some(entry) = self.scripts.get_mut(index) {
entry.script = script; entry.script = script;
if let Some(sender) = self.script_message_sender.as_ref() { if let Some(senders) = self.senders.as_ref() {
if entry.script.is_some() { if entry.script.is_some() {
Log::verify(sender.send(NodeScriptMessage::InitializeScript { Log::verify(senders.script_message_sender.send(
handle: self.self_handle, NodeScriptMessage::InitializeScript {
script_index: index, handle: self.self_handle,
})); script_index: index,
},
));
} }
} }
} }
@@ -922,11 +943,15 @@ impl Base {
{ {
let script_index = self.scripts.len(); let script_index = self.scripts.len();
self.scripts.push(ScriptRecord::new(Script::new(script))); self.scripts.push(ScriptRecord::new(Script::new(script)));
if let Some(sender) = self.script_message_sender.as_ref() { if let Some(senders) = self.senders.as_ref() {
Log::verify(sender.send(NodeScriptMessage::InitializeScript { Log::verify(
handle: self.self_handle, senders
script_index, .script_message_sender
})); .send(NodeScriptMessage::InitializeScript {
handle: self.self_handle,
script_index,
}),
);
} }
} }
@@ -1344,8 +1369,7 @@ impl BaseBuilder {
pub fn build_base(self) -> Base { pub fn build_base(self) -> Base {
Base { Base {
self_handle: Default::default(), self_handle: Default::default(),
script_message_sender: None, senders: None,
message_sender: None,
name: self.name.into(), name: self.name.into(),
children: self.children, children: self.children,
local_transform: TrackedProperty::unbound( local_transform: TrackedProperty::unbound(
+1 -1
View File
@@ -351,7 +351,7 @@ impl Default for Exposure {
/// ///
/// Each camera forces engine to re-render same scene one more time, which may cause almost double load /// Each camera forces engine to re-render same scene one more time, which may cause almost double load
/// of your GPU. /// of your GPU.
#[derive(Debug, Visit, Reflect, Clone)] #[derive(Debug, Visit, PartialEq, Reflect, Clone)]
#[reflect( #[reflect(
derived_type = "Node", derived_type = "Node",
type_uuid = "198d3aca-433c-4ce1-bb25-3190699b757f" type_uuid = "198d3aca-433c-4ce1-bb25-3190699b757f"
+1 -1
View File
@@ -617,7 +617,7 @@ impl ColliderShape {
/// Collider is a geometric entity that can be attached to a rigid body to allow participate it /// Collider is a geometric entity that can be attached to a rigid body to allow participate it
/// participate in contact generation, collision response and proximity queries. /// participate in contact generation, collision response and proximity queries.
#[derive(Reflect, Visit, Debug)] #[derive(PartialEq, Reflect, Visit, Debug)]
#[reflect( #[reflect(
derived_type = "Node", derived_type = "Node",
type_uuid = "bfaa2e82-9c19-4b99-983b-3bc115744a1d" type_uuid = "bfaa2e82-9c19-4b99-983b-3bc115744a1d"
+2 -2
View File
@@ -32,7 +32,7 @@ use rapier2d::pipeline::{DebugColor, DebugRenderObject};
use std::ops::Range; use std::ops::Range;
/// Colored line between two points. /// Colored line between two points.
#[derive(Clone, Debug)] #[derive(Clone, PartialEq, Debug)]
pub struct Line { pub struct Line {
/// Beginning of the line. /// Beginning of the line.
pub begin: Vector3<f32>, pub begin: Vector3<f32>,
@@ -86,7 +86,7 @@ pub struct Line {
/// ///
/// The engine renders the entire set of lines in a single draw call, so it very fast - you should be able to draw /// The engine renders the entire set of lines in a single draw call, so it very fast - you should be able to draw
/// up to few millions of lines without any significant performance issues. /// up to few millions of lines without any significant performance issues.
#[derive(Default, Clone, Debug)] #[derive(Default, PartialEq, Clone, Debug)]
pub struct SceneDrawingContext { pub struct SceneDrawingContext {
/// List of lines to draw. /// List of lines to draw.
pub lines: Vec<Line>, pub lines: Vec<Line>,
+1 -1
View File
@@ -107,7 +107,7 @@ use std::ops::{Deref, DerefMut};
/// .build(graph) /// .build(graph)
/// } /// }
/// ``` /// ```
#[derive(Debug, Visit, Default, Clone, Reflect)] #[derive(Debug, Visit, Default, Clone, PartialEq, Reflect)]
#[reflect( #[reflect(
derived_type = "Node", derived_type = "Node",
type_uuid = "c4d24e48-edd1-4fb2-ad82-4b3d3ea985d8" type_uuid = "c4d24e48-edd1-4fb2-ad82-4b3d3ea985d8"
+1 -2
View File
@@ -273,7 +273,7 @@ impl ColliderShape {
/// Collider is a geometric entity that can be attached to a rigid body to allow to participate in /// Collider is a geometric entity that can be attached to a rigid body to allow to participate in
/// contact generation, collision response and proximity queries. /// contact generation, collision response and proximity queries.
#[derive(Reflect, Visit, Debug)] #[derive(PartialEq, Reflect, Visit, Debug)]
#[reflect( #[reflect(
derived_type = "Node", derived_type = "Node",
type_uuid = "2b1659ea-a116-4224-bcd4-7931e3ae3b40" type_uuid = "2b1659ea-a116-4224-bcd4-7931e3ae3b40"
@@ -865,7 +865,6 @@ impl ColliderBuilder {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use crate::core::algebra::Vector2; use crate::core::algebra::Vector2;
use crate::scene::{ use crate::scene::{
base::BaseBuilder, base::BaseBuilder,
+3 -3
View File
@@ -133,7 +133,7 @@ impl Default for JointParams {
} }
} }
#[derive(Visit, Reflect, Debug, Clone, Default)] #[derive(Visit, PartialEq, Reflect, Debug, Clone, Default)]
#[reflect(type_uuid = "d22556ef-f011-4b85-ac67-c1ff4d43d59e")] #[reflect(type_uuid = "d22556ef-f011-4b85-ac67-c1ff4d43d59e")]
pub(crate) struct LocalFrame { pub(crate) struct LocalFrame {
pub position: Vector2<f32>, pub position: Vector2<f32>,
@@ -149,7 +149,7 @@ impl LocalFrame {
} }
} }
#[derive(Visit, Reflect, Debug, Clone, Default)] #[derive(Visit, PartialEq, Reflect, Debug, Clone, Default)]
#[reflect(type_uuid = "448ce88b-1c89-4a66-b909-6835aff07d12")] #[reflect(type_uuid = "448ce88b-1c89-4a66-b909-6835aff07d12")]
pub(crate) struct JointLocalFrames { pub(crate) struct JointLocalFrames {
pub body1: LocalFrame, pub body1: LocalFrame,
@@ -167,7 +167,7 @@ impl JointLocalFrames {
/// Joint is used to restrict motion of two rigid bodies. There are numerous examples of joints in /// Joint is used to restrict motion of two rigid bodies. There are numerous examples of joints in
/// real life: door hinge, ball joints in human arms, etc. /// real life: door hinge, ball joints in human arms, etc.
#[derive(Visit, Reflect, Debug)] #[derive(Visit, PartialEq, Reflect, Debug)]
#[reflect( #[reflect(
derived_type = "Node", derived_type = "Node",
type_uuid = "b8d66eda-b69f-4c57-80ba-d76665573565" type_uuid = "b8d66eda-b69f-4c57-80ba-d76665573565"
+10 -1
View File
@@ -520,6 +520,15 @@ pub struct PhysicsWorld {
debug_render_pipeline: Mutex<DebugRenderPipeline>, debug_render_pipeline: Mutex<DebugRenderPipeline>,
} }
impl PartialEq for PhysicsWorld {
fn eq(&self, other: &Self) -> bool {
// Silly impl because Rapier does not really leave any other option.
self.bodies.len() == other.bodies.len()
&& self.joints.set.len() == other.joints.set.len()
&& self.colliders.len() == other.colliders.len()
}
}
impl Clone for PhysicsWorld { impl Clone for PhysicsWorld {
fn clone(&self) -> Self { fn clone(&self) -> Self {
PhysicsWorld { PhysicsWorld {
@@ -984,7 +993,7 @@ impl PhysicsWorld {
// 1) `get_mut` is **very** expensive because it forces physics engine to recalculate contacts // 1) `get_mut` is **very** expensive because it forces physics engine to recalculate contacts
// and a lot of other stuff, this is why we need `anything_changed` flag. // and a lot of other stuff, this is why we need `anything_changed` flag.
if rigid_body_node.native.get() != RigidBodyHandle::invalid() { if rigid_body_node.native.get() != RigidBodyHandle::invalid() {
let mut actions = rigid_body_node.actions.safe_lock(); let mut actions = rigid_body_node.actions.inner();
if rigid_body_node.need_sync_model() || !actions.is_empty() { if rigid_body_node.need_sync_model() || !actions.is_empty() {
if let Some(native) = self.bodies.get_mut(rigid_body_node.native.get()) { if let Some(native) = self.bodies.get_mut(rigid_body_node.native.get()) {
// Sync native rigid body's properties with scene node's in case if they // Sync native rigid body's properties with scene node's in case if they
+1 -1
View File
@@ -170,7 +170,7 @@ impl Hash for RectangleVertex {
/// image, but just changing portion for rendering. Keep in mind that the coordinates are normalized /// image, but just changing portion for rendering. Keep in mind that the coordinates are normalized
/// which means `[0; 0]` corresponds to top-left corner of the texture and `[1; 1]` corresponds to /// which means `[0; 0]` corresponds to top-left corner of the texture and `[1; 1]` corresponds to
/// right-bottom corner. /// right-bottom corner.
#[derive(Reflect, Debug, Clone, Visit)] #[derive(PartialEq, Reflect, Debug, Clone, Visit)]
#[reflect( #[reflect(
derived_type = "Node", derived_type = "Node",
type_uuid = "bb57b5e0-367a-4490-bf30-7f547407d5b5" type_uuid = "bb57b5e0-367a-4490-bf30-7f547407d5b5"
+16 -28
View File
@@ -34,7 +34,6 @@ use crate::{
algebra::{Isometry2, Matrix4, UnitComplex, Vector2}, algebra::{Isometry2, Matrix4, UnitComplex, Vector2},
log::Log, log::Log,
math::{aabb::AxisAlignedBoundingBox, m4x4_approx_eq}, math::{aabb::AxisAlignedBoundingBox, m4x4_approx_eq},
parking_lot::Mutex,
pool::Handle, pool::Handle,
reflect::prelude::*, reflect::prelude::*,
uuid::{uuid, Uuid}, uuid::{uuid, Uuid},
@@ -52,17 +51,17 @@ use crate::{
}; };
use crate::scene::dim2::collider::ColliderShape; use crate::scene::dim2::collider::ColliderShape;
use crate::utils::ThreadSafeQueue;
use fyrox_graph::constructor::ConstructorProvider; use fyrox_graph::constructor::ConstructorProvider;
use fyrox_graph::SceneGraph; use fyrox_graph::SceneGraph;
use rapier2d::prelude::RigidBodyHandle; use rapier2d::prelude::RigidBodyHandle;
use std::{ use std::{
cell::Cell, cell::Cell,
collections::VecDeque,
fmt::{Debug, Formatter}, fmt::{Debug, Formatter},
ops::{Deref, DerefMut}, ops::{Deref, DerefMut},
}; };
#[derive(Debug)] #[derive(Debug, PartialEq)]
pub(crate) enum ApplyAction { pub(crate) enum ApplyAction {
Force(Vector2<f32>), Force(Vector2<f32>),
Torque(f32), Torque(f32),
@@ -82,6 +81,8 @@ pub(crate) enum ApplyAction {
NextPosition(Isometry2<f32>), NextPosition(Isometry2<f32>),
} }
pub(crate) type ActionsQueue = ThreadSafeQueue<ApplyAction>;
/// Rigid body is a physics entity that responsible for the dynamics and kinematics of the solid. /// Rigid body is a physics entity that responsible for the dynamics and kinematics of the solid.
/// Use this node when you need to simulate real-world physics in your game. /// Use this node when you need to simulate real-world physics in your game.
/// ///
@@ -89,7 +90,7 @@ pub(crate) enum ApplyAction {
/// ///
/// Rigid body that does not move for some time will go asleep. This means that the body will not /// Rigid body that does not move for some time will go asleep. This means that the body will not
/// move unless it is woken up by some other moving body. This feature allows to save CPU resources. /// move unless it is woken up by some other moving body. This feature allows to save CPU resources.
#[derive(Visit, Reflect)] #[derive(Visit, PartialEq, Reflect)]
#[reflect( #[reflect(
derived_type = "Node", derived_type = "Node",
type_uuid = "0b242335-75a4-4c65-9685-3e82a8979047" type_uuid = "0b242335-75a4-4c65-9685-3e82a8979047"
@@ -148,7 +149,7 @@ pub struct RigidBody {
#[visit(skip)] #[visit(skip)]
#[reflect(hidden)] #[reflect(hidden)]
pub(crate) actions: Mutex<VecDeque<ApplyAction>>, pub(crate) actions: ActionsQueue,
} }
impl Debug for RigidBody { impl Debug for RigidBody {
@@ -361,39 +362,33 @@ impl RigidBody {
/// Applies a force at the center-of-mass of this rigid-body. The force will be applied in the /// Applies a force at the center-of-mass of this rigid-body. The force will be applied in the
/// next simulation step. This does nothing on non-dynamic bodies. /// next simulation step. This does nothing on non-dynamic bodies.
pub fn apply_force(&mut self, force: Vector2<f32>) { pub fn apply_force(&mut self, force: Vector2<f32>) {
self.actions.get_mut().push_back(ApplyAction::Force(force)) self.actions.push(ApplyAction::Force(force))
} }
/// Applies a torque at the center-of-mass of this rigid-body. The torque will be applied in /// Applies a torque at the center-of-mass of this rigid-body. The torque will be applied in
/// the next simulation step. This does nothing on non-dynamic bodies. /// the next simulation step. This does nothing on non-dynamic bodies.
pub fn apply_torque(&mut self, torque: f32) { pub fn apply_torque(&mut self, torque: f32) {
self.actions self.actions.push(ApplyAction::Torque(torque))
.get_mut()
.push_back(ApplyAction::Torque(torque))
} }
/// Applies a force at the given world-space point of this rigid-body. The force will be applied /// Applies a force at the given world-space point of this rigid-body. The force will be applied
/// in the next simulation step. This does nothing on non-dynamic bodies. /// in the next simulation step. This does nothing on non-dynamic bodies.
pub fn apply_force_at_point(&mut self, force: Vector2<f32>, point: Vector2<f32>) { pub fn apply_force_at_point(&mut self, force: Vector2<f32>, point: Vector2<f32>) {
self.actions self.actions
.get_mut() .push(ApplyAction::ForceAtPoint { force, point })
.push_back(ApplyAction::ForceAtPoint { force, point })
} }
/// Applies an impulse at the center-of-mass of this rigid-body. The impulse is applied right /// Applies an impulse at the center-of-mass of this rigid-body. The impulse is applied right
/// away, changing the linear velocity. This does nothing on non-dynamic bodies. /// away, changing the linear velocity. This does nothing on non-dynamic bodies.
pub fn apply_impulse(&mut self, impulse: Vector2<f32>) { pub fn apply_impulse(&mut self, impulse: Vector2<f32>) {
self.actions self.actions.push(ApplyAction::Impulse(impulse))
.get_mut()
.push_back(ApplyAction::Impulse(impulse))
} }
/// Applies an angular impulse at the center-of-mass of this rigid-body. The impulse is applied /// Applies an angular impulse at the center-of-mass of this rigid-body. The impulse is applied
/// right away, changing the angular velocity. This does nothing on non-dynamic bodies. /// right away, changing the angular velocity. This does nothing on non-dynamic bodies.
pub fn apply_torque_impulse(&mut self, torque_impulse: f32) { pub fn apply_torque_impulse(&mut self, torque_impulse: f32) {
self.actions self.actions
.get_mut() .push(ApplyAction::TorqueImpulse(torque_impulse))
.push_back(ApplyAction::TorqueImpulse(torque_impulse))
} }
/// Applies an impulse at the given world-space point of this rigid-body. The impulse is applied /// Applies an impulse at the given world-space point of this rigid-body. The impulse is applied
@@ -401,32 +396,25 @@ impl RigidBody {
/// bodies. /// bodies.
pub fn apply_impulse_at_point(&mut self, impulse: Vector2<f32>, point: Vector2<f32>) { pub fn apply_impulse_at_point(&mut self, impulse: Vector2<f32>, point: Vector2<f32>) {
self.actions self.actions
.get_mut() .push(ApplyAction::ImpulseAtPoint { impulse, point })
.push_back(ApplyAction::ImpulseAtPoint { impulse, point })
} }
/// If this rigid body is kinematic, sets its future translation after /// If this rigid body is kinematic, sets its future translation after
/// the next timestep integration. /// the next timestep integration.
pub fn set_next_kinematic_translation(&mut self, translation: Vector2<f32>) { pub fn set_next_kinematic_translation(&mut self, translation: Vector2<f32>) {
self.actions self.actions.push(ApplyAction::NextTranslation(translation));
.get_mut()
.push_back(ApplyAction::NextTranslation(translation));
} }
/// If this rigid body is kinematic, sets its future orientation after /// If this rigid body is kinematic, sets its future orientation after
/// the next timestep integration. /// the next timestep integration.
pub fn set_next_kinematic_rotation(&mut self, rotation: UnitComplex<f32>) { pub fn set_next_kinematic_rotation(&mut self, rotation: UnitComplex<f32>) {
self.actions self.actions.push(ApplyAction::NextRotation(rotation));
.get_mut()
.push_back(ApplyAction::NextRotation(rotation));
} }
/// If this rigid body is kinematic, sets its future position (translation and orientation) after /// If this rigid body is kinematic, sets its future position (translation and orientation) after
/// the next timestep integration. /// the next timestep integration.
pub fn set_next_kinematic_position(&mut self, position: Isometry2<f32>) { pub fn set_next_kinematic_position(&mut self, position: Isometry2<f32>) {
self.actions self.actions.push(ApplyAction::NextPosition(position));
.get_mut()
.push_back(ApplyAction::NextPosition(position));
} }
/// Sets whether the rigid body can sleep or not. If `false` is passed, it _automatically_ wake /// Sets whether the rigid body can sleep or not. If `false` is passed, it _automatically_ wake
@@ -442,7 +430,7 @@ impl RigidBody {
/// Wakes up rigid body, forcing it to return to participate in the simulation. /// Wakes up rigid body, forcing it to return to participate in the simulation.
pub fn wake_up(&mut self) { pub fn wake_up(&mut self) {
self.actions.get_mut().push_back(ApplyAction::WakeUp) self.actions.push(ApplyAction::WakeUp)
} }
pub(crate) fn need_sync_model(&self) -> bool { pub(crate) fn need_sync_model(&self) -> bool {
+7 -1
View File
@@ -90,7 +90,7 @@ pub mod physics;
/// Graph performance statistics. Allows you to find out "hot" parts of the scene graph, which /// Graph performance statistics. Allows you to find out "hot" parts of the scene graph, which
/// parts takes the most time to update. /// parts takes the most time to update.
#[derive(Clone, Default, Debug)] #[derive(Clone, PartialEq, Default, Debug)]
pub struct GraphPerformanceStatistics { pub struct GraphPerformanceStatistics {
/// Amount of time that was needed to update global transform, visibility, and every other /// Amount of time that was needed to update global transform, visibility, and every other
/// property of every object which depends on the state of a parent node. /// property of every object which depends on the state of a parent node.
@@ -174,6 +174,12 @@ pub struct Graph {
instance_id_map: FxHashMap<SceneNodeId, Handle<Node>>, instance_id_map: FxHashMap<SceneNodeId, Handle<Node>>,
} }
impl PartialEq for Graph {
fn eq(&self, other: &Self) -> bool {
self.root == other.root && self.pool == other.pool
}
}
impl Debug for Graph { impl Debug for Graph {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("Graph") f.debug_struct("Graph")
+3 -3
View File
@@ -193,7 +193,7 @@ impl Into<rapier2d::dynamics::CoefficientCombineRule> for CoefficientCombineRule
} }
/// Performance statistics for the physics part of the engine. /// Performance statistics for the physics part of the engine.
#[derive(Debug, Default, Clone)] #[derive(Debug, PartialEq, Default, Clone)]
pub struct PhysicsPerformanceStatistics { pub struct PhysicsPerformanceStatistics {
/// A time that was needed to perform a single simulation step. /// A time that was needed to perform a single simulation step.
pub step_time: Duration, pub step_time: Duration,
@@ -912,7 +912,7 @@ impl Default for IntegrationParameters {
/// methods, mostly for ray casting. You should add physical entities using scene graph nodes, such /// methods, mostly for ray casting. You should add physical entities using scene graph nodes, such
/// as RigidBody, Collider, Joint. /// as RigidBody, Collider, Joint.
#[derive(Visit, Reflect)] #[derive(Visit, Reflect)]
#[reflect(type_uuid = "17e663b8-98a4-46db-be71-a336246f571a")] #[reflect(type_uuid = "17e663b8-98a4-46db-be71-a336246f571a", non_comparable)]
pub struct PhysicsWorld { pub struct PhysicsWorld {
/// A flag that defines whether physics simulation is enabled or not. /// A flag that defines whether physics simulation is enabled or not.
pub enabled: InheritableVariable<bool>, pub enabled: InheritableVariable<bool>,
@@ -1441,7 +1441,7 @@ impl PhysicsWorld {
// 1) `get_mut` is **very** expensive because it forces physics engine to recalculate contacts // 1) `get_mut` is **very** expensive because it forces physics engine to recalculate contacts
// and a lot of other stuff, this is why we need `anything_changed` flag. // and a lot of other stuff, this is why we need `anything_changed` flag.
if rigid_body_node.native.get() != RigidBodyHandle::invalid() { if rigid_body_node.native.get() != RigidBodyHandle::invalid() {
let mut actions = rigid_body_node.actions.safe_lock(); let mut actions = rigid_body_node.actions.inner();
if rigid_body_node.need_sync_model() || !actions.is_empty() { if rigid_body_node.need_sync_model() || !actions.is_empty() {
if let Some(native) = self.bodies.get_mut(rigid_body_node.native.get()) { if let Some(native) = self.bodies.get_mut(rigid_body_node.native.get()) {
// Sync native rigid body's properties with scene node's in case if they // Sync native rigid body's properties with scene node's in case if they
+3 -3
View File
@@ -176,7 +176,7 @@ impl Default for JointParams {
} }
} }
#[derive(Visit, Reflect, Debug, Clone, Default)] #[derive(Visit, PartialEq, Reflect, Debug, Clone, Default)]
#[reflect(type_uuid = "1be0b82e-d05e-4b93-808a-41895c5a1627")] #[reflect(type_uuid = "1be0b82e-d05e-4b93-808a-41895c5a1627")]
pub(crate) struct LocalFrame { pub(crate) struct LocalFrame {
pub position: Vector3<f32>, pub position: Vector3<f32>,
@@ -192,7 +192,7 @@ impl LocalFrame {
} }
} }
#[derive(Visit, Reflect, Debug, Clone, Default)] #[derive(Visit, PartialEq, Reflect, Debug, Clone, Default)]
#[reflect(type_uuid = "2a8e0d9c-4c14-454e-967b-920a032bbafb")] #[reflect(type_uuid = "2a8e0d9c-4c14-454e-967b-920a032bbafb")]
pub(crate) struct JointLocalFrames { pub(crate) struct JointLocalFrames {
pub body1: LocalFrame, pub body1: LocalFrame,
@@ -210,7 +210,7 @@ impl JointLocalFrames {
/// Joint is used to restrict motion of two rigid bodies. There are numerous examples of joints in /// Joint is used to restrict motion of two rigid bodies. There are numerous examples of joints in
/// real life: door hinge, ball joints in human arms, etc. /// real life: door hinge, ball joints in human arms, etc.
#[derive(Visit, Reflect, Debug)] #[derive(Visit, PartialEq, Reflect, Debug)]
#[reflect( #[reflect(
derived_type = "Node", derived_type = "Node",
type_uuid = "439d48f5-e3a3-4255-aa08-353c1ca42e3b" type_uuid = "439d48f5-e3a3-4255-aa08-353c1ca42e3b"
+1 -1
View File
@@ -125,7 +125,7 @@ impl CsmOptions {
} }
/// See module docs. /// See module docs.
#[derive(Default, Debug, Visit, Reflect, Clone)] #[derive(Default, Debug, Visit, PartialEq, Reflect, Clone)]
#[reflect( #[reflect(
derived_type = "Node", derived_type = "Node",
type_uuid = "8b8248e1-1cdf-42a3-9abe-0691de82c519" type_uuid = "8b8248e1-1cdf-42a3-9abe-0691de82c519"
+1 -1
View File
@@ -67,7 +67,7 @@ pub const DEFAULT_SCATTER_B: f32 = 0.03;
/// Light scene node. It contains common properties of light such as color, /// Light scene node. It contains common properties of light such as color,
/// scattering factor (per color channel) and other useful properties. Exact /// scattering factor (per color channel) and other useful properties. Exact
/// behavior defined by specific light kind. /// behavior defined by specific light kind.
#[derive(Debug, Reflect, Clone, Visit)] #[derive(Debug, PartialEq, Reflect, Clone, Visit)]
#[reflect(type_uuid = "5c9486ed-5f3b-4225-bed5-95f9bde6360e")] #[reflect(type_uuid = "5c9486ed-5f3b-4225-bed5-95f9bde6360e")]
pub struct BaseLight { pub struct BaseLight {
base: Base, base: Base,
+1 -1
View File
@@ -62,7 +62,7 @@ use fyrox_graph::SceneGraph;
use std::ops::{Deref, DerefMut}; use std::ops::{Deref, DerefMut};
/// See module docs. /// See module docs.
#[derive(Debug, Reflect, Clone, Visit)] #[derive(Debug, PartialEq, Reflect, Clone, Visit)]
#[reflect( #[reflect(
derived_type = "Node", derived_type = "Node",
type_uuid = "c81dcc31-7cb9-465f-abd9-b385ac6f4d37" type_uuid = "c81dcc31-7cb9-465f-abd9-b385ac6f4d37"
+1 -1
View File
@@ -69,7 +69,7 @@ use fyrox_graph::SceneGraph;
use std::ops::{Deref, DerefMut}; use std::ops::{Deref, DerefMut};
/// See module docs. /// See module docs.
#[derive(Debug, Reflect, Clone, Visit)] #[derive(Debug, PartialEq, Reflect, Clone, Visit)]
#[reflect( #[reflect(
derived_type = "Node", derived_type = "Node",
type_uuid = "9856a3c1-ced7-47ec-b682-4dc4dea89d8f" type_uuid = "9856a3c1-ced7-47ec-b682-4dc4dea89d8f"
+4 -4
View File
@@ -170,7 +170,7 @@ pub struct VertexAttributeDescriptor {
/// Vertex attribute is a simple "bridge" between raw data and its interpretation. In /// Vertex attribute is a simple "bridge" between raw data and its interpretation. In
/// other words it defines how to treat raw data in vertex shader. /// other words it defines how to treat raw data in vertex shader.
#[derive(Reflect, Visit, Copy, Clone, Default, Debug, Hash)] #[derive(Reflect, Visit, Copy, PartialEq, Clone, Default, Debug, Hash)]
#[reflect(type_uuid = "705f8ad3-69b4-4b39-99aa-a3f97e319202")] #[reflect(type_uuid = "705f8ad3-69b4-4b39-99aa-a3f97e319202")]
pub struct VertexAttribute { pub struct VertexAttribute {
/// Claimed usage of the attribute. It could be Position, Normal, etc. /// Claimed usage of the attribute. It could be Position, Normal, etc.
@@ -219,7 +219,7 @@ impl Display for VertexAttribute {
} }
/// Bytes storage of a vertex buffer. /// Bytes storage of a vertex buffer.
#[derive(Reflect, Clone, Debug)] #[derive(Reflect, Clone, PartialEq, Debug)]
#[reflect(type_uuid = "493045ee-fba2-4c5f-a5cd-c27034d1ec71")] #[reflect(type_uuid = "493045ee-fba2-4c5f-a5cd-c27034d1ec71")]
pub struct BytesStorage { pub struct BytesStorage {
bytes: Vec<u8>, bytes: Vec<u8>,
@@ -399,7 +399,7 @@ impl Deref for BytesStorage {
/// ///
/// Vertex size cannot be more than 256 bytes, this limitation shouldn't be a problem because almost every GPU supports up to /// Vertex size cannot be more than 256 bytes, this limitation shouldn't be a problem because almost every GPU supports up to
/// 16 vertex attributes with 16 bytes of size each, which gives exactly 256 bytes. /// 16 vertex attributes with 16 bytes of size each, which gives exactly 256 bytes.
#[derive(Reflect, Clone, Visit, Default, Debug)] #[derive(Reflect, Clone, Visit, PartialEq, Default, Debug)]
#[reflect(type_uuid = "edab7161-6695-4e2a-b947-13305709d451")] #[reflect(type_uuid = "edab7161-6695-4e2a-b947-13305709d451")]
pub struct VertexBuffer { pub struct VertexBuffer {
dense_layout: Vec<VertexAttribute>, dense_layout: Vec<VertexAttribute>,
@@ -1468,7 +1468,7 @@ impl VertexWriteTrait for VertexViewMut<'_> {
} }
/// A buffer for data that defines connections between vertices. /// A buffer for data that defines connections between vertices.
#[derive(Reflect, Default, Clone, Debug)] #[derive(Reflect, Default, PartialEq, Clone, Debug)]
#[reflect(type_uuid = "ed9f9aa9-e1fb-4f58-b1cb-162d51dbc9e7")] #[reflect(type_uuid = "ed9f9aa9-e1fb-4f58-b1cb-162d51dbc9e7")]
pub struct TriangleBuffer { pub struct TriangleBuffer {
triangles: Vec<TriangleDefinition>, triangles: Vec<TriangleDefinition>,
+9 -3
View File
@@ -157,13 +157,13 @@ pub enum BatchingMode {
Dynamic, Dynamic,
} }
#[derive(Debug, Clone)] #[derive(Debug, PartialEq, Clone)]
struct Batch { struct Batch {
data: SurfaceResource, data: SurfaceResource,
material: MaterialResource, material: MaterialResource,
} }
#[derive(Debug, Default, Clone)] #[derive(Debug, Default, PartialEq, Clone)]
struct BatchContainer { struct BatchContainer {
batches: FxHashMap<u64, Batch>, batches: FxHashMap<u64, Batch>,
} }
@@ -192,6 +192,12 @@ impl BatchContainer {
#[derive(Debug, Default)] #[derive(Debug, Default)]
struct BatchContainerWrapper(Mutex<BatchContainer>); struct BatchContainerWrapper(Mutex<BatchContainer>);
impl PartialEq for BatchContainerWrapper {
fn eq(&self, other: &Self) -> bool {
*self.0.safe_lock() == *other.0.safe_lock()
}
}
impl Clone for BatchContainerWrapper { impl Clone for BatchContainerWrapper {
fn clone(&self) -> Self { fn clone(&self) -> Self {
Self(Mutex::new(self.0.safe_lock().clone())) Self(Mutex::new(self.0.safe_lock().clone()))
@@ -314,7 +320,7 @@ impl RenderDataBundleStorageTrait for BatchContainer {
/// ///
/// This example creates a unit cube surface with default material and then creates a mesh with this surface. If you need to create /// This example creates a unit cube surface with default material and then creates a mesh with this surface. If you need to create
/// custom surface, see [`crate::scene::mesh::surface::SurfaceData`] docs for more info. /// custom surface, see [`crate::scene::mesh::surface::SurfaceData`] docs for more info.
#[derive(Debug, Reflect, Clone, Visit)] #[derive(Debug, PartialEq, Reflect, Clone, Visit)]
#[reflect( #[reflect(
derived_type = "Node", derived_type = "Node",
type_uuid = "caaf9d7b-bd74-48ce-b7cc-57e9dc65c2e6" type_uuid = "caaf9d7b-bd74-48ce-b7cc-57e9dc65c2e6"
+2 -2
View File
@@ -87,7 +87,7 @@ impl Default for BlendShape {
} }
/// A container for multiple blend shapes/ /// A container for multiple blend shapes/
#[derive(Reflect, Debug, Clone, Default)] #[derive(Reflect, Debug, Clone, PartialEq, Default)]
#[reflect(type_uuid = "bd60343b-4a27-42aa-959e-b0d1bc8682db")] #[reflect(type_uuid = "bd60343b-4a27-42aa-959e-b0d1bc8682db")]
pub struct BlendShapesContainer { pub struct BlendShapesContainer {
/// A list of blend shapes. /// A list of blend shapes.
@@ -220,7 +220,7 @@ impl BlendShapesContainer {
/// Data source of a surface. Each surface can share same data source, this is used /// Data source of a surface. Each surface can share same data source, this is used
/// in instancing technique to render multiple instances of same model at different /// in instancing technique to render multiple instances of same model at different
/// places. /// places.
#[derive(Debug, Clone, Default, Reflect)] #[derive(Debug, Clone, Default, PartialEq, Reflect)]
#[reflect(type_uuid = "8a23a414-e66d-4e12-9628-92c6ab49c2f0")] #[reflect(type_uuid = "8a23a414-e66d-4e12-9628-92c6ab49c2f0")]
pub struct SurfaceData { pub struct SurfaceData {
/// Current vertex buffer. /// Current vertex buffer.
+2 -2
View File
@@ -240,7 +240,7 @@ impl Clone for SceneRenderingOptions {
} }
/// See module docs. /// See module docs.
#[derive(Debug, Reflect)] #[derive(Debug, PartialEq, Reflect)]
#[reflect(type_uuid = "03b3f812-3518-429b-befe-3f7a160503fa")] #[reflect(type_uuid = "03b3f812-3518-429b-befe-3f7a160503fa")]
pub struct Scene { pub struct Scene {
/// Graph is main container for all scene nodes. It calculates global transforms for nodes, /// Graph is main container for all scene nodes. It calculates global transforms for nodes,
@@ -296,7 +296,7 @@ impl Default for Scene {
} }
/// A structure that holds times that specific update step took. /// A structure that holds times that specific update step took.
#[derive(Clone, Default, Debug)] #[derive(Clone, PartialEq, Default, Debug)]
pub struct PerformanceStatistics { pub struct PerformanceStatistics {
/// Graph performance statistics. /// Graph performance statistics.
pub graph: GraphPerformanceStatistics, pub graph: GraphPerformanceStatistics,
+1 -1
View File
@@ -156,7 +156,7 @@ impl Visit for Container {
/// scene.graph[handle].as_navigational_mesh_mut() /// scene.graph[handle].as_navigational_mesh_mut()
/// } /// }
/// ``` /// ```
#[derive(Debug, Clone, Visit, Reflect, Default)] #[derive(Debug, Clone, Visit, PartialEq, Reflect, Default)]
#[reflect( #[reflect(
derived_type = "Node", derived_type = "Node",
type_uuid = "d0ce963c-b50a-4707-bd21-af6dc0d1c668" type_uuid = "d0ce963c-b50a-4707-bd21-af6dc0d1c668"
+1 -1
View File
@@ -35,7 +35,7 @@ use fyrox_core::visitor::error::VisitError;
/// A wrapper for node pool record that allows to define custom visit method to have full /// A wrapper for node pool record that allows to define custom visit method to have full
/// control over instantiation process at deserialization. /// control over instantiation process at deserialization.
#[derive(Debug, Clone, Default, Reflect)] #[derive(Debug, Clone, Default, PartialEq, Reflect)]
#[reflect(type_uuid = "be27db20-c0b0-491e-9421-8b1ebc357b9a")] #[reflect(type_uuid = "be27db20-c0b0-491e-9421-8b1ebc357b9a")]
pub struct NodeContainer(Option<Node>); pub struct NodeContainer(Option<Node>);
+7 -1
View File
@@ -362,6 +362,12 @@ impl<T: NodeTrait> ObjectOrVariantHelper<Node, T> for PhantomData<T> {
#[reflect(type_uuid = "a9bc5231-155c-4564-b0ca-f23972673925")] #[reflect(type_uuid = "a9bc5231-155c-4564-b0ca-f23972673925")]
pub struct Node(#[reflect(deref, display_name = "Node")] pub(crate) Box<dyn NodeTrait>); pub struct Node(#[reflect(deref, display_name = "Node")] pub(crate) Box<dyn NodeTrait>);
impl PartialEq for Node {
fn eq(&self, other: &Self) -> bool {
self.0.try_compare(&*other.0).unwrap_or_default()
}
}
impl<T: NodeTrait> From<T> for Node { impl<T: NodeTrait> From<T> for Node {
fn from(value: T) -> Self { fn from(value: T) -> Self {
Self(Box::new(value)) Self(Box::new(value))
@@ -608,7 +614,7 @@ mod test {
use fyrox_resource::untyped::ResourceKind; use fyrox_resource::untyped::ResourceKind;
use std::{fs, path::Path, sync::Arc}; use std::{fs, path::Path, sync::Arc};
#[derive(Debug, Clone, Reflect, Visit, Default)] #[derive(Debug, Clone, PartialEq, Reflect, Visit, Default)]
#[reflect(type_uuid = "d3f66902-803f-4ace-8170-0aa485d98b40")] #[reflect(type_uuid = "d3f66902-803f-4ace-8170-0aa485d98b40")]
struct MyScript { struct MyScript {
some_field: InheritableVariable<String>, some_field: InheritableVariable<String>,
+2 -2
View File
@@ -63,7 +63,7 @@ pub mod emitter;
pub mod particle; pub mod particle;
/// Pseudo-random numbers generator for particle systems. /// Pseudo-random numbers generator for particle systems.
#[derive(Debug, Clone, Reflect)] #[derive(Debug, Clone, PartialEq, Reflect)]
#[reflect(type_uuid = "13d58184-e65c-41a3-9986-fc8d31231636")] #[reflect(type_uuid = "13d58184-e65c-41a3-9986-fc8d31231636")]
pub struct ParticleSystemRng { pub struct ParticleSystemRng {
rng_seed: u64, rng_seed: u64,
@@ -218,7 +218,7 @@ impl Visit for ParticleSystemRng {
/// .build(graph); /// .build(graph);
/// } /// }
/// ``` /// ```
#[derive(Debug, Clone, Reflect)] #[derive(Debug, Clone, PartialEq, Reflect)]
#[reflect( #[reflect(
derived_type = "Node", derived_type = "Node",
type_uuid = "8b210eff-97a4-494f-ba7a-a581d3f4a442" type_uuid = "8b210eff-97a4-494f-ba7a-a581d3f4a442"

Some files were not shown because too many files have changed in this diff Show More