From c0978db579e5930efed9a57c0fcee1f3dcbac23a Mon Sep 17 00:00:00 2001 From: Dmitry Stepanov Date: Tue, 9 Jun 2026 23:15:40 +0300 Subject: [PATCH] continue with `PartialEq` impls --- fyrox-core/src/reflect/macros.rs | 4 ++++ fyrox-math/Cargo.toml | 2 +- fyrox-ui/src/absm.rs | 4 ++-- fyrox-ui/src/animation.rs | 2 +- fyrox-ui/src/bit.rs | 2 +- fyrox-ui/src/border.rs | 2 +- fyrox-ui/src/button.rs | 2 +- fyrox-ui/src/canvas.rs | 2 +- fyrox-ui/src/check_box.rs | 2 +- fyrox-ui/src/color/gradient.rs | 8 ++++---- fyrox-ui/src/color/mod.rs | 10 +++++----- fyrox-ui/src/curve/key.rs | 4 ++-- fyrox-ui/src/curve/mod.rs | 18 ++++++++++++------ fyrox-ui/src/decorator.rs | 2 +- fyrox-ui/src/dock/mod.rs | 2 +- fyrox-ui/src/dock/tile.rs | 2 +- fyrox-ui/src/draw.rs | 12 ++++++------ fyrox-ui/src/dropdown_list.rs | 2 +- fyrox-ui/src/dropdown_menu.rs | 2 +- fyrox-ui/src/expander.rs | 2 +- fyrox-ui/src/file_browser/dialog.rs | 2 +- fyrox-ui/src/file_browser/field.rs | 2 +- fyrox-ui/src/file_browser/menu.rs | 2 +- fyrox-ui/src/file_browser/mod.rs | 3 +-- fyrox-ui/src/file_browser/selector.rs | 2 +- fyrox-ui/src/font/mod.rs | 13 ++++++++++++- fyrox-ui/src/formatted_text.rs | 6 +++--- fyrox-ui/src/grid.rs | 4 ++-- fyrox-ui/src/image.rs | 2 +- fyrox-ui/src/input.rs | 2 +- fyrox-ui/src/inspector/editors/array.rs | 2 +- fyrox-ui/src/inspector/editors/collection.rs | 6 +++--- fyrox-ui/src/inspector/editors/enumeration.rs | 6 +++--- fyrox-ui/src/inspector/editors/inherit.rs | 2 +- fyrox-ui/src/inspector/editors/style.rs | 4 ++-- .../src/inspector/editors/texture_slice.rs | 6 +++--- fyrox-ui/src/inspector/mod.rs | 2 +- fyrox-ui/src/key.rs | 4 ++-- fyrox-ui/src/lib.rs | 2 +- fyrox-ui/src/list_view.rs | 4 ++-- fyrox-ui/src/matrix.rs | 2 +- fyrox-ui/src/menu.rs | 8 ++++---- fyrox-ui/src/messagebox.rs | 2 +- fyrox-ui/src/navigation.rs | 2 +- fyrox-ui/src/nine_patch.rs | 2 +- fyrox-ui/src/node/container.rs | 2 +- fyrox-ui/src/node/mod.rs | 6 ++++++ fyrox-ui/src/numeric.rs | 6 ++++-- fyrox-ui/src/path.rs | 2 +- fyrox-ui/src/popup.rs | 2 +- fyrox-ui/src/progress_bar.rs | 2 +- fyrox-ui/src/range.rs | 2 +- fyrox-ui/src/rect.rs | 2 +- fyrox-ui/src/screen.rs | 2 +- fyrox-ui/src/scroll_bar.rs | 2 +- fyrox-ui/src/scroll_panel.rs | 2 +- fyrox-ui/src/scroll_viewer.rs | 2 +- fyrox-ui/src/searchbar.rs | 2 +- fyrox-ui/src/selector.rs | 2 +- fyrox-ui/src/stack_panel.rs | 2 +- fyrox-ui/src/style/mod.rs | 10 +++++----- fyrox-ui/src/tab_control.rs | 2 +- fyrox-ui/src/text.rs | 2 +- fyrox-ui/src/text_box.rs | 2 +- fyrox-ui/src/thumb.rs | 2 +- fyrox-ui/src/toggle.rs | 2 +- fyrox-ui/src/tree.rs | 4 ++-- fyrox-ui/src/uuid.rs | 2 +- fyrox-ui/src/vec.rs | 2 +- fyrox-ui/src/vector_image.rs | 2 +- fyrox-ui/src/widget.rs | 4 ++-- fyrox-ui/src/window.rs | 6 +++--- fyrox-ui/src/wrap_panel.rs | 4 ++-- 73 files changed, 144 insertions(+), 116 deletions(-) diff --git a/fyrox-core/src/reflect/macros.rs b/fyrox-core/src/reflect/macros.rs index c99ace23a..eb234b30a 100644 --- a/fyrox-core/src/reflect/macros.rs +++ b/fyrox-core/src/reflect/macros.rs @@ -213,6 +213,10 @@ macro_rules! blank_reflect_ref { None } + fn try_compare(&self, other: &dyn Reflect) -> Option { + None + } + fn fields_ref(&self, func: &mut dyn FnMut(&[$crate::reflect::FieldRef])) { func(&[]) } diff --git a/fyrox-math/Cargo.toml b/fyrox-math/Cargo.toml index d744c6a68..83fa8a38c 100644 --- a/fyrox-math/Cargo.toml +++ b/fyrox-math/Cargo.toml @@ -14,7 +14,7 @@ repository = "https://github.com/FyroxEngine/Fyrox" rust-version = "1.87" [dependencies] -rectutils = "0.5.0" +rectutils = "0.6.0" nalgebra = { version = "0.34", features = ["bytemuck", "convert-glam030"] } arrayvec = "0.7.4" num-traits = "0.2.18" diff --git a/fyrox-ui/src/absm.rs b/fyrox-ui/src/absm.rs index 98a1496a8..9812ef7fa 100644 --- a/fyrox-ui/src/absm.rs +++ b/fyrox-ui/src/absm.rs @@ -118,7 +118,7 @@ pub mod prelude { /// /// The node does **not** contain any animations, instead it just takes animations from an animation /// player node and mixes them. -#[derive(Visit, Reflect, Clone, Debug, Default)] +#[derive(Visit, PartialEq, Reflect, Clone, Debug, Default)] #[reflect(type_uuid = "4b08c753-2a10-41e3-8fb2-4fd0517e86bc")] #[reflect(derived_type = "UiNode")] pub struct AnimationBlendingStateMachine { @@ -276,7 +276,7 @@ pub struct EventAction { } /// A widget that listens for particular events and sets parameters in an ABSM accordingly. -#[derive(Visit, Reflect, Clone, Debug, Default)] +#[derive(Visit, PartialEq, Reflect, Clone, Debug, Default)] #[reflect(type_uuid = "15f306b8-3bb8-4b35-87bd-6e9e5d748455")] #[reflect(derived_type = "UiNode")] pub struct AbsmEventProvider { diff --git a/fyrox-ui/src/animation.rs b/fyrox-ui/src/animation.rs index 32effeb9f..37adc865a 100644 --- a/fyrox-ui/src/animation.rs +++ b/fyrox-ui/src/animation.rs @@ -142,7 +142,7 @@ impl BoundValueCollectionExt for BoundValueCollection { /// Animation player is a node that contains multiple animations. It updates and plays all the animations. /// The node could be a source of animations for animation blending state machines. To learn more about /// animations, see [`Animation`] docs. -#[derive(Visit, Reflect, Clone, Debug)] +#[derive(Visit, PartialEq, Reflect, Clone, Debug)] #[reflect( derived_type = "UiNode", type_uuid = "44d1c94e-354f-4f9a-b918-9d31c28aa16a" diff --git a/fyrox-ui/src/bit.rs b/fyrox-ui/src/bit.rs index 49c812d1c..995129b81 100644 --- a/fyrox-ui/src/bit.rs +++ b/fyrox-ui/src/bit.rs @@ -113,7 +113,7 @@ impl ConstructorProvider for BitField } } -#[derive(Default, Clone, Reflect, Visit, Debug)] +#[derive(Default, Clone, PartialEq, Reflect, Visit, Debug)] #[reflect( derived_type = "UiNode", type_uuid = "6c19b266-18be-46d2-bfd3-f1dc9cb3f36c" diff --git a/fyrox-ui/src/border.rs b/fyrox-ui/src/border.rs index 194be02e5..014e020ea 100644 --- a/fyrox-ui/src/border.rs +++ b/fyrox-ui/src/border.rs @@ -99,7 +99,7 @@ use fyrox_graph::constructor::{ConstructorProvider, GraphNodeConstructor}; /// .with_stroke_thickness(Thickness {left: 2.0, right: 2.0, top: 2.0, bottom: 2.0}.into()) /// .build(&mut ui.build_ctx()); /// ``` -#[derive(Default, Clone, Visit, Reflect, Debug)] +#[derive(Default, Clone, Visit, PartialEq, Reflect, Debug)] #[reflect(type_uuid = "6aba3dc5-831d-481a-bc83-ec10b2b2bf12")] #[reflect(derived_type = "UiNode")] pub struct Border { diff --git a/fyrox-ui/src/button.rs b/fyrox-ui/src/button.rs index 7e75ffe65..f0883566d 100644 --- a/fyrox-ui/src/button.rs +++ b/fyrox-ui/src/button.rs @@ -90,7 +90,7 @@ impl MessageData for ButtonMessage {} /// } /// } /// ``` -#[derive(Default, Clone, Visit, Reflect, Debug)] +#[derive(Default, Clone, Visit, PartialEq, Reflect, Debug)] #[reflect(type_uuid = "2abcf12b-2f19-46da-b900-ae8890f7c9c6")] #[reflect(derived_type = "UiNode")] pub struct Button { diff --git a/fyrox-ui/src/canvas.rs b/fyrox-ui/src/canvas.rs index 28276108c..35f1e6ed8 100644 --- a/fyrox-ui/src/canvas.rs +++ b/fyrox-ui/src/canvas.rs @@ -66,7 +66,7 @@ use fyrox_graph::constructor::{ConstructorProvider, GraphNodeConstructor}; /// .build(ctx) /// } /// ``` -#[derive(Default, Clone, Visit, Reflect, Debug)] +#[derive(Default, Clone, Visit, PartialEq, Reflect, Debug)] #[reflect(type_uuid = "6b843a36-53da-467b-b85e-2380fe891ca1")] #[reflect(derived_type = "UiNode")] pub struct Canvas { diff --git a/fyrox-ui/src/check_box.rs b/fyrox-ui/src/check_box.rs index d4f4395b8..939ec40d9 100644 --- a/fyrox-ui/src/check_box.rs +++ b/fyrox-ui/src/check_box.rs @@ -148,7 +148,7 @@ impl MessageData for CheckBoxMessage {} /// 2) [`CheckBoxBuilder::with_check_mark`] - sets the widget that will be used as checked icon. /// 3) [`CheckBoxBuilder::with_uncheck_mark`] - sets the widget that will be used as unchecked icon. /// 4) [`CheckBoxBuilder::with_undefined_mark`] - sets the widget that will be used as undefined icon. -#[derive(Default, Clone, Debug, Visit, Reflect)] +#[derive(Default, Clone, Debug, Visit, PartialEq, Reflect)] #[reflect(type_uuid = "3a866ba8-7682-4ce7-954a-46360f5837dc")] #[reflect(derived_type = "UiNode")] pub struct CheckBox { diff --git a/fyrox-ui/src/color/gradient.rs b/fyrox-ui/src/color/gradient.rs index 295ca2cc3..5ac5975f6 100644 --- a/fyrox-ui/src/color/gradient.rs +++ b/fyrox-ui/src/color/gradient.rs @@ -56,7 +56,7 @@ pub enum ColorGradientEditorMessage { } impl MessageData for ColorGradientEditorMessage {} -#[derive(Default, Clone, Debug, Visit, Reflect)] +#[derive(Default, Clone, Debug, Visit, PartialEq, Reflect)] #[reflect(type_uuid = "50d00eb7-f30b-4973-8a36-03d6b8f007ec")] #[reflect(derived_type = "UiNode")] pub struct ColorGradientField { @@ -182,7 +182,7 @@ impl ColorGradientFieldBuilder { } } -#[derive(Default, Clone, Debug, Visit, Reflect)] +#[derive(Default, Clone, Debug, Visit, PartialEq, Reflect)] #[reflect(type_uuid = "82843d8b-1972-46e6-897c-9619b74059cc")] #[reflect(derived_type = "UiNode")] pub struct ColorGradientEditor { @@ -469,7 +469,7 @@ pub enum ColorPointMessage { } impl MessageData for ColorPointMessage {} -#[derive(Default, Clone, Debug, Visit, Reflect)] +#[derive(Default, Clone, Debug, Visit, PartialEq, Reflect)] #[reflect(type_uuid = "a493a603-3451-4005-8c80-559707729e70")] #[reflect(derived_type = "UiNode")] pub struct ColorPoint { @@ -602,7 +602,7 @@ impl ColorPointBuilder { } } -#[derive(Clone, Visit, Reflect, Debug)] +#[derive(Clone, Visit, PartialEq, Reflect, Debug)] #[reflect(type_uuid = "2608955a-4095-4fd1-af71-99bcdf2600f0")] #[reflect(derived_type = "UiNode")] pub struct ColorPointsCanvas { diff --git a/fyrox-ui/src/color/mod.rs b/fyrox-ui/src/color/mod.rs index da38737d2..91a0c7804 100644 --- a/fyrox-ui/src/color/mod.rs +++ b/fyrox-ui/src/color/mod.rs @@ -103,7 +103,7 @@ pub enum ColorFieldMessage { } impl MessageData for ColorFieldMessage {} -#[derive(Default, Clone, Debug, Visit, Reflect)] +#[derive(Default, Clone, Debug, Visit, PartialEq, Reflect)] #[reflect( derived_type = "UiNode", type_uuid = "956d4cae-7953-486b-99da-a9b852c2e144" @@ -384,7 +384,7 @@ impl AlphaBarBuilder { } } -#[derive(Default, Clone, Debug, Visit, Reflect)] +#[derive(Default, Clone, Debug, Visit, PartialEq, Reflect)] #[reflect( derived_type = "UiNode", type_uuid = "af28f977-85e7-4c9e-9a61-7f208844acb5" @@ -547,7 +547,7 @@ impl HueBarBuilder { } } -#[derive(Default, Clone, Debug, Visit, Reflect)] +#[derive(Default, Clone, Debug, Visit, PartialEq, Reflect)] #[reflect( derived_type = "UiNode", type_uuid = "ab6bfad5-0c4b-42a5-8da5-fc5687b1afc7" @@ -764,7 +764,7 @@ impl SaturationBrightnessFieldBuilder { } } -#[derive(Default, Clone, Debug, Visit, Reflect)] +#[derive(Default, Clone, Debug, Visit, PartialEq, Reflect)] #[reflect( derived_type = "UiNode", type_uuid = "b7a5d650-5b77-4938-83c1-37f3fe107885" @@ -1154,7 +1154,7 @@ impl ColorPickerBuilder { } } -#[derive(Default, Clone, Debug, Visit, Reflect)] +#[derive(Default, Clone, Debug, Visit, PartialEq, Reflect)] #[reflect( derived_type = "UiNode", type_uuid = "68dec1ac-23c6-41df-bc85-499f2a82e908" diff --git a/fyrox-ui/src/curve/key.rs b/fyrox-ui/src/curve/key.rs index 9a59148ec..953087a38 100644 --- a/fyrox-ui/src/curve/key.rs +++ b/fyrox-ui/src/curve/key.rs @@ -30,7 +30,7 @@ use crate::{ }; use std::cmp::Ordering; -#[derive(Default, Clone, Debug, Visit, Reflect)] +#[derive(Default, Clone, Debug, Visit, PartialEq, Reflect)] #[reflect(type_uuid = "ae6110cd-f1dd-45b5-98e1-d8ae8bf3d0cc")] pub struct CurveKeyView { pub position: Vector2, @@ -48,7 +48,7 @@ impl From<&CurveKey> for CurveKeyView { } } -#[derive(Default, Clone, Visit, Reflect, Debug)] +#[derive(Default, Clone, Visit, PartialEq, Reflect, Debug)] #[reflect(type_uuid = "866c6360-2c6a-4218-aebc-530036b59a87")] pub struct CurveKeyViewContainer { id: Uuid, diff --git a/fyrox-ui/src/curve/mod.rs b/fyrox-ui/src/curve/mod.rs index 630aa567d..72578e2bd 100644 --- a/fyrox-ui/src/curve/mod.rs +++ b/fyrox-ui/src/curve/mod.rs @@ -110,6 +110,12 @@ pub struct HighlightZone { #[derive(Debug, Default)] pub struct CurveTransformCell(Mutex); +impl PartialEq for CurveTransformCell { + fn eq(&self, other: &Self) -> bool { + *self.0.safe_lock() == *other.0.safe_lock() + } +} + impl Clone for CurveTransformCell { fn clone(&self) -> Self { Self(Mutex::new(self.0.safe_lock().clone())) @@ -211,7 +217,7 @@ fn standardize_step(step: f32) -> f32 { /// /// Since widgets are not mutable during layout and rendering, a CurveTransform /// is intended to be used within a [CurveTransformCell] which provides interior mutability. -#[derive(Clone, Debug)] +#[derive(Clone, PartialEq, Debug)] pub struct CurveTransform { /// Position of the center of the curve editor in the curve coordinate space. pub position: Vector2, @@ -358,7 +364,7 @@ impl Iterator for StepIterator { } } -#[derive(Default, Clone, Visit, Reflect, Debug)] +#[derive(Default, Clone, Visit, PartialEq, Reflect, Debug)] #[reflect(type_uuid = "4b640057-639e-4f47-9a08-c08d94eca68e")] pub struct CurvesContainer { curves: Vec, @@ -412,7 +418,7 @@ impl CurvesContainer { } } -#[derive(Default, Clone, Visit, Reflect, Debug)] +#[derive(Default, Clone, Visit, PartialEq, Reflect, Debug)] #[reflect( derived_type = "UiNode", type_uuid = "5c7b087e-871e-498d-b064-187b604a37d8" @@ -471,7 +477,7 @@ impl ConstructorProvider for CurveEditor { crate::define_widget_deref!(CurveEditor); -#[derive(Default, Clone, Visit, Reflect, Debug)] +#[derive(Default, Clone, Visit, PartialEq, Reflect, Debug)] #[reflect(type_uuid = "c81d942c-394d-498d-b460-1dc508288ed3")] struct ContextMenu { widget: RcUiNodeHandle, @@ -495,7 +501,7 @@ struct DragEntry { initial_position: Vector2, } -#[derive(Clone, Debug)] +#[derive(Clone, PartialEq, Debug)] enum OperationContext { DragKeys { // In local coordinates. @@ -527,7 +533,7 @@ impl OperationContext { } } -#[derive(Clone, Debug)] +#[derive(Clone,PartialEq, Debug)] enum Selection { Keys { keys: FxHashSet }, LeftTangent { key_id: Uuid }, diff --git a/fyrox-ui/src/decorator.rs b/fyrox-ui/src/decorator.rs index f63a55cbf..1afe78d15 100644 --- a/fyrox-ui/src/decorator.rs +++ b/fyrox-ui/src/decorator.rs @@ -86,7 +86,7 @@ impl MessageData for DecoratorMessage {} /// .build(ctx) /// } /// ``` -#[derive(Default, Clone, Visit, Reflect, Debug)] +#[derive(Default, Clone, Visit, PartialEq, Reflect, Debug)] #[reflect( derived_type = "UiNode", type_uuid = "bb4b60aa-c657-4ed6-8db6-d7f374397c73" diff --git a/fyrox-ui/src/dock/mod.rs b/fyrox-ui/src/dock/mod.rs index e481124e1..ad68224eb 100644 --- a/fyrox-ui/src/dock/mod.rs +++ b/fyrox-ui/src/dock/mod.rs @@ -160,7 +160,7 @@ impl MessageData for DockingManagerMessage {} /// To be able to restore the layout to its defaults, just create a desired layout from code, /// save the layout and use the returned layout descriptor when you need to restore the layout /// to its defaults. -#[derive(Default, Clone, Visit, Reflect, Debug)] +#[derive(Default, Clone, Visit, PartialEq, Reflect, Debug)] #[reflect( derived_type = "UiNode", type_uuid = "b04299f7-3f6b-45f1-89a6-0dce4ad929e1" diff --git a/fyrox-ui/src/dock/tile.rs b/fyrox-ui/src/dock/tile.rs index 06f9cdcfd..1c67c9917 100644 --- a/fyrox-ui/src/dock/tile.rs +++ b/fyrox-ui/src/dock/tile.rs @@ -256,7 +256,7 @@ fn deminimize_other_window( } } -#[derive(Default, Clone, Debug, Visit, Reflect)] +#[derive(Default, Clone, Debug, Visit, PartialEq, Reflect)] #[reflect( derived_type = "UiNode", type_uuid = "8ed17fa9-890e-4dd7-b4f9-a24660882234" diff --git a/fyrox-ui/src/draw.rs b/fyrox-ui/src/draw.rs index 186f18e1b..2597a5fc6 100644 --- a/fyrox-ui/src/draw.rs +++ b/fyrox-ui/src/draw.rs @@ -40,7 +40,7 @@ use fyrox_texture::TextureResource; use std::fmt::{Display, Formatter}; use std::ops::Range; -#[derive(Clone, Copy, Debug, Pod, Zeroable)] +#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)] #[repr(C)] pub struct Vertex { pub pos: Vector2, @@ -58,7 +58,7 @@ impl Vertex { } } -#[derive(Clone, Debug)] +#[derive(Clone, PartialEq, Debug)] pub enum CommandTexture { None, Texture(TextureResource), @@ -70,7 +70,7 @@ pub enum CommandTexture { } /// A set of triangles that will be used for clipping. -#[derive(Clone, Debug)] +#[derive(Clone, PartialEq, Debug)] pub struct ClippingGeometry { pub vertex_buffer: Vec, pub triangle_buffer: Vec, @@ -126,7 +126,7 @@ impl ClippingGeometry { } } -#[derive(Clone, Debug)] +#[derive(Clone, PartialEq, Debug)] pub struct Command { /// Clipping bounds, should be used for scissor-test. Screen-space. pub clip_bounds: Rect, @@ -753,7 +753,7 @@ pub trait Draw { } } -#[derive(Clone, Debug)] +#[derive(Clone, PartialEq, Debug)] pub struct TransformStack { transform: Matrix3, stack: Vec>, @@ -806,7 +806,7 @@ impl TransformStack { } } -#[derive(Debug, Clone, Default)] +#[derive(Debug, Clone, PartialEq, Default)] pub struct RenderData { pub vertex_buffer: Vec, pub triangle_buffer: Vec, diff --git a/fyrox-ui/src/dropdown_list.rs b/fyrox-ui/src/dropdown_list.rs index d204937c0..777bf29e7 100644 --- a/fyrox-ui/src/dropdown_list.rs +++ b/fyrox-ui/src/dropdown_list.rs @@ -167,7 +167,7 @@ impl MessageData for DropdownListMessage {} /// /// A dropdown list could be opened and closed manually using [`DropdownListMessage::Open`] and /// [`DropdownListMessage::Close`] messages. -#[derive(Default, Clone, Debug, Visit, Reflect)] +#[derive(Default, Clone, Debug, Visit, PartialEq, Reflect)] #[reflect( derived_type = "UiNode", type_uuid = "1da2f69a-c8b4-4ae2-a2ad-4afe61ee2a32" diff --git a/fyrox-ui/src/dropdown_menu.rs b/fyrox-ui/src/dropdown_menu.rs index 1292c01db..ce1b2b8aa 100644 --- a/fyrox-ui/src/dropdown_menu.rs +++ b/fyrox-ui/src/dropdown_menu.rs @@ -34,7 +34,7 @@ use std::sync::mpsc::Sender; /// A simple widget that opens a popup when clicked. It could be used to create dropdown menus that /// consolidates content of a group. -#[derive(Default, Clone, Visit, Reflect, Debug)] +#[derive(Default, Clone, Visit, PartialEq, Reflect, Debug)] #[reflect(type_uuid = "c0a4c51b-f041-453b-a89d-7ceb5394e321")] #[reflect(derived_type = "UiNode")] pub struct DropdownMenu { diff --git a/fyrox-ui/src/expander.rs b/fyrox-ui/src/expander.rs index c28435fb7..ce44bad00 100644 --- a/fyrox-ui/src/expander.rs +++ b/fyrox-ui/src/expander.rs @@ -151,7 +151,7 @@ impl MessageData for ExpanderMessage {} /// /// To switch expander state at runtime, send [`ExpanderMessage::Expand`] to your Expander widget instance with /// [`crate::message::MessageDirection::ToWidget`]. -#[derive(Default, Clone, Visit, Reflect, Debug)] +#[derive(Default, Clone, Visit, PartialEq, Reflect, Debug)] #[reflect( derived_type = "UiNode", type_uuid = "24976179-b338-4c55-84c3-72d21663efd2" diff --git a/fyrox-ui/src/file_browser/dialog.rs b/fyrox-ui/src/file_browser/dialog.rs index 965ae95d6..50ba47b87 100644 --- a/fyrox-ui/src/file_browser/dialog.rs +++ b/fyrox-ui/src/file_browser/dialog.rs @@ -41,7 +41,7 @@ pub enum FolderNameDialogMessage { } impl MessageData for FolderNameDialogMessage {} -#[derive(Clone, Visit, Reflect, Default, Debug)] +#[derive(Clone, Visit, PartialEq, Reflect, Default, Debug)] #[reflect(type_uuid = "832f63b8-1372-49b8-8ce5-7564920343a8")] #[reflect(derived_type = "UiNode")] pub struct FolderNameDialog { diff --git a/fyrox-ui/src/file_browser/field.rs b/fyrox-ui/src/file_browser/field.rs index 2da1caf04..d32ea55d4 100644 --- a/fyrox-ui/src/file_browser/field.rs +++ b/fyrox-ui/src/file_browser/field.rs @@ -46,7 +46,7 @@ impl MessageData for FileSelectorFieldMessage {} define_widget_deref!(FileSelectorField); -#[derive(Default, Clone, Visit, Reflect, Debug)] +#[derive(Default, Clone, Visit, PartialEq, Reflect, Debug)] #[reflect( derived_type = "UiNode", type_uuid = "2dbda730-8a60-4f62-aee8-2ff0ccd15bf2" diff --git a/fyrox-ui/src/file_browser/menu.rs b/fyrox-ui/src/file_browser/menu.rs index 44629377f..fc4a9c412 100644 --- a/fyrox-ui/src/file_browser/menu.rs +++ b/fyrox-ui/src/file_browser/menu.rs @@ -43,7 +43,7 @@ use std::{ sync::mpsc::Sender, }; -#[derive(Clone, Visit, Reflect, Debug)] +#[derive(Clone, Visit, PartialEq, Reflect, Debug)] #[reflect( derived_type = "UiNode", type_uuid = "6a9d597f-6a9f-4bad-b569-4cff1a6deff7" diff --git a/fyrox-ui/src/file_browser/mod.rs b/fyrox-ui/src/file_browser/mod.rs index 9be1d9354..20bbe35a8 100644 --- a/fyrox-ui/src/file_browser/mod.rs +++ b/fyrox-ui/src/file_browser/mod.rs @@ -100,7 +100,7 @@ enum FsEventMessage { } impl MessageData for FsEventMessage {} -#[derive(Default, Visit, Reflect)] +#[derive(Default, Visit, PartialEq, Reflect)] #[reflect(type_uuid = "b7f4610e-4b0c-4671-9b4a-60bb45268928")] #[reflect(derived_type = "UiNode")] pub struct FileBrowser { @@ -120,7 +120,6 @@ pub struct FileBrowser { #[visit(skip)] #[reflect(hidden)] pub item_context_menu: RcUiNodeHandle, - #[allow(clippy::type_complexity)] #[visit(skip)] #[reflect(hidden)] pub watcher: Option, diff --git a/fyrox-ui/src/file_browser/selector.rs b/fyrox-ui/src/file_browser/selector.rs index afc208886..70e5aed11 100644 --- a/fyrox-ui/src/file_browser/selector.rs +++ b/fyrox-ui/src/file_browser/selector.rs @@ -73,7 +73,7 @@ impl MessageData for FileSelectorMessage {} /// File selector is a modal window that allows you to select a file (or directory) and commit or /// cancel selection. -#[derive(Default, Clone, Debug, Visit, Reflect)] +#[derive(Default, Clone, Debug, Visit, PartialEq, Reflect)] #[reflect( derived_type = "UiNode", type_uuid = "878b2220-03e6-4a50-a97d-3a8e5397b6cb" diff --git a/fyrox-ui/src/font/mod.rs b/fyrox-ui/src/font/mod.rs index f199a7ed4..447ee5e95 100644 --- a/fyrox-ui/src/font/mod.rs +++ b/fyrox-ui/src/font/mod.rs @@ -330,7 +330,7 @@ impl Atlas { } /// A font resource and the associated data required for rendering glyphs from the font. -#[derive(Default, Clone, Debug, Reflect, PartialEq, Visit)] +#[derive(Default, Clone, Debug, Reflect, Visit)] #[reflect(type_uuid = "692fec79-103a-483c-bb0b-9fc3a349cb48")] pub struct Font { /// The source font data, such as might come from a ttf file. @@ -361,6 +361,17 @@ pub struct Font { pub fallbacks: Vec>, } +impl PartialEq for Font { + fn eq(&self, other: &Self) -> bool { + self.atlases == other.atlases + && self.page_size == other.page_size + && self.bold == other.bold + && self.italic == other.italic + && self.bold_italic == other.bold_italic + && self.fallbacks == other.fallbacks + } +} + impl ResourceData for Font { fn save(&mut self, _path: &Path) -> Result<(), Box> { Ok(()) diff --git a/fyrox-ui/src/formatted_text.rs b/fyrox-ui/src/formatted_text.rs index baecda4b9..a441eff07 100644 --- a/fyrox-ui/src/formatted_text.rs +++ b/fyrox-ui/src/formatted_text.rs @@ -55,7 +55,7 @@ pub struct Position { pub offset: usize, } -#[derive(Debug, Clone, Default)] +#[derive(Debug, PartialEq, Clone, Default)] pub struct TextGlyph { pub bounds: Rect, pub tex_coords: [Vector2; 4], @@ -63,7 +63,7 @@ pub struct TextGlyph { pub source_char_index: usize, } -#[derive(Copy, Clone, Debug, Default)] +#[derive(Copy, Clone, PartialEq, Debug, Default)] pub struct TextLine { /// Index of starting symbol in text array. pub begin: usize, @@ -256,7 +256,7 @@ impl LineSink for WrapSink<'_> { } } -#[derive(Default, Clone, Debug, Visit, Reflect)] +#[derive(Default, Clone, Debug, Visit, PartialEq, Reflect)] #[reflect(type_uuid = "a48f1f1d-24ce-4a84-a45d-706ac541cf0a")] pub struct FormattedText { font: InheritableVariable>, diff --git a/fyrox-ui/src/grid.rs b/fyrox-ui/src/grid.rs index 7ed68b666..be6b5fcfe 100644 --- a/fyrox-ui/src/grid.rs +++ b/fyrox-ui/src/grid.rs @@ -217,7 +217,7 @@ pub type Row = GridDimension; /// You can add any number of rows and columns to a grid widget, and each grid cell does **not** need to have a UI widget /// in it to be valid. For example, you can add a column and set it to a specific size via strict to provide spacing between /// two other columns. -#[derive(Default, Clone, Visit, Reflect, Debug)] +#[derive(Default, Clone, Visit, PartialEq, Reflect, Debug)] #[reflect( derived_type = "UiNode", type_uuid = "98ce15e2-bd62-497d-a37b-9b1cb4a1918c" @@ -262,7 +262,7 @@ crate::define_widget_deref!(Grid); /// Cell of the grid, that contains additional information for layout purposes. It does not have any /// particular use outside of grid's internals. -#[derive(Clone, Debug)] +#[derive(Clone, PartialEq, Debug)] pub struct Cell { /// A set of nodes of the cell. pub nodes: Vec>, diff --git a/fyrox-ui/src/image.rs b/fyrox-ui/src/image.rs index 2c7539343..4a1fb1a34 100644 --- a/fyrox-ui/src/image.rs +++ b/fyrox-ui/src/image.rs @@ -157,7 +157,7 @@ impl MessageData for ImageMessage {} /// It is useful if you have many custom UI elements packed in a single texture atlas. Drawing using atlases is much more /// efficient and faster. This could also be used for animations when you have multiple frames packed in a single atlas /// and changing texture coordinates over time. -#[derive(Default, Clone, Visit, Reflect, Debug)] +#[derive(Default, Clone, Visit, PartialEq, Reflect, Debug)] #[reflect(type_uuid = "18e18d0f-cb84-4ac1-8050-3480a2ec3de5")] #[visit(optional)] #[reflect(derived_type = "UiNode")] diff --git a/fyrox-ui/src/input.rs b/fyrox-ui/src/input.rs index 2006053e6..b5e396c96 100644 --- a/fyrox-ui/src/input.rs +++ b/fyrox-ui/src/input.rs @@ -88,7 +88,7 @@ pub enum InputBoxResult { /// There's no way to change the style of the input box, nor add some widgets to it. If you need a /// custom input box, then you need to create your own widget. This input box is meant to be used as /// a standard dialog box for standard situations in the UI. -#[derive(Default, Clone, Visit, Reflect, Debug)] +#[derive(Default, Clone, Visit, PartialEq, Reflect, Debug)] #[reflect(type_uuid = "6b7b6b82-939b-4f98-9bb9-9bd19ce68b21")] #[reflect(derived_type = "UiNode")] pub struct InputBox { diff --git a/fyrox-ui/src/inspector/editors/array.rs b/fyrox-ui/src/inspector/editors/array.rs index bc929f166..68735761a 100644 --- a/fyrox-ui/src/inspector/editors/array.rs +++ b/fyrox-ui/src/inspector/editors/array.rs @@ -53,7 +53,7 @@ pub enum ArrayEditorMessage { } impl MessageData for ArrayEditorMessage {} -#[derive(Clone, Debug, Visit, Reflect)] +#[derive(Clone, Debug, Visit, PartialEq, Reflect)] #[reflect( derived_type = "UiNode", type_uuid = "5c6e4785-8e2d-441f-8478-523900394b93" diff --git a/fyrox-ui/src/inspector/editors/collection.rs b/fyrox-ui/src/inspector/editors/collection.rs index c134a7785..00402c498 100644 --- a/fyrox-ui/src/inspector/editors/collection.rs +++ b/fyrox-ui/src/inspector/editors/collection.rs @@ -57,11 +57,11 @@ pub struct Item { remove: Handle