mirror of
https://github.com/FyroxEngine/Fyrox.git
synced 2026-10-11 22:50:08 +00:00
finished with PartialEq impls
This commit is contained in:
@@ -26,7 +26,7 @@ use crate::{
|
||||
asset::{manager::ResourceManager, untyped::UntypedResource, Resource, TypedResourceData},
|
||||
core::{
|
||||
algebra::Vector2, color::Color, futures::executor::block_on, make_relative_path,
|
||||
parking_lot::lock_api::Mutex, pool::Handle, reflect::prelude::*, visitor::prelude::*,
|
||||
pool::Handle, reflect::prelude::*, visitor::prelude::*,
|
||||
},
|
||||
graph::SceneGraph,
|
||||
gui::{
|
||||
@@ -54,10 +54,10 @@ use fyrox::core::ok_or_return;
|
||||
use fyrox::gui::border::Border;
|
||||
use fyrox::gui::image::Image;
|
||||
use fyrox::gui::message::MessageData;
|
||||
use fyrox::gui::widget::UserData;
|
||||
use std::{
|
||||
ops::{Deref, DerefMut},
|
||||
path::{Path, PathBuf},
|
||||
sync::Arc,
|
||||
};
|
||||
|
||||
pub const DEFAULT_SIZE: f32 = 60.0;
|
||||
@@ -79,7 +79,7 @@ pub enum AssetItemMessage {
|
||||
impl MessageData for AssetItemMessage {}
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[derive(Debug, Clone, Visit, Reflect)]
|
||||
#[derive(Debug, Clone, Visit, PartialEq, Reflect)]
|
||||
#[reflect(
|
||||
derived_type = "UiNode",
|
||||
type_uuid = "54f7d9c1-e707-4c8c-a5c9-3fc5cc80b545"
|
||||
@@ -432,7 +432,7 @@ impl AssetItemBuilder {
|
||||
let item = AssetItem {
|
||||
widget: self
|
||||
.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_allow_drag(true)
|
||||
.with_allow_drop(true)
|
||||
|
||||
@@ -61,7 +61,7 @@ use std::{
|
||||
path::PathBuf,
|
||||
};
|
||||
|
||||
#[derive(Clone, Visit, Reflect, Debug)]
|
||||
#[derive(Clone, Visit, PartialEq, Reflect, Debug)]
|
||||
#[reflect(derived_type = "UiNode")]
|
||||
#[reflect(type_uuid = "8c9934ad-b4e1-4c68-9876-f253e34c6667")]
|
||||
struct AssetRenameDialog {
|
||||
|
||||
@@ -79,7 +79,7 @@ pub enum AssetSelectorMessage {
|
||||
impl MessageData for AssetSelectorMessage {}
|
||||
|
||||
#[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 {
|
||||
pub widget: Widget,
|
||||
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")]
|
||||
pub struct AssetSelector {
|
||||
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")]
|
||||
pub struct AssetSelectorWindow {
|
||||
pub window: Window,
|
||||
@@ -591,7 +591,7 @@ impl<'a> AssetSelectorWindowBuilder<'a> {
|
||||
}
|
||||
|
||||
#[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 selector: Cell<Handle<AssetSelectorWindow>>,
|
||||
pub select: Handle<Button>,
|
||||
|
||||
@@ -47,7 +47,7 @@ pub enum AudioBusViewMessage {
|
||||
}
|
||||
impl MessageData for AudioBusViewMessage {}
|
||||
|
||||
#[derive(Clone, Visit, Reflect, Debug)]
|
||||
#[derive(Clone, Visit, PartialEq, Reflect, Debug)]
|
||||
#[reflect(
|
||||
derived_type = "UiNode",
|
||||
type_uuid = "5439e3a9-096a-4155-922c-ed57a76a46f3"
|
||||
|
||||
@@ -52,7 +52,7 @@ use fyrox::scene::camera::Camera;
|
||||
use fyrox::scene::mesh::Mesh;
|
||||
use fyrox::scene::pivot::Pivot;
|
||||
|
||||
#[derive(Reflect, Debug, Clone)]
|
||||
#[derive(PartialEq, Reflect, Debug, Clone)]
|
||||
#[reflect(type_uuid = "060abe31-ce96-4696-aa5d-e44e9639df0e")]
|
||||
pub struct MoveGizmo {
|
||||
pub origin: Handle<Pivot>,
|
||||
|
||||
@@ -51,7 +51,7 @@ use fyrox::scene::camera::Camera;
|
||||
use fyrox::scene::mesh::Mesh;
|
||||
use fyrox::scene::pivot::Pivot;
|
||||
|
||||
#[derive(Reflect, Debug)]
|
||||
#[derive(PartialEq, Reflect, Debug)]
|
||||
#[reflect(non_cloneable, type_uuid = "5ef2c27b-18af-458d-9549-1395f0869551")]
|
||||
pub enum RotateGizmoMode {
|
||||
Pitch,
|
||||
@@ -59,7 +59,7 @@ pub enum RotateGizmoMode {
|
||||
Roll,
|
||||
}
|
||||
|
||||
#[derive(Reflect, Debug)]
|
||||
#[derive(PartialEq, Reflect, Debug)]
|
||||
#[reflect(non_cloneable, type_uuid = "36fc1ea4-33cd-4108-ae61-bab544f8ac02")]
|
||||
pub struct RotationGizmo {
|
||||
mode: RotateGizmoMode,
|
||||
|
||||
@@ -49,7 +49,7 @@ use fyrox::core::reflect::prelude::*;
|
||||
use fyrox::scene::camera::Camera;
|
||||
use fyrox::scene::mesh::Mesh;
|
||||
|
||||
#[derive(Reflect, Debug)]
|
||||
#[derive(PartialEq, Reflect, Debug)]
|
||||
#[reflect(non_cloneable, type_uuid = "0555e074-bbd8-4753-a2ab-56d7092251c1")]
|
||||
pub enum ScaleGizmoMode {
|
||||
None,
|
||||
@@ -59,7 +59,7 @@ pub enum ScaleGizmoMode {
|
||||
Uniform,
|
||||
}
|
||||
|
||||
#[derive(Reflect, Debug)]
|
||||
#[derive(PartialEq, Reflect, Debug)]
|
||||
#[reflect(non_cloneable, type_uuid = "c8827bb2-1aac-41e7-b2c1-ba04e0dc59e0")]
|
||||
pub struct ScaleGizmo {
|
||||
mode: ScaleGizmoMode,
|
||||
|
||||
@@ -52,7 +52,7 @@ use crate::{
|
||||
use fyrox::core::some_or_return;
|
||||
use fyrox::gui::button::Button;
|
||||
|
||||
#[derive(Reflect, Debug, Clone)]
|
||||
#[derive(PartialEq, Reflect, Debug, Clone)]
|
||||
#[reflect(type_uuid = "067c67e2-865b-4112-8d60-133ee1e1883a")]
|
||||
struct Entry {
|
||||
node: Handle<Node>,
|
||||
@@ -62,7 +62,7 @@ struct Entry {
|
||||
new_local_position: Vector3<f32>,
|
||||
}
|
||||
|
||||
#[derive(Reflect, Debug, Clone)]
|
||||
#[derive(PartialEq, Reflect, Debug, Clone)]
|
||||
#[reflect(type_uuid = "f50af953-308e-40e8-85ae-48c905ba5f46")]
|
||||
struct MoveContext {
|
||||
#[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")]
|
||||
pub struct MoveInteractionMode {
|
||||
move_context: Option<MoveContext>,
|
||||
|
||||
@@ -198,7 +198,7 @@ impl NavmeshPanel {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Reflect, Debug)]
|
||||
#[derive(PartialEq, Reflect, Debug)]
|
||||
#[reflect(
|
||||
non_cloneable,
|
||||
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")]
|
||||
pub struct EditNavmeshMode {
|
||||
move_gizmo: MoveGizmo,
|
||||
|
||||
@@ -22,7 +22,7 @@ use crate::fyrox::core::{algebra::Vector3, math::plane::Plane, num_traits::Zero}
|
||||
use fyrox::core::reflect::prelude::*;
|
||||
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")]
|
||||
pub enum PlaneKind {
|
||||
X,
|
||||
|
||||
@@ -47,7 +47,7 @@ use crate::{
|
||||
};
|
||||
use fyrox::gui::button::Button;
|
||||
|
||||
#[derive(Reflect, Debug)]
|
||||
#[derive(PartialEq, Reflect, Debug)]
|
||||
#[reflect(non_cloneable, type_uuid = "37f20364-feb5-4731-8c19-c3df922818d6")]
|
||||
pub struct RotateInteractionMode {
|
||||
initial_rotations: Vec<UnitQuaternion<f32>>,
|
||||
|
||||
@@ -44,7 +44,7 @@ use crate::{
|
||||
};
|
||||
use fyrox::gui::button::Button;
|
||||
|
||||
#[derive(Reflect, Debug)]
|
||||
#[derive(PartialEq, Reflect, Debug)]
|
||||
#[reflect(non_cloneable, type_uuid = "64b4da1a-5d0f-49e1-9f48-011165cd1ec5")]
|
||||
pub struct ScaleInteractionMode {
|
||||
initial_scales: Vec<Vector3<f32>>,
|
||||
|
||||
@@ -41,7 +41,7 @@ use fyrox::gui::button::Button;
|
||||
use fyrox::gui::image::Image;
|
||||
use fyrox::gui::widget::WidgetMessage;
|
||||
|
||||
#[derive(Reflect, Debug)]
|
||||
#[derive(PartialEq, Reflect, Debug)]
|
||||
#[reflect(non_cloneable, type_uuid = "bab9ce8c-d679-4c49-beb9-f5a8482e0678")]
|
||||
pub struct SelectInteractionMode {
|
||||
preview: Handle<Image>,
|
||||
|
||||
@@ -106,7 +106,7 @@ fn handle_undo_chunks(undo_chunks: UndoData, sender: &MessageSender) {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Reflect)]
|
||||
#[derive(PartialEq, Reflect)]
|
||||
#[reflect(
|
||||
non_cloneable,
|
||||
type_uuid = "bc19eff3-3e3a-49c0-9a9d-17d36fccc34e",
|
||||
@@ -243,6 +243,7 @@ impl TerrainInteractionMode {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(PartialEq)]
|
||||
pub struct BrushGizmo {
|
||||
brush: Handle<Mesh>,
|
||||
}
|
||||
@@ -558,6 +559,7 @@ impl InteractionMode for TerrainInteractionMode {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(PartialEq)]
|
||||
struct BrushPanel {
|
||||
window: Handle<Window>,
|
||||
inspector: Handle<Inspector>,
|
||||
|
||||
+1
-1
@@ -55,7 +55,7 @@ use std::{
|
||||
},
|
||||
};
|
||||
|
||||
#[derive(Reflect, Clone, Debug)]
|
||||
#[derive(PartialEq, Reflect, Clone, Debug)]
|
||||
#[reflect(type_uuid = "86eed637-0d96-4ad2-9566-a451f0b00237")]
|
||||
struct LightmapperSettings {
|
||||
/// Name of the property in a material that will be modified in all materials for all surfaces
|
||||
|
||||
@@ -41,13 +41,12 @@ use crate::{
|
||||
settings::{recent::RecentFiles, Settings},
|
||||
Engine, Message, Mode, Panels, SaveSceneConfirmationDialogAction,
|
||||
};
|
||||
use fyrox::core::parking_lot::Mutex;
|
||||
use fyrox::core::uuid::{uuid, Uuid};
|
||||
use fyrox::graph::SceneGraph;
|
||||
use fyrox::gui::file_browser::FileSelector;
|
||||
use fyrox::gui::menu::MenuItem;
|
||||
use fyrox::gui::messagebox::MessageBox;
|
||||
use std::sync::Arc;
|
||||
use fyrox::gui::widget::UserData;
|
||||
use std::{path::PathBuf, sync::mpsc::Sender};
|
||||
|
||||
pub struct FileMenu {
|
||||
@@ -82,7 +81,7 @@ fn make_recent_files_items(
|
||||
.iter()
|
||||
.map(|f| {
|
||||
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
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
|
||||
@@ -128,6 +128,12 @@ pub enum Message {
|
||||
#[reflect(hide_all, type_uuid = "86eed637-0d96-4ad2-9566-a451f0b00237")]
|
||||
pub struct MessageSender(pub Sender<Message>);
|
||||
|
||||
impl PartialEq for MessageSender {
|
||||
fn eq(&self, _other: &Self) -> bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for MessageSender {
|
||||
fn default() -> Self {
|
||||
let (rx, _) = channel();
|
||||
|
||||
@@ -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")]
|
||||
struct ContextMenu {
|
||||
#[visit(skip)]
|
||||
@@ -101,13 +101,13 @@ struct ContextMenu {
|
||||
remove_point: Handle<MenuItem>,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
#[derive(PartialEq, Clone)]
|
||||
enum DragContext {
|
||||
SamplingPoint,
|
||||
Point { point: usize },
|
||||
}
|
||||
|
||||
#[derive(Clone, Visit, Reflect)]
|
||||
#[derive(Clone, Visit, PartialEq, Reflect)]
|
||||
#[reflect(
|
||||
derived_type = "UiNode",
|
||||
type_uuid = "854a7c2d-3ccd-4331-95e1-956a3a035bd0"
|
||||
@@ -557,7 +557,7 @@ pub enum BlendSpaceFieldPointMessage {
|
||||
}
|
||||
impl MessageData for BlendSpaceFieldPointMessage {}
|
||||
|
||||
#[derive(Clone, Visit, Reflect, Debug)]
|
||||
#[derive(Clone, Visit, PartialEq, Reflect, Debug)]
|
||||
#[reflect(
|
||||
derived_type = "UiNode",
|
||||
type_uuid = "22c215c1-ff23-4a64-9aa7-640b5014a78b"
|
||||
|
||||
@@ -113,7 +113,7 @@ impl MessageData for AbsmCanvasMessage {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Visit, Reflect, Debug)]
|
||||
#[derive(Clone, Visit, PartialEq, Reflect, Debug)]
|
||||
#[reflect(
|
||||
derived_type = "UiNode",
|
||||
type_uuid = "100b1c33-d017-4fe6-95e7-e1daf310ef27"
|
||||
|
||||
@@ -43,7 +43,7 @@ use fyrox::material::MaterialResource;
|
||||
const PICKED_BRUSH: Brush = Brush::Solid(Color::opaque(100, 100, 100));
|
||||
const NORMAL_BRUSH: Brush = Brush::Solid(Color::opaque(80, 80, 80));
|
||||
|
||||
#[derive(Debug, Clone, Visit, Reflect)]
|
||||
#[derive(Debug, Clone, Visit, PartialEq, Reflect)]
|
||||
#[reflect(
|
||||
derived_type = "UiNode",
|
||||
type_uuid = "c802b6fa-a5ef-4464-a097-749c731ffde0"
|
||||
|
||||
@@ -48,7 +48,7 @@ use std::{
|
||||
ops::{Deref, DerefMut},
|
||||
};
|
||||
|
||||
#[derive(Clone, Debug, Visit, Reflect)]
|
||||
#[derive(Clone, Debug, Visit, PartialEq, Reflect)]
|
||||
#[reflect(type_uuid = "1a5d0042-3607-4fcb-88c6-025a0bce6111")]
|
||||
pub struct AbsmBaseNode {
|
||||
pub input_sockets: Vec<Handle<Socket>>,
|
||||
@@ -58,7 +58,8 @@ pub struct AbsmBaseNode {
|
||||
#[derive(Visit, Reflect)]
|
||||
#[reflect(
|
||||
derived_type = "UiNode",
|
||||
type_uuid = "15bc1a7e-a385-46e0-a65c-7e9c014b4a1d"
|
||||
type_uuid = "15bc1a7e-a385-46e0-a65c-7e9c014b4a1d",
|
||||
non_comparable
|
||||
)]
|
||||
pub struct AbsmNode<T>
|
||||
where
|
||||
|
||||
@@ -31,7 +31,7 @@ pub enum SegmentMessage {
|
||||
}
|
||||
impl MessageData for SegmentMessage {}
|
||||
|
||||
#[derive(Debug, Clone, Reflect, Visit)]
|
||||
#[derive(Debug, Clone, Reflect, PartialEq, Visit)]
|
||||
#[reflect(type_uuid = "fda5a731-e927-40e5-9d96-e19104fbb63e")]
|
||||
pub struct Segment {
|
||||
pub source: Handle<UiNode>,
|
||||
|
||||
@@ -53,7 +53,7 @@ pub enum SocketDirection {
|
||||
Output,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Visit, Reflect)]
|
||||
#[derive(Clone, Debug, Visit, PartialEq, Reflect)]
|
||||
#[reflect(
|
||||
derived_type = "UiNode",
|
||||
type_uuid = "a6c0473e-7073-4e91-a681-cf88795af52a"
|
||||
|
||||
@@ -54,7 +54,7 @@ pub enum TransitionMessage {
|
||||
}
|
||||
impl MessageData for TransitionMessage {}
|
||||
|
||||
#[derive(Clone, Debug, Visit, Reflect)]
|
||||
#[derive(Clone, Debug, Visit, PartialEq, Reflect)]
|
||||
#[reflect(
|
||||
derived_type = "UiNode",
|
||||
type_uuid = "01798aee-8fe5-4480-a69d-8e5b95c3cc96"
|
||||
|
||||
@@ -65,7 +65,7 @@ pub enum RulerMessage {
|
||||
}
|
||||
impl MessageData for RulerMessage {}
|
||||
|
||||
#[derive(Clone)]
|
||||
#[derive(PartialEq, Clone)]
|
||||
struct ContextMenu {
|
||||
menu: RcUiNodeHandle,
|
||||
add_signal: Handle<MenuItem>,
|
||||
@@ -148,18 +148,18 @@ impl SignalView {
|
||||
const SIZE: f32 = 10.0;
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
#[derive(PartialEq, Clone)]
|
||||
enum DragEntity {
|
||||
TimePosition,
|
||||
Signal(Uuid),
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
#[derive(PartialEq, Clone)]
|
||||
struct DragContext {
|
||||
entity: DragEntity,
|
||||
}
|
||||
|
||||
#[derive(Clone, Visit, Reflect)]
|
||||
#[derive(Clone, Visit, PartialEq, Reflect)]
|
||||
#[reflect(
|
||||
derived_type = "UiNode",
|
||||
type_uuid = "98655c9b-428f-4977-a478-ad3674cc66d4"
|
||||
|
||||
@@ -51,7 +51,7 @@ pub enum ThumbMessage {
|
||||
}
|
||||
impl MessageData for ThumbMessage {}
|
||||
|
||||
#[derive(Clone, Visit, Reflect, Debug)]
|
||||
#[derive(Clone, Visit, PartialEq, Reflect, Debug)]
|
||||
#[reflect(
|
||||
derived_type = "UiNode",
|
||||
type_uuid = "820ba009-54e0-4050-ba7e-28f1f5b40429"
|
||||
|
||||
@@ -31,7 +31,6 @@ use crate::{
|
||||
log::Log,
|
||||
math::curve::{CurveKey, CurveKeyKind},
|
||||
ok_or_continue,
|
||||
parking_lot::Mutex,
|
||||
pool::{ErasedHandle, Handle},
|
||||
reflect::{prelude::*, Reflect},
|
||||
some_or_return,
|
||||
@@ -103,12 +102,13 @@ use crate::{
|
||||
utils::{self},
|
||||
};
|
||||
use fyrox::core::warn;
|
||||
use fyrox::gui::widget::UserData;
|
||||
use std::{
|
||||
any::{Any, TypeId},
|
||||
cmp::Ordering,
|
||||
collections::hash_map::Entry,
|
||||
ops::{Deref, DerefMut},
|
||||
sync::{mpsc::Sender, Arc},
|
||||
sync::mpsc::Sender,
|
||||
};
|
||||
|
||||
#[derive(PartialEq, Eq)]
|
||||
@@ -346,7 +346,7 @@ pub enum TrackViewMessage {
|
||||
}
|
||||
impl MessageData for TrackViewMessage {}
|
||||
|
||||
#[derive(Clone, Debug, Reflect, Visit)]
|
||||
#[derive(Clone, Debug, PartialEq, Reflect, Visit)]
|
||||
#[reflect(
|
||||
derived_type = "UiNode",
|
||||
type_uuid = "c1e930da-d55d-492e-b87b-16c1adf03319"
|
||||
@@ -1560,9 +1560,9 @@ impl TrackList {
|
||||
};
|
||||
|
||||
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() },
|
||||
))),
|
||||
)),
|
||||
)
|
||||
.with_content(
|
||||
GridBuilder::new(
|
||||
|
||||
@@ -298,7 +298,7 @@ fn make_handle(scene: &mut Scene, root: Handle<Pivot>, visible: bool) -> Handle<
|
||||
handle
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Reflect, Debug)]
|
||||
#[derive(Copy, Clone, PartialEq, Reflect, Debug)]
|
||||
#[reflect(non_cloneable, type_uuid = "42b19406-299d-4c3d-a7e3-77b41817ae71")]
|
||||
enum ShapeHandleValue {
|
||||
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")]
|
||||
enum ColliderInitialShape {
|
||||
TwoD(dim2::collider::ColliderShape),
|
||||
ThreeD(ColliderShape),
|
||||
}
|
||||
|
||||
#[derive(Reflect, Debug)]
|
||||
#[derive(PartialEq, Reflect, Debug)]
|
||||
#[reflect(non_cloneable, type_uuid = "e9aac4a5-0755-4d94-94ff-dfa37b40d5ca")]
|
||||
struct DragContext {
|
||||
handle: Handle<Sprite>,
|
||||
@@ -344,7 +344,11 @@ struct DragContext {
|
||||
}
|
||||
|
||||
#[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 {
|
||||
collider: Handle<Node>,
|
||||
#[reflect(hidden)]
|
||||
|
||||
@@ -61,7 +61,7 @@ use crate::{
|
||||
};
|
||||
use std::{fmt::Debug, path::PathBuf};
|
||||
|
||||
#[derive(Reflect, Clone, Debug)]
|
||||
#[derive(PartialEq, Reflect, Clone, Debug)]
|
||||
#[reflect(type_uuid = "f29aa9c7-e0c4-4602-8588-3e8a20ab7cdc")]
|
||||
pub struct CurveEditorContext {}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ use crate::{
|
||||
core::dyntype::{DynTypeConstructorContainer, DynTypeContainer},
|
||||
graph::SceneGraph,
|
||||
gui::{
|
||||
core::{parking_lot::Mutex, pool::Handle, reflect::prelude::*, visitor::prelude::*},
|
||||
core::{pool::Handle, reflect::prelude::*, visitor::prelude::*},
|
||||
dropdown_list::{DropdownList, DropdownListBuilder, DropdownListMessage},
|
||||
grid::{GridBuilder, GridDimension},
|
||||
inspector::InspectorContextArgs,
|
||||
@@ -34,8 +34,8 @@ use crate::{
|
||||
PropertyEditorMessageContext, PropertyEditorTranslationContext,
|
||||
},
|
||||
make_expander_container, FieldAction, Inspector, InspectorBuilder,
|
||||
InspectorContext, InspectorEnvironment, InspectorError, InspectorMessage,
|
||||
PropertyChanged, PropertyFilter,
|
||||
InspectorContext, InspectorError, InspectorMessage, PropertyChanged,
|
||||
PropertyFilter,
|
||||
},
|
||||
message::MessageData,
|
||||
message::{MessageDirection, UiMessage},
|
||||
@@ -48,6 +48,7 @@ use crate::{
|
||||
};
|
||||
use fyrox::core::dyntype::DynTypeWrapper;
|
||||
use fyrox::gui::inspector::InspectorEnvironmentContainer;
|
||||
use fyrox::gui::widget::UserData;
|
||||
use std::{
|
||||
any::TypeId,
|
||||
cell::Cell,
|
||||
@@ -62,7 +63,7 @@ pub enum DynTypePropertyEditorMessage {
|
||||
}
|
||||
impl MessageData for DynTypePropertyEditorMessage {}
|
||||
|
||||
#[derive(Clone, Debug, Visit, Reflect)]
|
||||
#[derive(Clone, Debug, Visit, PartialEq, Reflect)]
|
||||
#[reflect(
|
||||
derived_type = "UiNode",
|
||||
type_uuid = "f43c3bfb-8b39-4cc0-be77-04141a45822e"
|
||||
@@ -192,13 +193,13 @@ fn create_items(
|
||||
) -> Vec<Handle<UiNode>> {
|
||||
let mut items = vec![{
|
||||
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
|
||||
}];
|
||||
|
||||
items.extend(constructors.inner().iter().map(|(type_uuid, constructor)| {
|
||||
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
|
||||
}));
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ use std::{
|
||||
ops::{Deref, DerefMut},
|
||||
};
|
||||
|
||||
#[derive(Clone, Visit, Reflect)]
|
||||
#[derive(Clone, Visit, PartialEq, Reflect)]
|
||||
#[reflect(
|
||||
derived_type = "UiNode",
|
||||
type_uuid = "5db49479-ff89-49b8-a038-0766253d6493"
|
||||
|
||||
@@ -105,8 +105,11 @@ pub struct HandlePropertyEditorHierarchyMessage(pub HierarchyNode);
|
||||
impl MessageData for HandlePropertyEditorHierarchyMessage {}
|
||||
|
||||
#[derive(Visit, Reflect)]
|
||||
#[reflect(type_uuid = "3ceca8c1-c365-4f03-a413-062f8f3cd685")]
|
||||
#[reflect(derived_type = "UiNode")]
|
||||
#[reflect(
|
||||
non_comparable,
|
||||
derived_type = "UiNode",
|
||||
type_uuid = "3ceca8c1-c365-4f03-a413-062f8f3cd685"
|
||||
)]
|
||||
pub struct HandlePropertyEditor<T: Reflect> {
|
||||
widget: Widget,
|
||||
text: Handle<Text>,
|
||||
|
||||
@@ -117,7 +117,8 @@ pub type ResourceLoaderCallback<T> = Arc<
|
||||
#[derive(Visit, Reflect)]
|
||||
#[reflect(
|
||||
derived_type = "UiNode",
|
||||
type_uuid = "5179b3b9-855f-43a6-b23a-831129fee1cf"
|
||||
type_uuid = "5179b3b9-855f-43a6-b23a-831129fee1cf",
|
||||
non_comparable
|
||||
)]
|
||||
pub struct ResourceField<T>
|
||||
where
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
// SOFTWARE.
|
||||
|
||||
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,
|
||||
graph::SceneGraph,
|
||||
gui::{
|
||||
@@ -33,8 +33,7 @@ use crate::fyrox::{
|
||||
PropertyEditorMessageContext, PropertyEditorTranslationContext,
|
||||
},
|
||||
make_expander_container, FieldAction, Inspector, InspectorBuilder, InspectorContext,
|
||||
InspectorEnvironment, InspectorError, InspectorMessage, PropertyChanged,
|
||||
PropertyFilter,
|
||||
InspectorError, InspectorMessage, PropertyChanged, PropertyFilter,
|
||||
},
|
||||
message::{MessageDirection, UiMessage},
|
||||
text::TextBuilder,
|
||||
@@ -54,6 +53,7 @@ use fyrox::gui::button::Button;
|
||||
use fyrox::gui::inspector::{InspectorContextArgs, InspectorEnvironmentContainer};
|
||||
use fyrox::gui::message::MessageData;
|
||||
use fyrox::gui::utils::make_dropdown_list_option;
|
||||
use fyrox::gui::widget::UserData;
|
||||
use fyrox::gui::{Thickness, VerticalAlignment};
|
||||
use std::{
|
||||
any::TypeId,
|
||||
@@ -69,7 +69,7 @@ pub enum ScriptPropertyEditorMessage {
|
||||
}
|
||||
impl MessageData for ScriptPropertyEditorMessage {}
|
||||
|
||||
#[derive(Clone, Debug, Visit, Reflect)]
|
||||
#[derive(Clone, Debug, Visit, PartialEq, Reflect)]
|
||||
#[reflect(
|
||||
derived_type = "UiNode",
|
||||
type_uuid = "f43c3bfb-8b39-4cc0-be77-04141a45822e"
|
||||
@@ -267,10 +267,7 @@ fn create_items(
|
||||
) -> Vec<Handle<UiNode>> {
|
||||
let mut items = vec![{
|
||||
let empty = make_dropdown_list_option(ctx, "<No Script>");
|
||||
ctx[empty].user_data = Some(Arc::new(Mutex::new((
|
||||
Uuid::default(),
|
||||
Option::<String>::None,
|
||||
))));
|
||||
ctx[empty].user_data = Some(UserData::new((Uuid::default(), Option::<String>::None)));
|
||||
empty
|
||||
}];
|
||||
|
||||
@@ -278,10 +275,10 @@ fn create_items(
|
||||
|(type_uuid, constructor)| {
|
||||
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,
|
||||
Some(constructor.source_path.to_string()),
|
||||
))));
|
||||
)));
|
||||
|
||||
item
|
||||
},
|
||||
|
||||
@@ -45,7 +45,7 @@ use crate::{
|
||||
use fyrox::gui::button::Button;
|
||||
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(derived_type = "UiNode")]
|
||||
pub struct ShaderSourceCodeEditorField {
|
||||
|
||||
@@ -42,7 +42,7 @@ pub enum 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(derived_type = "UiNode")]
|
||||
pub struct ShaderSourceCodeEditor {
|
||||
|
||||
@@ -57,7 +57,7 @@ pub enum SpriteSheetFramesPropertyEditorMessage {
|
||||
}
|
||||
impl MessageData for SpriteSheetFramesPropertyEditorMessage {}
|
||||
|
||||
#[derive(Clone, Debug, Reflect, Visit)]
|
||||
#[derive(Clone, Debug, PartialEq, Reflect, Visit)]
|
||||
#[reflect(
|
||||
derived_type = "UiNode",
|
||||
type_uuid = "8994228d-6106-4e41-872c-5191840badcc"
|
||||
|
||||
@@ -20,10 +20,7 @@
|
||||
|
||||
use crate::fyrox::graph::SceneGraph;
|
||||
use crate::fyrox::{
|
||||
core::{
|
||||
algebra::Vector2, parking_lot::Mutex, pool::Handle, reflect::prelude::*,
|
||||
visitor::prelude::*,
|
||||
},
|
||||
core::{algebra::Vector2, pool::Handle, reflect::prelude::*, visitor::prelude::*},
|
||||
gui::{
|
||||
border::BorderBuilder,
|
||||
button::{ButtonBuilder, ButtonMessage},
|
||||
@@ -54,12 +51,13 @@ use fyrox::gui::image::Image;
|
||||
use fyrox::gui::numeric::NumericUpDown;
|
||||
use fyrox::gui::style::resource::StyleResourceExt;
|
||||
use fyrox::gui::style::Style;
|
||||
use fyrox::gui::widget::UserData;
|
||||
use std::{
|
||||
ops::{Deref, DerefMut},
|
||||
sync::{mpsc::Sender, Arc},
|
||||
sync::mpsc::Sender,
|
||||
};
|
||||
|
||||
#[derive(Clone, Visit, Reflect, Debug)]
|
||||
#[derive(Clone, Visit, PartialEq, Reflect, Debug)]
|
||||
#[reflect(
|
||||
derived_type = "UiNode",
|
||||
type_uuid = "55607fe0-2996-418d-ad31-a5b96fdfa4b7"
|
||||
@@ -206,7 +204,7 @@ fn make_grid(
|
||||
.with_height(16.0)
|
||||
.on_row(i 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)))
|
||||
.build(ctx),
|
||||
|
||||
@@ -68,8 +68,11 @@ pub enum SurfaceDataPropertyEditorMessage {
|
||||
impl MessageData for SurfaceDataPropertyEditorMessage {}
|
||||
|
||||
#[derive(Clone, Visit, Reflect, Debug)]
|
||||
#[reflect(type_uuid = "8461a183-4fd4-4f74-a4f4-7fd8e84bf423")]
|
||||
#[reflect(derived_type = "UiNode")]
|
||||
#[reflect(
|
||||
type_uuid = "8461a183-4fd4-4f74-a4f4-7fd8e84bf423",
|
||||
derived_type = "UiNode",
|
||||
non_comparable
|
||||
)]
|
||||
#[allow(dead_code)]
|
||||
pub struct SurfaceDataPropertyEditor {
|
||||
widget: Widget,
|
||||
|
||||
@@ -61,7 +61,8 @@ use std::{
|
||||
#[derive(Clone, Visit, Reflect)]
|
||||
#[reflect(
|
||||
derived_type = "UiNode",
|
||||
type_uuid = "5db49479-ff89-49b8-a038-0766253d6493"
|
||||
type_uuid = "5db49479-ff89-49b8-a038-0766253d6493",
|
||||
non_comparable
|
||||
)]
|
||||
pub struct TextureEditor {
|
||||
widget: Widget,
|
||||
|
||||
@@ -68,7 +68,7 @@ use std::{any::Any, sync::mpsc::Sender, sync::Arc};
|
||||
pub mod editors;
|
||||
pub mod handlers;
|
||||
|
||||
#[derive(Clone, Reflect, Debug)]
|
||||
#[derive(Clone, PartialEq, Reflect, Debug)]
|
||||
#[reflect(type_uuid = "e617f0b6-fb5f-4e41-85c2-9dbb1869af30")]
|
||||
pub struct AnimationDefinition {
|
||||
name: String,
|
||||
@@ -76,7 +76,11 @@ pub struct AnimationDefinition {
|
||||
}
|
||||
|
||||
#[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 resource_manager: ResourceManager,
|
||||
#[reflect(hidden)]
|
||||
@@ -345,7 +349,7 @@ impl InspectorPlugin {
|
||||
object: obj,
|
||||
ctx: &mut ui.build_ctx(),
|
||||
definition_container: property_editors,
|
||||
environment: Some(environment),
|
||||
environment: Some(InspectorEnvironmentContainer(environment)),
|
||||
layer_index: 0,
|
||||
generate_property_string_values: true,
|
||||
filter: Default::default(),
|
||||
|
||||
@@ -74,7 +74,8 @@ impl MessageData for MaterialFieldMessage {}
|
||||
#[derive(Clone, Visit, Reflect)]
|
||||
#[reflect(
|
||||
derived_type = "UiNode",
|
||||
type_uuid = "d3fa0a7c-52d6-4cca-885e-0db8b18542e2"
|
||||
type_uuid = "d3fa0a7c-52d6-4cca-885e-0db8b18542e2",
|
||||
non_comparable
|
||||
)]
|
||||
pub struct MaterialFieldEditor {
|
||||
widget: Widget,
|
||||
|
||||
@@ -92,10 +92,11 @@ use crate::{
|
||||
};
|
||||
use fyrox::gui::dock::DockingManager;
|
||||
use fyrox::gui::stack_panel::StackPanel;
|
||||
use fyrox::gui::widget::UserData;
|
||||
use fyrox::gui::window::Window;
|
||||
use std::{
|
||||
path::PathBuf,
|
||||
sync::{mpsc::Receiver, mpsc::Sender, Arc},
|
||||
sync::{mpsc::Receiver, mpsc::Sender},
|
||||
};
|
||||
|
||||
pub mod editor;
|
||||
@@ -461,7 +462,7 @@ impl MaterialEditor {
|
||||
let editor = TextureEditorBuilder::new(
|
||||
WidgetBuilder::new()
|
||||
.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_tooltip(make_simple_tooltip(ctx, &path)),
|
||||
)
|
||||
|
||||
@@ -138,14 +138,14 @@ impl ReflectionProbePreviewControlPanel {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Reflect, Debug)]
|
||||
#[derive(PartialEq, Reflect, Debug)]
|
||||
#[reflect(non_cloneable, type_uuid = "9a535782-87a9-4407-8d12-a723d67e179d")]
|
||||
struct DragContext {
|
||||
new_position: Vector3<f32>,
|
||||
plane_kind: PlaneKind,
|
||||
}
|
||||
|
||||
#[derive(Reflect, Debug)]
|
||||
#[derive(PartialEq, Reflect, Debug)]
|
||||
#[reflect(non_cloneable, type_uuid = "d8fd164c-523c-447a-93ab-e86f2d71eed6")]
|
||||
pub struct ReflectionProbeInteractionMode {
|
||||
probe: Handle<ReflectionProbe>,
|
||||
|
||||
@@ -74,7 +74,7 @@ use fyrox::scene::joint::Joint;
|
||||
use fyrox::scene::ragdoll::Ragdoll;
|
||||
use std::{ops::Range, sync::Arc};
|
||||
|
||||
#[derive(Reflect, Clone, Debug)]
|
||||
#[derive(PartialEq, Reflect, Clone, Debug)]
|
||||
#[reflect(type_uuid = "07d73807-1716-4ea6-bef4-91903c214f7e")]
|
||||
pub struct RagdollPreset {
|
||||
/// A handle of a hips (pelvis) bone.
|
||||
|
||||
@@ -23,9 +23,7 @@
|
||||
use crate::menu::create_menu_item_shortcut;
|
||||
use crate::{
|
||||
fyrox::{
|
||||
core::{
|
||||
log::Log, parking_lot::lock_api::Mutex, pool::Handle, reflect::Reflect, some_or_return,
|
||||
},
|
||||
core::{log::Log, pool::Handle, reflect::Reflect, some_or_return},
|
||||
engine::Engine,
|
||||
graph::SceneGraph,
|
||||
gui::{
|
||||
@@ -61,6 +59,7 @@ use fyrox::gui::scroll_viewer::ScrollViewer;
|
||||
use fyrox::gui::searchbar::SearchBar;
|
||||
use fyrox::gui::stack_panel::StackPanel;
|
||||
use fyrox::gui::text_box::EmptyTextPlaceholder;
|
||||
use fyrox::gui::widget::UserData;
|
||||
use fyrox::gui::window::{Window, WindowAlignment};
|
||||
use rust_fuzzy_search::fuzzy_compare;
|
||||
use std::sync::Arc;
|
||||
@@ -224,19 +223,19 @@ impl SettingsWindow {
|
||||
base_path: Default::default(),
|
||||
has_parent_object: false,
|
||||
});
|
||||
let groups =
|
||||
context
|
||||
.entries
|
||||
.iter()
|
||||
.map(|entry| {
|
||||
ButtonBuilder::new(WidgetBuilder::new().with_user_data(Arc::new(Mutex::new(
|
||||
GroupName(entry.property_tag.clone()),
|
||||
))))
|
||||
.with_text(&entry.property_display_name)
|
||||
.build(ctx)
|
||||
.to_base()
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
let groups = context
|
||||
.entries
|
||||
.iter()
|
||||
.map(|entry| {
|
||||
ButtonBuilder::new(
|
||||
WidgetBuilder::new()
|
||||
.with_user_data(UserData::new(GroupName(entry.property_tag.clone()))),
|
||||
)
|
||||
.with_text(&entry.property_display_name)
|
||||
.build(ctx)
|
||||
.to_base()
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
ui.send(self.groups, WidgetMessage::ReplaceChildren(groups));
|
||||
ui.send(self.inspector, InspectorMessage::Context(context));
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ pub struct AutoTileMacro {
|
||||
autotiler: TileSetAutoTiler,
|
||||
}
|
||||
|
||||
#[derive(Default, Debug, Clone, Reflect)]
|
||||
#[derive(Default, Debug, PartialEq, Clone, Reflect)]
|
||||
#[reflect(type_uuid = "e50fa366-145d-4491-8126-acdd162031ea")]
|
||||
struct CellData {
|
||||
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")]
|
||||
pub(super) struct AutoTileInstance {
|
||||
frequency_property: Option<TileSetPropertyF32>,
|
||||
@@ -151,7 +151,7 @@ pub(super) struct AutoTileInstance {
|
||||
widgets: InstanceCellWidgets,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Clone)]
|
||||
#[derive(Debug, Default, PartialEq, Clone)]
|
||||
struct InstanceCellWidgets {
|
||||
handle: Handle<UiNode>,
|
||||
value_field: MacroPropertyValueField,
|
||||
|
||||
@@ -20,10 +20,11 @@
|
||||
|
||||
use super::*;
|
||||
use crate::command::{Command, CommandContext, CommandTrait};
|
||||
use fyrox::asset::TypedResourceData;
|
||||
use fyrox::gui::dropdown_list::DropdownList;
|
||||
use fyrox::gui::message::{DeliveryMode, MessageData};
|
||||
use fyrox::{
|
||||
asset::{untyped::UntypedResource, Resource, ResourceData, ResourceDataRef},
|
||||
asset::{untyped::UntypedResource, Resource, ResourceDataRef},
|
||||
core::{
|
||||
futures::executor::block_on,
|
||||
log::Log,
|
||||
@@ -54,6 +55,12 @@ const UNKNOWN_PROPERTY: &str = "UNKNOWN PROPERTY";
|
||||
#[derive(Default, Clone)]
|
||||
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 {
|
||||
/// Create a new reference and assign it to point to the given macro list.
|
||||
pub fn new(list: BrushMacroList) -> Self {
|
||||
@@ -128,7 +135,7 @@ impl BrushMacroInstance {
|
||||
/// A typed reference to the configuration resource.
|
||||
pub fn settings<T>(&self) -> Option<Resource<T>>
|
||||
where
|
||||
T: ResourceData + Default,
|
||||
T: TypedResourceData,
|
||||
{
|
||||
self.settings.as_ref()?.try_cast()
|
||||
}
|
||||
@@ -211,7 +218,7 @@ impl BrushMacroCellContext {
|
||||
/// A typed reference to the configuration resource.
|
||||
pub fn settings<T>(&self) -> Option<Resource<T>>
|
||||
where
|
||||
T: ResourceData + Default,
|
||||
T: TypedResourceData,
|
||||
{
|
||||
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`].
|
||||
/// The property is represented as a [`TileSetPropertyValueElement`] internally, but the user
|
||||
/// is given a dropdown list of value names if possible.
|
||||
#[derive(Debug, Default, Clone)]
|
||||
#[derive(Debug, Default, PartialEq, Clone)]
|
||||
pub struct MacroPropertyValueField {
|
||||
handle: Handle<UiNode>,
|
||||
textbox: Handle<UiNode>,
|
||||
|
||||
@@ -76,7 +76,7 @@ impl MessageData for TileDefinitionHandleEditorMessage {}
|
||||
/// pair is the page coordinates and the second pair is the tile coordinates.
|
||||
/// 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.
|
||||
#[derive(Clone, Debug, Visit, Reflect)]
|
||||
#[derive(Clone, Debug, Visit, PartialEq, Reflect)]
|
||||
#[reflect(derived_type = "UiNode")]
|
||||
#[reflect(type_uuid = "60146cf0-33e3-4757-8e66-e7196324271f")]
|
||||
pub struct TileDefinitionHandleEditor {
|
||||
|
||||
@@ -53,7 +53,7 @@ impl MessageData for TileHandleEditorMessage {}
|
||||
/// pair is the page coordinates and the second pair is the tile coordinates.
|
||||
/// 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.
|
||||
#[derive(Debug, Default, Clone, Visit, Reflect)]
|
||||
#[derive(Debug, Default, Clone, Visit, PartialEq, Reflect)]
|
||||
#[reflect(type_uuid = "86513074-461d-4583-a214-fb84f5aacac1")]
|
||||
#[reflect(derived_type = "UiNode")]
|
||||
pub struct TileHandleField {
|
||||
|
||||
@@ -20,12 +20,14 @@
|
||||
|
||||
//! The [`InteractionMode`] for editing a tile map.
|
||||
|
||||
use super::*;
|
||||
use crate::{
|
||||
command::{Command, CommandGroup},
|
||||
make_color_material,
|
||||
};
|
||||
use commands::{MoveMapTileCommand, SetMapTilesCommand};
|
||||
use fyrox::gui::button::Button;
|
||||
use fyrox::scene::tilemap::{TileMapEffectRef, TileMapEffectRefContainer};
|
||||
use fyrox::{
|
||||
asset::untyped::UntypedResource,
|
||||
core::reflect::prelude::*,
|
||||
@@ -41,8 +43,6 @@ use fyrox::{
|
||||
};
|
||||
use std::fmt::Formatter;
|
||||
|
||||
use super::*;
|
||||
|
||||
const CURSOR_COLOR: Color = Color::from_rgba(255, 255, 255, 30);
|
||||
const SELECT_COLOR: Color = Color::from_rgba(255, 255, 0, 200);
|
||||
const ERASE_COLOR: Color = Color::from_rgba(255, 0, 0, 255);
|
||||
@@ -64,6 +64,7 @@ enum MouseMode {
|
||||
#[derive(Reflect)]
|
||||
#[reflect(
|
||||
non_cloneable,
|
||||
non_comparable,
|
||||
type_uuid = "33fa8ef9-a29c-45d4-a493-79571edd870a",
|
||||
hide_all
|
||||
)]
|
||||
@@ -172,15 +173,15 @@ impl TileMapInteractionMode {
|
||||
pub fn on_tile_map_selected(&mut self, tile_map: &mut TileMap) {
|
||||
tile_map.before_effects.clear();
|
||||
tile_map.before_effects.extend([
|
||||
self.overlay_effect.clone() as TileMapEffectRef,
|
||||
self.update_effect.clone() as TileMapEffectRef,
|
||||
self.erase_effect.clone() as TileMapEffectRef,
|
||||
TileMapEffectRefContainer(self.overlay_effect.clone() as TileMapEffectRef),
|
||||
TileMapEffectRefContainer(self.update_effect.clone() as TileMapEffectRef),
|
||||
TileMapEffectRefContainer(self.erase_effect.clone() as TileMapEffectRef),
|
||||
]);
|
||||
tile_map.after_effects.clear();
|
||||
tile_map.after_effects.extend([
|
||||
self.cursor_effect.clone() as TileMapEffectRef,
|
||||
self.erase_select_effect.clone() as TileMapEffectRef,
|
||||
self.select_effect.clone() as TileMapEffectRef,
|
||||
TileMapEffectRefContainer(self.cursor_effect.clone() as TileMapEffectRef),
|
||||
TileMapEffectRefContainer(self.erase_select_effect.clone() as TileMapEffectRef),
|
||||
TileMapEffectRefContainer(self.select_effect.clone() as TileMapEffectRef),
|
||||
]);
|
||||
}
|
||||
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);
|
||||
|
||||
#[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 {
|
||||
handle: Handle<UiNode>,
|
||||
content: Handle<UiNode>,
|
||||
|
||||
@@ -59,7 +59,7 @@ use fyrox::gui::text::TextBuilder;
|
||||
use fyrox::gui::{message::KeyCode, texture::TextureResource};
|
||||
use fyrox::gui::{HorizontalAlignment, VerticalAlignment};
|
||||
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::*;
|
||||
use handle_field::*;
|
||||
use interaction_mode::*;
|
||||
|
||||
@@ -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
|
||||
/// to be selected, dragged, and edits in various ways.
|
||||
#[derive(Clone, Visit, Reflect)]
|
||||
#[reflect(type_uuid = "5356a864-c026-4bd7-a4b1-30bacf77d8fa")]
|
||||
#[reflect(derived_type = "UiNode")]
|
||||
#[reflect(
|
||||
derived_type = "UiNode",
|
||||
type_uuid = "5356a864-c026-4bd7-a4b1-30bacf77d8fa",
|
||||
non_comparable
|
||||
)]
|
||||
pub struct PaletteWidget {
|
||||
widget: Widget,
|
||||
#[visit(skip)]
|
||||
@@ -278,7 +281,7 @@ impl Debug for PaletteWidget {
|
||||
|
||||
type PaletteTriangleData = (Vec<Point2<f32>>, Vec<[u32; 3]>);
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Debug, PartialEq, Clone)]
|
||||
struct ColliderHighlight {
|
||||
position: Vector2<i32>,
|
||||
color: Color,
|
||||
|
||||
@@ -50,8 +50,11 @@ use fyrox::material::MaterialResource;
|
||||
/// currently selected tile stamp, including whatever transformations have been applied
|
||||
/// to the stamp.
|
||||
#[derive(Clone, Debug, Visit, Reflect)]
|
||||
#[reflect(type_uuid = "5356a864-c026-4bd7-a4b1-30bacf77d8fa")]
|
||||
#[reflect(derived_type = "UiNode")]
|
||||
#[reflect(
|
||||
non_comparable,
|
||||
derived_type = "UiNode",
|
||||
type_uuid = "5356a864-c026-4bd7-a4b1-30bacf77d8fa"
|
||||
)]
|
||||
pub struct PanelPreview {
|
||||
widget: Widget,
|
||||
/// 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 {}
|
||||
|
||||
#[derive(Clone, Default, Debug, Visit, Reflect)]
|
||||
#[derive(Clone, Default, Debug, Visit, PartialEq, Reflect)]
|
||||
#[reflect(type_uuid = "1e600103-6516-4c5a-a30b-f90f64fc9623")]
|
||||
#[reflect(derived_type = "UiNode")]
|
||||
pub struct TileBoundsEditor {
|
||||
|
||||
@@ -544,7 +544,7 @@ fn find_collider_value(
|
||||
.unwrap_or_default()
|
||||
}
|
||||
|
||||
#[derive(Clone, Default, Debug, Visit, Reflect)]
|
||||
#[derive(Clone, Default, Debug, Visit, PartialEq, Reflect)]
|
||||
#[reflect(type_uuid = "9c65682b-0160-443c-95fc-0b88f86a497b")]
|
||||
struct InspectorField {
|
||||
handle: Handle<Grid>,
|
||||
@@ -572,7 +572,7 @@ impl InspectorField {
|
||||
|
||||
/// Object that keeps track of the editors for all the property layers.
|
||||
#[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 {
|
||||
handle: Handle<UiNode>,
|
||||
content: Handle<UiNode>,
|
||||
@@ -646,7 +646,7 @@ impl PropertyEditors {
|
||||
|
||||
/// Object that keeps track of the editors for all the collider layers.
|
||||
#[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 {
|
||||
handle: Handle<UiNode>,
|
||||
content: Handle<UiNode>,
|
||||
@@ -719,7 +719,7 @@ impl ColliderEditors {
|
||||
}
|
||||
|
||||
#[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 {
|
||||
handle: Handle<UiNode>,
|
||||
/// The shared state that represents the user's currently selected tool and tiles.
|
||||
|
||||
@@ -71,7 +71,7 @@ pub struct WfcMacro {
|
||||
current_terrain: TileTerrainId,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Visit, Reflect)]
|
||||
#[derive(Debug, Clone, PartialEq, Visit, Reflect)]
|
||||
#[reflect(type_uuid = "24f9947e-f58b-4623-ad14-cb21cd09297e")]
|
||||
pub(super) struct WfcInstance {
|
||||
frequency_property: Option<TileSetPropertyF32>,
|
||||
|
||||
@@ -46,8 +46,11 @@ pub mod sound_context;
|
||||
pub mod terrain;
|
||||
|
||||
#[derive(Reflect, Debug)]
|
||||
#[reflect(non_cloneable)]
|
||||
#[reflect(type_uuid = "4dd03d8c-b0c9-43a2-871c-55e5fd603afd")]
|
||||
#[reflect(
|
||||
type_uuid = "4dd03d8c-b0c9-43a2-871c-55e5fd603afd",
|
||||
non_cloneable,
|
||||
non_comparable
|
||||
)]
|
||||
pub struct GameSceneContext {
|
||||
pub selection: &'static mut Selection,
|
||||
pub scene: &'static mut Scene,
|
||||
|
||||
@@ -29,7 +29,7 @@ use super::*;
|
||||
|
||||
/// The [`CommandContext`] that is used when the current scene is the
|
||||
/// null scene.
|
||||
#[derive(Reflect, Debug)]
|
||||
#[derive(PartialEq, Reflect, Debug)]
|
||||
#[reflect(non_cloneable)]
|
||||
#[reflect(type_uuid = "09ba866d-db75-46fb-938b-b3cc583f4469")]
|
||||
pub struct NullSceneContext {
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
|
||||
use crate::fyrox::{
|
||||
core::{
|
||||
make_pretty_type_name, parking_lot::Mutex, pool::Handle, reflect::prelude::*,
|
||||
sstorage::ImmutableString, visitor::prelude::*,
|
||||
make_pretty_type_name, pool::Handle, reflect::prelude::*, sstorage::ImmutableString,
|
||||
visitor::prelude::*,
|
||||
},
|
||||
fxhash::FxHashSet,
|
||||
graph::SceneGraph,
|
||||
@@ -50,10 +50,10 @@ use fyrox::gui::style::resource::StyleResourceExt;
|
||||
use fyrox::gui::style::Style;
|
||||
use fyrox::gui::text_box::EmptyTextPlaceholder;
|
||||
use fyrox::gui::tree::TreeRoot;
|
||||
use fyrox::gui::widget::UserData;
|
||||
use std::{
|
||||
any::TypeId,
|
||||
ops::{Deref, DerefMut},
|
||||
sync::Arc,
|
||||
};
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
@@ -140,13 +140,13 @@ impl PropertyDescriptor {
|
||||
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 {
|
||||
name: name.clone(),
|
||||
path: self.path.clone(),
|
||||
type_id: self.type_id,
|
||||
},
|
||||
))))
|
||||
)))
|
||||
.with_items(items)
|
||||
.with_content(
|
||||
TextBuilder::new(WidgetBuilder::new().with_margin(Thickness::uniform(1.0)))
|
||||
@@ -290,7 +290,7 @@ where
|
||||
descriptors
|
||||
}
|
||||
|
||||
#[derive(Clone, Visit, Reflect, Debug)]
|
||||
#[derive(Clone, Visit, PartialEq, Reflect, Debug)]
|
||||
#[reflect(
|
||||
derived_type = "UiNode",
|
||||
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(
|
||||
derived_type = "UiNode",
|
||||
type_uuid = "725e4a10-eca6-4345-9833-d54dae2f20f2"
|
||||
|
||||
@@ -20,10 +20,7 @@
|
||||
|
||||
use crate::{
|
||||
fyrox::{
|
||||
core::{
|
||||
parking_lot::Mutex, pool::ErasedHandle, pool::Handle, reflect::prelude::*,
|
||||
visitor::prelude::*,
|
||||
},
|
||||
core::{pool::ErasedHandle, pool::Handle, reflect::prelude::*, visitor::prelude::*},
|
||||
fxhash::FxHashSet,
|
||||
graph::{NodeWrapper, SceneGraph},
|
||||
gui::{
|
||||
@@ -55,12 +52,12 @@ use fyrox::gui::scroll_viewer::ScrollViewer;
|
||||
use fyrox::gui::searchbar::SearchBar;
|
||||
use fyrox::gui::text_box::EmptyTextPlaceholder;
|
||||
use fyrox::gui::tree::TreeRoot;
|
||||
use fyrox::gui::widget::UserData;
|
||||
use std::hash::{Hash, Hasher};
|
||||
use std::{
|
||||
any::{Any, TypeId},
|
||||
fmt::Debug,
|
||||
ops::{Deref, DerefMut},
|
||||
sync::Arc,
|
||||
};
|
||||
|
||||
#[derive(Eq, Clone, Debug, PartialEq)]
|
||||
@@ -135,14 +132,12 @@ impl HierarchyNode {
|
||||
ctx.style.property(Style::BRUSH_LIGHT)
|
||||
};
|
||||
|
||||
TreeBuilder::new(
|
||||
WidgetBuilder::new().with_user_data(Arc::new(Mutex::new(TreeData {
|
||||
name: self.name.clone(),
|
||||
handle: self.handle,
|
||||
inner_type_id: self.inner_type_id,
|
||||
derived_type_ids: self.derived_type_ids.clone(),
|
||||
}))),
|
||||
)
|
||||
TreeBuilder::new(WidgetBuilder::new().with_user_data(UserData::new(TreeData {
|
||||
name: self.name.clone(),
|
||||
handle: self.handle,
|
||||
inner_type_id: self.inner_type_id,
|
||||
derived_type_ids: self.derived_type_ids.clone(),
|
||||
})))
|
||||
.with_items(
|
||||
self.children
|
||||
.iter()
|
||||
@@ -207,7 +202,7 @@ struct TreeData {
|
||||
pub derived_type_ids: Vec<TypeId>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Visit, Reflect)]
|
||||
#[derive(Debug, Clone,PartialEq, Visit, Reflect)]
|
||||
#[reflect(derived_type = "UiNode")]
|
||||
#[reflect(type_uuid = "1d718f90-323c-492d-b057-98d47495900a")]
|
||||
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(derived_type = "UiNode")]
|
||||
pub struct NodeSelectorWindow {
|
||||
|
||||
@@ -56,7 +56,7 @@ use crate::{
|
||||
GameScene, Message,
|
||||
};
|
||||
use fyrox::gui::inspector::editors::inspectable::InspectablePropertyEditorDefinition;
|
||||
use fyrox::gui::inspector::Inspector;
|
||||
use fyrox::gui::inspector::{Inspector, InspectorEnvironmentContainer};
|
||||
use std::sync::{mpsc::Sender, Arc};
|
||||
|
||||
pub struct SceneSettingsWindow {
|
||||
@@ -160,7 +160,7 @@ impl SceneSettingsWindow {
|
||||
object,
|
||||
ctx: &mut ui.build_ctx(),
|
||||
definition_container: self.property_definitions.clone(),
|
||||
environment: Some(environment),
|
||||
environment: Some(InspectorEnvironmentContainer(environment)),
|
||||
layer_index: 0,
|
||||
generate_property_string_values: false,
|
||||
filter: PropertyFilter::new(|property| {
|
||||
|
||||
@@ -40,6 +40,15 @@ pub struct UiSceneContext {
|
||||
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 {
|
||||
pub fn exec<'a, F>(
|
||||
ui: &'a mut UserInterface,
|
||||
|
||||
@@ -43,7 +43,7 @@ use fyrox::gui::image::Image;
|
||||
|
||||
pub mod move_mode;
|
||||
|
||||
#[derive(Reflect, Clone, Debug)]
|
||||
#[derive(PartialEq, Reflect, Clone, Debug)]
|
||||
#[reflect(type_uuid = "12e550dc-0fb2-4a45-8060-fa363db3e197")]
|
||||
pub struct UiSelectInteractionMode {
|
||||
preview: Handle<Image>,
|
||||
|
||||
@@ -34,7 +34,7 @@ use crate::{
|
||||
};
|
||||
use fyrox::gui::button::Button;
|
||||
|
||||
#[derive(Reflect, Debug, Clone)]
|
||||
#[derive(PartialEq, Reflect, Debug, Clone)]
|
||||
#[reflect(type_uuid = "05a1b439-d354-45b1-9014-10393c5ba35d")]
|
||||
struct Entry {
|
||||
widget: Handle<UiNode>,
|
||||
@@ -43,13 +43,13 @@ struct Entry {
|
||||
delta: Vector2<f32>,
|
||||
}
|
||||
|
||||
#[derive(Reflect, Debug, Clone)]
|
||||
#[derive(PartialEq, Reflect, Debug, Clone)]
|
||||
#[reflect(type_uuid = "c9b6b3d6-ade9-4da2-a5e7-48893f24d97f")]
|
||||
struct MoveContext {
|
||||
entries: Vec<Entry>,
|
||||
}
|
||||
|
||||
#[derive(Reflect, Debug, Clone)]
|
||||
#[derive(PartialEq, Reflect, Debug, Clone)]
|
||||
#[reflect(type_uuid = "e5c09b04-5c31-4044-ac48-5227ab4a4b83")]
|
||||
pub struct MoveWidgetsInteractionMode {
|
||||
move_context: Option<MoveContext>,
|
||||
|
||||
@@ -62,7 +62,7 @@ pub enum SceneItemMessage {
|
||||
}
|
||||
impl MessageData for SceneItemMessage {}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
#[derive(Copy, PartialEq, Clone)]
|
||||
pub enum DropAnchor {
|
||||
Side {
|
||||
visual_offset: f32,
|
||||
@@ -71,7 +71,7 @@ pub enum DropAnchor {
|
||||
OnTop,
|
||||
}
|
||||
|
||||
#[derive(Visit, Reflect)]
|
||||
#[derive(Visit, PartialEq, Reflect)]
|
||||
#[reflect(derived_type = "UiNode")]
|
||||
#[reflect(type_uuid = "16f35257-a250-413b-ab51-b1ad086a3a9c")]
|
||||
pub struct SceneItem {
|
||||
|
||||
@@ -119,7 +119,7 @@ pub trait PatternSource {
|
||||
/// 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
|
||||
/// may change.
|
||||
#[derive(Debug, Default, Clone, Copy)]
|
||||
#[derive(Debug, Default, Clone, PartialEq, Copy)]
|
||||
pub struct ConstraintFillRules {
|
||||
/// True if adjacent cells should be automatically added to the autotiling constraint
|
||||
/// so that they may be modified.
|
||||
|
||||
@@ -49,7 +49,7 @@ pub struct BuildOutput {
|
||||
|
||||
pub type BuildResult = Result<BuildOutput, String>;
|
||||
|
||||
#[derive(Reflect, Debug, Clone)]
|
||||
#[derive(PartialEq, Reflect, Debug, Clone)]
|
||||
#[reflect(type_uuid = "b1387e05-fb9f-48d8-8776-5b1d2993fa1a")]
|
||||
pub struct ExportOptions {
|
||||
#[reflect(hidden)]
|
||||
|
||||
@@ -43,7 +43,7 @@ clap = { version = "4", features = ["derive"] }
|
||||
winit = { version = "0.30", features = ["serde"] }
|
||||
half = { version = "2.2.1", features = ["bytemuck"] }
|
||||
base64 = "0.22.1"
|
||||
uvgen = "0.3.0"
|
||||
uvgen = "0.4.0"
|
||||
lightmap = "0.6.0"
|
||||
libloading = "0.9"
|
||||
gltf = { version = "1.4.0", default-features = false, features = ["names", "utils", "extras", "KHR_materials_emissive_strength"] }
|
||||
|
||||
@@ -149,8 +149,9 @@ use winit::{
|
||||
#[reflect(
|
||||
hide_all,
|
||||
non_cloneable,
|
||||
non_comparable,
|
||||
type_uuid = "1973a8c9-6ac6-48a2-bca1-9b4f3cce0774"
|
||||
)] // TODO
|
||||
)]
|
||||
pub struct SerializationContext {
|
||||
/// A node constructor container.
|
||||
pub node_constructors: NodeConstructorContainer,
|
||||
@@ -2926,7 +2927,7 @@ mod test {
|
||||
}
|
||||
|
||||
#[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 {
|
||||
#[reflect(hidden)]
|
||||
#[visit(skip)]
|
||||
@@ -2993,7 +2994,7 @@ mod test {
|
||||
}
|
||||
|
||||
#[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 {
|
||||
#[reflect(hidden)]
|
||||
#[visit(skip)]
|
||||
@@ -3152,7 +3153,7 @@ mod test {
|
||||
}
|
||||
|
||||
#[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 {
|
||||
index: u32,
|
||||
#[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")]
|
||||
struct ScriptSendingMessages {
|
||||
index: u32,
|
||||
@@ -3392,7 +3393,7 @@ mod test {
|
||||
}
|
||||
|
||||
#[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 {
|
||||
#[reflect(hidden)]
|
||||
#[visit(skip)]
|
||||
@@ -3433,7 +3434,7 @@ mod test {
|
||||
}
|
||||
|
||||
#[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 {
|
||||
num: usize,
|
||||
#[reflect(hidden)]
|
||||
@@ -3482,7 +3483,7 @@ mod test {
|
||||
}
|
||||
|
||||
#[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 {
|
||||
stuff: usize,
|
||||
#[reflect(hidden)]
|
||||
|
||||
@@ -72,7 +72,7 @@ impl From<VisitError> for CurveResourceError {
|
||||
}
|
||||
|
||||
/// 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")]
|
||||
pub struct CurveResourceState {
|
||||
/// Actual curve.
|
||||
|
||||
@@ -81,7 +81,7 @@ use uuid::uuid;
|
||||
pub mod loader;
|
||||
|
||||
/// See module docs.
|
||||
#[derive(Debug, Clone, Visit, Reflect)]
|
||||
#[derive(Debug, PartialEq, Clone, Visit, Reflect)]
|
||||
#[reflect(type_uuid = "44cd768f-b4ca-4804-a98c-0adf85577ada")]
|
||||
pub struct Model {
|
||||
#[visit(skip)]
|
||||
|
||||
@@ -219,7 +219,7 @@ type AnimationPlayerHandle = InheritableVariable<Handle<AnimationPlayer>>;
|
||||
/// .build(graph)
|
||||
/// }
|
||||
/// ```
|
||||
#[derive(Visit, Reflect, Clone, Debug, Default)]
|
||||
#[derive(Visit, PartialEq, Reflect, Clone, Debug, Default)]
|
||||
#[reflect(
|
||||
derived_type = "Node",
|
||||
type_uuid = "4b08c753-2a10-41e3-8fb2-4fd0517e86bc"
|
||||
|
||||
@@ -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
|
||||
/// (`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`].
|
||||
#[derive(Visit, Reflect, Clone, Debug)]
|
||||
#[derive(Visit, PartialEq, Reflect, Clone, Debug)]
|
||||
#[reflect(
|
||||
derived_type = "Node",
|
||||
type_uuid = "44d1c94e-354f-4f9a-b918-9d31c28aa16a"
|
||||
|
||||
@@ -237,7 +237,7 @@ impl Visit for SceneNodeId {
|
||||
}
|
||||
|
||||
/// A script container record.
|
||||
#[derive(Clone, Reflect, Debug, Default)]
|
||||
#[derive(Clone, Reflect, Debug, PartialEq, Default)]
|
||||
#[reflect(type_uuid = "51bc577b-5a50-4a97-9b31-eda2f3d46c9d")]
|
||||
pub struct ScriptRecord {
|
||||
// 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> {
|
||||
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.
|
||||
/// 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
|
||||
@@ -366,17 +384,14 @@ impl<T> DerefMut for TrackedProperty<T> {
|
||||
/// .build(graph)
|
||||
/// }
|
||||
/// ```
|
||||
#[derive(Debug, Reflect, Clone)]
|
||||
#[derive(Debug, Reflect, PartialEq, Clone)]
|
||||
#[reflect(type_uuid = "5bf7fb77-fd50-4b92-83d7-27153b7da531")]
|
||||
pub struct Base {
|
||||
#[reflect(hidden)]
|
||||
self_handle: Handle<Node>,
|
||||
|
||||
#[reflect(hidden)]
|
||||
script_message_sender: Option<Sender<NodeScriptMessage>>,
|
||||
|
||||
#[reflect(hidden)]
|
||||
message_sender: Option<Sender<NodeMessage>>,
|
||||
senders: Option<MessageSenders>,
|
||||
|
||||
// Name is not inheritable, because property inheritance works bad with external 3D models.
|
||||
// They use names to search "original" nodes.
|
||||
@@ -509,8 +524,10 @@ impl Base {
|
||||
script_message_sender: Sender<NodeScriptMessage>,
|
||||
) {
|
||||
self.self_handle = self_handle;
|
||||
self.message_sender = Some(message_sender.clone());
|
||||
self.script_message_sender = Some(script_message_sender);
|
||||
self.senders = Some(MessageSenders {
|
||||
message_sender: message_sender.clone(),
|
||||
script_message_sender,
|
||||
});
|
||||
self.local_transform
|
||||
.set_message_data(message_sender.clone(), self_handle);
|
||||
self.visibility
|
||||
@@ -523,10 +540,10 @@ impl Base {
|
||||
}
|
||||
|
||||
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;
|
||||
};
|
||||
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
|
||||
@@ -866,12 +883,14 @@ impl Base {
|
||||
// We might be in a middle of a script method execution, where script is temporarily
|
||||
// extracted from the array.
|
||||
if let Some(script) = entry.take() {
|
||||
if let Some(sender) = self.script_message_sender.as_ref() {
|
||||
Log::verify(sender.send(NodeScriptMessage::DestroyScript {
|
||||
script,
|
||||
handle: self.self_handle,
|
||||
script_index: index,
|
||||
}));
|
||||
if let Some(senders) = self.senders.as_ref() {
|
||||
Log::verify(senders.script_message_sender.send(
|
||||
NodeScriptMessage::DestroyScript {
|
||||
script,
|
||||
handle: self.self_handle,
|
||||
script_index: index,
|
||||
},
|
||||
));
|
||||
} else {
|
||||
Log::warn(format!(
|
||||
"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) {
|
||||
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() {
|
||||
Log::verify(sender.send(NodeScriptMessage::InitializeScript {
|
||||
handle: self.self_handle,
|
||||
script_index: index,
|
||||
}));
|
||||
Log::verify(senders.script_message_sender.send(
|
||||
NodeScriptMessage::InitializeScript {
|
||||
handle: self.self_handle,
|
||||
script_index: index,
|
||||
},
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -922,11 +943,15 @@ impl Base {
|
||||
{
|
||||
let script_index = self.scripts.len();
|
||||
self.scripts.push(ScriptRecord::new(Script::new(script)));
|
||||
if let Some(sender) = self.script_message_sender.as_ref() {
|
||||
Log::verify(sender.send(NodeScriptMessage::InitializeScript {
|
||||
handle: self.self_handle,
|
||||
script_index,
|
||||
}));
|
||||
if let Some(senders) = self.senders.as_ref() {
|
||||
Log::verify(
|
||||
senders
|
||||
.script_message_sender
|
||||
.send(NodeScriptMessage::InitializeScript {
|
||||
handle: self.self_handle,
|
||||
script_index,
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1344,8 +1369,7 @@ impl BaseBuilder {
|
||||
pub fn build_base(self) -> Base {
|
||||
Base {
|
||||
self_handle: Default::default(),
|
||||
script_message_sender: None,
|
||||
message_sender: None,
|
||||
senders: None,
|
||||
name: self.name.into(),
|
||||
children: self.children,
|
||||
local_transform: TrackedProperty::unbound(
|
||||
|
||||
@@ -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
|
||||
/// of your GPU.
|
||||
#[derive(Debug, Visit, Reflect, Clone)]
|
||||
#[derive(Debug, Visit, PartialEq, Reflect, Clone)]
|
||||
#[reflect(
|
||||
derived_type = "Node",
|
||||
type_uuid = "198d3aca-433c-4ce1-bb25-3190699b757f"
|
||||
|
||||
@@ -617,7 +617,7 @@ impl ColliderShape {
|
||||
|
||||
/// 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.
|
||||
#[derive(Reflect, Visit, Debug)]
|
||||
#[derive(PartialEq, Reflect, Visit, Debug)]
|
||||
#[reflect(
|
||||
derived_type = "Node",
|
||||
type_uuid = "bfaa2e82-9c19-4b99-983b-3bc115744a1d"
|
||||
|
||||
@@ -32,7 +32,7 @@ use rapier2d::pipeline::{DebugColor, DebugRenderObject};
|
||||
use std::ops::Range;
|
||||
|
||||
/// Colored line between two points.
|
||||
#[derive(Clone, Debug)]
|
||||
#[derive(Clone, PartialEq, Debug)]
|
||||
pub struct Line {
|
||||
/// Beginning of the line.
|
||||
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
|
||||
/// up to few millions of lines without any significant performance issues.
|
||||
#[derive(Default, Clone, Debug)]
|
||||
#[derive(Default, PartialEq, Clone, Debug)]
|
||||
pub struct SceneDrawingContext {
|
||||
/// List of lines to draw.
|
||||
pub lines: Vec<Line>,
|
||||
|
||||
@@ -107,7 +107,7 @@ use std::ops::{Deref, DerefMut};
|
||||
/// .build(graph)
|
||||
/// }
|
||||
/// ```
|
||||
#[derive(Debug, Visit, Default, Clone, Reflect)]
|
||||
#[derive(Debug, Visit, Default, Clone, PartialEq, Reflect)]
|
||||
#[reflect(
|
||||
derived_type = "Node",
|
||||
type_uuid = "c4d24e48-edd1-4fb2-ad82-4b3d3ea985d8"
|
||||
|
||||
@@ -273,7 +273,7 @@ impl ColliderShape {
|
||||
|
||||
/// 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.
|
||||
#[derive(Reflect, Visit, Debug)]
|
||||
#[derive(PartialEq, Reflect, Visit, Debug)]
|
||||
#[reflect(
|
||||
derived_type = "Node",
|
||||
type_uuid = "2b1659ea-a116-4224-bcd4-7931e3ae3b40"
|
||||
@@ -865,7 +865,6 @@ impl ColliderBuilder {
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
|
||||
use crate::core::algebra::Vector2;
|
||||
use crate::scene::{
|
||||
base::BaseBuilder,
|
||||
|
||||
@@ -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")]
|
||||
pub(crate) struct LocalFrame {
|
||||
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")]
|
||||
pub(crate) struct JointLocalFrames {
|
||||
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
|
||||
/// real life: door hinge, ball joints in human arms, etc.
|
||||
#[derive(Visit, Reflect, Debug)]
|
||||
#[derive(Visit, PartialEq, Reflect, Debug)]
|
||||
#[reflect(
|
||||
derived_type = "Node",
|
||||
type_uuid = "b8d66eda-b69f-4c57-80ba-d76665573565"
|
||||
|
||||
@@ -520,6 +520,15 @@ pub struct PhysicsWorld {
|
||||
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 {
|
||||
fn clone(&self) -> Self {
|
||||
PhysicsWorld {
|
||||
@@ -984,7 +993,7 @@ impl PhysicsWorld {
|
||||
// 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.
|
||||
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 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
|
||||
|
||||
@@ -170,7 +170,7 @@ impl Hash for RectangleVertex {
|
||||
/// 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
|
||||
/// right-bottom corner.
|
||||
#[derive(Reflect, Debug, Clone, Visit)]
|
||||
#[derive(PartialEq, Reflect, Debug, Clone, Visit)]
|
||||
#[reflect(
|
||||
derived_type = "Node",
|
||||
type_uuid = "bb57b5e0-367a-4490-bf30-7f547407d5b5"
|
||||
|
||||
@@ -34,7 +34,6 @@ use crate::{
|
||||
algebra::{Isometry2, Matrix4, UnitComplex, Vector2},
|
||||
log::Log,
|
||||
math::{aabb::AxisAlignedBoundingBox, m4x4_approx_eq},
|
||||
parking_lot::Mutex,
|
||||
pool::Handle,
|
||||
reflect::prelude::*,
|
||||
uuid::{uuid, Uuid},
|
||||
@@ -52,17 +51,17 @@ use crate::{
|
||||
};
|
||||
|
||||
use crate::scene::dim2::collider::ColliderShape;
|
||||
use crate::utils::ThreadSafeQueue;
|
||||
use fyrox_graph::constructor::ConstructorProvider;
|
||||
use fyrox_graph::SceneGraph;
|
||||
use rapier2d::prelude::RigidBodyHandle;
|
||||
use std::{
|
||||
cell::Cell,
|
||||
collections::VecDeque,
|
||||
fmt::{Debug, Formatter},
|
||||
ops::{Deref, DerefMut},
|
||||
};
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub(crate) enum ApplyAction {
|
||||
Force(Vector2<f32>),
|
||||
Torque(f32),
|
||||
@@ -82,6 +81,8 @@ pub(crate) enum ApplyAction {
|
||||
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.
|
||||
/// 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
|
||||
/// 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(
|
||||
derived_type = "Node",
|
||||
type_uuid = "0b242335-75a4-4c65-9685-3e82a8979047"
|
||||
@@ -148,7 +149,7 @@ pub struct RigidBody {
|
||||
|
||||
#[visit(skip)]
|
||||
#[reflect(hidden)]
|
||||
pub(crate) actions: Mutex<VecDeque<ApplyAction>>,
|
||||
pub(crate) actions: ActionsQueue,
|
||||
}
|
||||
|
||||
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
|
||||
/// next simulation step. This does nothing on non-dynamic bodies.
|
||||
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
|
||||
/// the next simulation step. This does nothing on non-dynamic bodies.
|
||||
pub fn apply_torque(&mut self, torque: f32) {
|
||||
self.actions
|
||||
.get_mut()
|
||||
.push_back(ApplyAction::Torque(torque))
|
||||
self.actions.push(ApplyAction::Torque(torque))
|
||||
}
|
||||
|
||||
/// 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.
|
||||
pub fn apply_force_at_point(&mut self, force: Vector2<f32>, point: Vector2<f32>) {
|
||||
self.actions
|
||||
.get_mut()
|
||||
.push_back(ApplyAction::ForceAtPoint { force, point })
|
||||
.push(ApplyAction::ForceAtPoint { force, point })
|
||||
}
|
||||
|
||||
/// 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.
|
||||
pub fn apply_impulse(&mut self, impulse: Vector2<f32>) {
|
||||
self.actions
|
||||
.get_mut()
|
||||
.push_back(ApplyAction::Impulse(impulse))
|
||||
self.actions.push(ApplyAction::Impulse(impulse))
|
||||
}
|
||||
|
||||
/// 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.
|
||||
pub fn apply_torque_impulse(&mut self, torque_impulse: f32) {
|
||||
self.actions
|
||||
.get_mut()
|
||||
.push_back(ApplyAction::TorqueImpulse(torque_impulse))
|
||||
.push(ApplyAction::TorqueImpulse(torque_impulse))
|
||||
}
|
||||
|
||||
/// Applies an impulse at the given world-space point of this rigid-body. The impulse is applied
|
||||
@@ -401,32 +396,25 @@ impl RigidBody {
|
||||
/// bodies.
|
||||
pub fn apply_impulse_at_point(&mut self, impulse: Vector2<f32>, point: Vector2<f32>) {
|
||||
self.actions
|
||||
.get_mut()
|
||||
.push_back(ApplyAction::ImpulseAtPoint { impulse, point })
|
||||
.push(ApplyAction::ImpulseAtPoint { impulse, point })
|
||||
}
|
||||
|
||||
/// If this rigid body is kinematic, sets its future translation after
|
||||
/// the next timestep integration.
|
||||
pub fn set_next_kinematic_translation(&mut self, translation: Vector2<f32>) {
|
||||
self.actions
|
||||
.get_mut()
|
||||
.push_back(ApplyAction::NextTranslation(translation));
|
||||
self.actions.push(ApplyAction::NextTranslation(translation));
|
||||
}
|
||||
|
||||
/// If this rigid body is kinematic, sets its future orientation after
|
||||
/// the next timestep integration.
|
||||
pub fn set_next_kinematic_rotation(&mut self, rotation: UnitComplex<f32>) {
|
||||
self.actions
|
||||
.get_mut()
|
||||
.push_back(ApplyAction::NextRotation(rotation));
|
||||
self.actions.push(ApplyAction::NextRotation(rotation));
|
||||
}
|
||||
|
||||
/// If this rigid body is kinematic, sets its future position (translation and orientation) after
|
||||
/// the next timestep integration.
|
||||
pub fn set_next_kinematic_position(&mut self, position: Isometry2<f32>) {
|
||||
self.actions
|
||||
.get_mut()
|
||||
.push_back(ApplyAction::NextPosition(position));
|
||||
self.actions.push(ApplyAction::NextPosition(position));
|
||||
}
|
||||
|
||||
/// 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.
|
||||
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 {
|
||||
|
||||
@@ -90,7 +90,7 @@ pub mod physics;
|
||||
|
||||
/// Graph performance statistics. Allows you to find out "hot" parts of the scene graph, which
|
||||
/// parts takes the most time to update.
|
||||
#[derive(Clone, Default, Debug)]
|
||||
#[derive(Clone, PartialEq, Default, Debug)]
|
||||
pub struct GraphPerformanceStatistics {
|
||||
/// 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.
|
||||
@@ -174,6 +174,12 @@ pub struct Graph {
|
||||
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 {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.debug_struct("Graph")
|
||||
|
||||
@@ -193,7 +193,7 @@ impl Into<rapier2d::dynamics::CoefficientCombineRule> for CoefficientCombineRule
|
||||
}
|
||||
|
||||
/// Performance statistics for the physics part of the engine.
|
||||
#[derive(Debug, Default, Clone)]
|
||||
#[derive(Debug, PartialEq, Default, Clone)]
|
||||
pub struct PhysicsPerformanceStatistics {
|
||||
/// A time that was needed to perform a single simulation step.
|
||||
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
|
||||
/// as RigidBody, Collider, Joint.
|
||||
#[derive(Visit, Reflect)]
|
||||
#[reflect(type_uuid = "17e663b8-98a4-46db-be71-a336246f571a")]
|
||||
#[reflect(type_uuid = "17e663b8-98a4-46db-be71-a336246f571a", non_comparable)]
|
||||
pub struct PhysicsWorld {
|
||||
/// A flag that defines whether physics simulation is enabled or not.
|
||||
pub enabled: InheritableVariable<bool>,
|
||||
@@ -1441,7 +1441,7 @@ impl PhysicsWorld {
|
||||
// 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.
|
||||
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 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
|
||||
|
||||
@@ -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")]
|
||||
pub(crate) struct LocalFrame {
|
||||
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")]
|
||||
pub(crate) struct JointLocalFrames {
|
||||
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
|
||||
/// real life: door hinge, ball joints in human arms, etc.
|
||||
#[derive(Visit, Reflect, Debug)]
|
||||
#[derive(Visit, PartialEq, Reflect, Debug)]
|
||||
#[reflect(
|
||||
derived_type = "Node",
|
||||
type_uuid = "439d48f5-e3a3-4255-aa08-353c1ca42e3b"
|
||||
|
||||
@@ -125,7 +125,7 @@ impl CsmOptions {
|
||||
}
|
||||
|
||||
/// See module docs.
|
||||
#[derive(Default, Debug, Visit, Reflect, Clone)]
|
||||
#[derive(Default, Debug, Visit, PartialEq, Reflect, Clone)]
|
||||
#[reflect(
|
||||
derived_type = "Node",
|
||||
type_uuid = "8b8248e1-1cdf-42a3-9abe-0691de82c519"
|
||||
|
||||
@@ -67,7 +67,7 @@ pub const DEFAULT_SCATTER_B: f32 = 0.03;
|
||||
/// Light scene node. It contains common properties of light such as color,
|
||||
/// scattering factor (per color channel) and other useful properties. Exact
|
||||
/// 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")]
|
||||
pub struct BaseLight {
|
||||
base: Base,
|
||||
|
||||
@@ -62,7 +62,7 @@ use fyrox_graph::SceneGraph;
|
||||
use std::ops::{Deref, DerefMut};
|
||||
|
||||
/// See module docs.
|
||||
#[derive(Debug, Reflect, Clone, Visit)]
|
||||
#[derive(Debug, PartialEq, Reflect, Clone, Visit)]
|
||||
#[reflect(
|
||||
derived_type = "Node",
|
||||
type_uuid = "c81dcc31-7cb9-465f-abd9-b385ac6f4d37"
|
||||
|
||||
@@ -69,7 +69,7 @@ use fyrox_graph::SceneGraph;
|
||||
use std::ops::{Deref, DerefMut};
|
||||
|
||||
/// See module docs.
|
||||
#[derive(Debug, Reflect, Clone, Visit)]
|
||||
#[derive(Debug, PartialEq, Reflect, Clone, Visit)]
|
||||
#[reflect(
|
||||
derived_type = "Node",
|
||||
type_uuid = "9856a3c1-ced7-47ec-b682-4dc4dea89d8f"
|
||||
|
||||
@@ -170,7 +170,7 @@ pub struct VertexAttributeDescriptor {
|
||||
|
||||
/// 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.
|
||||
#[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")]
|
||||
pub struct VertexAttribute {
|
||||
/// 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.
|
||||
#[derive(Reflect, Clone, Debug)]
|
||||
#[derive(Reflect, Clone, PartialEq, Debug)]
|
||||
#[reflect(type_uuid = "493045ee-fba2-4c5f-a5cd-c27034d1ec71")]
|
||||
pub struct BytesStorage {
|
||||
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
|
||||
/// 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")]
|
||||
pub struct VertexBuffer {
|
||||
dense_layout: Vec<VertexAttribute>,
|
||||
@@ -1468,7 +1468,7 @@ impl VertexWriteTrait for VertexViewMut<'_> {
|
||||
}
|
||||
|
||||
/// 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")]
|
||||
pub struct TriangleBuffer {
|
||||
triangles: Vec<TriangleDefinition>,
|
||||
|
||||
@@ -157,13 +157,13 @@ pub enum BatchingMode {
|
||||
Dynamic,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Debug, PartialEq, Clone)]
|
||||
struct Batch {
|
||||
data: SurfaceResource,
|
||||
material: MaterialResource,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Clone)]
|
||||
#[derive(Debug, Default, PartialEq, Clone)]
|
||||
struct BatchContainer {
|
||||
batches: FxHashMap<u64, Batch>,
|
||||
}
|
||||
@@ -192,6 +192,12 @@ impl BatchContainer {
|
||||
#[derive(Debug, Default)]
|
||||
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 {
|
||||
fn clone(&self) -> Self {
|
||||
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
|
||||
/// custom surface, see [`crate::scene::mesh::surface::SurfaceData`] docs for more info.
|
||||
#[derive(Debug, Reflect, Clone, Visit)]
|
||||
#[derive(Debug, PartialEq, Reflect, Clone, Visit)]
|
||||
#[reflect(
|
||||
derived_type = "Node",
|
||||
type_uuid = "caaf9d7b-bd74-48ce-b7cc-57e9dc65c2e6"
|
||||
|
||||
@@ -87,7 +87,7 @@ impl Default for BlendShape {
|
||||
}
|
||||
|
||||
/// 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")]
|
||||
pub struct BlendShapesContainer {
|
||||
/// 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
|
||||
/// in instancing technique to render multiple instances of same model at different
|
||||
/// places.
|
||||
#[derive(Debug, Clone, Default, Reflect)]
|
||||
#[derive(Debug, Clone, Default, PartialEq, Reflect)]
|
||||
#[reflect(type_uuid = "8a23a414-e66d-4e12-9628-92c6ab49c2f0")]
|
||||
pub struct SurfaceData {
|
||||
/// Current vertex buffer.
|
||||
|
||||
@@ -240,7 +240,7 @@ impl Clone for SceneRenderingOptions {
|
||||
}
|
||||
|
||||
/// See module docs.
|
||||
#[derive(Debug, Reflect)]
|
||||
#[derive(Debug, PartialEq, Reflect)]
|
||||
#[reflect(type_uuid = "03b3f812-3518-429b-befe-3f7a160503fa")]
|
||||
pub struct Scene {
|
||||
/// 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.
|
||||
#[derive(Clone, Default, Debug)]
|
||||
#[derive(Clone, PartialEq, Default, Debug)]
|
||||
pub struct PerformanceStatistics {
|
||||
/// Graph performance statistics.
|
||||
pub graph: GraphPerformanceStatistics,
|
||||
|
||||
@@ -156,7 +156,7 @@ impl Visit for Container {
|
||||
/// scene.graph[handle].as_navigational_mesh_mut()
|
||||
/// }
|
||||
/// ```
|
||||
#[derive(Debug, Clone, Visit, Reflect, Default)]
|
||||
#[derive(Debug, Clone, Visit, PartialEq, Reflect, Default)]
|
||||
#[reflect(
|
||||
derived_type = "Node",
|
||||
type_uuid = "d0ce963c-b50a-4707-bd21-af6dc0d1c668"
|
||||
|
||||
@@ -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
|
||||
/// 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")]
|
||||
pub struct NodeContainer(Option<Node>);
|
||||
|
||||
|
||||
@@ -362,6 +362,12 @@ impl<T: NodeTrait> ObjectOrVariantHelper<Node, T> for PhantomData<T> {
|
||||
#[reflect(type_uuid = "a9bc5231-155c-4564-b0ca-f23972673925")]
|
||||
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 {
|
||||
fn from(value: T) -> Self {
|
||||
Self(Box::new(value))
|
||||
@@ -608,7 +614,7 @@ mod test {
|
||||
use fyrox_resource::untyped::ResourceKind;
|
||||
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")]
|
||||
struct MyScript {
|
||||
some_field: InheritableVariable<String>,
|
||||
|
||||
@@ -63,7 +63,7 @@ pub mod emitter;
|
||||
pub mod particle;
|
||||
|
||||
/// Pseudo-random numbers generator for particle systems.
|
||||
#[derive(Debug, Clone, Reflect)]
|
||||
#[derive(Debug, Clone, PartialEq, Reflect)]
|
||||
#[reflect(type_uuid = "13d58184-e65c-41a3-9986-fc8d31231636")]
|
||||
pub struct ParticleSystemRng {
|
||||
rng_seed: u64,
|
||||
@@ -218,7 +218,7 @@ impl Visit for ParticleSystemRng {
|
||||
/// .build(graph);
|
||||
/// }
|
||||
/// ```
|
||||
#[derive(Debug, Clone, Reflect)]
|
||||
#[derive(Debug, Clone, PartialEq, Reflect)]
|
||||
#[reflect(
|
||||
derived_type = "Node",
|
||||
type_uuid = "8b210eff-97a4-494f-ba7a-a581d3f4a442"
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user