diff --git a/Source/Editor/Analytics/EditorAnalytics.cpp b/Source/Editor/Analytics/EditorAnalytics.cpp
index d0642fd99..009b0e8ca 100644
--- a/Source/Editor/Analytics/EditorAnalytics.cpp
+++ b/Source/Editor/Analytics/EditorAnalytics.cpp
@@ -73,7 +73,7 @@ void EditorAnalytics::StartSession()
}
if (ScreenResolution.IsEmpty())
{
- const Vector2 desktopSize = Platform::GetDesktopSize();
+ const auto desktopSize = Platform::GetDesktopSize();
ScreenResolution = StringAnsi(StringUtils::ToString((int32)desktopSize.X)) + "x" + StringAnsi(StringUtils::ToString((int32)desktopSize.Y));
}
if (UserLanguage.IsEmpty())
diff --git a/Source/Editor/Content/Create/CreateFilesDialog.cs b/Source/Editor/Content/Create/CreateFilesDialog.cs
index 7df58a847..f1ed1457c 100644
--- a/Source/Editor/Content/Create/CreateFilesDialog.cs
+++ b/Source/Editor/Content/Create/CreateFilesDialog.cs
@@ -84,7 +84,7 @@ namespace FlaxEditor.Content.Create
_settingsEditor = new CustomEditorPresenter(null);
_settingsEditor.Panel.Parent = panel;
- _dialogSize = new Vector2(TotalWidth, panel.Bottom);
+ _dialogSize = new Float2(TotalWidth, panel.Bottom);
_settingsEditor.Select(_entry.Settings);
}
@@ -102,7 +102,7 @@ namespace FlaxEditor.Content.Create
{
base.SetupWindowSettings(ref settings);
- settings.MinimumSize = new Vector2(300, 400);
+ settings.MinimumSize = new Float2(300, 400);
settings.HasSizingFrame = true;
}
}
diff --git a/Source/Editor/Content/GUI/ContentNavigationButton.cs b/Source/Editor/Content/GUI/ContentNavigationButton.cs
index 74e4d2995..de353113e 100644
--- a/Source/Editor/Content/GUI/ContentNavigationButton.cs
+++ b/Source/Editor/Content/GUI/ContentNavigationButton.cs
@@ -66,7 +66,7 @@ namespace FlaxEditor.Content.GUI
}
///
- public override DragDropEffect OnDragEnter(ref Vector2 location, DragData data)
+ public override DragDropEffect OnDragEnter(ref Float2 location, DragData data)
{
base.OnDragEnter(ref location, data);
@@ -80,7 +80,7 @@ namespace FlaxEditor.Content.GUI
}
///
- public override DragDropEffect OnDragMove(ref Vector2 location, DragData data)
+ public override DragDropEffect OnDragMove(ref Float2 location, DragData data)
{
base.OnDragMove(ref location, data);
@@ -97,7 +97,7 @@ namespace FlaxEditor.Content.GUI
}
///
- public override DragDropEffect OnDragDrop(ref Vector2 location, DragData data)
+ public override DragDropEffect OnDragDrop(ref Float2 location, DragData data)
{
var result = DragDropEffect.None;
base.OnDragDrop(ref location, data);
diff --git a/Source/Editor/Content/GUI/ContentView.DragDrop.cs b/Source/Editor/Content/GUI/ContentView.DragDrop.cs
index 1f41809cf..3d82c6bd8 100644
--- a/Source/Editor/Content/GUI/ContentView.DragDrop.cs
+++ b/Source/Editor/Content/GUI/ContentView.DragDrop.cs
@@ -13,7 +13,7 @@ namespace FlaxEditor.Content.GUI
private DragActors _dragActors;
///
- public override DragDropEffect OnDragEnter(ref Vector2 location, DragData data)
+ public override DragDropEffect OnDragEnter(ref Float2 location, DragData data)
{
var result = base.OnDragEnter(ref location, data);
if (result != DragDropEffect.None)
@@ -50,7 +50,7 @@ namespace FlaxEditor.Content.GUI
}
///
- public override DragDropEffect OnDragMove(ref Vector2 location, DragData data)
+ public override DragDropEffect OnDragMove(ref Float2 location, DragData data)
{
_validDragOver = false;
var result = base.OnDragMove(ref location, data);
@@ -72,7 +72,7 @@ namespace FlaxEditor.Content.GUI
}
///
- public override DragDropEffect OnDragDrop(ref Vector2 location, DragData data)
+ public override DragDropEffect OnDragDrop(ref Float2 location, DragData data)
{
var result = base.OnDragDrop(ref location, data);
if (result != DragDropEffect.None)
diff --git a/Source/Editor/Content/GUI/ContentView.cs b/Source/Editor/Content/GUI/ContentView.cs
index 5d6041af0..e0affeedc 100644
--- a/Source/Editor/Content/GUI/ContentView.cs
+++ b/Source/Editor/Content/GUI/ContentView.cs
@@ -594,18 +594,18 @@ namespace FlaxEditor.Content.GUI
// Check if drag is over
if (IsDragOver && _validDragOver)
{
- Render2D.FillRectangle(new Rectangle(Vector2.Zero, Size), style.BackgroundSelected * 0.4f);
+ Render2D.FillRectangle(new Rectangle(Float2.Zero, Size), style.BackgroundSelected * 0.4f);
}
// Check if it's an empty thing
if (_items.Count == 0)
{
- Render2D.DrawText(style.FontSmall, IsSearching ? "No results" : "Empty", new Rectangle(Vector2.Zero, Size), style.ForegroundDisabled, TextAlignment.Center, TextAlignment.Center);
+ Render2D.DrawText(style.FontSmall, IsSearching ? "No results" : "Empty", new Rectangle(Float2.Zero, Size), style.ForegroundDisabled, TextAlignment.Center, TextAlignment.Center);
}
}
///
- public override bool OnMouseDown(Vector2 location, MouseButton button)
+ public override bool OnMouseDown(Float2 location, MouseButton button)
{
if (base.OnMouseDown(location, button))
return true;
@@ -613,7 +613,7 @@ namespace FlaxEditor.Content.GUI
}
///
- public override bool OnMouseWheel(Vector2 location, float delta)
+ public override bool OnMouseWheel(Float2 location, float delta)
{
// Check if pressing control key
if (Root.GetKey(KeyboardKeys.Control))
@@ -655,26 +655,26 @@ namespace FlaxEditor.Content.GUI
// Movement with arrows
{
var root = _selection[0];
- Vector2 size = root.Size;
- Vector2 offset = Vector2.Minimum;
+ var size = root.Size;
+ var offset = Float2.Minimum;
ContentItem item = null;
if (key == KeyboardKeys.ArrowUp)
{
- offset = new Vector2(0, -size.Y);
+ offset = new Float2(0, -size.Y);
}
else if (key == KeyboardKeys.ArrowDown)
{
- offset = new Vector2(0, size.Y);
+ offset = new Float2(0, size.Y);
}
else if (key == KeyboardKeys.ArrowRight)
{
- offset = new Vector2(size.X, 0);
+ offset = new Float2(size.X, 0);
}
else if (key == KeyboardKeys.ArrowLeft)
{
- offset = new Vector2(-size.X, 0);
+ offset = new Float2(-size.X, 0);
}
- if (offset != Vector2.Minimum)
+ if (offset != Float2.Minimum)
{
item = GetChildAt(root.Location + size / 2 + offset) as ContentItem;
}
diff --git a/Source/Editor/Content/Import/ImportFilesDialog.cs b/Source/Editor/Content/Import/ImportFilesDialog.cs
index 78a48c933..c9b5a0ef3 100644
--- a/Source/Editor/Content/Import/ImportFilesDialog.cs
+++ b/Source/Editor/Content/Import/ImportFilesDialog.cs
@@ -131,10 +131,10 @@ namespace FlaxEditor.Content.Import
// Select the first item
tree.Select(_rootNode.Children[0] as TreeNode);
- _dialogSize = new Vector2(TotalWidth, EditorHeight + splitPanel.Offsets.Height);
+ _dialogSize = new Float2(TotalWidth, EditorHeight + splitPanel.Offsets.Height);
}
- private void OnTreeRightClick(TreeNode node, Vector2 location)
+ private void OnTreeRightClick(TreeNode node, Float2 location)
{
var menu = new ContextMenu();
menu.AddButton("Rename", OnRenameClicked);
@@ -183,7 +183,7 @@ namespace FlaxEditor.Content.Import
}
///
- protected override bool OnMouseDoubleClickHeader(ref Vector2 location, MouseButton button)
+ protected override bool OnMouseDoubleClickHeader(ref Float2 location, MouseButton button)
{
StartRenaming();
return true;
@@ -254,7 +254,7 @@ namespace FlaxEditor.Content.Import
{
base.SetupWindowSettings(ref settings);
- settings.MinimumSize = new Vector2(300, 400);
+ settings.MinimumSize = new Float2(300, 400);
settings.HasSizingFrame = true;
}
}
diff --git a/Source/Editor/Content/Import/ModelImportEntry.cs b/Source/Editor/Content/Import/ModelImportEntry.cs
index ebd7cf951..bded33956 100644
--- a/Source/Editor/Content/Import/ModelImportEntry.cs
+++ b/Source/Editor/Content/Import/ModelImportEntry.cs
@@ -199,9 +199,9 @@ namespace FlaxEditor.Content.Import
///
/// Custom import geometry offset.
///
- [DefaultValue(typeof(Vector3), "0,0,0")]
+ [DefaultValue(typeof(Float3), "0,0,0")]
[EditorOrder(520), EditorDisplay("Transform")]
- public Vector3 Translation { get; set; } = Vector3.Zero;
+ public Float3 Translation { get; set; } = Float3.Zero;
///
/// If checked, the imported geometry will be shifted to the center of mass.
@@ -376,7 +376,7 @@ namespace FlaxEditor.Content.Import
// Transform
public float Scale;
public Quaternion Rotation;
- public Vector3 Translation;
+ public Float3 Translation;
public byte CenterGeometry;
// Animation
diff --git a/Source/Editor/Content/Items/AssetItem.cs b/Source/Editor/Content/Items/AssetItem.cs
index adc2da40d..33e06cb2a 100644
--- a/Source/Editor/Content/Items/AssetItem.cs
+++ b/Source/Editor/Content/Items/AssetItem.cs
@@ -56,7 +56,7 @@ namespace FlaxEditor.Content
Offsets = Margin.Zero;
}
- public override bool OnMouseDoubleClick(Vector2 location, MouseButton button)
+ public override bool OnMouseDoubleClick(Float2 location, MouseButton button)
{
return Item.OnMouseDoubleClick(Item.PointFromScreen(PointToScreen(location)), button);
}
diff --git a/Source/Editor/Content/Items/ContentFolder.cs b/Source/Editor/Content/Items/ContentFolder.cs
index 29bdaad40..ff47a0916 100644
--- a/Source/Editor/Content/Items/ContentFolder.cs
+++ b/Source/Editor/Content/Items/ContentFolder.cs
@@ -228,7 +228,7 @@ namespace FlaxEditor.Content
// Check if drag is over
if (IsDragOver && _validDragOver)
- Render2D.FillRectangle(new Rectangle(Vector2.Zero, Size), Style.Current.BackgroundSelected * 0.6f);
+ Render2D.FillRectangle(new Rectangle(Float2.Zero, Size), Style.Current.BackgroundSelected * 0.6f);
}
private bool ValidateDragItem(ContentItem item)
@@ -238,7 +238,7 @@ namespace FlaxEditor.Content
}
///
- public override DragDropEffect OnDragEnter(ref Vector2 location, DragData data)
+ public override DragDropEffect OnDragEnter(ref Float2 location, DragData data)
{
base.OnDragEnter(ref location, data);
@@ -258,7 +258,7 @@ namespace FlaxEditor.Content
}
///
- public override DragDropEffect OnDragMove(ref Vector2 location, DragData data)
+ public override DragDropEffect OnDragMove(ref Float2 location, DragData data)
{
base.OnDragMove(ref location, data);
@@ -268,7 +268,7 @@ namespace FlaxEditor.Content
}
///
- public override DragDropEffect OnDragDrop(ref Vector2 location, DragData data)
+ public override DragDropEffect OnDragDrop(ref Float2 location, DragData data)
{
var result = base.OnDragDrop(ref location, data);
diff --git a/Source/Editor/Content/Items/ContentItem.cs b/Source/Editor/Content/Items/ContentItem.cs
index a97f455f3..d887c304e 100644
--- a/Source/Editor/Content/Items/ContentItem.cs
+++ b/Source/Editor/Content/Items/ContentItem.cs
@@ -183,7 +183,7 @@ namespace FlaxEditor.Content
private ContentFolder _parentFolder;
private bool _isMouseDown;
- private Vector2 _mouseDownStartPos;
+ private Float2 _mouseDownStartPos;
private readonly List _references = new List(4);
private SpriteHandle _thumbnail;
@@ -593,11 +593,11 @@ namespace FlaxEditor.Content
protected override bool ShowTooltip => true;
///
- public override bool OnShowTooltip(out string text, out Vector2 location, out Rectangle area)
+ public override bool OnShowTooltip(out string text, out Float2 location, out Rectangle area)
{
UpdateTooltipText();
var result = base.OnShowTooltip(out text, out _, out area);
- location = Size * new Vector2(0.9f, 0.5f);
+ location = Size * new Float2(0.9f, 0.5f);
return result;
}
@@ -618,7 +618,7 @@ namespace FlaxEditor.Content
var style = Style.Current;
var view = Parent as ContentView;
var isSelected = view.IsSelected(this);
- var clientRect = new Rectangle(Vector2.Zero, size);
+ var clientRect = new Rectangle(Float2.Zero, size);
var textRect = TextRectangle;
Rectangle thumbnailRect;
TextAlignment nameAlignment;
@@ -657,7 +657,7 @@ namespace FlaxEditor.Content
}
///
- public override bool OnMouseDown(Vector2 location, MouseButton button)
+ public override bool OnMouseDown(Float2 location, MouseButton button)
{
Focus();
@@ -672,7 +672,7 @@ namespace FlaxEditor.Content
}
///
- public override bool OnMouseUp(Vector2 location, MouseButton button)
+ public override bool OnMouseUp(Float2 location, MouseButton button)
{
if (button == MouseButton.Left && _isMouseDown)
{
@@ -687,7 +687,7 @@ namespace FlaxEditor.Content
}
///
- public override bool OnMouseDoubleClick(Vector2 location, MouseButton button)
+ public override bool OnMouseDoubleClick(Float2 location, MouseButton button)
{
Focus();
@@ -707,10 +707,10 @@ namespace FlaxEditor.Content
}
///
- public override void OnMouseMove(Vector2 location)
+ public override void OnMouseMove(Float2 location)
{
// Check if start drag and drop
- if (_isMouseDown && Vector2.Distance(_mouseDownStartPos, location) > 10.0f)
+ if (_isMouseDown && Float2.Distance(_mouseDownStartPos, location) > 10.0f)
{
// Clear flag
_isMouseDown = false;
diff --git a/Source/Editor/Content/PreviewsCache.cpp b/Source/Editor/Content/PreviewsCache.cpp
index 5d305aa18..3d87e57ca 100644
--- a/Source/Editor/Content/PreviewsCache.cpp
+++ b/Source/Editor/Content/PreviewsCache.cpp
@@ -121,7 +121,7 @@ Asset::LoadResult PreviewsCache::load()
const float positionOffset = static_cast(ASSETS_ICONS_ATLAS_MARGIN) / ASSETS_ICONS_ATLAS_SIZE;
for (int32 i = 0; i < ASSETS_ICONS_PER_ATLAS; i++)
{
- sprite.Area.Location = Vector2(static_cast(i % ASSETS_ICONS_PER_ROW), static_cast(i / ASSETS_ICONS_PER_ROW)) * positionScale + positionOffset;
+ sprite.Area.Location = Float2(static_cast(i % ASSETS_ICONS_PER_ROW), static_cast(i / ASSETS_ICONS_PER_ROW)) * positionScale + positionOffset;
sprite.Name = StringUtils::ToString(i);
Sprites.Add(sprite);
}
diff --git a/Source/Editor/Content/Proxy/PrefabProxy.cs b/Source/Editor/Content/Proxy/PrefabProxy.cs
index 9ec143368..64eb1d9f1 100644
--- a/Source/Editor/Content/Proxy/PrefabProxy.cs
+++ b/Source/Editor/Content/Proxy/PrefabProxy.cs
@@ -130,7 +130,7 @@ namespace FlaxEditor.Content
{
_preview.Prefab = (Prefab)request.Asset;
_preview.Parent = guiRoot;
- _preview.Scale = Vector2.One;
+ _preview.Scale = Float2.One;
_preview.ShowDefaultSceneActors = true;
_preview.SyncBackbufferSize();
@@ -138,7 +138,7 @@ namespace FlaxEditor.Content
if (_preview.Instance is UIControl uiControl && uiControl.HasControl)
{
// Ensure to place UI in a proper way
- uiControl.Control.Location = Vector2.Zero;
+ uiControl.Control.Location = Float2.Zero;
uiControl.Control.Scale *= PreviewsCache.AssetIconSize / uiControl.Control.Size.MaxValue;
uiControl.Control.AnchorPreset = AnchorPresets.TopLeft;
uiControl.Control.AnchorPreset = AnchorPresets.MiddleCenter;
@@ -154,8 +154,8 @@ namespace FlaxEditor.Content
// Auto fit actor to camera
float targetSize = 30.0f;
var bounds = _preview.Instance.EditorBoxChildren;
- float maxSize = Mathf.Max(0.001f, bounds.Size.MaxValue);
- _preview.Instance.Scale = new Vector3(targetSize / maxSize);
+ var maxSize = Math.Max(0.001f, (float)bounds.Size.MaxValue);
+ _preview.Instance.Scale = new Float3(targetSize / maxSize);
_preview.Instance.Position = Vector3.Zero;
}
diff --git a/Source/Editor/CustomEditors/Dedicated/ActorEditor.cs b/Source/Editor/CustomEditors/Dedicated/ActorEditor.cs
index 49cc67868..dc11d4a69 100644
--- a/Source/Editor/CustomEditors/Dedicated/ActorEditor.cs
+++ b/Source/Editor/CustomEditors/Dedicated/ActorEditor.cs
@@ -75,7 +75,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
// Viewing changes applied to this actor
var viewChanges = panel.Button("View Changes");
- viewChanges.Button.Clicked += () => ViewChanges(viewChanges.Button, new Vector2(0.0f, 20.0f));
+ viewChanges.Button.Clicked += () => ViewChanges(viewChanges.Button, new Float2(0.0f, 20.0f));
// Link event to update editor on prefab apply
_linkedPrefabId = prefab.ID;
@@ -319,7 +319,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
return result;
}
- private void ViewChanges(Control target, Vector2 targetLocation)
+ private void ViewChanges(Control target, Float2 targetLocation)
{
// Build a tree out of modified properties
var rootNode = ProcessDiff(this, false);
@@ -343,7 +343,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
cm.Show(target, targetLocation);
}
- private void OnDiffNodeRightClick(TreeNode node, Vector2 location)
+ private void OnDiffNodeRightClick(TreeNode node, Float2 location)
{
var diffMenu = (PrefabDiffContextMenu)node.ParentTree.Tag;
@@ -353,7 +353,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
menu.AddButton("Revert All", OnDiffRevertAll);
menu.AddButton("Apply All", OnDiffApplyAll);
- diffMenu.ShowChild(menu, node.PointToParent(diffMenu, new Vector2(location.X, node.HeaderHeight)));
+ diffMenu.ShowChild(menu, node.PointToParent(diffMenu, new Float2(location.X, node.HeaderHeight)));
}
private void OnDiffRevertAll()
diff --git a/Source/Editor/CustomEditors/Dedicated/CurveObjectEditor.cs b/Source/Editor/CustomEditors/Dedicated/CurveObjectEditor.cs
index 8602bdeff..0eccb6f54 100644
--- a/Source/Editor/CustomEditors/Dedicated/CurveObjectEditor.cs
+++ b/Source/Editor/CustomEditors/Dedicated/CurveObjectEditor.cs
@@ -80,6 +80,21 @@ namespace FlaxEditor.CustomEditors.Dedicated
{
}
+ [CustomEditor(typeof(BezierCurve)), DefaultEditor]
+ sealed class Float2BezierCurveObjectEditor : BezierCurveObjectEditor
+ {
+ }
+
+ [CustomEditor(typeof(BezierCurve)), DefaultEditor]
+ sealed class Float3BezierCurveObjectEditor : BezierCurveObjectEditor
+ {
+ }
+
+ [CustomEditor(typeof(BezierCurve)), DefaultEditor]
+ sealed class Float4BezierCurveObjectEditor : BezierCurveObjectEditor
+ {
+ }
+
[CustomEditor(typeof(BezierCurve)), DefaultEditor]
sealed class QuaternionBezierCurveObjectEditor : BezierCurveObjectEditor
{
@@ -165,6 +180,21 @@ namespace FlaxEditor.CustomEditors.Dedicated
{
}
+ [CustomEditor(typeof(LinearCurve)), DefaultEditor]
+ sealed class Float2LinearCurveObjectEditor : LinearCurveObjectEditor
+ {
+ }
+
+ [CustomEditor(typeof(LinearCurve)), DefaultEditor]
+ sealed class Float3LinearCurveObjectEditor : LinearCurveObjectEditor
+ {
+ }
+
+ [CustomEditor(typeof(LinearCurve)), DefaultEditor]
+ sealed class Float4LinearCurveObjectEditor : LinearCurveObjectEditor
+ {
+ }
+
[CustomEditor(typeof(LinearCurve)), DefaultEditor]
sealed class QuaternionLinearCurveObjectEditor : LinearCurveObjectEditor
{
diff --git a/Source/Editor/CustomEditors/Dedicated/LayersMatrixEditor.cs b/Source/Editor/CustomEditors/Dedicated/LayersMatrixEditor.cs
index f50e41992..e6e2338d8 100644
--- a/Source/Editor/CustomEditors/Dedicated/LayersMatrixEditor.cs
+++ b/Source/Editor/CustomEditors/Dedicated/LayersMatrixEditor.cs
@@ -45,8 +45,8 @@ namespace FlaxEditor.CustomEditors.Dedicated
var upperRightCell = new VerticalPanel
{
ClipChildren = false,
- Pivot = new Vector2(0.0f, 0.0f),
- Offset = new Vector2(-labelsWidth, 0),
+ Pivot = new Float2(0.0f, 0.0f),
+ Offset = new Float2(-labelsWidth, 0),
Rotation = -90,
Spacing = 0,
TopMargin = 0,
@@ -116,7 +116,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
{
var box = new CheckBox(0, 0, true)
{
- Tag = new Vector2(_layersCount - column - 1, row),
+ Tag = new Float2(_layersCount - column - 1, row),
Parent = grid,
Checked = GetBit(column, row),
};
@@ -132,8 +132,8 @@ namespace FlaxEditor.CustomEditors.Dedicated
private void OnCheckBoxChanged(CheckBox box)
{
- int column = (int)((Vector2)box.Tag).X;
- int row = (int)((Vector2)box.Tag).Y;
+ int column = (int)((Float2)box.Tag).X;
+ int row = (int)((Float2)box.Tag).Y;
SetBit(column, row, box.Checked);
}
@@ -144,8 +144,8 @@ namespace FlaxEditor.CustomEditors.Dedicated
for (int i = 0; i < _checkBoxes.Count; i++)
{
var box = _checkBoxes[i];
- int column = (int)((Vector2)box.Tag).X;
- int row = (int)((Vector2)box.Tag).Y;
+ int column = (int)((Float2)box.Tag).X;
+ int row = (int)((Float2)box.Tag).Y;
box.Checked = GetBit(column, row);
}
}
diff --git a/Source/Editor/CustomEditors/Dedicated/LocalizationSettingsEditor.cs b/Source/Editor/CustomEditors/Dedicated/LocalizationSettingsEditor.cs
index a289f96cd..9c4280d84 100644
--- a/Source/Editor/CustomEditors/Dedicated/LocalizationSettingsEditor.cs
+++ b/Source/Editor/CustomEditors/Dedicated/LocalizationSettingsEditor.cs
@@ -158,7 +158,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
RebuildLayout();
Profiler.EndEvent();
});
- menu.Show(button, new Vector2(0, button.Height));
+ menu.Show(button, new Float2(0, button.Height));
};
// Export button
diff --git a/Source/Editor/CustomEditors/Dedicated/ParticleEffectEditor.cs b/Source/Editor/CustomEditors/Dedicated/ParticleEffectEditor.cs
index 664721258..634260922 100644
--- a/Source/Editor/CustomEditors/Dedicated/ParticleEffectEditor.cs
+++ b/Source/Editor/CustomEditors/Dedicated/ParticleEffectEditor.cs
@@ -28,14 +28,14 @@ namespace FlaxEditor.CustomEditors.Dedicated
private object ParameterGet(object instance, GraphParameter parameter, object tag)
{
- if (instance is ParticleEffect particleEffect && particleEffect && parameter && tag is ParticleEffectParameter effectParameter)
+ if (instance is ParticleEffect particleEffect && particleEffect && parameter && tag is ParticleEffectParameter effectParameter && effectParameter)
return particleEffect.GetParameterValue(effectParameter.TrackName, parameter.Name);
return null;
}
private void ParameterSet(object instance, object value, GraphParameter parameter, object tag)
{
- if (instance is ParticleEffect particleEffect && particleEffect && parameter && tag is ParticleEffectParameter effectParameter)
+ if (instance is ParticleEffect particleEffect && particleEffect && parameter && tag is ParticleEffectParameter effectParameter && effectParameter)
particleEffect.SetParameterValue(effectParameter.TrackName, parameter.Name, value);
}
diff --git a/Source/Editor/CustomEditors/Dedicated/RagdollEditor.cs b/Source/Editor/CustomEditors/Dedicated/RagdollEditor.cs
index 2c3aebcc1..f87cc10b8 100644
--- a/Source/Editor/CustomEditors/Dedicated/RagdollEditor.cs
+++ b/Source/Editor/CustomEditors/Dedicated/RagdollEditor.cs
@@ -76,7 +76,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
const float width = 280.0f;
const float height = 220.0f;
- Size = new Vector2(width, height);
+ Size = new Float2(width, height);
// Title
var title = new Label(2, 2, width - 4, 23.0f)
diff --git a/Source/Editor/CustomEditors/Dedicated/ScriptsEditor.cs b/Source/Editor/CustomEditors/Dedicated/ScriptsEditor.cs
index c165824eb..e7446f8bb 100644
--- a/Source/Editor/CustomEditors/Dedicated/ScriptsEditor.cs
+++ b/Source/Editor/CustomEditors/Dedicated/ScriptsEditor.cs
@@ -87,7 +87,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
// Check if drag is over
if (IsDragOver && _dragHandlers != null && _dragHandlers.HasValidDrag)
{
- var area = new Rectangle(Vector2.Zero, size);
+ var area = new Rectangle(Float2.Zero, size);
Render2D.FillRectangle(area, Color.Orange * 0.5f);
Render2D.DrawRectangle(area, Color.Black);
}
@@ -110,7 +110,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
}
///
- public override DragDropEffect OnDragEnter(ref Vector2 location, DragData data)
+ public override DragDropEffect OnDragEnter(ref Float2 location, DragData data)
{
var result = base.OnDragEnter(ref location, data);
if (result != DragDropEffect.None)
@@ -130,7 +130,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
}
///
- public override DragDropEffect OnDragMove(ref Vector2 location, DragData data)
+ public override DragDropEffect OnDragMove(ref Float2 location, DragData data)
{
var result = base.OnDragMove(ref location, data);
if (result != DragDropEffect.None)
@@ -148,7 +148,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
}
///
- public override DragDropEffect OnDragDrop(ref Vector2 location, DragData data)
+ public override DragDropEffect OnDragDrop(ref Float2 location, DragData data)
{
var result = base.OnDragDrop(ref location, data);
if (result != DragDropEffect.None)
@@ -253,7 +253,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
{
private ScriptsEditor _editor;
private bool _isMouseDown;
- private Vector2 _mouseDownPos;
+ private Float2 _mouseDownPos;
///
/// Gets the target script.
@@ -272,9 +272,9 @@ namespace FlaxEditor.CustomEditors.Dedicated
}
///
- public override void OnMouseEnter(Vector2 location)
+ public override void OnMouseEnter(Float2 location)
{
- _mouseDownPos = Vector2.Minimum;
+ _mouseDownPos = Float2.Minimum;
base.OnMouseEnter(location);
}
@@ -293,10 +293,10 @@ namespace FlaxEditor.CustomEditors.Dedicated
}
///
- public override void OnMouseMove(Vector2 location)
+ public override void OnMouseMove(Float2 location)
{
// Check if start drag drop
- if (_isMouseDown && Vector2.Distance(location, _mouseDownPos) > 10.0f)
+ if (_isMouseDown && Float2.Distance(location, _mouseDownPos) > 10.0f)
{
DoDrag();
_isMouseDown = false;
@@ -306,7 +306,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
}
///
- public override bool OnMouseUp(Vector2 location, MouseButton button)
+ public override bool OnMouseUp(Float2 location, MouseButton button)
{
if (button == MouseButton.Left)
{
@@ -318,7 +318,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
}
///
- public override bool OnMouseDown(Vector2 location, MouseButton button)
+ public override bool OnMouseDown(Float2 location, MouseButton button)
{
if (button == MouseButton.Left)
{
@@ -373,11 +373,11 @@ namespace FlaxEditor.CustomEditors.Dedicated
base.Draw();
var color = FlaxEngine.GUI.Style.Current.BackgroundSelected * (IsDragOver ? 0.9f : 0.1f);
- Render2D.FillRectangle(new Rectangle(Vector2.Zero, Size), color);
+ Render2D.FillRectangle(new Rectangle(Float2.Zero, Size), color);
}
///
- public override DragDropEffect OnDragEnter(ref Vector2 location, DragData data)
+ public override DragDropEffect OnDragEnter(ref Float2 location, DragData data)
{
_dragEffect = DragDropEffect.None;
@@ -392,7 +392,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
}
///
- public override DragDropEffect OnDragMove(ref Vector2 location, DragData data)
+ public override DragDropEffect OnDragMove(ref Float2 location, DragData data)
{
return _dragEffect;
}
@@ -406,7 +406,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
}
///
- public override DragDropEffect OnDragDrop(ref Vector2 location, DragData data)
+ public override DragDropEffect OnDragDrop(ref Float2 location, DragData data)
{
var result = base.OnDragDrop(ref location, data);
if (result != DragDropEffect.None)
@@ -636,7 +636,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
IsScrollable = false,
Checked = script.Enabled,
Parent = group.Panel,
- Size = new Vector2(14, 14),
+ Size = new Float2(14, 14),
Bounds = new Rectangle(2, 0, 14, 14),
BoxSize = 12.0f,
Tag = script,
diff --git a/Source/Editor/CustomEditors/Dedicated/UIControlEditor.cs b/Source/Editor/CustomEditors/Dedicated/UIControlEditor.cs
index 60915ff8e..602c6d0ee 100644
--- a/Source/Editor/CustomEditors/Dedicated/UIControlEditor.cs
+++ b/Source/Editor/CustomEditors/Dedicated/UIControlEditor.cs
@@ -44,7 +44,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
public override void Draw()
{
// Cache data
- var rect = new Rectangle(Vector2.Zero, Size);
+ var rect = new Rectangle(Float2.Zero, Size);
if (rect.Width >= rect.Height)
{
rect.X = (rect.Width - rect.Height) * 0.5f;
@@ -159,49 +159,49 @@ namespace FlaxEditor.CustomEditors.Dedicated
// Draw pivot point
if (SupportsShiftModulation && Input.GetKey(KeyboardKeys.Control))
{
- Vector2 pivotPoint;
+ Float2 pivotPoint;
switch (_presets)
{
case AnchorPresets.Custom:
- pivotPoint = Vector2.Minimum;
+ pivotPoint = Float2.Minimum;
break;
case AnchorPresets.TopLeft:
- pivotPoint = new Vector2(0, 0);
+ pivotPoint = new Float2(0, 0);
break;
case AnchorPresets.TopCenter:
case AnchorPresets.HorizontalStretchTop:
- pivotPoint = new Vector2(rect.Width / 2, 0);
+ pivotPoint = new Float2(rect.Width / 2, 0);
break;
case AnchorPresets.TopRight:
- pivotPoint = new Vector2(rect.Width, 0);
+ pivotPoint = new Float2(rect.Width, 0);
break;
case AnchorPresets.MiddleLeft:
case AnchorPresets.VerticalStretchLeft:
- pivotPoint = new Vector2(0, rect.Height / 2);
+ pivotPoint = new Float2(0, rect.Height / 2);
break;
case AnchorPresets.MiddleCenter:
case AnchorPresets.VerticalStretchCenter:
case AnchorPresets.HorizontalStretchMiddle:
case AnchorPresets.StretchAll:
- pivotPoint = new Vector2(rect.Width / 2, rect.Height / 2);
+ pivotPoint = new Float2(rect.Width / 2, rect.Height / 2);
break;
case AnchorPresets.MiddleRight:
case AnchorPresets.VerticalStretchRight:
- pivotPoint = new Vector2(rect.Width, rect.Height / 2);
+ pivotPoint = new Float2(rect.Width, rect.Height / 2);
break;
case AnchorPresets.BottomLeft:
- pivotPoint = new Vector2(0, rect.Height);
+ pivotPoint = new Float2(0, rect.Height);
break;
case AnchorPresets.BottomCenter:
case AnchorPresets.HorizontalStretchBottom:
- pivotPoint = new Vector2(rect.Width / 2, rect.Height);
+ pivotPoint = new Float2(rect.Width / 2, rect.Height);
break;
case AnchorPresets.BottomRight:
- pivotPoint = new Vector2(rect.Width, rect.Height);
+ pivotPoint = new Float2(rect.Width, rect.Height);
break;
default: throw new ArgumentOutOfRangeException();
}
- var pivotPointSize = new Vector2(3.0f);
+ var pivotPointSize = new Float2(3.0f);
Render2D.DrawRectangle(new Rectangle(pivotPoint - pivotPointSize * 0.5f, pivotPointSize), style.ProgressNormal, 1.1f);
}
}
@@ -234,7 +234,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
var style = FlaxEngine.GUI.Style.Current;
Tag = presets;
- Size = new Vector2(DialogWidth, DialogHeight);
+ Size = new Float2(DialogWidth, DialogHeight);
// Title
var title = new Label(2, 2, DialogWidth - 4, TitleHeight)
@@ -346,7 +346,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
private void OnButtonClicked()
{
- var location = _button.Center + new Vector2(3.0f);
+ var location = _button.Center + new Float2(3.0f);
var editor = new AnchorPresetsEditorPopup(_button.Presets, true);
editor.VisibleChanged += OnEditorVisibleChanged;
editor.Show(_button.Parent, location);
@@ -563,17 +563,17 @@ namespace FlaxEditor.CustomEditors.Dedicated
yEl = UniformPanelCapsuleForObjectWithText(horUp, "Top: ", topItem.GetValues(Values));
hEl = UniformPanelCapsuleForObjectWithText(horDown, "Bottom: ", bottomItem.GetValues(Values));
}
- xEl.Control.AnchorMin = new Vector2(0, xEl.Control.AnchorMin.Y);
- xEl.Control.AnchorMax = new Vector2(0.5f, xEl.Control.AnchorMax.Y);
+ xEl.Control.AnchorMin = new Float2(0, xEl.Control.AnchorMin.Y);
+ xEl.Control.AnchorMax = new Float2(0.5f, xEl.Control.AnchorMax.Y);
- vEl.Control.AnchorMin = new Vector2(0, xEl.Control.AnchorMin.Y);
- vEl.Control.AnchorMax = new Vector2(0.5f, xEl.Control.AnchorMax.Y);
+ vEl.Control.AnchorMin = new Float2(0, xEl.Control.AnchorMin.Y);
+ vEl.Control.AnchorMax = new Float2(0.5f, xEl.Control.AnchorMax.Y);
- yEl.Control.AnchorMin = new Vector2(0.5f, xEl.Control.AnchorMin.Y);
- yEl.Control.AnchorMax = new Vector2(1, xEl.Control.AnchorMax.Y);
+ yEl.Control.AnchorMin = new Float2(0.5f, xEl.Control.AnchorMin.Y);
+ yEl.Control.AnchorMax = new Float2(1, xEl.Control.AnchorMax.Y);
- hEl.Control.AnchorMin = new Vector2(0.5f, xEl.Control.AnchorMin.Y);
- hEl.Control.AnchorMax = new Vector2(1, xEl.Control.AnchorMax.Y);
+ hEl.Control.AnchorMin = new Float2(0.5f, xEl.Control.AnchorMin.Y);
+ hEl.Control.AnchorMax = new Float2(1, xEl.Control.AnchorMax.Y);
}
private VerticalPanelElement VerticalPanelWithoutMargin(LayoutElementsContainer cont)
diff --git a/Source/Editor/CustomEditors/Editors/ActorTransformEditor.cs b/Source/Editor/CustomEditors/Editors/ActorTransformEditor.cs
index e65dcacd8..296c6f037 100644
--- a/Source/Editor/CustomEditors/Editors/ActorTransformEditor.cs
+++ b/Source/Editor/CustomEditors/Editors/ActorTransformEditor.cs
@@ -26,10 +26,10 @@ namespace FlaxEditor.CustomEditors.Editors
public static Color AxisColorZ = new Color(0.0f, 0.0235294f, 1.0f, 1.0f);
///
- /// Custom editor for actor position/scale property.
+ /// Custom editor for actor position property.
///
///
- public class PositionScaleEditor : Vector3Editor
+ public class PositionEditor : Vector3Editor
{
///
public override void Initialize(LayoutElementsContainer layout)
@@ -39,12 +39,12 @@ namespace FlaxEditor.CustomEditors.Editors
// Override colors
var back = FlaxEngine.GUI.Style.Current.TextBoxBackground;
var grayOutFactor = 0.6f;
- XElement.FloatValue.BorderColor = Color.Lerp(AxisColorX, back, grayOutFactor);
- XElement.FloatValue.BorderSelectedColor = AxisColorX;
- YElement.FloatValue.BorderColor = Color.Lerp(AxisColorY, back, grayOutFactor);
- YElement.FloatValue.BorderSelectedColor = AxisColorY;
- ZElement.FloatValue.BorderColor = Color.Lerp(AxisColorZ, back, grayOutFactor);
- ZElement.FloatValue.BorderSelectedColor = AxisColorZ;
+ XElement.ValueBox.BorderColor = Color.Lerp(AxisColorX, back, grayOutFactor);
+ XElement.ValueBox.BorderSelectedColor = AxisColorX;
+ YElement.ValueBox.BorderColor = Color.Lerp(AxisColorY, back, grayOutFactor);
+ YElement.ValueBox.BorderSelectedColor = AxisColorY;
+ ZElement.ValueBox.BorderColor = Color.Lerp(AxisColorZ, back, grayOutFactor);
+ ZElement.ValueBox.BorderSelectedColor = AxisColorZ;
}
}
@@ -62,12 +62,35 @@ namespace FlaxEditor.CustomEditors.Editors
// Override colors
var back = FlaxEngine.GUI.Style.Current.TextBoxBackground;
var grayOutFactor = 0.6f;
- XElement.FloatValue.BorderColor = Color.Lerp(AxisColorX, back, grayOutFactor);
- XElement.FloatValue.BorderSelectedColor = AxisColorX;
- YElement.FloatValue.BorderColor = Color.Lerp(AxisColorY, back, grayOutFactor);
- YElement.FloatValue.BorderSelectedColor = AxisColorY;
- ZElement.FloatValue.BorderColor = Color.Lerp(AxisColorZ, back, grayOutFactor);
- ZElement.FloatValue.BorderSelectedColor = AxisColorZ;
+ XElement.ValueBox.BorderColor = Color.Lerp(AxisColorX, back, grayOutFactor);
+ XElement.ValueBox.BorderSelectedColor = AxisColorX;
+ YElement.ValueBox.BorderColor = Color.Lerp(AxisColorY, back, grayOutFactor);
+ YElement.ValueBox.BorderSelectedColor = AxisColorY;
+ ZElement.ValueBox.BorderColor = Color.Lerp(AxisColorZ, back, grayOutFactor);
+ ZElement.ValueBox.BorderSelectedColor = AxisColorZ;
+ }
+ }
+
+ ///
+ /// Custom editor for actor scale property.
+ ///
+ ///
+ public class ScaleEditor : Float3Editor
+ {
+ ///
+ public override void Initialize(LayoutElementsContainer layout)
+ {
+ base.Initialize(layout);
+
+ // Override colors
+ var back = FlaxEngine.GUI.Style.Current.TextBoxBackground;
+ var grayOutFactor = 0.6f;
+ XElement.ValueBox.BorderColor = Color.Lerp(AxisColorX, back, grayOutFactor);
+ XElement.ValueBox.BorderSelectedColor = AxisColorX;
+ YElement.ValueBox.BorderColor = Color.Lerp(AxisColorY, back, grayOutFactor);
+ YElement.ValueBox.BorderSelectedColor = AxisColorY;
+ ZElement.ValueBox.BorderColor = Color.Lerp(AxisColorZ, back, grayOutFactor);
+ ZElement.ValueBox.BorderSelectedColor = AxisColorZ;
}
}
}
diff --git a/Source/Editor/CustomEditors/Editors/ColorTrackball.cs b/Source/Editor/CustomEditors/Editors/ColorTrackball.cs
index bbee911f8..f10a74652 100644
--- a/Source/Editor/CustomEditors/Editors/ColorTrackball.cs
+++ b/Source/Editor/CustomEditors/Editors/ColorTrackball.cs
@@ -9,7 +9,7 @@ using FlaxEngine.GUI;
namespace FlaxEditor.CustomEditors.Editors
{
///
- /// Custom implementation of the inspector used to edit Vector4 color value type properties with color grading trackball.
+ /// Custom implementation of the inspector used to edit Float4 color value type properties with color grading trackball.
///
public sealed class ColorTrackball : CustomEditor
{
@@ -73,12 +73,12 @@ namespace FlaxEditor.CustomEditors.Editors
{
var element = layout.FloatValue();
element.SetLimits(limit);
- element.FloatValue.ValueChanged += OnValueChanged;
- element.FloatValue.SlidingEnd += ClearToken;
+ element.ValueBox.ValueChanged += OnValueChanged;
+ element.ValueBox.SlidingEnd += ClearToken;
var back = FlaxEngine.GUI.Style.Current.TextBoxBackground;
var grayOutFactor = 0.6f;
- element.FloatValue.BorderColor = Color.Lerp(borderColor, back, grayOutFactor);
- element.FloatValue.BorderSelectedColor = borderColor;
+ element.ValueBox.BorderColor = Color.Lerp(borderColor, back, grayOutFactor);
+ element.ValueBox.BorderSelectedColor = borderColor;
return element;
}
@@ -89,7 +89,7 @@ namespace FlaxEditor.CustomEditors.Editors
var isSliding = _trackball.CustomControl.IsSliding;
var token = isSliding ? this : null;
- var value = new Vector4(color.R, color.G, color.B, _wElement.FloatValue.Value);
+ var value = new Float4(color.R, color.G, color.B, _wElement.ValueBox.Value);
SetValue(value, token);
}
@@ -100,7 +100,7 @@ namespace FlaxEditor.CustomEditors.Editors
var isSliding = _xElement.IsSliding || _yElement.IsSliding || _zElement.IsSliding || _wElement.IsSliding;
var token = isSliding ? this : null;
- var value = new Vector4(_xElement.FloatValue.Value, _yElement.FloatValue.Value, _zElement.FloatValue.Value, _wElement.FloatValue.Value);
+ var value = new Float4(_xElement.ValueBox.Value, _yElement.ValueBox.Value, _zElement.ValueBox.Value, _wElement.ValueBox.Value);
SetValue(value, token);
}
@@ -111,8 +111,8 @@ namespace FlaxEditor.CustomEditors.Editors
if (!HasDifferentValues)
{
- var value = (Vector4)Values[0];
- var color = new Vector3(value);
+ var value = (Float4)Values[0];
+ var color = new Float3(value);
var scale = value.W;
float min = color.MinValue;
float max = color.MaxValue;
@@ -130,7 +130,7 @@ namespace FlaxEditor.CustomEditors.Editors
_yElement.Value = color.Y;
_zElement.Value = color.Z;
_wElement.Value = scale;
- _trackball.CustomControl.Color = Vector3.Abs(color);
+ _trackball.CustomControl.Color = Float3.Abs(color);
}
}
}
diff --git a/Source/Editor/CustomEditors/Editors/CultureInfoEditor.cs b/Source/Editor/CustomEditors/Editors/CultureInfoEditor.cs
index 95fc7fa55..157c3af17 100644
--- a/Source/Editor/CustomEditors/Editors/CultureInfoEditor.cs
+++ b/Source/Editor/CustomEditors/Editors/CultureInfoEditor.cs
@@ -108,7 +108,7 @@ namespace FlaxEditor.CustomEditors.Editors
private void ShowPicker()
{
var menu = CreatePicker(Culture, value => { Culture = value; });
- menu.Show(_label, new Vector2(0, _label.Height));
+ menu.Show(_label, new Float2(0, _label.Height));
}
internal static ContextMenuBase CreatePicker(CultureInfo value, Action changed)
diff --git a/Source/Editor/CustomEditors/Editors/DictionaryEditor.cs b/Source/Editor/CustomEditors/Editors/DictionaryEditor.cs
index 5035a48f5..c77768ea2 100644
--- a/Source/Editor/CustomEditors/Editors/DictionaryEditor.cs
+++ b/Source/Editor/CustomEditors/Editors/DictionaryEditor.cs
@@ -113,7 +113,7 @@ namespace FlaxEditor.CustomEditors.Editors
}
///
- public override bool OnMouseDoubleClick(Vector2 location, MouseButton button)
+ public override bool OnMouseDoubleClick(Float2 location, MouseButton button)
{
if (button == MouseButton.Left)
{
diff --git a/Source/Editor/CustomEditors/Editors/Double2Editor.cs b/Source/Editor/CustomEditors/Editors/Double2Editor.cs
deleted file mode 100644
index 6d3a69f0e..000000000
--- a/Source/Editor/CustomEditors/Editors/Double2Editor.cs
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright (c) 2012-2022 Wojciech Figat. All rights reserved.
-
-using System.Linq;
-using FlaxEditor.CustomEditors.Elements;
-using FlaxEngine;
-using FlaxEngine.GUI;
-
-namespace FlaxEditor.CustomEditors.Editors
-{
- ///
- /// Default implementation of the inspector used to edit Double2 value type properties.
- ///
- [CustomEditor(typeof(Double2)), DefaultEditor]
- public class Double2Editor : CustomEditor
- {
- ///
- /// The X component editor.
- ///
- protected DoubleValueElement XElement;
-
- ///
- /// The Y component editor.
- ///
- protected DoubleValueElement YElement;
-
- ///
- public override DisplayStyle Style => DisplayStyle.Inline;
-
- ///
- public override void Initialize(LayoutElementsContainer layout)
- {
- var grid = layout.CustomContainer();
- var gridControl = grid.CustomControl;
- gridControl.ClipChildren = false;
- gridControl.Height = TextBox.DefaultHeight;
- gridControl.SlotsHorizontally = 2;
- gridControl.SlotsVertically = 1;
-
- LimitAttribute limit = null;
- var attributes = Values.GetAttributes();
- if (attributes != null)
- {
- limit = (LimitAttribute)attributes.FirstOrDefault(x => x is LimitAttribute);
- }
-
- XElement = grid.DoubleValue();
- XElement.SetLimits(limit);
- XElement.DoubleValue.ValueChanged += OnValueChanged;
- XElement.DoubleValue.SlidingEnd += ClearToken;
-
- YElement = grid.DoubleValue();
- YElement.SetLimits(limit);
- YElement.DoubleValue.ValueChanged += OnValueChanged;
- YElement.DoubleValue.SlidingEnd += ClearToken;
- }
-
- private void OnValueChanged()
- {
- if (IsSetBlocked)
- return;
-
- var isSliding = XElement.IsSliding || YElement.IsSliding;
- var token = isSliding ? this : null;
- var value = new Double2(XElement.DoubleValue.Value, YElement.DoubleValue.Value);
- SetValue(value, token);
- }
-
- ///
- public override void Refresh()
- {
- base.Refresh();
-
- if (HasDifferentValues)
- {
- // TODO: support different values for ValueBox
- }
- else
- {
- var value = (Double2)Values[0];
- XElement.DoubleValue.Value = value.X;
- YElement.DoubleValue.Value = value.Y;
- }
- }
- }
-}
diff --git a/Source/Editor/CustomEditors/Editors/Double3Editor.cs b/Source/Editor/CustomEditors/Editors/Double3Editor.cs
deleted file mode 100644
index 601206f7d..000000000
--- a/Source/Editor/CustomEditors/Editors/Double3Editor.cs
+++ /dev/null
@@ -1,96 +0,0 @@
-// Copyright (c) 2012-2022 Wojciech Figat. All rights reserved.
-
-using System.Linq;
-using FlaxEditor.CustomEditors.Elements;
-using FlaxEngine;
-using FlaxEngine.GUI;
-
-namespace FlaxEditor.CustomEditors.Editors
-{
- ///
- /// Default implementation of the inspector used to edit Double3 value type properties.
- ///
- [CustomEditor(typeof(Double3)), DefaultEditor]
- public class Double3Editor : CustomEditor
- {
- ///
- /// The X component editor.
- ///
- protected DoubleValueElement XElement;
-
- ///
- /// The Y component editor.
- ///
- protected DoubleValueElement YElement;
-
- ///
- /// The Z component editor.
- ///
- protected DoubleValueElement ZElement;
-
- ///
- public override DisplayStyle Style => DisplayStyle.Inline;
-
- ///
- public override void Initialize(LayoutElementsContainer layout)
- {
- var grid = layout.CustomContainer();
- var gridControl = grid.CustomControl;
- gridControl.ClipChildren = false;
- gridControl.Height = TextBox.DefaultHeight;
- gridControl.SlotsHorizontally = 3;
- gridControl.SlotsVertically = 1;
-
- LimitAttribute limit = null;
- var attributes = Values.GetAttributes();
- if (attributes != null)
- {
- limit = (LimitAttribute)attributes.FirstOrDefault(x => x is LimitAttribute);
- }
-
- XElement = grid.DoubleValue();
- XElement.SetLimits(limit);
- XElement.DoubleValue.ValueChanged += OnValueChanged;
- XElement.DoubleValue.SlidingEnd += ClearToken;
-
- YElement = grid.DoubleValue();
- YElement.SetLimits(limit);
- YElement.DoubleValue.ValueChanged += OnValueChanged;
- YElement.DoubleValue.SlidingEnd += ClearToken;
-
- ZElement = grid.DoubleValue();
- ZElement.SetLimits(limit);
- ZElement.DoubleValue.ValueChanged += OnValueChanged;
- ZElement.DoubleValue.SlidingEnd += ClearToken;
- }
-
- private void OnValueChanged()
- {
- if (IsSetBlocked)
- return;
-
- var isSliding = XElement.IsSliding || YElement.IsSliding || ZElement.IsSliding;
- var token = isSliding ? this : null;
- var value = new Double3(XElement.DoubleValue.Value, YElement.DoubleValue.Value, ZElement.DoubleValue.Value);
- SetValue(value, token);
- }
-
- ///
- public override void Refresh()
- {
- base.Refresh();
-
- if (HasDifferentValues)
- {
- // TODO: support different values for ValueBox
- }
- else
- {
- var value = (Double3)Values[0];
- XElement.DoubleValue.Value = value.X;
- YElement.DoubleValue.Value = value.Y;
- ZElement.DoubleValue.Value = value.Z;
- }
- }
- }
-}
diff --git a/Source/Editor/CustomEditors/Editors/Double4Editor.cs b/Source/Editor/CustomEditors/Editors/Double4Editor.cs
deleted file mode 100644
index 9244bf89d..000000000
--- a/Source/Editor/CustomEditors/Editors/Double4Editor.cs
+++ /dev/null
@@ -1,107 +0,0 @@
-// Copyright (c) 2012-2022 Wojciech Figat. All rights reserved.
-
-using System.Linq;
-using FlaxEditor.CustomEditors.Elements;
-using FlaxEngine;
-using FlaxEngine.GUI;
-
-namespace FlaxEditor.CustomEditors.Editors
-{
- ///
- /// Default implementation of the inspector used to edit Double4 value type properties.
- ///
- [CustomEditor(typeof(Double4)), DefaultEditor]
- public class Double4Editor : CustomEditor
- {
- ///
- /// The X component editor.
- ///
- protected DoubleValueElement XElement;
-
- ///
- /// The Y component editor.
- ///
- protected DoubleValueElement YElement;
-
- ///
- /// The Z component editor.
- ///
- protected DoubleValueElement ZElement;
-
- ///
- /// The W component editor.
- ///
- protected DoubleValueElement WElement;
-
- ///
- public override DisplayStyle Style => DisplayStyle.Inline;
-
- ///
- public override void Initialize(LayoutElementsContainer layout)
- {
- var grid = layout.CustomContainer();
- var gridControl = grid.CustomControl;
- gridControl.ClipChildren = false;
- gridControl.Height = TextBox.DefaultHeight;
- gridControl.SlotsHorizontally = 4;
- gridControl.SlotsVertically = 1;
-
- LimitAttribute limit = null;
- var attributes = Values.GetAttributes();
- if (attributes != null)
- {
- limit = (LimitAttribute)attributes.FirstOrDefault(x => x is LimitAttribute);
- }
-
- XElement = grid.DoubleValue();
- XElement.SetLimits(limit);
- XElement.DoubleValue.ValueChanged += OnValueChanged;
- XElement.DoubleValue.SlidingEnd += ClearToken;
-
- YElement = grid.DoubleValue();
- YElement.SetLimits(limit);
- YElement.DoubleValue.ValueChanged += OnValueChanged;
- YElement.DoubleValue.SlidingEnd += ClearToken;
-
- ZElement = grid.DoubleValue();
- ZElement.SetLimits(limit);
- ZElement.DoubleValue.ValueChanged += OnValueChanged;
- ZElement.DoubleValue.SlidingEnd += ClearToken;
-
- WElement = grid.DoubleValue();
- WElement.SetLimits(limit);
- WElement.DoubleValue.ValueChanged += OnValueChanged;
- WElement.DoubleValue.SlidingEnd += ClearToken;
- }
-
- private void OnValueChanged()
- {
- if (IsSetBlocked)
- return;
-
- var isSliding = XElement.IsSliding || YElement.IsSliding || ZElement.IsSliding || WElement.IsSliding;
- var token = isSliding ? this : null;
- var value = new Double4(XElement.DoubleValue.Value, YElement.DoubleValue.Value, ZElement.DoubleValue.Value, WElement.DoubleValue.Value);
- SetValue(value, token);
- }
-
- ///
- public override void Refresh()
- {
- base.Refresh();
-
- if (HasDifferentValues)
- {
- // TODO: support different values for ValueBox
- }
- else
- {
- var value = (Double4)Values[0];
- XElement.DoubleValue.Value = value.X;
- YElement.DoubleValue.Value = value.Y;
- ZElement.DoubleValue.Value = value.Z;
- WElement.DoubleValue.Value = value.W;
- }
- }
- }
-}
diff --git a/Source/Editor/CustomEditors/Editors/DoubleEditor.cs b/Source/Editor/CustomEditors/Editors/DoubleEditor.cs
index 859b70f4e..4deaeae05 100644
--- a/Source/Editor/CustomEditors/Editors/DoubleEditor.cs
+++ b/Source/Editor/CustomEditors/Editors/DoubleEditor.cs
@@ -33,8 +33,8 @@ namespace FlaxEditor.CustomEditors.Editors
// Use double value editor with limit
var doubleValue = layout.DoubleValue();
doubleValue.SetLimits((LimitAttribute)limit);
- doubleValue.DoubleValue.ValueChanged += OnValueChanged;
- doubleValue.DoubleValue.SlidingEnd += ClearToken;
+ doubleValue.ValueBox.ValueChanged += OnValueChanged;
+ doubleValue.ValueBox.SlidingEnd += ClearToken;
_element = doubleValue;
return;
}
@@ -43,8 +43,8 @@ namespace FlaxEditor.CustomEditors.Editors
{
// Use double value editor
var doubleValue = layout.DoubleValue();
- doubleValue.DoubleValue.ValueChanged += OnValueChanged;
- doubleValue.DoubleValue.SlidingEnd += ClearToken;
+ doubleValue.ValueBox.ValueChanged += OnValueChanged;
+ doubleValue.ValueBox.SlidingEnd += ClearToken;
_element = doubleValue;
}
}
diff --git a/Source/Editor/CustomEditors/Editors/FlaxObjectRefEditor.cs b/Source/Editor/CustomEditors/Editors/FlaxObjectRefEditor.cs
index 267ec31b3..8e445db47 100644
--- a/Source/Editor/CustomEditors/Editors/FlaxObjectRefEditor.cs
+++ b/Source/Editor/CustomEditors/Editors/FlaxObjectRefEditor.cs
@@ -27,8 +27,8 @@ namespace FlaxEditor.CustomEditors.Editors
private bool _supportsPickDropDown;
private bool _isMouseDown;
- private Vector2 _mouseDownPos;
- private Vector2 _mousePos;
+ private Float2 _mouseDownPos;
+ private Float2 _mousePos;
private bool _hasValidDragOver;
private DragActors _dragActors;
@@ -146,7 +146,7 @@ namespace FlaxEditor.CustomEditors.Editors
Focus();
if (new ScriptType(typeof(Actor)).IsAssignableFrom(_type))
{
- ActorSearchPopup.Show(this, new Vector2(0, Height), IsValid, actor =>
+ ActorSearchPopup.Show(this, new Float2(0, Height), IsValid, actor =>
{
Value = actor;
RootWindow.Focus();
@@ -155,7 +155,7 @@ namespace FlaxEditor.CustomEditors.Editors
}
else
{
- ScriptSearchPopup.Show(this, new Vector2(0, Height), IsValid, script =>
+ ScriptSearchPopup.Show(this, new Float2(0, Height), IsValid, script =>
{
Value = script;
RootWindow.Focus();
@@ -219,14 +219,14 @@ namespace FlaxEditor.CustomEditors.Editors
// Check if drag is over
if (IsDragOver && _hasValidDragOver)
- Render2D.FillRectangle(new Rectangle(Vector2.Zero, Size), style.BackgroundSelected * 0.4f);
+ Render2D.FillRectangle(new Rectangle(Float2.Zero, Size), style.BackgroundSelected * 0.4f);
}
///
- public override void OnMouseEnter(Vector2 location)
+ public override void OnMouseEnter(Float2 location)
{
_mousePos = location;
- _mouseDownPos = Vector2.Minimum;
+ _mouseDownPos = Float2.Minimum;
base.OnMouseEnter(location);
}
@@ -234,7 +234,7 @@ namespace FlaxEditor.CustomEditors.Editors
///
public override void OnMouseLeave()
{
- _mousePos = Vector2.Minimum;
+ _mousePos = Float2.Minimum;
// Check if start drag drop
if (_isMouseDown)
@@ -250,12 +250,12 @@ namespace FlaxEditor.CustomEditors.Editors
}
///
- public override void OnMouseMove(Vector2 location)
+ public override void OnMouseMove(Float2 location)
{
_mousePos = location;
// Check if start drag drop
- if (_isMouseDown && Vector2.Distance(location, _mouseDownPos) > 10.0f)
+ if (_isMouseDown && Float2.Distance(location, _mouseDownPos) > 10.0f)
{
// Do the drag
DoDrag();
@@ -268,7 +268,7 @@ namespace FlaxEditor.CustomEditors.Editors
}
///
- public override bool OnMouseUp(Vector2 location, MouseButton button)
+ public override bool OnMouseUp(Float2 location, MouseButton button)
{
if (button == MouseButton.Left)
{
@@ -299,7 +299,7 @@ namespace FlaxEditor.CustomEditors.Editors
}
///
- public override bool OnMouseDown(Vector2 location, MouseButton button)
+ public override bool OnMouseDown(Float2 location, MouseButton button)
{
if (button == MouseButton.Left)
{
@@ -312,7 +312,7 @@ namespace FlaxEditor.CustomEditors.Editors
}
///
- public override bool OnMouseDoubleClick(Vector2 location, MouseButton button)
+ public override bool OnMouseDoubleClick(Float2 location, MouseButton button)
{
Focus();
@@ -358,7 +358,7 @@ namespace FlaxEditor.CustomEditors.Editors
private DragDropEffect DragEffect => _hasValidDragOver ? DragDropEffect.Move : DragDropEffect.None;
///
- public override DragDropEffect OnDragEnter(ref Vector2 location, DragData data)
+ public override DragDropEffect OnDragEnter(ref Float2 location, DragData data)
{
base.OnDragEnter(ref location, data);
@@ -417,7 +417,7 @@ namespace FlaxEditor.CustomEditors.Editors
}
///
- public override DragDropEffect OnDragMove(ref Vector2 location, DragData data)
+ public override DragDropEffect OnDragMove(ref Float2 location, DragData data)
{
base.OnDragMove(ref location, data);
@@ -434,7 +434,7 @@ namespace FlaxEditor.CustomEditors.Editors
}
///
- public override DragDropEffect OnDragDrop(ref Vector2 location, DragData data)
+ public override DragDropEffect OnDragDrop(ref Float2 location, DragData data)
{
var result = DragEffect;
diff --git a/Source/Editor/CustomEditors/Editors/FloatEditor.cs b/Source/Editor/CustomEditors/Editors/FloatEditor.cs
index fea3e2526..a1f66ddfc 100644
--- a/Source/Editor/CustomEditors/Editors/FloatEditor.cs
+++ b/Source/Editor/CustomEditors/Editors/FloatEditor.cs
@@ -49,8 +49,8 @@ namespace FlaxEditor.CustomEditors.Editors
// Use float value editor with limit
var floatValue = layout.FloatValue();
floatValue.SetLimits((LimitAttribute)limit);
- floatValue.FloatValue.ValueChanged += OnValueChanged;
- floatValue.FloatValue.SlidingEnd += ClearToken;
+ floatValue.ValueBox.ValueChanged += OnValueChanged;
+ floatValue.ValueBox.SlidingEnd += ClearToken;
_element = floatValue;
return;
}
@@ -59,8 +59,8 @@ namespace FlaxEditor.CustomEditors.Editors
{
// Use float value editor
var floatValue = layout.FloatValue();
- floatValue.FloatValue.ValueChanged += OnValueChanged;
- floatValue.FloatValue.SlidingEnd += ClearToken;
+ floatValue.ValueBox.ValueChanged += OnValueChanged;
+ floatValue.ValueBox.SlidingEnd += ClearToken;
_element = floatValue;
}
}
diff --git a/Source/Editor/CustomEditors/Editors/GenericEditor.cs b/Source/Editor/CustomEditors/Editors/GenericEditor.cs
index a69ae7ba4..489c324e5 100644
--- a/Source/Editor/CustomEditors/Editors/GenericEditor.cs
+++ b/Source/Editor/CustomEditors/Editors/GenericEditor.cs
@@ -498,7 +498,7 @@ namespace FlaxEditor.CustomEditors.Editors
return false;
}
- private void OnGroupPanelMouseButtonRightClicked(DropPanel groupPanel, Vector2 location)
+ private void OnGroupPanelMouseButtonRightClicked(DropPanel groupPanel, Float2 location)
{
var group = (GroupElement)groupPanel.Tag;
bool canRevertReference = false, canRevertDefault = false;
@@ -637,10 +637,10 @@ namespace FlaxEditor.CustomEditors.Editors
{
Text = "+",
TooltipText = "Create a new instance of the object",
- Size = new Vector2(ButtonSize, ButtonSize),
+ Size = new Float2(ButtonSize, ButtonSize),
AnchorPreset = AnchorPresets.MiddleRight,
Parent = layout.ContainerControl,
- Location = new Vector2(layout.ContainerControl.Width - ButtonSize - 4, (layout.ContainerControl.Height - ButtonSize) * 0.5f),
+ Location = new Float2(layout.ContainerControl.Width - ButtonSize - 4, (layout.ContainerControl.Height - ButtonSize) * 0.5f),
};
button.Clicked += () => SetValue(Values.Type.CreateInstance());
}
diff --git a/Source/Editor/CustomEditors/Editors/Int2Editor.cs b/Source/Editor/CustomEditors/Editors/Int2Editor.cs
deleted file mode 100644
index b8f747100..000000000
--- a/Source/Editor/CustomEditors/Editors/Int2Editor.cs
+++ /dev/null
@@ -1,87 +0,0 @@
-// Copyright (c) 2012-2022 Wojciech Figat. All rights reserved.
-
-using System.Linq;
-using FlaxEditor.CustomEditors.Elements;
-using FlaxEngine;
-using FlaxEngine.GUI;
-
-namespace FlaxEditor.CustomEditors.Editors
-{
- ///
- /// Default implementation of the inspector used to edit Int2 value type properties.
- ///
- [CustomEditor(typeof(Int2)), DefaultEditor]
- public class Int2Editor : CustomEditor
- {
- ///
- /// The X component editor.
- ///
- protected IntegerValueElement XElement;
-
- ///
- /// The Y component editor.
- ///
- protected IntegerValueElement YElement;
-
- ///
- public override DisplayStyle Style => DisplayStyle.Inline;
-
- ///
- public override void Initialize(LayoutElementsContainer layout)
- {
- var grid = layout.CustomContainer();
- var gridControl = grid.CustomControl;
- gridControl.ClipChildren = false;
- gridControl.Height = TextBox.DefaultHeight;
- gridControl.SlotsHorizontally = 2;
- gridControl.SlotsVertically = 1;
-
- LimitAttribute limit = null;
- var attributes = Values.GetAttributes();
- if (attributes != null)
- {
- limit = (LimitAttribute)attributes.FirstOrDefault(x => x is LimitAttribute);
- }
-
- XElement = grid.IntegerValue();
- XElement.SetLimits(limit);
- XElement.IntValue.ValueChanged += OnValueChanged;
- XElement.IntValue.SlidingEnd += ClearToken;
-
- YElement = grid.IntegerValue();
- YElement.SetLimits(limit);
- YElement.IntValue.ValueChanged += OnValueChanged;
- YElement.IntValue.SlidingEnd += ClearToken;
- }
-
- private void OnValueChanged()
- {
- if (IsSetBlocked)
- return;
-
- var isSliding = XElement.IsSliding || YElement.IsSliding;
- var token = isSliding ? this : null;
- var value = new Int2(
- XElement.IntValue.Value,
- YElement.IntValue.Value);
- SetValue(value, token);
- }
-
- ///
- public override void Refresh()
- {
- base.Refresh();
-
- if (HasDifferentValues)
- {
- // TODO: support different values for ValueBox
- }
- else
- {
- var value = (Int2)Values[0];
- XElement.IntValue.Value = value.X;
- YElement.IntValue.Value = value.Y;
- }
- }
- }
-}
diff --git a/Source/Editor/CustomEditors/Editors/Int3Editor.cs b/Source/Editor/CustomEditors/Editors/Int3Editor.cs
deleted file mode 100644
index d01b6c695..000000000
--- a/Source/Editor/CustomEditors/Editors/Int3Editor.cs
+++ /dev/null
@@ -1,99 +0,0 @@
-// Copyright (c) 2012-2022 Wojciech Figat. All rights reserved.
-
-using System.Linq;
-using FlaxEditor.CustomEditors.Elements;
-using FlaxEngine;
-using FlaxEngine.GUI;
-
-namespace FlaxEditor.CustomEditors.Editors
-{
- ///
- /// Default implementation of the inspector used to edit Int3 value type properties.
- ///
- [CustomEditor(typeof(Int3)), DefaultEditor]
- public class Int3Editor : CustomEditor
- {
- ///
- /// The X component editor.
- ///
- protected IntegerValueElement XElement;
-
- ///
- /// The Y component editor.
- ///
- protected IntegerValueElement YElement;
-
- ///
- /// The Z component editor.
- ///
- protected IntegerValueElement ZElement;
-
- ///
- public override DisplayStyle Style => DisplayStyle.Inline;
-
- ///
- public override void Initialize(LayoutElementsContainer layout)
- {
- var grid = layout.CustomContainer();
- var gridControl = grid.CustomControl;
- gridControl.ClipChildren = false;
- gridControl.Height = TextBox.DefaultHeight;
- gridControl.SlotsHorizontally = 3;
- gridControl.SlotsVertically = 1;
-
- LimitAttribute limit = null;
- var attributes = Values.GetAttributes();
- if (attributes != null)
- {
- limit = (LimitAttribute)attributes.FirstOrDefault(x => x is LimitAttribute);
- }
-
- XElement = grid.IntegerValue();
- XElement.SetLimits(limit);
- XElement.IntValue.ValueChanged += OnValueChanged;
- XElement.IntValue.SlidingEnd += ClearToken;
-
- YElement = grid.IntegerValue();
- YElement.SetLimits(limit);
- YElement.IntValue.ValueChanged += OnValueChanged;
- YElement.IntValue.SlidingEnd += ClearToken;
-
- ZElement = grid.IntegerValue();
- ZElement.SetLimits(limit);
- ZElement.IntValue.ValueChanged += OnValueChanged;
- ZElement.IntValue.SlidingEnd += ClearToken;
- }
-
- private void OnValueChanged()
- {
- if (IsSetBlocked)
- return;
-
- var isSliding = XElement.IsSliding || YElement.IsSliding || ZElement.IsSliding;
- var token = isSliding ? this : null;
- var value = new Int3(
- XElement.IntValue.Value,
- YElement.IntValue.Value,
- ZElement.IntValue.Value);
- SetValue(value, token);
- }
-
- ///
- public override void Refresh()
- {
- base.Refresh();
-
- if (HasDifferentValues)
- {
- // TODO: support different values for ValueBox
- }
- else
- {
- var value = (Int3)Values[0];
- XElement.IntValue.Value = value.X;
- YElement.IntValue.Value = value.Y;
- ZElement.IntValue.Value = value.Z;
- }
- }
- }
-}
diff --git a/Source/Editor/CustomEditors/Editors/Int4Editor.cs b/Source/Editor/CustomEditors/Editors/Int4Editor.cs
deleted file mode 100644
index b8271fe98..000000000
--- a/Source/Editor/CustomEditors/Editors/Int4Editor.cs
+++ /dev/null
@@ -1,111 +0,0 @@
-// Copyright (c) 2012-2022 Wojciech Figat. All rights reserved.
-
-using System.Linq;
-using FlaxEditor.CustomEditors.Elements;
-using FlaxEngine;
-using FlaxEngine.GUI;
-
-namespace FlaxEditor.CustomEditors.Editors
-{
- ///
- /// Default implementation of the inspector used to edit Int4 value type properties.
- ///
- [CustomEditor(typeof(Int4)), DefaultEditor]
- public class Int4Editor : CustomEditor
- {
- ///
- /// The X component editor.
- ///
- protected IntegerValueElement XElement;
-
- ///
- /// The Y component editor.
- ///
- protected IntegerValueElement YElement;
-
- ///
- /// The Z component editor.
- ///
- protected IntegerValueElement ZElement;
-
- ///
- /// The W component editor.
- ///
- protected IntegerValueElement WElement;
-
- ///
- public override DisplayStyle Style => DisplayStyle.Inline;
-
- ///
- public override void Initialize(LayoutElementsContainer layout)
- {
- var grid = layout.CustomContainer();
- var gridControl = grid.CustomControl;
- gridControl.ClipChildren = false;
- gridControl.Height = TextBox.DefaultHeight;
- gridControl.SlotsHorizontally = 4;
- gridControl.SlotsVertically = 1;
-
- LimitAttribute limit = null;
- var attributes = Values.GetAttributes();
- if (attributes != null)
- {
- limit = (LimitAttribute)attributes.FirstOrDefault(x => x is LimitAttribute);
- }
-
- XElement = grid.IntegerValue();
- XElement.SetLimits(limit);
- XElement.IntValue.ValueChanged += OnValueChanged;
- XElement.IntValue.SlidingEnd += ClearToken;
-
- YElement = grid.IntegerValue();
- YElement.SetLimits(limit);
- YElement.IntValue.ValueChanged += OnValueChanged;
- YElement.IntValue.SlidingEnd += ClearToken;
-
- ZElement = grid.IntegerValue();
- ZElement.SetLimits(limit);
- ZElement.IntValue.ValueChanged += OnValueChanged;
- ZElement.IntValue.SlidingEnd += ClearToken;
-
- WElement = grid.IntegerValue();
- WElement.SetLimits(limit);
- WElement.IntValue.ValueChanged += OnValueChanged;
- WElement.IntValue.SlidingEnd += ClearToken;
- }
-
- private void OnValueChanged()
- {
- if (IsSetBlocked)
- return;
-
- var isSliding = XElement.IsSliding || YElement.IsSliding || ZElement.IsSliding || WElement.IsSliding;
- var token = isSliding ? this : null;
- var value = new Int4(
- XElement.IntValue.Value,
- YElement.IntValue.Value,
- ZElement.IntValue.Value,
- WElement.IntValue.Value);
- SetValue(value, token);
- }
-
- ///
- public override void Refresh()
- {
- base.Refresh();
-
- if (HasDifferentValues)
- {
- // TODO: support different values for ValueBox
- }
- else
- {
- var value = (Int4)Values[0];
- XElement.IntValue.Value = value.X;
- YElement.IntValue.Value = value.Y;
- ZElement.IntValue.Value = value.Z;
- WElement.IntValue.Value = value.W;
- }
- }
- }
-}
diff --git a/Source/Editor/CustomEditors/Editors/LocalizedStringEditor.cs b/Source/Editor/CustomEditors/Editors/LocalizedStringEditor.cs
index 5bfd475ff..136532b44 100644
--- a/Source/Editor/CustomEditors/Editors/LocalizedStringEditor.cs
+++ b/Source/Editor/CustomEditors/Editors/LocalizedStringEditor.cs
@@ -152,7 +152,7 @@ namespace FlaxEditor.CustomEditors.Editors
tree.UnlockChildrenRecursive();
menu.PerformLayout();
};
- menu.Show(button, new Vector2(0, button.Height));
+ menu.Show(button, new Float2(0, button.Height));
Profiler.EndEvent();
}
diff --git a/Source/Editor/CustomEditors/Editors/MatrixEditor.cs b/Source/Editor/CustomEditors/Editors/MatrixEditor.cs
index 6e09156d3..5a6eaab9f 100644
--- a/Source/Editor/CustomEditors/Editors/MatrixEditor.cs
+++ b/Source/Editor/CustomEditors/Editors/MatrixEditor.cs
@@ -42,8 +42,8 @@ namespace FlaxEditor.CustomEditors.Editors
{
var elemnt = grid.FloatValue();
elemnt.SetLimits(limit);
- elemnt.FloatValue.ValueChanged += OnValueChanged;
- elemnt.FloatValue.SlidingEnd += ClearToken;
+ elemnt.ValueBox.ValueChanged += OnValueChanged;
+ elemnt.ValueBox.SlidingEnd += ClearToken;
Elements[i] = elemnt;
}
}
@@ -62,7 +62,7 @@ namespace FlaxEditor.CustomEditors.Editors
var value = new Matrix();
for (int i = 0; i < 16; i++)
{
- value[i] = Elements[i].FloatValue.Value;
+ value[i] = Elements[i].ValueBox.Value;
}
SetValue(value, token);
}
@@ -81,7 +81,7 @@ namespace FlaxEditor.CustomEditors.Editors
var value = (Matrix)Values[0];
for (int i = 0; i < 16; i++)
{
- Elements[i].FloatValue.Value = value[i];
+ Elements[i].ValueBox.Value = value[i];
}
}
}
diff --git a/Source/Editor/CustomEditors/Editors/QuaternionEditor.cs b/Source/Editor/CustomEditors/Editors/QuaternionEditor.cs
index b64aadced..0a40b7716 100644
--- a/Source/Editor/CustomEditors/Editors/QuaternionEditor.cs
+++ b/Source/Editor/CustomEditors/Editors/QuaternionEditor.cs
@@ -12,7 +12,7 @@ namespace FlaxEditor.CustomEditors.Editors
[CustomEditor(typeof(Quaternion)), DefaultEditor]
public class QuaternionEditor : CustomEditor
{
- private Vector3 _cachedAngles = Vector3.Zero;
+ private Float3 _cachedAngles = Float3.Zero;
private object _cachedToken;
///
@@ -44,16 +44,16 @@ namespace FlaxEditor.CustomEditors.Editors
gridControl.SlotsVertically = 1;
XElement = grid.FloatValue();
- XElement.FloatValue.ValueChanged += OnValueChanged;
- XElement.FloatValue.SlidingEnd += ClearToken;
+ XElement.ValueBox.ValueChanged += OnValueChanged;
+ XElement.ValueBox.SlidingEnd += ClearToken;
YElement = grid.FloatValue();
- YElement.FloatValue.ValueChanged += OnValueChanged;
- YElement.FloatValue.SlidingEnd += ClearToken;
+ YElement.ValueBox.ValueChanged += OnValueChanged;
+ YElement.ValueBox.SlidingEnd += ClearToken;
ZElement = grid.FloatValue();
- ZElement.FloatValue.ValueChanged += OnValueChanged;
- ZElement.FloatValue.SlidingEnd += ClearToken;
+ ZElement.ValueBox.ValueChanged += OnValueChanged;
+ ZElement.ValueBox.SlidingEnd += ClearToken;
}
private void OnValueChanged()
@@ -65,9 +65,9 @@ namespace FlaxEditor.CustomEditors.Editors
var token = isSliding ? this : null;
var useCachedAngles = isSliding && token == _cachedToken;
- float x = (useCachedAngles && !XElement.IsSliding) ? _cachedAngles.X : XElement.FloatValue.Value;
- float y = (useCachedAngles && !YElement.IsSliding) ? _cachedAngles.Y : YElement.FloatValue.Value;
- float z = (useCachedAngles && !ZElement.IsSliding) ? _cachedAngles.Z : ZElement.FloatValue.Value;
+ float x = (useCachedAngles && !XElement.IsSliding) ? _cachedAngles.X : XElement.ValueBox.Value;
+ float y = (useCachedAngles && !YElement.IsSliding) ? _cachedAngles.Y : YElement.ValueBox.Value;
+ float z = (useCachedAngles && !ZElement.IsSliding) ? _cachedAngles.Z : ZElement.ValueBox.Value;
x = Mathf.UnwindDegrees(x);
y = Mathf.UnwindDegrees(y);
@@ -75,7 +75,7 @@ namespace FlaxEditor.CustomEditors.Editors
if (!useCachedAngles)
{
- _cachedAngles = new Vector3(x, y, z);
+ _cachedAngles = new Float3(x, y, z);
}
_cachedToken = token;
@@ -104,9 +104,9 @@ namespace FlaxEditor.CustomEditors.Editors
{
var value = (Quaternion)Values[0];
var euler = value.EulerAngles;
- XElement.FloatValue.Value = euler.X;
- YElement.FloatValue.Value = euler.Y;
- ZElement.FloatValue.Value = euler.Z;
+ XElement.ValueBox.Value = euler.X;
+ YElement.ValueBox.Value = euler.Y;
+ ZElement.ValueBox.Value = euler.Z;
}
}
}
diff --git a/Source/Editor/CustomEditors/Editors/TypeEditor.cs b/Source/Editor/CustomEditors/Editors/TypeEditor.cs
index caff6279e..9f7068548 100644
--- a/Source/Editor/CustomEditors/Editors/TypeEditor.cs
+++ b/Source/Editor/CustomEditors/Editors/TypeEditor.cs
@@ -23,7 +23,7 @@ namespace FlaxEditor.CustomEditors.Editors
private ScriptType _value;
private string _valueName;
- private Vector2 _mousePos;
+ private Float2 _mousePos;
private bool _hasValidDragOver;
private DragActors _dragActors;
@@ -124,7 +124,7 @@ namespace FlaxEditor.CustomEditors.Editors
private void ShowDropDownMenu()
{
Focus();
- TypeSearchPopup.Show(this, new Vector2(0, Height), IsValid, scriptType =>
+ TypeSearchPopup.Show(this, new Float2(0, Height), IsValid, scriptType =>
{
Value = scriptType;
RootWindow.Focus();
@@ -174,11 +174,11 @@ namespace FlaxEditor.CustomEditors.Editors
// Check if drag is over
if (IsDragOver && _hasValidDragOver)
- Render2D.FillRectangle(new Rectangle(Vector2.Zero, Size), style.BackgroundSelected * 0.4f);
+ Render2D.FillRectangle(new Rectangle(Float2.Zero, Size), style.BackgroundSelected * 0.4f);
}
///
- public override void OnMouseEnter(Vector2 location)
+ public override void OnMouseEnter(Float2 location)
{
_mousePos = location;
@@ -186,7 +186,7 @@ namespace FlaxEditor.CustomEditors.Editors
}
///
- public override void OnMouseMove(Vector2 location)
+ public override void OnMouseMove(Float2 location)
{
_mousePos = location;
@@ -196,13 +196,13 @@ namespace FlaxEditor.CustomEditors.Editors
///
public override void OnMouseLeave()
{
- _mousePos = Vector2.Minimum;
+ _mousePos = Float2.Minimum;
base.OnMouseLeave();
}
///
- public override bool OnMouseUp(Vector2 location, MouseButton button)
+ public override bool OnMouseUp(Float2 location, MouseButton button)
{
// Cache data
bool isSelected = _value != ScriptType.Null;
@@ -225,7 +225,7 @@ namespace FlaxEditor.CustomEditors.Editors
}
///
- public override bool OnMouseDoubleClick(Vector2 location, MouseButton button)
+ public override bool OnMouseDoubleClick(Float2 location, MouseButton button)
{
// Navigate to types from game project
if (button == MouseButton.Left && _value != ScriptType.Null)
@@ -241,7 +241,7 @@ namespace FlaxEditor.CustomEditors.Editors
private DragDropEffect DragEffect => _hasValidDragOver ? DragDropEffect.Move : DragDropEffect.None;
///
- public override DragDropEffect OnDragEnter(ref Vector2 location, DragData data)
+ public override DragDropEffect OnDragEnter(ref Float2 location, DragData data)
{
base.OnDragEnter(ref location, data);
@@ -267,7 +267,7 @@ namespace FlaxEditor.CustomEditors.Editors
}
///
- public override DragDropEffect OnDragMove(ref Vector2 location, DragData data)
+ public override DragDropEffect OnDragMove(ref Float2 location, DragData data)
{
base.OnDragMove(ref location, data);
@@ -284,7 +284,7 @@ namespace FlaxEditor.CustomEditors.Editors
}
///
- public override DragDropEffect OnDragDrop(ref Vector2 location, DragData data)
+ public override DragDropEffect OnDragDrop(ref Float2 location, DragData data)
{
var result = DragEffect;
diff --git a/Source/Editor/CustomEditors/Editors/Vector2Editor.cs b/Source/Editor/CustomEditors/Editors/Vector2Editor.cs
index 8b97aa360..ee0b12e5f 100644
--- a/Source/Editor/CustomEditors/Editors/Vector2Editor.cs
+++ b/Source/Editor/CustomEditors/Editors/Vector2Editor.cs
@@ -11,7 +11,20 @@ namespace FlaxEditor.CustomEditors.Editors
/// Default implementation of the inspector used to edit Vector2 value type properties.
///
[CustomEditor(typeof(Vector2)), DefaultEditor]
- public class Vector2Editor : CustomEditor
+ public class Vector2Editor :
+#if USE_LARGE_WORLDS
+ Double2Editor
+#else
+ Float2Editor
+#endif
+ {
+ }
+
+ ///
+ /// Default implementation of the inspector used to edit Float2 value type properties.
+ ///
+ [CustomEditor(typeof(Float2)), DefaultEditor]
+ public class Float2Editor : CustomEditor
{
///
/// The X component editor.
@@ -45,13 +58,13 @@ namespace FlaxEditor.CustomEditors.Editors
XElement = grid.FloatValue();
XElement.SetLimits(limit);
- XElement.FloatValue.ValueChanged += OnValueChanged;
- XElement.FloatValue.SlidingEnd += ClearToken;
+ XElement.ValueBox.ValueChanged += OnValueChanged;
+ XElement.ValueBox.SlidingEnd += ClearToken;
YElement = grid.FloatValue();
YElement.SetLimits(limit);
- YElement.FloatValue.ValueChanged += OnValueChanged;
- YElement.FloatValue.SlidingEnd += ClearToken;
+ YElement.ValueBox.ValueChanged += OnValueChanged;
+ YElement.ValueBox.SlidingEnd += ClearToken;
}
private void OnValueChanged()
@@ -61,9 +74,185 @@ namespace FlaxEditor.CustomEditors.Editors
var isSliding = XElement.IsSliding || YElement.IsSliding;
var token = isSliding ? this : null;
- var value = new Vector2(
- XElement.FloatValue.Value,
- YElement.FloatValue.Value);
+ var value = new Float2(XElement.ValueBox.Value, YElement.ValueBox.Value);
+ object v = Values[0];
+ if (v is Vector2)
+ v = (Vector2)value;
+ else if (v is Float2)
+ v = (Float2)value;
+ else if (v is Double2)
+ v = (Double2)value;
+ SetValue(v, token);
+ }
+
+ ///
+ public override void Refresh()
+ {
+ base.Refresh();
+
+ if (HasDifferentValues)
+ {
+ // TODO: support different values for ValueBox
+ }
+ else
+ {
+ var value = Float2.Zero;
+ if (Values[0] is Vector2 asVector2)
+ value = asVector2;
+ else if (Values[0] is Float2 asFloat2)
+ value = asFloat2;
+ else if (Values[0] is Double2 asDouble2)
+ value = asDouble2;
+ XElement.ValueBox.Value = value.X;
+ YElement.ValueBox.Value = value.Y;
+ }
+ }
+ }
+
+ ///
+ /// Default implementation of the inspector used to edit Double2 value type properties.
+ ///
+ [CustomEditor(typeof(Double2)), DefaultEditor]
+ public class Double2Editor : CustomEditor
+ {
+ ///
+ /// The X component editor.
+ ///
+ protected DoubleValueElement XElement;
+
+ ///
+ /// The Y component editor.
+ ///
+ protected DoubleValueElement YElement;
+
+ ///
+ public override DisplayStyle Style => DisplayStyle.Inline;
+
+ ///
+ public override void Initialize(LayoutElementsContainer layout)
+ {
+ var grid = layout.CustomContainer();
+ var gridControl = grid.CustomControl;
+ gridControl.ClipChildren = false;
+ gridControl.Height = TextBox.DefaultHeight;
+ gridControl.SlotsHorizontally = 2;
+ gridControl.SlotsVertically = 1;
+
+ LimitAttribute limit = null;
+ var attributes = Values.GetAttributes();
+ if (attributes != null)
+ {
+ limit = (LimitAttribute)attributes.FirstOrDefault(x => x is LimitAttribute);
+ }
+
+ XElement = grid.DoubleValue();
+ XElement.SetLimits(limit);
+ XElement.ValueBox.ValueChanged += OnValueChanged;
+ XElement.ValueBox.SlidingEnd += ClearToken;
+
+ YElement = grid.DoubleValue();
+ YElement.SetLimits(limit);
+ YElement.ValueBox.ValueChanged += OnValueChanged;
+ YElement.ValueBox.SlidingEnd += ClearToken;
+ }
+
+ private void OnValueChanged()
+ {
+ if (IsSetBlocked)
+ return;
+
+ var isSliding = XElement.IsSliding || YElement.IsSliding;
+ var token = isSliding ? this : null;
+ var value = new Double2(XElement.ValueBox.Value, YElement.ValueBox.Value);
+ object v = Values[0];
+ if (v is Vector2)
+ v = (Vector2)value;
+ else if (v is Float2)
+ v = (Float2)value;
+ else if (v is Double2)
+ v = (Double2)value;
+ SetValue(v, token);
+ }
+
+ ///
+ public override void Refresh()
+ {
+ base.Refresh();
+
+ if (HasDifferentValues)
+ {
+ // TODO: support different values for ValueBox
+ }
+ else
+ {
+ var value = Double2.Zero;
+ if (Values[0] is Vector2 asVector2)
+ value = asVector2;
+ else if (Values[0] is Float2 asFloat2)
+ value = asFloat2;
+ else if (Values[0] is Double2 asDouble2)
+ value = asDouble2;
+ XElement.ValueBox.Value = value.X;
+ YElement.ValueBox.Value = value.Y;
+ }
+ }
+ }
+
+ ///
+ /// Default implementation of the inspector used to edit Int2 value type properties.
+ ///
+ [CustomEditor(typeof(Int2)), DefaultEditor]
+ public class Int2Editor : CustomEditor
+ {
+ ///
+ /// The X component editor.
+ ///
+ protected IntegerValueElement XElement;
+
+ ///
+ /// The Y component editor.
+ ///
+ protected IntegerValueElement YElement;
+
+ ///
+ public override DisplayStyle Style => DisplayStyle.Inline;
+
+ ///
+ public override void Initialize(LayoutElementsContainer layout)
+ {
+ var grid = layout.CustomContainer();
+ var gridControl = grid.CustomControl;
+ gridControl.ClipChildren = false;
+ gridControl.Height = TextBox.DefaultHeight;
+ gridControl.SlotsHorizontally = 2;
+ gridControl.SlotsVertically = 1;
+
+ LimitAttribute limit = null;
+ var attributes = Values.GetAttributes();
+ if (attributes != null)
+ {
+ limit = (LimitAttribute)attributes.FirstOrDefault(x => x is LimitAttribute);
+ }
+
+ XElement = grid.IntegerValue();
+ XElement.SetLimits(limit);
+ XElement.IntValue.ValueChanged += OnValueChanged;
+ XElement.IntValue.SlidingEnd += ClearToken;
+
+ YElement = grid.IntegerValue();
+ YElement.SetLimits(limit);
+ YElement.IntValue.ValueChanged += OnValueChanged;
+ YElement.IntValue.SlidingEnd += ClearToken;
+ }
+
+ private void OnValueChanged()
+ {
+ if (IsSetBlocked)
+ return;
+
+ var isSliding = XElement.IsSliding || YElement.IsSliding;
+ var token = isSliding ? this : null;
+ var value = new Int2(XElement.IntValue.Value, YElement.IntValue.Value);
SetValue(value, token);
}
@@ -78,9 +267,9 @@ namespace FlaxEditor.CustomEditors.Editors
}
else
{
- var value = (Vector2)Values[0];
- XElement.FloatValue.Value = value.X;
- YElement.FloatValue.Value = value.Y;
+ var value = (Int2)Values[0];
+ XElement.IntValue.Value = value.X;
+ YElement.IntValue.Value = value.Y;
}
}
}
diff --git a/Source/Editor/CustomEditors/Editors/Vector3Editor.cs b/Source/Editor/CustomEditors/Editors/Vector3Editor.cs
index 7c9b0d9b3..7fdcc0c84 100644
--- a/Source/Editor/CustomEditors/Editors/Vector3Editor.cs
+++ b/Source/Editor/CustomEditors/Editors/Vector3Editor.cs
@@ -11,7 +11,20 @@ namespace FlaxEditor.CustomEditors.Editors
/// Default implementation of the inspector used to edit Vector3 value type properties.
///
[CustomEditor(typeof(Vector3)), DefaultEditor]
- public class Vector3Editor : CustomEditor
+ public class Vector3Editor :
+#if USE_LARGE_WORLDS
+ Double3Editor
+#else
+ Float3Editor
+#endif
+ {
+ }
+
+ ///
+ /// Default implementation of the inspector used to edit Float3 value type properties.
+ ///
+ [CustomEditor(typeof(Float3)), DefaultEditor]
+ public class Float3Editor : CustomEditor
{
///
/// The X component editor.
@@ -50,18 +63,18 @@ namespace FlaxEditor.CustomEditors.Editors
XElement = grid.FloatValue();
XElement.SetLimits(limit);
- XElement.FloatValue.ValueChanged += OnValueChanged;
- XElement.FloatValue.SlidingEnd += ClearToken;
+ XElement.ValueBox.ValueChanged += OnValueChanged;
+ XElement.ValueBox.SlidingEnd += ClearToken;
YElement = grid.FloatValue();
YElement.SetLimits(limit);
- YElement.FloatValue.ValueChanged += OnValueChanged;
- YElement.FloatValue.SlidingEnd += ClearToken;
+ YElement.ValueBox.ValueChanged += OnValueChanged;
+ YElement.ValueBox.SlidingEnd += ClearToken;
ZElement = grid.FloatValue();
ZElement.SetLimits(limit);
- ZElement.FloatValue.ValueChanged += OnValueChanged;
- ZElement.FloatValue.SlidingEnd += ClearToken;
+ ZElement.ValueBox.ValueChanged += OnValueChanged;
+ ZElement.ValueBox.SlidingEnd += ClearToken;
}
private void OnValueChanged()
@@ -71,10 +84,207 @@ namespace FlaxEditor.CustomEditors.Editors
var isSliding = XElement.IsSliding || YElement.IsSliding || ZElement.IsSliding;
var token = isSliding ? this : null;
- var value = new Vector3(
- XElement.FloatValue.Value,
- YElement.FloatValue.Value,
- ZElement.FloatValue.Value);
+ var value = new Float3(XElement.ValueBox.Value, YElement.ValueBox.Value, ZElement.ValueBox.Value);
+ object v = Values[0];
+ if (v is Vector3)
+ v = (Vector3)value;
+ else if (v is Float3)
+ v = (Float3)value;
+ else if (v is Double3)
+ v = (Double3)value;
+ SetValue(v, token);
+ }
+
+ ///
+ public override void Refresh()
+ {
+ base.Refresh();
+
+ if (HasDifferentValues)
+ {
+ // TODO: support different values for ValueBox
+ }
+ else
+ {
+ var value = Float3.Zero;
+ if (Values[0] is Vector3 asVector3)
+ value = asVector3;
+ else if (Values[0] is Float3 asFloat3)
+ value = asFloat3;
+ else if (Values[0] is Double3 asDouble3)
+ value = asDouble3;
+ XElement.ValueBox.Value = value.X;
+ YElement.ValueBox.Value = value.Y;
+ ZElement.ValueBox.Value = value.Z;
+ }
+ }
+ }
+
+ ///
+ /// Default implementation of the inspector used to edit Double3 value type properties.
+ ///
+ [CustomEditor(typeof(Double3)), DefaultEditor]
+ public class Double3Editor : CustomEditor
+ {
+ ///
+ /// The X component editor.
+ ///
+ protected DoubleValueElement XElement;
+
+ ///
+ /// The Y component editor.
+ ///
+ protected DoubleValueElement YElement;
+
+ ///
+ /// The Z component editor.
+ ///
+ protected DoubleValueElement ZElement;
+
+ ///
+ public override DisplayStyle Style => DisplayStyle.Inline;
+
+ ///
+ public override void Initialize(LayoutElementsContainer layout)
+ {
+ var grid = layout.CustomContainer();
+ var gridControl = grid.CustomControl;
+ gridControl.ClipChildren = false;
+ gridControl.Height = TextBox.DefaultHeight;
+ gridControl.SlotsHorizontally = 3;
+ gridControl.SlotsVertically = 1;
+
+ LimitAttribute limit = null;
+ var attributes = Values.GetAttributes();
+ if (attributes != null)
+ {
+ limit = (LimitAttribute)attributes.FirstOrDefault(x => x is LimitAttribute);
+ }
+
+ XElement = grid.DoubleValue();
+ XElement.SetLimits(limit);
+ XElement.ValueBox.ValueChanged += OnValueChanged;
+ XElement.ValueBox.SlidingEnd += ClearToken;
+
+ YElement = grid.DoubleValue();
+ YElement.SetLimits(limit);
+ YElement.ValueBox.ValueChanged += OnValueChanged;
+ YElement.ValueBox.SlidingEnd += ClearToken;
+
+ ZElement = grid.DoubleValue();
+ ZElement.SetLimits(limit);
+ ZElement.ValueBox.ValueChanged += OnValueChanged;
+ ZElement.ValueBox.SlidingEnd += ClearToken;
+ }
+
+ private void OnValueChanged()
+ {
+ if (IsSetBlocked)
+ return;
+
+ var isSliding = XElement.IsSliding || YElement.IsSliding || ZElement.IsSliding;
+ var token = isSliding ? this : null;
+ var value = new Double3(XElement.ValueBox.Value, YElement.ValueBox.Value, ZElement.ValueBox.Value);
+ object v = Values[0];
+ if (v is Vector3)
+ v = (Vector3)value;
+ else if (v is Float3)
+ v = (Float3)value;
+ else if (v is Double3)
+ v = (Double3)value;
+ SetValue(v, token);
+ }
+
+ ///
+ public override void Refresh()
+ {
+ base.Refresh();
+
+ if (HasDifferentValues)
+ {
+ // TODO: support different values for ValueBox
+ }
+ else
+ {
+ var value = Double3.Zero;
+ if (Values[0] is Vector3 asVector3)
+ value = asVector3;
+ else if (Values[0] is Float3 asFloat3)
+ value = asFloat3;
+ else if (Values[0] is Double3 asDouble3)
+ value = asDouble3;
+ XElement.ValueBox.Value = value.X;
+ YElement.ValueBox.Value = value.Y;
+ ZElement.ValueBox.Value = value.Z;
+ }
+ }
+ }
+
+ ///
+ /// Default implementation of the inspector used to edit Int3 value type properties.
+ ///
+ [CustomEditor(typeof(Int3)), DefaultEditor]
+ public class Int3Editor : CustomEditor
+ {
+ ///
+ /// The X component editor.
+ ///
+ protected IntegerValueElement XElement;
+
+ ///
+ /// The Y component editor.
+ ///
+ protected IntegerValueElement YElement;
+
+ ///
+ /// The Z component editor.
+ ///
+ protected IntegerValueElement ZElement;
+
+ ///
+ public override DisplayStyle Style => DisplayStyle.Inline;
+
+ ///
+ public override void Initialize(LayoutElementsContainer layout)
+ {
+ var grid = layout.CustomContainer();
+ var gridControl = grid.CustomControl;
+ gridControl.ClipChildren = false;
+ gridControl.Height = TextBox.DefaultHeight;
+ gridControl.SlotsHorizontally = 3;
+ gridControl.SlotsVertically = 1;
+
+ LimitAttribute limit = null;
+ var attributes = Values.GetAttributes();
+ if (attributes != null)
+ {
+ limit = (LimitAttribute)attributes.FirstOrDefault(x => x is LimitAttribute);
+ }
+
+ XElement = grid.IntegerValue();
+ XElement.SetLimits(limit);
+ XElement.IntValue.ValueChanged += OnValueChanged;
+ XElement.IntValue.SlidingEnd += ClearToken;
+
+ YElement = grid.IntegerValue();
+ YElement.SetLimits(limit);
+ YElement.IntValue.ValueChanged += OnValueChanged;
+ YElement.IntValue.SlidingEnd += ClearToken;
+
+ ZElement = grid.IntegerValue();
+ ZElement.SetLimits(limit);
+ ZElement.IntValue.ValueChanged += OnValueChanged;
+ ZElement.IntValue.SlidingEnd += ClearToken;
+ }
+
+ private void OnValueChanged()
+ {
+ if (IsSetBlocked)
+ return;
+
+ var isSliding = XElement.IsSliding || YElement.IsSliding || ZElement.IsSliding;
+ var token = isSliding ? this : null;
+ var value = new Int3(XElement.IntValue.Value, YElement.IntValue.Value, ZElement.IntValue.Value);
SetValue(value, token);
}
@@ -89,10 +299,10 @@ namespace FlaxEditor.CustomEditors.Editors
}
else
{
- var value = (Vector3)Values[0];
- XElement.FloatValue.Value = value.X;
- YElement.FloatValue.Value = value.Y;
- ZElement.FloatValue.Value = value.Z;
+ var value = (Int3)Values[0];
+ XElement.IntValue.Value = value.X;
+ YElement.IntValue.Value = value.Y;
+ ZElement.IntValue.Value = value.Z;
}
}
}
diff --git a/Source/Editor/CustomEditors/Editors/Vector4Editor.cs b/Source/Editor/CustomEditors/Editors/Vector4Editor.cs
index 1a296231e..5c53adf29 100644
--- a/Source/Editor/CustomEditors/Editors/Vector4Editor.cs
+++ b/Source/Editor/CustomEditors/Editors/Vector4Editor.cs
@@ -11,7 +11,20 @@ namespace FlaxEditor.CustomEditors.Editors
/// Default implementation of the inspector used to edit Vector4 value type properties.
///
[CustomEditor(typeof(Vector4)), DefaultEditor]
- public class Vector4Editor : CustomEditor
+ public class Vector4Editor :
+#if USE_LARGE_WORLDS
+ Double4Editor
+#else
+ Float4Editor
+#endif
+ {
+ }
+
+ ///
+ /// Default implementation of the inspector used to edit Vector4 value type properties.
+ ///
+ [CustomEditor(typeof(Float4)), DefaultEditor]
+ public class Float4Editor : CustomEditor
{
///
/// The X component editor.
@@ -55,23 +68,23 @@ namespace FlaxEditor.CustomEditors.Editors
XElement = grid.FloatValue();
XElement.SetLimits(limit);
- XElement.FloatValue.ValueChanged += OnValueChanged;
- XElement.FloatValue.SlidingEnd += ClearToken;
+ XElement.ValueBox.ValueChanged += OnValueChanged;
+ XElement.ValueBox.SlidingEnd += ClearToken;
YElement = grid.FloatValue();
YElement.SetLimits(limit);
- YElement.FloatValue.ValueChanged += OnValueChanged;
- YElement.FloatValue.SlidingEnd += ClearToken;
+ YElement.ValueBox.ValueChanged += OnValueChanged;
+ YElement.ValueBox.SlidingEnd += ClearToken;
ZElement = grid.FloatValue();
ZElement.SetLimits(limit);
- ZElement.FloatValue.ValueChanged += OnValueChanged;
- ZElement.FloatValue.SlidingEnd += ClearToken;
+ ZElement.ValueBox.ValueChanged += OnValueChanged;
+ ZElement.ValueBox.SlidingEnd += ClearToken;
WElement = grid.FloatValue();
WElement.SetLimits(limit);
- WElement.FloatValue.ValueChanged += OnValueChanged;
- WElement.FloatValue.SlidingEnd += ClearToken;
+ WElement.ValueBox.ValueChanged += OnValueChanged;
+ WElement.ValueBox.SlidingEnd += ClearToken;
}
private void OnValueChanged()
@@ -81,11 +94,229 @@ namespace FlaxEditor.CustomEditors.Editors
var isSliding = XElement.IsSliding || YElement.IsSliding || ZElement.IsSliding || WElement.IsSliding;
var token = isSliding ? this : null;
- var value = new Vector4(
- XElement.FloatValue.Value,
- YElement.FloatValue.Value,
- ZElement.FloatValue.Value,
- WElement.FloatValue.Value);
+ var value = new Float4(XElement.ValueBox.Value, YElement.ValueBox.Value, ZElement.ValueBox.Value, WElement.ValueBox.Value);
+ object v = Values[0];
+ if (v is Vector4)
+ v = (Vector4)value;
+ else if (v is Float4)
+ v = (Float4)value;
+ else if (v is Double4)
+ v = (Double4)value;
+ SetValue(v, token);
+ }
+
+ ///
+ public override void Refresh()
+ {
+ base.Refresh();
+
+ if (HasDifferentValues)
+ {
+ // TODO: support different values for ValueBox
+ }
+ else
+ {
+ var value = Float4.Zero;
+ if (Values[0] is Vector4 asVector4)
+ value = asVector4;
+ else if (Values[0] is Float4 asFloat4)
+ value = asFloat4;
+ else if (Values[0] is Double4 asDouble4)
+ value = asDouble4;
+ XElement.ValueBox.Value = value.X;
+ YElement.ValueBox.Value = value.Y;
+ ZElement.ValueBox.Value = value.Z;
+ WElement.ValueBox.Value = value.W;
+ }
+ }
+ }
+
+ ///
+ /// Default implementation of the inspector used to edit Double4 value type properties.
+ ///
+ [CustomEditor(typeof(Double4)), DefaultEditor]
+ public class Double4Editor : CustomEditor
+ {
+ ///
+ /// The X component editor.
+ ///
+ protected DoubleValueElement XElement;
+
+ ///
+ /// The Y component editor.
+ ///
+ protected DoubleValueElement YElement;
+
+ ///
+ /// The Z component editor.
+ ///
+ protected DoubleValueElement ZElement;
+
+ ///
+ /// The W component editor.
+ ///
+ protected DoubleValueElement WElement;
+
+ ///
+ public override DisplayStyle Style => DisplayStyle.Inline;
+
+ ///
+ public override void Initialize(LayoutElementsContainer layout)
+ {
+ var grid = layout.CustomContainer();
+ var gridControl = grid.CustomControl;
+ gridControl.ClipChildren = false;
+ gridControl.Height = TextBox.DefaultHeight;
+ gridControl.SlotsHorizontally = 4;
+ gridControl.SlotsVertically = 1;
+
+ LimitAttribute limit = null;
+ var attributes = Values.GetAttributes();
+ if (attributes != null)
+ {
+ limit = (LimitAttribute)attributes.FirstOrDefault(x => x is LimitAttribute);
+ }
+
+ XElement = grid.DoubleValue();
+ XElement.SetLimits(limit);
+ XElement.ValueBox.ValueChanged += OnValueChanged;
+ XElement.ValueBox.SlidingEnd += ClearToken;
+
+ YElement = grid.DoubleValue();
+ YElement.SetLimits(limit);
+ YElement.ValueBox.ValueChanged += OnValueChanged;
+ YElement.ValueBox.SlidingEnd += ClearToken;
+
+ ZElement = grid.DoubleValue();
+ ZElement.SetLimits(limit);
+ ZElement.ValueBox.ValueChanged += OnValueChanged;
+ ZElement.ValueBox.SlidingEnd += ClearToken;
+
+ WElement = grid.DoubleValue();
+ WElement.SetLimits(limit);
+ WElement.ValueBox.ValueChanged += OnValueChanged;
+ WElement.ValueBox.SlidingEnd += ClearToken;
+ }
+
+ private void OnValueChanged()
+ {
+ if (IsSetBlocked)
+ return;
+
+ var isSliding = XElement.IsSliding || YElement.IsSliding || ZElement.IsSliding || WElement.IsSliding;
+ var token = isSliding ? this : null;
+ var value = new Double4(XElement.ValueBox.Value, YElement.ValueBox.Value, ZElement.ValueBox.Value, WElement.ValueBox.Value);
+ object v = Values[0];
+ if (v is Vector4)
+ v = (Vector4)value;
+ else if (v is Float4)
+ v = (Float4)value;
+ else if (v is Double4)
+ v = (Double4)value;
+ SetValue(v, token);
+ }
+
+ ///
+ public override void Refresh()
+ {
+ base.Refresh();
+
+ if (HasDifferentValues)
+ {
+ // TODO: support different values for ValueBox
+ }
+ else
+ {
+ var value = Double4.Zero;
+ if (Values[0] is Vector4 asVector4)
+ value = asVector4;
+ else if (Values[0] is Float4 asFloat4)
+ value = asFloat4;
+ else if (Values[0] is Double4 asDouble4)
+ value = asDouble4;
+ XElement.ValueBox.Value = value.X;
+ YElement.ValueBox.Value = value.Y;
+ ZElement.ValueBox.Value = value.Z;
+ WElement.ValueBox.Value = value.W;
+ }
+ }
+ }
+
+ ///
+ /// Default implementation of the inspector used to edit Int4 value type properties.
+ ///
+ [CustomEditor(typeof(Int4)), DefaultEditor]
+ public class Int4Editor : CustomEditor
+ {
+ ///
+ /// The X component editor.
+ ///
+ protected IntegerValueElement XElement;
+
+ ///
+ /// The Y component editor.
+ ///
+ protected IntegerValueElement YElement;
+
+ ///
+ /// The Z component editor.
+ ///
+ protected IntegerValueElement ZElement;
+
+ ///
+ /// The W component editor.
+ ///
+ protected IntegerValueElement WElement;
+
+ ///
+ public override DisplayStyle Style => DisplayStyle.Inline;
+
+ ///
+ public override void Initialize(LayoutElementsContainer layout)
+ {
+ var grid = layout.CustomContainer();
+ var gridControl = grid.CustomControl;
+ gridControl.ClipChildren = false;
+ gridControl.Height = TextBox.DefaultHeight;
+ gridControl.SlotsHorizontally = 4;
+ gridControl.SlotsVertically = 1;
+
+ LimitAttribute limit = null;
+ var attributes = Values.GetAttributes();
+ if (attributes != null)
+ {
+ limit = (LimitAttribute)attributes.FirstOrDefault(x => x is LimitAttribute);
+ }
+
+ XElement = grid.IntegerValue();
+ XElement.SetLimits(limit);
+ XElement.IntValue.ValueChanged += OnValueChanged;
+ XElement.IntValue.SlidingEnd += ClearToken;
+
+ YElement = grid.IntegerValue();
+ YElement.SetLimits(limit);
+ YElement.IntValue.ValueChanged += OnValueChanged;
+ YElement.IntValue.SlidingEnd += ClearToken;
+
+ ZElement = grid.IntegerValue();
+ ZElement.SetLimits(limit);
+ ZElement.IntValue.ValueChanged += OnValueChanged;
+ ZElement.IntValue.SlidingEnd += ClearToken;
+
+ WElement = grid.IntegerValue();
+ WElement.SetLimits(limit);
+ WElement.IntValue.ValueChanged += OnValueChanged;
+ WElement.IntValue.SlidingEnd += ClearToken;
+ }
+
+ private void OnValueChanged()
+ {
+ if (IsSetBlocked)
+ return;
+
+ var isSliding = XElement.IsSliding || YElement.IsSliding || ZElement.IsSliding || WElement.IsSliding;
+ var token = isSliding ? this : null;
+ var value = new Int4(XElement.IntValue.Value, YElement.IntValue.Value, ZElement.IntValue.Value, WElement.IntValue.Value);
SetValue(value, token);
}
@@ -100,11 +331,11 @@ namespace FlaxEditor.CustomEditors.Editors
}
else
{
- var value = (Vector4)Values[0];
- XElement.FloatValue.Value = value.X;
- YElement.FloatValue.Value = value.Y;
- ZElement.FloatValue.Value = value.Z;
- WElement.FloatValue.Value = value.W;
+ var value = (Int4)Values[0];
+ XElement.IntValue.Value = value.X;
+ YElement.IntValue.Value = value.Y;
+ ZElement.IntValue.Value = value.Z;
+ WElement.IntValue.Value = value.W;
}
}
}
diff --git a/Source/Editor/CustomEditors/Elements/DoubleValueElement.cs b/Source/Editor/CustomEditors/Elements/DoubleValueElement.cs
index b4078d6b2..03a143094 100644
--- a/Source/Editor/CustomEditors/Elements/DoubleValueElement.cs
+++ b/Source/Editor/CustomEditors/Elements/DoubleValueElement.cs
@@ -17,14 +17,20 @@ namespace FlaxEditor.CustomEditors.Elements
///
/// The double value box.
///
- public readonly DoubleValueBox DoubleValue;
+ public readonly DoubleValueBox ValueBox;
+
+ ///
+ /// [Deprecated on 26.05.2022, expires on 26.05.2024]
+ ///
+ [System.Obsolete("Deprecated in 1.4")]
+ public DoubleValueBox DoubleValue => ValueBox;
///
/// Initializes a new instance of the class.
///
public DoubleValueElement()
{
- DoubleValue = new DoubleValueBox(0);
+ ValueBox = new DoubleValueBox(0);
}
///
@@ -40,7 +46,7 @@ namespace FlaxEditor.CustomEditors.Elements
var limit = attributes.FirstOrDefault(x => x is LimitAttribute);
if (limit != null)
{
- DoubleValue.SetLimits((LimitAttribute)limit);
+ ValueBox.SetLimits((LimitAttribute)limit);
}
}
}
@@ -53,7 +59,7 @@ namespace FlaxEditor.CustomEditors.Elements
{
if (limit != null)
{
- DoubleValue.SetLimits(limit);
+ ValueBox.SetLimits(limit);
}
}
@@ -65,25 +71,25 @@ namespace FlaxEditor.CustomEditors.Elements
{
if (other != null)
{
- DoubleValue.SetLimits(other.DoubleValue);
+ ValueBox.SetLimits(other.ValueBox);
}
}
///
- public override Control Control => DoubleValue;
+ public override Control Control => ValueBox;
///
/// Gets or sets the value.
///
public double Value
{
- get => DoubleValue.Value;
- set => DoubleValue.Value = value;
+ get => ValueBox.Value;
+ set => ValueBox.Value = value;
}
///
/// Gets a value indicating whether user is using a slider.
///
- public bool IsSliding => DoubleValue.IsSliding;
+ public bool IsSliding => ValueBox.IsSliding;
}
}
diff --git a/Source/Editor/CustomEditors/Elements/FloatValueElement.cs b/Source/Editor/CustomEditors/Elements/FloatValueElement.cs
index dfbfeb27b..ff2218a9b 100644
--- a/Source/Editor/CustomEditors/Elements/FloatValueElement.cs
+++ b/Source/Editor/CustomEditors/Elements/FloatValueElement.cs
@@ -17,14 +17,20 @@ namespace FlaxEditor.CustomEditors.Elements
///
/// The float value box.
///
- public readonly FloatValueBox FloatValue;
+ public readonly FloatValueBox ValueBox;
+
+ ///
+ /// [Deprecated on 26.05.2022, expires on 26.05.2024]
+ ///
+ [System.Obsolete("Deprecated in 1.4")]
+ public FloatValueBox FloatValue => ValueBox;
///
/// Initializes a new instance of the class.
///
public FloatValueElement()
{
- FloatValue = new FloatValueBox(0);
+ ValueBox = new FloatValueBox(0);
}
///
@@ -40,7 +46,7 @@ namespace FlaxEditor.CustomEditors.Elements
var limit = attributes.FirstOrDefault(x => x is LimitAttribute);
if (limit != null)
{
- FloatValue.SetLimits((LimitAttribute)limit);
+ ValueBox.SetLimits((LimitAttribute)limit);
}
}
}
@@ -53,7 +59,7 @@ namespace FlaxEditor.CustomEditors.Elements
{
if (limit != null)
{
- FloatValue.SetLimits(limit);
+ ValueBox.SetLimits(limit);
}
}
@@ -65,21 +71,21 @@ namespace FlaxEditor.CustomEditors.Elements
{
if (other != null)
{
- FloatValue.SetLimits(other.FloatValue);
+ ValueBox.SetLimits(other.ValueBox);
}
}
///
- public override Control Control => FloatValue;
+ public override Control Control => ValueBox;
///
public float Value
{
- get => FloatValue.Value;
- set => FloatValue.Value = value;
+ get => ValueBox.Value;
+ set => ValueBox.Value = value;
}
///
- public bool IsSliding => FloatValue.IsSliding;
+ public bool IsSliding => ValueBox.IsSliding;
}
}
diff --git a/Source/Editor/CustomEditors/Elements/LabelElement.cs b/Source/Editor/CustomEditors/Elements/LabelElement.cs
index 5fab106d5..83cb63a0a 100644
--- a/Source/Editor/CustomEditors/Elements/LabelElement.cs
+++ b/Source/Editor/CustomEditors/Elements/LabelElement.cs
@@ -28,7 +28,7 @@ namespace FlaxEditor.CustomEditors.Elements
{
Label = new ClickableLabel
{
- Size = new Vector2(100, 18),
+ Size = new Float2(100, 18),
HorizontalAlignment = TextAlignment.Near,
};
// TODO: auto height for label
diff --git a/Source/Editor/CustomEditors/GUI/CheckablePropertyNameLabel.cs b/Source/Editor/CustomEditors/GUI/CheckablePropertyNameLabel.cs
index b85fdbbd4..cce901750 100644
--- a/Source/Editor/CustomEditors/GUI/CheckablePropertyNameLabel.cs
+++ b/Source/Editor/CustomEditors/GUI/CheckablePropertyNameLabel.cs
@@ -31,7 +31,7 @@ namespace FlaxEditor.CustomEditors.GUI
CheckBox = new CheckBox(2, 2)
{
Checked = true,
- Size = new Vector2(14),
+ Size = new Float2(14),
Parent = this
};
CheckBox.StateChanged += OnCheckChanged;
diff --git a/Source/Editor/CustomEditors/GUI/ClickablePropertyNameLabel.cs b/Source/Editor/CustomEditors/GUI/ClickablePropertyNameLabel.cs
index 7eaef3f5c..e10cce58a 100644
--- a/Source/Editor/CustomEditors/GUI/ClickablePropertyNameLabel.cs
+++ b/Source/Editor/CustomEditors/GUI/ClickablePropertyNameLabel.cs
@@ -16,7 +16,7 @@ namespace FlaxEditor.CustomEditors.GUI
///
/// The label.
/// The mouse location.
- public delegate void MouseDelegate(ClickablePropertyNameLabel label, Vector2 location);
+ public delegate void MouseDelegate(ClickablePropertyNameLabel label, Float2 location);
///
/// The mouse left button clicks on the label.
@@ -45,7 +45,7 @@ namespace FlaxEditor.CustomEditors.GUI
}
///
- public override bool OnMouseUp(Vector2 location, MouseButton button)
+ public override bool OnMouseUp(Float2 location, MouseButton button)
{
// Fire events
if (button == MouseButton.Left)
@@ -69,7 +69,7 @@ namespace FlaxEditor.CustomEditors.GUI
}
///
- public override bool OnMouseDoubleClick(Vector2 location, MouseButton button)
+ public override bool OnMouseDoubleClick(Float2 location, MouseButton button)
{
// Fire events
if (button == MouseButton.Left)
diff --git a/Source/Editor/CustomEditors/GUI/DraggablePropertyNameLabel.cs b/Source/Editor/CustomEditors/GUI/DraggablePropertyNameLabel.cs
index c79e98088..f4d704f31 100644
--- a/Source/Editor/CustomEditors/GUI/DraggablePropertyNameLabel.cs
+++ b/Source/Editor/CustomEditors/GUI/DraggablePropertyNameLabel.cs
@@ -33,7 +33,7 @@ namespace FlaxEditor.CustomEditors.GUI
}
///
- public override bool OnMouseUp(Vector2 location, MouseButton button)
+ public override bool OnMouseUp(Float2 location, MouseButton button)
{
if (button == MouseButton.Left)
{
@@ -45,7 +45,7 @@ namespace FlaxEditor.CustomEditors.GUI
}
///
- public override bool OnMouseDown(Vector2 location, MouseButton button)
+ public override bool OnMouseDown(Float2 location, MouseButton button)
{
if (button == MouseButton.Left)
{
diff --git a/Source/Editor/CustomEditors/GUI/PropertiesList.cs b/Source/Editor/CustomEditors/GUI/PropertiesList.cs
index 882c4d426..68c503c1b 100644
--- a/Source/Editor/CustomEditors/GUI/PropertiesList.cs
+++ b/Source/Editor/CustomEditors/GUI/PropertiesList.cs
@@ -117,7 +117,7 @@ namespace FlaxEditor.CustomEditors.GUI
}
///
- public override void OnMouseMove(Vector2 location)
+ public override void OnMouseMove(Float2 location)
{
_mouseOverSplitter = _splitterRect.Contains(location);
@@ -130,7 +130,7 @@ namespace FlaxEditor.CustomEditors.GUI
}
///
- public override bool OnMouseDown(Vector2 location, MouseButton button)
+ public override bool OnMouseDown(Float2 location, MouseButton button)
{
if (button == MouseButton.Left)
{
@@ -146,7 +146,7 @@ namespace FlaxEditor.CustomEditors.GUI
}
///
- public override bool OnMouseUp(Vector2 location, MouseButton button)
+ public override bool OnMouseUp(Float2 location, MouseButton button)
{
if (_splitterClicked)
{
diff --git a/Source/Editor/CustomEditors/GUI/PropertyNameLabel.cs b/Source/Editor/CustomEditors/GUI/PropertyNameLabel.cs
index ea96a72ac..b050e60c3 100644
--- a/Source/Editor/CustomEditors/GUI/PropertyNameLabel.cs
+++ b/Source/Editor/CustomEditors/GUI/PropertyNameLabel.cs
@@ -89,7 +89,7 @@ namespace FlaxEditor.CustomEditors.GUI
}
///
- public override bool OnMouseDown(Vector2 location, MouseButton button)
+ public override bool OnMouseDown(Float2 location, MouseButton button)
{
if (button == MouseButton.Right)
{
@@ -100,7 +100,7 @@ namespace FlaxEditor.CustomEditors.GUI
}
///
- public override bool OnMouseUp(Vector2 location, MouseButton button)
+ public override bool OnMouseUp(Float2 location, MouseButton button)
{
if (base.OnMouseUp(location, button))
return true;
diff --git a/Source/Editor/CustomEditors/LayoutElementsContainer.cs b/Source/Editor/CustomEditors/LayoutElementsContainer.cs
index e96fee420..4d488a0d6 100644
--- a/Source/Editor/CustomEditors/LayoutElementsContainer.cs
+++ b/Source/Editor/CustomEditors/LayoutElementsContainer.cs
@@ -55,7 +55,7 @@ namespace FlaxEditor.CustomEditors
return element;
}
- private void OnGroupPanelMouseButtonRightClicked(DropPanel groupPanel, Vector2 location)
+ private void OnGroupPanelMouseButtonRightClicked(DropPanel groupPanel, Float2 location)
{
var linkedEditor = (CustomEditor)groupPanel.Tag;
var menu = new ContextMenu();
diff --git a/Source/Editor/Editor.cs b/Source/Editor/Editor.cs
index 3098af5b6..4110c6e05 100644
--- a/Source/Editor/Editor.cs
+++ b/Source/Editor/Editor.cs
@@ -1292,43 +1292,43 @@ namespace FlaxEditor
return false;
}
- internal void Internal_ScreenToGameViewport(ref Vector2 pos)
+ internal void Internal_ScreenToGameViewport(ref Float2 pos)
{
if (Windows.GameWin != null && Windows.GameWin.ContainsFocus)
{
var win = Windows.GameWin.Root;
if (win?.RootWindow is WindowRootControl root && root.Window && root.Window.IsFocused)
{
- pos = Vector2.Round(Windows.GameWin.Viewport.PointFromScreen(pos) * root.DpiScale);
+ pos = Float2.Round(Windows.GameWin.Viewport.PointFromScreen(pos) * root.DpiScale);
}
else
{
- pos = Vector2.Minimum;
+ pos = Float2.Minimum;
}
}
else
{
- pos = Vector2.Minimum;
+ pos = Float2.Minimum;
}
}
- internal void Internal_GameViewportToScreen(ref Vector2 pos)
+ internal void Internal_GameViewportToScreen(ref Float2 pos)
{
if (Windows.GameWin != null && Windows.GameWin.ContainsFocus)
{
var win = Windows.GameWin.Root;
if (win?.RootWindow is WindowRootControl root && root.Window && root.Window.IsFocused)
{
- pos = Vector2.Round(Windows.GameWin.Viewport.PointToScreen(pos / root.DpiScale));
+ pos = Float2.Round(Windows.GameWin.Viewport.PointToScreen(pos / root.DpiScale));
}
else
{
- pos = Vector2.Minimum;
+ pos = Float2.Minimum;
}
}
else
{
- pos = Vector2.Minimum;
+ pos = Float2.Minimum;
}
}
@@ -1343,9 +1343,9 @@ namespace FlaxEditor
}
}
- internal void Internal_GetGameWindowSize(out Vector2 resultAsRef)
+ internal void Internal_GetGameWindowSize(out Float2 resultAsRef)
{
- resultAsRef = Vector2.Zero;
+ resultAsRef = Float2.Zero;
var gameWin = Windows.GameWin;
if (gameWin != null)
{
@@ -1359,7 +1359,7 @@ namespace FlaxEditor
else
resultAsRef = gameWin.Size * root.DpiScale;
- resultAsRef = Vector2.Round(resultAsRef);
+ resultAsRef = Float2.Round(resultAsRef);
}
}
}
@@ -1448,7 +1448,7 @@ namespace FlaxEditor
internal static extern bool Internal_CookMeshCollision(string path, CollisionDataType type, IntPtr model, int modelLodIndex, uint materialSlotsMask, ConvexMeshGenerationFlags convexFlags, int convexVertexLimit);
[MethodImpl(MethodImplOptions.InternalCall)]
- internal static extern void Internal_GetCollisionWires(IntPtr collisionData, out Vector3[] triangles, out int[] indices);
+ internal static extern void Internal_GetCollisionWires(IntPtr collisionData, out Float3[] triangles, out int[] indices);
[MethodImpl(MethodImplOptions.InternalCall)]
internal static extern void Internal_GetEditorBoxWithChildren(IntPtr obj, out BoundingBox resultAsRef);
diff --git a/Source/Editor/GUI/AssetPicker.cs b/Source/Editor/GUI/AssetPicker.cs
index f520a2a84..4e90dfe46 100644
--- a/Source/Editor/GUI/AssetPicker.cs
+++ b/Source/Editor/GUI/AssetPicker.cs
@@ -26,8 +26,8 @@ namespace FlaxEditor.GUI
private ScriptType _type;
private bool _isMouseDown;
- private Vector2 _mouseDownPos;
- private Vector2 _mousePos;
+ private Float2 _mouseDownPos;
+ private Float2 _mousePos;
private DragAssets _dragOverElement;
///
@@ -180,7 +180,7 @@ namespace FlaxEditor.GUI
/// Initializes a new instance of the class.
///
public AssetPicker()
- : this(new ScriptType(typeof(Asset)), Vector2.Zero)
+ : this(new ScriptType(typeof(Asset)), Float2.Zero)
{
}
@@ -189,11 +189,11 @@ namespace FlaxEditor.GUI
///
/// The assets types that this picker accepts.
/// The control location.
- public AssetPicker(ScriptType assetType, Vector2 location)
- : base(location, new Vector2(DefaultIconSize + ButtonsOffset + ButtonsSize, DefaultIconSize))
+ public AssetPicker(ScriptType assetType, Float2 location)
+ : base(location, new Float2(DefaultIconSize + ButtonsOffset + ButtonsSize, DefaultIconSize))
{
_type = assetType;
- _mousePos = Vector2.Minimum;
+ _mousePos = Float2.Minimum;
}
///
@@ -207,7 +207,7 @@ namespace FlaxEditor.GUI
private void DoDrag()
{
// Do the drag drop operation if has selected element
- if (_selected != null && new Rectangle(Vector2.Zero, Size).Contains(ref _mouseDownPos))
+ if (_selected != null && new Rectangle(Float2.Zero, Size).Contains(ref _mouseDownPos))
{
DoDragDrop(DragAssets.GetDragData(_selected));
}
@@ -334,7 +334,7 @@ namespace FlaxEditor.GUI
///
public override void OnMouseLeave()
{
- _mousePos = Vector2.Minimum;
+ _mousePos = Float2.Minimum;
// Check if start drag drop
if (_isMouseDown)
@@ -350,21 +350,21 @@ namespace FlaxEditor.GUI
}
///
- public override void OnMouseEnter(Vector2 location)
+ public override void OnMouseEnter(Float2 location)
{
_mousePos = location;
- _mouseDownPos = Vector2.Minimum;
+ _mouseDownPos = Float2.Minimum;
base.OnMouseEnter(location);
}
///
- public override void OnMouseMove(Vector2 location)
+ public override void OnMouseMove(Float2 location)
{
_mousePos = location;
// Check if start drag drop
- if (_isMouseDown && Vector2.Distance(location, _mouseDownPos) > 10.0f && IconRect.Contains(_mouseDownPos))
+ if (_isMouseDown && Float2.Distance(location, _mouseDownPos) > 10.0f && IconRect.Contains(_mouseDownPos))
{
// Do the drag
_isMouseDown = false;
@@ -375,7 +375,7 @@ namespace FlaxEditor.GUI
}
///
- public override bool OnMouseUp(Vector2 location, MouseButton button)
+ public override bool OnMouseUp(Float2 location, MouseButton button)
{
if (button == MouseButton.Left && _isMouseDown)
{
@@ -422,7 +422,7 @@ namespace FlaxEditor.GUI
}
///
- public override bool OnMouseDown(Vector2 location, MouseButton button)
+ public override bool OnMouseDown(Float2 location, MouseButton button)
{
if (button == MouseButton.Left)
{
@@ -435,7 +435,7 @@ namespace FlaxEditor.GUI
}
///
- public override bool OnMouseDoubleClick(Vector2 location, MouseButton button)
+ public override bool OnMouseDoubleClick(Float2 location, MouseButton button)
{
// Focus
Focus();
@@ -452,7 +452,7 @@ namespace FlaxEditor.GUI
}
///
- public override DragDropEffect OnDragEnter(ref Vector2 location, DragData data)
+ public override DragDropEffect OnDragEnter(ref Float2 location, DragData data)
{
base.OnDragEnter(ref location, data);
@@ -467,7 +467,7 @@ namespace FlaxEditor.GUI
}
///
- public override DragDropEffect OnDragMove(ref Vector2 location, DragData data)
+ public override DragDropEffect OnDragMove(ref Float2 location, DragData data)
{
base.OnDragMove(ref location, data);
@@ -484,7 +484,7 @@ namespace FlaxEditor.GUI
}
///
- public override DragDropEffect OnDragDrop(ref Vector2 location, DragData data)
+ public override DragDropEffect OnDragDrop(ref Float2 location, DragData data)
{
base.OnDragDrop(ref location, data);
diff --git a/Source/Editor/GUI/ClickableLabel.cs b/Source/Editor/GUI/ClickableLabel.cs
index b1657b08e..de3a5aa30 100644
--- a/Source/Editor/GUI/ClickableLabel.cs
+++ b/Source/Editor/GUI/ClickableLabel.cs
@@ -32,7 +32,7 @@ namespace FlaxEditor.GUI
public Action RightClick;
///
- public override bool OnMouseDoubleClick(Vector2 location, MouseButton button)
+ public override bool OnMouseDoubleClick(Float2 location, MouseButton button)
{
DoubleClick?.Invoke();
@@ -40,7 +40,7 @@ namespace FlaxEditor.GUI
}
///
- public override bool OnMouseDown(Vector2 location, MouseButton button)
+ public override bool OnMouseDown(Float2 location, MouseButton button)
{
if (button == MouseButton.Left)
_leftClick = true;
@@ -51,7 +51,7 @@ namespace FlaxEditor.GUI
}
///
- public override bool OnMouseUp(Vector2 location, MouseButton button)
+ public override bool OnMouseUp(Float2 location, MouseButton button)
{
if (button == MouseButton.Left && _leftClick)
{
diff --git a/Source/Editor/GUI/ComboBox.cs b/Source/Editor/GUI/ComboBox.cs
index cffd1f5bd..07c2e269f 100644
--- a/Source/Editor/GUI/ComboBox.cs
+++ b/Source/Editor/GUI/ComboBox.cs
@@ -389,7 +389,7 @@ namespace FlaxEditor.GUI
_popupMenu.VisibleChanged += cm =>
{
var win = Root;
- _blockPopup = win != null && new Rectangle(Vector2.Zero, Size).Contains(PointFromWindow(win.MousePosition));
+ _blockPopup = win != null && new Rectangle(Float2.Zero, Size).Contains(PointFromWindow(win.MousePosition));
if (!_blockPopup)
Focus();
};
@@ -436,7 +436,7 @@ namespace FlaxEditor.GUI
// Show dropdown list
_popupMenu.MinimumWidth = Width;
- _popupMenu.Show(this, new Vector2(1, Height));
+ _popupMenu.Show(this, new Float2(1, Height));
}
}
@@ -473,7 +473,7 @@ namespace FlaxEditor.GUI
public override void Draw()
{
// Cache data
- var clientRect = new Rectangle(Vector2.Zero, Size);
+ var clientRect = new Rectangle(Float2.Zero, Size);
float margin = clientRect.Height * 0.2f;
float boxSize = clientRect.Height - margin * 2;
bool isOpened = IsPopupOpened;
@@ -542,7 +542,7 @@ namespace FlaxEditor.GUI
}
///
- public override bool OnMouseDown(Vector2 location, MouseButton button)
+ public override bool OnMouseDown(Float2 location, MouseButton button)
{
if (button == MouseButton.Left)
{
@@ -555,7 +555,7 @@ namespace FlaxEditor.GUI
}
///
- public override bool OnMouseUp(Vector2 location, MouseButton button)
+ public override bool OnMouseUp(Float2 location, MouseButton button)
{
if (_mouseDown && !_blockPopup)
{
diff --git a/Source/Editor/GUI/ContextMenu/ContextMenu.cs b/Source/Editor/GUI/ContextMenu/ContextMenu.cs
index 307b091a4..b7cbea30f 100644
--- a/Source/Editor/GUI/ContextMenu/ContextMenu.cs
+++ b/Source/Editor/GUI/ContextMenu/ContextMenu.cs
@@ -341,12 +341,12 @@ namespace FlaxEditor.GUI.ContextMenu
}
///
- public override bool ContainsPoint(ref Vector2 location)
+ public override bool ContainsPoint(ref Float2 location)
{
if (base.ContainsPoint(ref location))
return true;
- Vector2 cLocation = location - Location;
+ var cLocation = location - Location;
for (int i = 0; i < _panel.Children.Count; i++)
{
if (_panel.Children[i].ContainsPoint(ref cLocation))
@@ -380,10 +380,10 @@ namespace FlaxEditor.GUI.ContextMenu
maxWidth = Mathf.Max(maxWidth + 20, MinimumWidth);
// Resize container
- Size = new Vector2(Mathf.Ceil(maxWidth), Mathf.Ceil(height));
+ Size = new Float2(Mathf.Ceil(maxWidth), Mathf.Ceil(height));
// Arrange items view panel
- var panelBounds = new Rectangle(Vector2.Zero, Size);
+ var panelBounds = new Rectangle(Float2.Zero, Size);
_itemsAreaMargin.ShrinkRectangle(ref panelBounds);
_panel.Bounds = panelBounds;
diff --git a/Source/Editor/GUI/ContextMenu/ContextMenuBase.cs b/Source/Editor/GUI/ContextMenu/ContextMenuBase.cs
index 40f8541d0..8103e0128 100644
--- a/Source/Editor/GUI/ContextMenu/ContextMenuBase.cs
+++ b/Source/Editor/GUI/ContextMenu/ContextMenuBase.cs
@@ -105,7 +105,7 @@ namespace FlaxEditor.GUI.ContextMenu
///
/// Parent control to attach to it.
/// Popup menu origin location in parent control coordinates.
- public virtual void Show(Control parent, Vector2 location)
+ public virtual void Show(Control parent, Float2 location)
{
Assert.IsNotNull(parent);
@@ -130,12 +130,12 @@ namespace FlaxEditor.GUI.ContextMenu
// Calculate popup direction and initial location (fit on a single monitor)
var dpiScale = parentWin.DpiScale;
- Vector2 dpiSize = Size * dpiScale;
- Vector2 locationWS = parent.PointToWindow(location);
- Vector2 locationSS = parentWin.PointToScreen(locationWS);
- Location = Vector2.Zero;
- Rectangle monitorBounds = Platform.GetMonitorBounds(locationSS);
- Vector2 rightBottomLocationSS = locationSS + dpiSize;
+ var dpiSize = Size * dpiScale;
+ var locationWS = parent.PointToWindow(location);
+ var locationSS = parentWin.PointToScreen(locationWS);
+ Location = Float2.Zero;
+ var monitorBounds = Platform.GetMonitorBounds(locationSS);
+ var rightBottomLocationSS = locationSS + dpiSize;
bool isUp = false, isLeft = false;
if (UseAutomaticDirectionFix)
{
@@ -250,7 +250,7 @@ namespace FlaxEditor.GUI.ContextMenu
/// The child menu.
/// The child menu initial location.
/// True if context menu is a normal sub-menu, otherwise it is a custom menu popup linked as child.
- public void ShowChild(ContextMenuBase child, Vector2 location, bool isSubMenu = true)
+ public void ShowChild(ContextMenuBase child, Float2 location, bool isSubMenu = true)
{
// Hide current child
HideChild();
@@ -376,7 +376,7 @@ namespace FlaxEditor.GUI.ContextMenu
{
// Draw background
var style = Style.Current;
- var bounds = new Rectangle(Vector2.Zero, Size);
+ var bounds = new Rectangle(Float2.Zero, Size);
Render2D.FillRectangle(bounds, style.Background);
Render2D.DrawRectangle(bounds, Color.Lerp(style.BackgroundSelected, style.Background, 0.6f));
@@ -384,14 +384,14 @@ namespace FlaxEditor.GUI.ContextMenu
}
///
- public override bool OnMouseDown(Vector2 location, MouseButton button)
+ public override bool OnMouseDown(Float2 location, MouseButton button)
{
base.OnMouseDown(location, button);
return true;
}
///
- public override bool OnMouseUp(Vector2 location, MouseButton button)
+ public override bool OnMouseUp(Float2 location, MouseButton button)
{
base.OnMouseUp(location, button);
return true;
diff --git a/Source/Editor/GUI/ContextMenu/ContextMenuButton.cs b/Source/Editor/GUI/ContextMenu/ContextMenuButton.cs
index e3fedd8f5..fee2332c4 100644
--- a/Source/Editor/GUI/ContextMenu/ContextMenuButton.cs
+++ b/Source/Editor/GUI/ContextMenu/ContextMenuButton.cs
@@ -146,7 +146,7 @@ namespace FlaxEditor.GUI.ContextMenu
}
///
- public override bool OnMouseDown(Vector2 location, MouseButton button)
+ public override bool OnMouseDown(Float2 location, MouseButton button)
{
if (base.OnMouseDown(location, button))
return true;
@@ -156,7 +156,7 @@ namespace FlaxEditor.GUI.ContextMenu
}
///
- public override bool OnMouseUp(Vector2 location, MouseButton button)
+ public override bool OnMouseUp(Float2 location, MouseButton button)
{
if (base.OnMouseUp(location, button))
return true;
diff --git a/Source/Editor/GUI/ContextMenu/ContextMenuChildMenu.cs b/Source/Editor/GUI/ContextMenu/ContextMenuChildMenu.cs
index f069e2f09..13451fc02 100644
--- a/Source/Editor/GUI/ContextMenu/ContextMenuChildMenu.cs
+++ b/Source/Editor/GUI/ContextMenu/ContextMenuChildMenu.cs
@@ -47,7 +47,7 @@ namespace FlaxEditor.GUI.ContextMenu
}
///
- public override void OnMouseEnter(Vector2 location)
+ public override void OnMouseEnter(Float2 location)
{
base.OnMouseEnter(location);
@@ -61,7 +61,7 @@ namespace FlaxEditor.GUI.ContextMenu
return;
// Hide parent CM popups and set itself as child
- parentContextMenu.ShowChild(ContextMenu, PointToParent(ParentContextMenu, new Vector2(Width, 0)));
+ parentContextMenu.ShowChild(ContextMenu, PointToParent(ParentContextMenu, new Float2(Width, 0)));
}
}
}
diff --git a/Source/Editor/GUI/ContextMenu/ContextMenuItem.cs b/Source/Editor/GUI/ContextMenu/ContextMenuItem.cs
index 3f4b5f39c..18f7f9a88 100644
--- a/Source/Editor/GUI/ContextMenu/ContextMenuItem.cs
+++ b/Source/Editor/GUI/ContextMenu/ContextMenuItem.cs
@@ -53,7 +53,7 @@ namespace FlaxEditor.GUI.ContextMenu
}
///
- public override void OnMouseEnter(Vector2 location)
+ public override void OnMouseEnter(Float2 location)
{
ParentContextMenu?.HideChild();
diff --git a/Source/Editor/GUI/CurveEditor.Access.cs b/Source/Editor/GUI/CurveEditor.Access.cs
index 880f7bc2a..6ff6ff44e 100644
--- a/Source/Editor/GUI/CurveEditor.Access.cs
+++ b/Source/Editor/GUI/CurveEditor.Access.cs
@@ -1,5 +1,10 @@
-// Copyright (c) 2012-2022 Wojciech Figat. All rights reserved.
+#if USE_LARGE_WORLDS
+using Real = System.Double;
+#else
+using Real = System.Single;
+#endif
+// Copyright (c) 2012-2022 Wojciech Figat. All rights reserved.
using FlaxEngine;
// ReSharper disable RedundantAssignment
@@ -51,6 +56,12 @@ namespace FlaxEditor.GUI
IKeyframeAccess,
IKeyframeAccess,
IKeyframeAccess,
+ IKeyframeAccess,
+ IKeyframeAccess,
+ IKeyframeAccess,
+ IKeyframeAccess,
+ IKeyframeAccess,
+ IKeyframeAccess,
IKeyframeAccess,
IKeyframeAccess,
IKeyframeAccess
@@ -112,7 +123,7 @@ namespace FlaxEditor.GUI
void IKeyframeAccess.SetCurveValue(float curve, ref double value, int component)
{
- value = curve;
+ value = (double)curve;
}
void IKeyframeAccess.GetDefaultValue(out float value)
@@ -132,7 +143,7 @@ namespace FlaxEditor.GUI
void IKeyframeAccess.SetCurveValue(float curve, ref float value, int component)
{
- value = curve;
+ value = (float)curve;
}
void IKeyframeAccess.GetDefaultValue(out Vector2 value)
@@ -147,12 +158,12 @@ namespace FlaxEditor.GUI
float IKeyframeAccess.GetCurveValue(ref Vector2 value, int component)
{
- return value[component];
+ return (float)value[component];
}
void IKeyframeAccess.SetCurveValue(float curve, ref Vector2 value, int component)
{
- value[component] = curve;
+ value[component] = (Real)curve;
}
void IKeyframeAccess.GetDefaultValue(out Vector3 value)
@@ -167,12 +178,12 @@ namespace FlaxEditor.GUI
float IKeyframeAccess.GetCurveValue(ref Vector3 value, int component)
{
- return value[component];
+ return (float)value[component];
}
void IKeyframeAccess.SetCurveValue(float curve, ref Vector3 value, int component)
{
- value[component] = curve;
+ value[component] = (Real)curve;
}
void IKeyframeAccess.GetDefaultValue(out Vector4 value)
@@ -187,10 +198,130 @@ namespace FlaxEditor.GUI
float IKeyframeAccess.GetCurveValue(ref Vector4 value, int component)
{
- return value[component];
+ return (float)value[component];
}
void IKeyframeAccess.SetCurveValue(float curve, ref Vector4 value, int component)
+ {
+ value[component] = (Real)curve;
+ }
+
+ void IKeyframeAccess.GetDefaultValue(out Float2 value)
+ {
+ value = Float2.Zero;
+ }
+
+ int IKeyframeAccess.GetCurveComponents()
+ {
+ return 2;
+ }
+
+ float IKeyframeAccess.GetCurveValue(ref Float2 value, int component)
+ {
+ return value[component];
+ }
+
+ void IKeyframeAccess.SetCurveValue(float curve, ref Float2 value, int component)
+ {
+ value[component] = curve;
+ }
+
+ void IKeyframeAccess.GetDefaultValue(out Float3 value)
+ {
+ value = Float3.Zero;
+ }
+
+ int IKeyframeAccess.GetCurveComponents()
+ {
+ return 3;
+ }
+
+ float IKeyframeAccess.GetCurveValue(ref Float3 value, int component)
+ {
+ return value[component];
+ }
+
+ void IKeyframeAccess.SetCurveValue(float curve, ref Float3 value, int component)
+ {
+ value[component] = curve;
+ }
+
+ void IKeyframeAccess.GetDefaultValue(out Float4 value)
+ {
+ value = Float4.Zero;
+ }
+
+ int IKeyframeAccess.GetCurveComponents()
+ {
+ return 4;
+ }
+
+ float IKeyframeAccess.GetCurveValue(ref Float4 value, int component)
+ {
+ return value[component];
+ }
+
+ void IKeyframeAccess.SetCurveValue(float curve, ref Float4 value, int component)
+ {
+ value[component] = curve;
+ }
+
+ void IKeyframeAccess.GetDefaultValue(out Double2 value)
+ {
+ value = Double2.Zero;
+ }
+
+ int IKeyframeAccess.GetCurveComponents()
+ {
+ return 2;
+ }
+
+ float IKeyframeAccess.GetCurveValue(ref Double2 value, int component)
+ {
+ return (float)value[component];
+ }
+
+ void IKeyframeAccess.SetCurveValue(float curve, ref Double2 value, int component)
+ {
+ value[component] = curve;
+ }
+
+ void IKeyframeAccess.GetDefaultValue(out Double3 value)
+ {
+ value = Double3.Zero;
+ }
+
+ int IKeyframeAccess.GetCurveComponents()
+ {
+ return 3;
+ }
+
+ float IKeyframeAccess.GetCurveValue(ref Double3 value, int component)
+ {
+ return (float)value[component];
+ }
+
+ void IKeyframeAccess.SetCurveValue(float curve, ref Double3 value, int component)
+ {
+ value[component] = curve;
+ }
+
+ void IKeyframeAccess.GetDefaultValue(out Double4 value)
+ {
+ value = Double4.Zero;
+ }
+
+ int IKeyframeAccess.GetCurveComponents()
+ {
+ return 4;
+ }
+
+ float IKeyframeAccess.GetCurveValue(ref Double4 value, int component)
+ {
+ return (float)value[component];
+ }
+
+ void IKeyframeAccess.SetCurveValue(float curve, ref Double4 value, int component)
{
value[component] = curve;
}
@@ -213,7 +344,7 @@ namespace FlaxEditor.GUI
void IKeyframeAccess.SetCurveValue(float curve, ref Quaternion value, int component)
{
var euler = value.EulerAngles;
- euler[component] = curve;
+ euler[component] = (float)curve;
Quaternion.Euler(euler.X, euler.Y, euler.Z, out value);
}
@@ -234,7 +365,7 @@ namespace FlaxEditor.GUI
void IKeyframeAccess.SetCurveValue(float curve, ref Color value, int component)
{
- value[component] = curve;
+ value[component] = (float)curve;
}
void IKeyframeAccess.GetDefaultValue(out Color32 value)
diff --git a/Source/Editor/GUI/CurveEditor.Base.cs b/Source/Editor/GUI/CurveEditor.Base.cs
index a46ae3c31..2b93b64f0 100644
--- a/Source/Editor/GUI/CurveEditor.Base.cs
+++ b/Source/Editor/GUI/CurveEditor.Base.cs
@@ -58,7 +58,7 @@ namespace FlaxEditor.GUI
///
/// The function for custom view panning. Gets input movement delta (in curve control space) and returns the renaming input delta to process by curve editor itself.
///
- public Func CustomViewPanning;
+ public Func CustomViewPanning;
///
/// The maximum amount of keyframes to use in a single curve.
@@ -113,12 +113,12 @@ namespace FlaxEditor.GUI
///
/// Gets or sets the view offset (via scroll bars).
///
- public abstract Vector2 ViewOffset { get; set; }
+ public abstract Float2 ViewOffset { get; set; }
///
/// Gets or sets the view scale.
///
- public abstract Vector2 ViewScale { get; set; }
+ public abstract Float2 ViewScale { get; set; }
///
/// Gets the amount of keyframes added to the curve.
@@ -174,8 +174,8 @@ namespace FlaxEditor.GUI
///
public void ResetView()
{
- ViewScale = ApplyUseModeMask(EnableZoom, Vector2.One, ViewScale);
- ViewOffset = ApplyUseModeMask(EnablePanning, Vector2.Zero, ViewOffset);
+ ViewScale = ApplyUseModeMask(EnableZoom, Float2.One, ViewScale);
+ ViewOffset = ApplyUseModeMask(EnablePanning, Float2.Zero, ViewOffset);
UpdateKeyframes();
}
@@ -247,16 +247,16 @@ namespace FlaxEditor.GUI
/// The keyframe index.
/// The keyframe value component index.
/// The point in time/value space.
- public abstract Vector2 GetKeyframePoint(int index, int component);
+ public abstract Float2 GetKeyframePoint(int index, int component);
///
- /// Converts the into the mask.
+ /// Converts the into the mask.
///
/// The mode.
/// The mask.
- protected static Vector2 GetUseModeMask(UseMode mode)
+ protected static Float2 GetUseModeMask(UseMode mode)
{
- return new Vector2((mode & UseMode.Horizontal) == UseMode.Horizontal ? 1.0f : 0.0f, (mode & UseMode.Vertical) == UseMode.Vertical ? 1.0f : 0.0f);
+ return new Float2((mode & UseMode.Horizontal) == UseMode.Horizontal ? 1.0f : 0.0f, (mode & UseMode.Vertical) == UseMode.Vertical ? 1.0f : 0.0f);
}
///
@@ -266,12 +266,12 @@ namespace FlaxEditor.GUI
/// The value to process.
/// The default value.
/// The combined value.
- protected static Vector2 ApplyUseModeMask(UseMode mode, Vector2 value, Vector2 defaultValue)
+ protected static Float2 ApplyUseModeMask(UseMode mode, Float2 value, Float2 defaultValue)
{
- return new Vector2(
- (mode & UseMode.Horizontal) == UseMode.Horizontal ? value.X : defaultValue.X,
- (mode & UseMode.Vertical) == UseMode.Vertical ? value.Y : defaultValue.Y
- );
+ return new Float2(
+ (mode & UseMode.Horizontal) == UseMode.Horizontal ? value.X : defaultValue.X,
+ (mode & UseMode.Vertical) == UseMode.Vertical ? value.Y : defaultValue.Y
+ );
}
///
@@ -290,7 +290,7 @@ namespace FlaxEditor.GUI
public abstract void OnKeyframesDelete(IKeyframesEditor editor);
///
- public abstract void OnKeyframesMove(IKeyframesEditor editor, ContainerControl control, Vector2 location, bool start, bool end);
+ public abstract void OnKeyframesMove(IKeyframesEditor editor, ContainerControl control, Float2 location, bool start, bool end);
///
public abstract void OnKeyframesCopy(IKeyframesEditor editor, float? timeOffset, System.Text.StringBuilder data);
diff --git a/Source/Editor/GUI/CurveEditor.Contents.cs b/Source/Editor/GUI/CurveEditor.Contents.cs
index b730e923f..d30cfdffa 100644
--- a/Source/Editor/GUI/CurveEditor.Contents.cs
+++ b/Source/Editor/GUI/CurveEditor.Contents.cs
@@ -22,17 +22,17 @@ namespace FlaxEditor.GUI
private readonly CurveEditor _editor;
internal bool _leftMouseDown;
private bool _rightMouseDown;
- internal Vector2 _leftMouseDownPos = Vector2.Minimum;
- private Vector2 _rightMouseDownPos = Vector2.Minimum;
- private Vector2 _movingViewLastPos;
- internal Vector2 _mousePos = Vector2.Minimum;
+ internal Float2 _leftMouseDownPos = Float2.Minimum;
+ private Float2 _rightMouseDownPos = Float2.Minimum;
+ private Float2 _movingViewLastPos;
+ internal Float2 _mousePos = Float2.Minimum;
internal bool _isMovingSelection;
internal bool _isMovingTangent;
internal bool _movedKeyframes;
private TangentPoint _movingTangent;
- private Vector2 _movingSelectionStart;
- private Vector2[] _movingSelectionOffsets;
- private Vector2 _cmShowPos;
+ private Float2 _movingSelectionStart;
+ private Float2[] _movingSelectionOffsets;
+ private Float2 _cmShowPos;
///
/// Initializes a new instance of the class.
@@ -65,7 +65,7 @@ namespace FlaxEditor.GUI
_editor.UpdateTangents();
}
- internal void OnMoveStart(Vector2 location)
+ internal void OnMoveStart(Float2 location)
{
// Start moving selected keyframes
_isMovingSelection = true;
@@ -73,13 +73,13 @@ namespace FlaxEditor.GUI
var viewRect = _editor._mainPanel.GetClientArea();
_movingSelectionStart = PointToKeyframes(location, ref viewRect);
if (_movingSelectionOffsets == null || _movingSelectionOffsets.Length != _editor._points.Count)
- _movingSelectionOffsets = new Vector2[_editor._points.Count];
+ _movingSelectionOffsets = new Float2[_editor._points.Count];
for (int i = 0; i < _movingSelectionOffsets.Length; i++)
_movingSelectionOffsets[i] = _editor._points[i].Point - _movingSelectionStart;
_editor.OnEditingStart();
}
- internal void OnMove(Vector2 location)
+ internal void OnMove(Float2 location)
{
var viewRect = _editor._mainPanel.GetClientArea();
var locationKeyframes = PointToKeyframes(location, ref viewRect);
@@ -145,7 +145,7 @@ namespace FlaxEditor.GUI
}
}
- internal void OnMoveEnd(Vector2 location)
+ internal void OnMoveEnd(Float2 location)
{
if (_movedKeyframes)
{
@@ -157,7 +157,7 @@ namespace FlaxEditor.GUI
}
///
- public override bool IntersectsContent(ref Vector2 locationParent, out Vector2 location)
+ public override bool IntersectsContent(ref Float2 locationParent, out Float2 location)
{
// Pass all events
location = PointFromParent(ref locationParent);
@@ -165,7 +165,7 @@ namespace FlaxEditor.GUI
}
///
- public override void OnMouseEnter(Vector2 location)
+ public override void OnMouseEnter(Float2 location)
{
_mousePos = location;
@@ -173,7 +173,7 @@ namespace FlaxEditor.GUI
}
///
- public override void OnMouseMove(Vector2 location)
+ public override void OnMouseMove(Float2 location)
{
_mousePos = location;
@@ -189,7 +189,7 @@ namespace FlaxEditor.GUI
// Moving view
if (_rightMouseDown)
{
- Vector2 delta = location - _movingViewLastPos;
+ var delta = location - _movingViewLastPos;
if (_editor.CustomViewPanning != null)
delta = _editor.CustomViewPanning(delta);
delta *= GetUseModeMask(_editor.EnablePanning) * _editor.ViewScale;
@@ -273,7 +273,7 @@ namespace FlaxEditor.GUI
}
///
- public override bool OnMouseDown(Vector2 location, MouseButton button)
+ public override bool OnMouseDown(Float2 location, MouseButton button)
{
if (base.OnMouseDown(location, button))
{
@@ -403,7 +403,7 @@ namespace FlaxEditor.GUI
}
///
- public override bool OnMouseUp(Vector2 location, MouseButton button)
+ public override bool OnMouseUp(Float2 location, MouseButton button)
{
_mousePos = location;
@@ -443,7 +443,7 @@ namespace FlaxEditor.GUI
Cursor = CursorType.Default;
// Check if no move has been made at all
- if (Vector2.Distance(ref location, ref _rightMouseDownPos) < 2.0f)
+ if (Float2.Distance(ref location, ref _rightMouseDownPos) < 2.0f)
{
var selectionCount = _editor.SelectionCount;
var point = GetChildAt(location) as KeyframePoint;
@@ -511,7 +511,7 @@ namespace FlaxEditor.GUI
}
///
- public override bool OnMouseWheel(Vector2 location, float delta)
+ public override bool OnMouseWheel(Float2 location, float delta)
{
if (base.OnMouseWheel(location, delta))
return true;
@@ -528,7 +528,7 @@ namespace FlaxEditor.GUI
}
///
- protected override void SetScaleInternal(ref Vector2 scale)
+ protected override void SetScaleInternal(ref Float2 scale)
{
base.SetScaleInternal(ref scale);
@@ -541,13 +541,13 @@ namespace FlaxEditor.GUI
/// The point.
/// The curve contents area bounds.
/// The result.
- private Vector2 PointToKeyframes(Vector2 point, ref Rectangle curveContentAreaBounds)
+ private Float2 PointToKeyframes(Float2 point, ref Rectangle curveContentAreaBounds)
{
// Contents -> Keyframes
- return new Vector2(
- (point.X + Location.X) / UnitsPerSecond,
- (point.Y + Location.Y - curveContentAreaBounds.Height) / -UnitsPerSecond
- );
+ return new Float2(
+ (point.X + Location.X) / UnitsPerSecond,
+ (point.Y + Location.Y - curveContentAreaBounds.Height) / -UnitsPerSecond
+ );
}
}
@@ -579,7 +579,7 @@ namespace FlaxEditor.GUI
}
///
- public override void OnKeyframesMove(IKeyframesEditor editor, ContainerControl control, Vector2 location, bool start, bool end)
+ public override void OnKeyframesMove(IKeyframesEditor editor, ContainerControl control, Float2 location, bool start, bool end)
{
if (SelectionCount == 0)
return;
diff --git a/Source/Editor/GUI/CurveEditor.cs b/Source/Editor/GUI/CurveEditor.cs
index fdce5781d..225a63e96 100644
--- a/Source/Editor/GUI/CurveEditor.cs
+++ b/Source/Editor/GUI/CurveEditor.cs
@@ -39,7 +39,7 @@ namespace FlaxEditor.GUI
{
_editor = editor;
const float width = 340.0f;
- Size = new Vector2(width, height);
+ Size = new Float2(width, height);
var panel1 = new Panel(ScrollBars.Vertical)
{
Bounds = new Rectangle(0, 0.0f, width, height),
@@ -152,7 +152,7 @@ namespace FlaxEditor.GUI
///
/// Gets the point time and value on a curve.
///
- public Vector2 Point => Editor.GetKeyframePoint(Index, Component);
+ public Float2 Point => Editor.GetKeyframePoint(Index, Component);
///
/// Gets the time of the keyframe point.
@@ -162,7 +162,7 @@ namespace FlaxEditor.GUI
///
public override void Draw()
{
- var rect = new Rectangle(Vector2.Zero, Size);
+ var rect = new Rectangle(Float2.Zero, Size);
var color = Editor.ShowCollapsed ? Color.Gray : Editor.Colors[Component];
if (IsSelected)
color = Editor.ContainsFocus ? Color.YellowGreen : Color.Lerp(Color.Gray, Color.YellowGreen, 0.4f);
@@ -172,7 +172,7 @@ namespace FlaxEditor.GUI
}
///
- public override bool OnMouseDoubleClick(Vector2 location, MouseButton button)
+ public override bool OnMouseDoubleClick(Float2 location, MouseButton button)
{
if (base.OnMouseDoubleClick(location, button))
return true;
@@ -249,7 +249,7 @@ namespace FlaxEditor.GUI
var pointPos = PointFromParent(Point.Center);
Render2D.DrawLine(Size * 0.5f, pointPos, Color.Gray);
- var rect = new Rectangle(Vector2.Zero, Size);
+ var rect = new Rectangle(Float2.Zero, Size);
var color = Color.MediumVioletRed;
if (IsMouseOver)
color *= 1.1f;
@@ -278,7 +278,7 @@ namespace FlaxEditor.GUI
///
/// The keyframes size.
///
- protected static readonly Vector2 KeyframesSize = new Vector2(7.0f);
+ protected static readonly Float2 KeyframesSize = new Float2(7.0f);
///
/// The colors for the keyframe points.
@@ -330,7 +330,7 @@ namespace FlaxEditor.GUI
protected readonly TangentPoint[] _tangents = new TangentPoint[2];
///
- public override Vector2 ViewOffset
+ public override Float2 ViewOffset
{
get => _mainPanel.ViewOffset;
set
@@ -341,10 +341,10 @@ namespace FlaxEditor.GUI
}
///
- public override Vector2 ViewScale
+ public override Float2 ViewScale
{
get => _contents.Scale;
- set => _contents.Scale = Vector2.Clamp(value, new Vector2(0.0001f), new Vector2(1000.0f));
+ set => _contents.Scale = Float2.Clamp(value, new Float2(0.0001f), new Float2(1000.0f));
}
///
@@ -520,7 +520,7 @@ namespace FlaxEditor.GUI
/// Adds a new keyframe at the given location (in keyframes space).
///
/// The new keyframe position (in keyframes space).
- protected abstract void AddKeyframe(Vector2 keyframesPos);
+ protected abstract void AddKeyframe(Float2 keyframesPos);
///
/// Sets the keyframe data (internally).
@@ -588,13 +588,13 @@ namespace FlaxEditor.GUI
void Apply();
}
- private void EditAllKeyframes(Control control, Vector2 pos)
+ private void EditAllKeyframes(Control control, Float2 pos)
{
_popup = new Popup(this, new object[] { GetAllKeyframesEditingProxy() }, null, 400.0f);
_popup.Show(control, pos);
}
- private void EditKeyframes(Control control, Vector2 pos)
+ private void EditKeyframes(Control control, Float2 pos)
{
var keyframeIndices = new List();
for (int i = 0; i < _points.Count; i++)
@@ -607,7 +607,7 @@ namespace FlaxEditor.GUI
EditKeyframes(control, pos, keyframeIndices);
}
- private void EditKeyframes(Control control, Vector2 pos, List keyframeIndices)
+ private void EditKeyframes(Control control, Float2 pos, List keyframeIndices)
{
var selection = new object[keyframeIndices.Count];
var keyframes = GetKeyframes();
@@ -730,7 +730,7 @@ namespace FlaxEditor.GUI
/// The point.
/// The curve contents area bounds.
/// The result.
- protected Vector2 PointToKeyframes(Vector2 point, ref Rectangle curveContentAreaBounds)
+ protected Float2 PointToKeyframes(Float2 point, ref Rectangle curveContentAreaBounds)
{
// Curve Editor -> Main Panel
point = _mainPanel.PointFromParent(point);
@@ -739,10 +739,10 @@ namespace FlaxEditor.GUI
point = _contents.PointFromParent(point);
// Contents -> Keyframes
- return new Vector2(
- (point.X + _contents.Location.X) / UnitsPerSecond,
- (point.Y + _contents.Location.Y - curveContentAreaBounds.Height) / -UnitsPerSecond
- );
+ return new Float2(
+ (point.X + _contents.Location.X) / UnitsPerSecond,
+ (point.Y + _contents.Location.Y - curveContentAreaBounds.Height) / -UnitsPerSecond
+ );
}
///
@@ -751,13 +751,13 @@ namespace FlaxEditor.GUI
/// The point.
/// The curve contents area bounds.
/// The result.
- protected Vector2 PointFromKeyframes(Vector2 point, ref Rectangle curveContentAreaBounds)
+ protected Float2 PointFromKeyframes(Float2 point, ref Rectangle curveContentAreaBounds)
{
// Keyframes -> Contents
- point = new Vector2(
- point.X * UnitsPerSecond - _contents.Location.X,
- point.Y * -UnitsPerSecond + curveContentAreaBounds.Height - _contents.Location.Y
- );
+ point = new Float2(
+ point.X * UnitsPerSecond - _contents.Location.X,
+ point.Y * -UnitsPerSecond + curveContentAreaBounds.Height - _contents.Location.Y
+ );
// Contents -> Main Panel
point = _contents.PointToParent(point);
@@ -766,7 +766,7 @@ namespace FlaxEditor.GUI
return _mainPanel.PointToParent(point);
}
- private void DrawAxis(Vector2 axis, ref Rectangle viewRect, float min, float max, float pixelRange)
+ private void DrawAxis(Float2 axis, ref Rectangle viewRect, float min, float max, float pixelRange)
{
int minDistanceBetweenTicks = 20;
int maxDistanceBetweenTicks = 60;
@@ -819,7 +819,7 @@ namespace FlaxEditor.GUI
var lineRect = new Rectangle
(
viewRect.Location + (p - 0.5f) * axis,
- Vector2.Lerp(viewRect.Size, Vector2.One, axis)
+ Float2.Lerp(viewRect.Size, Float2.One, axis)
);
Render2D.FillRectangle(lineRect, _linesColor.AlphaMultiplied(strength));
@@ -854,7 +854,7 @@ namespace FlaxEditor.GUI
}
var style = Style.Current;
- var rect = new Rectangle(Vector2.Zero, Size);
+ var rect = new Rectangle(Float2.Zero, Size);
var viewRect = _mainPanel.GetClientArea();
// Draw background
@@ -869,16 +869,16 @@ namespace FlaxEditor.GUI
var upperLeft = PointToKeyframes(viewRect.Location, ref viewRect);
var bottomRight = PointToKeyframes(viewRect.Size, ref viewRect);
- var min = Vector2.Min(upperLeft, bottomRight);
- var max = Vector2.Max(upperLeft, bottomRight);
+ var min = Float2.Min(upperLeft, bottomRight);
+ var max = Float2.Max(upperLeft, bottomRight);
var pixelRange = (max - min) * ViewScale * UnitsPerSecond;
Render2D.PushClip(ref viewRect);
if ((ShowAxes & UseMode.Vertical) == UseMode.Vertical)
- DrawAxis(Vector2.UnitX, ref viewRect, min.X, max.X, pixelRange.X);
+ DrawAxis(Float2.UnitX, ref viewRect, min.X, max.X, pixelRange.X);
if ((ShowAxes & UseMode.Horizontal) == UseMode.Horizontal)
- DrawAxis(Vector2.UnitY, ref viewRect, min.Y, max.Y, pixelRange.Y);
+ DrawAxis(Float2.UnitY, ref viewRect, min.Y, max.Y, pixelRange.Y);
Render2D.PopClip();
}
@@ -1094,9 +1094,9 @@ namespace FlaxEditor.GUI
/// The keyframe.
/// The keyframe value component index.
/// The point in time/value space.
- private Vector2 GetKeyframePoint(ref LinearCurve.Keyframe k, int component)
+ private Float2 GetKeyframePoint(ref LinearCurve.Keyframe k, int component)
{
- return new Vector2(k.Time, Accessor.GetCurveValue(ref k.Value, component));
+ return new Float2(k.Time, Accessor.GetCurveValue(ref k.Value, component));
}
private void DrawLine(LinearCurve.Keyframe startK, LinearCurve.Keyframe endK, int component, ref Rectangle viewRect)
@@ -1179,7 +1179,7 @@ namespace FlaxEditor.GUI
}
///
- protected override void AddKeyframe(Vector2 keyframesPos)
+ protected override void AddKeyframe(Float2 keyframesPos)
{
var k = new LinearCurve.Keyframe
{
@@ -1320,10 +1320,10 @@ namespace FlaxEditor.GUI
}
///
- public override Vector2 GetKeyframePoint(int index, int component)
+ public override Float2 GetKeyframePoint(int index, int component)
{
var k = _keyframes[index];
- return new Vector2(k.Time, Accessor.GetCurveValue(ref k.Value, component));
+ return new Float2(k.Time, Accessor.GetCurveValue(ref k.Value, component));
}
///
@@ -1379,7 +1379,7 @@ namespace FlaxEditor.GUI
var k = _keyframes[p.Index];
var location = GetKeyframePoint(ref k, p.Component);
- var point = new Vector2
+ var point = new Float2
(
location.X * UnitsPerSecond - p.Width * 0.5f,
location.Y * -UnitsPerSecond - p.Height * 0.5f + curveContentAreaBounds.Height
@@ -1388,7 +1388,7 @@ namespace FlaxEditor.GUI
if (_showCollapsed)
{
point.Y = 1.0f;
- p.Size = new Vector2(KeyframesSize.X / viewScale.X, Height - 2.0f);
+ p.Size = new Float2(KeyframesSize.X / viewScale.X, Height - 2.0f);
p.Visible = p.Component == 0;
}
else
@@ -1418,7 +1418,7 @@ namespace FlaxEditor.GUI
}
else if (_contents.Bounds == Rectangle.Empty)
{
- _contents.Bounds = Rectangle.Union(bounds, new Rectangle(Vector2.Zero, Vector2.One));
+ _contents.Bounds = Rectangle.Union(bounds, new Rectangle(Float2.Zero, Float2.One));
}
// Offset the keyframes (parent container changed its location)
@@ -1805,9 +1805,9 @@ namespace FlaxEditor.GUI
/// The keyframe.
/// The keyframe value component index.
/// The point in time/value space.
- private Vector2 GetKeyframePoint(ref BezierCurve.Keyframe k, int component)
+ private Float2 GetKeyframePoint(ref BezierCurve.Keyframe k, int component)
{
- return new Vector2(k.Time, Accessor.GetCurveValue(ref k.Value, component));
+ return new Float2(k.Time, Accessor.GetCurveValue(ref k.Value, component));
}
private void DrawLine(BezierCurve.Keyframe startK, BezierCurve.Keyframe endK, int component, ref Rectangle viewRect)
@@ -1890,7 +1890,7 @@ namespace FlaxEditor.GUI
}
///
- protected override void AddKeyframe(Vector2 keyframesPos)
+ protected override void AddKeyframe(Float2 keyframesPos)
{
var k = new BezierCurve.Keyframe
{
@@ -2042,10 +2042,10 @@ namespace FlaxEditor.GUI
}
///
- public override Vector2 GetKeyframePoint(int index, int component)
+ public override Float2 GetKeyframePoint(int index, int component)
{
var k = _keyframes[index];
- return new Vector2(k.Time, Accessor.GetCurveValue(ref k.Value, component));
+ return new Float2(k.Time, Accessor.GetCurveValue(ref k.Value, component));
}
///
@@ -2094,13 +2094,13 @@ namespace FlaxEditor.GUI
// Place keyframes
Rectangle curveContentAreaBounds = _mainPanel.GetClientArea();
var viewScale = ViewScale;
- var pointsSize = _showCollapsed ? new Vector2(4.0f / viewScale.X, Height - 2.0f) : KeyframesSize / viewScale;
+ var pointsSize = _showCollapsed ? new Float2(4.0f / viewScale.X, Height - 2.0f) : KeyframesSize / viewScale;
for (int i = 0; i < _points.Count; i++)
{
var p = _points[i];
var k = _keyframes[p.Index];
var point = GetKeyframePoint(ref k, p.Component);
- var location = new Vector2
+ var location = new Float2
(
point.X * UnitsPerSecond - pointsSize.X * 0.5f,
point.Y * -UnitsPerSecond - pointsSize.Y * 0.5f + curveContentAreaBounds.Height
@@ -2136,7 +2136,7 @@ namespace FlaxEditor.GUI
}
else if (_contents.Bounds == Rectangle.Empty)
{
- _contents.Bounds = Rectangle.Union(bounds, new Rectangle(Vector2.Zero, Vector2.One));
+ _contents.Bounds = Rectangle.Union(bounds, new Rectangle(Float2.Zero, Float2.One));
}
// Offset the keyframes (parent container changed its location)
@@ -2191,7 +2191,7 @@ namespace FlaxEditor.GUI
var offset = 30.0f * direction;
var location = GetKeyframePoint(ref k, selectedComponent);
t.Size = KeyframesSize / ViewScale;
- t.Location = new Vector2
+ t.Location = new Float2
(
location.X * UnitsPerSecond - t.Width * 0.5f + offset,
location.Y * -UnitsPerSecond - t.Height * 0.5f + curveContentAreaBounds.Height - offset * tangent
@@ -2272,8 +2272,8 @@ namespace FlaxEditor.GUI
var offset = (end.X - start.X) * 0.5f;
var p1 = PointFromKeyframes(start, ref viewRect);
- var p2 = PointFromKeyframes(start + new Vector2(offset, startTangent * offset), ref viewRect);
- var p3 = PointFromKeyframes(end - new Vector2(offset, endTangent * offset), ref viewRect);
+ var p2 = PointFromKeyframes(start + new Float2(offset, startTangent * offset), ref viewRect);
+ var p3 = PointFromKeyframes(end - new Float2(offset, endTangent * offset), ref viewRect);
var p4 = PointFromKeyframes(end, ref viewRect);
Render2D.DrawBezier(p1, p2, p3, p4, color);
diff --git a/Source/Editor/GUI/Dialogs/ColorPickerDialog.cs b/Source/Editor/GUI/Dialogs/ColorPickerDialog.cs
index b7207b58c..1fa3f4db3 100644
--- a/Source/Editor/GUI/Dialogs/ColorPickerDialog.cs
+++ b/Source/Editor/GUI/Dialogs/ColorPickerDialog.cs
@@ -111,7 +111,7 @@ namespace FlaxEditor.GUI.Dialogs
// Selector
_cSelector = new ColorSelectorWithSliders(180, 18)
{
- Location = new Vector2(PickerMargin, PickerMargin),
+ Location = new Float2(PickerMargin, PickerMargin),
Parent = this
};
_cSelector.ColorChanged += x => SelectedColor = x;
@@ -166,7 +166,7 @@ namespace FlaxEditor.GUI.Dialogs
_cValue.ValueChanged += OnHSVChanged;
// Set valid dialog size based on UI content
- _dialogSize = Size = new Vector2(_cRed.Right + PickerMargin, 300);
+ _dialogSize = Size = new Float2(_cRed.Right + PickerMargin, 300);
// Hex
const float hexTextBoxWidth = 80;
diff --git a/Source/Editor/GUI/Dialogs/ColorSelector.cs b/Source/Editor/GUI/Dialogs/ColorSelector.cs
index 9048379cb..b42ab3ca5 100644
--- a/Source/Editor/GUI/Dialogs/ColorSelector.cs
+++ b/Source/Editor/GUI/Dialogs/ColorSelector.cs
@@ -84,11 +84,11 @@ namespace FlaxEditor.GUI.Dialogs
/// Updates the color selected by the mouse.
///
/// The location.
- protected virtual void UpdateMouse(ref Vector2 location)
+ protected virtual void UpdateMouse(ref Float2 location)
{
if (_isMouseDownWheel)
{
- Vector2 delta = location - _wheelRect.Center;
+ var delta = location - _wheelRect.Center;
float distance = delta.Length;
float degrees;
@@ -171,9 +171,9 @@ namespace FlaxEditor.GUI.Dialogs
Render2D.DrawSprite(_colorWheelSprite, _wheelRect.MakeExpanded(boxExpand), enabled ? Color.White : Color.Gray);
float hAngle = hsv.X * Mathf.DegreesToRadians;
float hRadius = hsv.Y * _wheelRect.Width * 0.5f;
- Vector2 hsPos = new Vector2(hRadius * Mathf.Cos(hAngle), -hRadius * Mathf.Sin(hAngle));
+ var hsPos = new Float2(hRadius * Mathf.Cos(hAngle), -hRadius * Mathf.Sin(hAngle));
const float wheelBoxSize = 4.0f;
- Render2D.DrawRectangle(new Rectangle(hsPos - (wheelBoxSize * 0.5f) + _wheelRect.Center, new Vector2(wheelBoxSize)), _isMouseDownWheel ? Color.Gray : Color.Black);
+ Render2D.DrawRectangle(new Rectangle(hsPos - (wheelBoxSize * 0.5f) + _wheelRect.Center, new Float2(wheelBoxSize)), _isMouseDownWheel ? Color.Gray : Color.Black);
}
///
@@ -185,7 +185,7 @@ namespace FlaxEditor.GUI.Dialogs
}
///
- public override void OnMouseMove(Vector2 location)
+ public override void OnMouseMove(Float2 location)
{
UpdateMouse(ref location);
@@ -193,7 +193,7 @@ namespace FlaxEditor.GUI.Dialogs
}
///
- public override bool OnMouseDown(Vector2 location, MouseButton button)
+ public override bool OnMouseDown(Float2 location, MouseButton button)
{
if (button == MouseButton.Left && _wheelRect.Contains(location))
{
@@ -211,7 +211,7 @@ namespace FlaxEditor.GUI.Dialogs
}
///
- public override bool OnMouseUp(Vector2 location, MouseButton button)
+ public override bool OnMouseUp(Float2 location, MouseButton button)
{
if (button == MouseButton.Left && _isMouseDownWheel)
{
@@ -261,11 +261,11 @@ namespace FlaxEditor.GUI.Dialogs
const float slidersMargin = 8.0f;
_slider1Rect = new Rectangle(wheelSize + slidersMargin, 0, slidersThickness, wheelSize);
_slider2Rect = new Rectangle(_slider1Rect.Right + slidersMargin, _slider1Rect.Y, slidersThickness, _slider1Rect.Height);
- Size = new Vector2(_slider2Rect.Right, wheelSize);
+ Size = new Float2(_slider2Rect.Right, wheelSize);
}
///
- protected override void UpdateMouse(ref Vector2 location)
+ protected override void UpdateMouse(ref Float2 location)
{
if (_isMouseDownSlider1)
{
@@ -327,7 +327,7 @@ namespace FlaxEditor.GUI.Dialogs
}
///
- public override bool OnMouseDown(Vector2 location, MouseButton button)
+ public override bool OnMouseDown(Float2 location, MouseButton button)
{
if (button == MouseButton.Left && _slider1Rect.Contains(location))
{
@@ -346,7 +346,7 @@ namespace FlaxEditor.GUI.Dialogs
}
///
- public override bool OnMouseUp(Vector2 location, MouseButton button)
+ public override bool OnMouseUp(Float2 location, MouseButton button)
{
if (button == MouseButton.Left && (_isMouseDownSlider1 || _isMouseDownSlider2))
{
diff --git a/Source/Editor/GUI/Dialogs/Dialog.cs b/Source/Editor/GUI/Dialogs/Dialog.cs
index 55f60b116..1bcf88c82 100644
--- a/Source/Editor/GUI/Dialogs/Dialog.cs
+++ b/Source/Editor/GUI/Dialogs/Dialog.cs
@@ -32,7 +32,7 @@ namespace FlaxEditor.GUI.Dialogs
///
/// The dialog size.
///
- protected Vector2 _dialogSize = new Vector2(300, 100);
+ protected Float2 _dialogSize = new Float2(300, 100);
///
/// Gets the dialog result.
diff --git a/Source/Editor/GUI/Docking/DockHintWindow.cs b/Source/Editor/GUI/Docking/DockHintWindow.cs
index ad9d567bb..50be41766 100644
--- a/Source/Editor/GUI/Docking/DockHintWindow.cs
+++ b/Source/Editor/GUI/Docking/DockHintWindow.cs
@@ -13,11 +13,11 @@ namespace FlaxEditor.GUI.Docking
{
private FloatWindowDockPanel _toMove;
- private Vector2 _dragOffset;
- private Vector2 _defaultWindowSize;
+ private Float2 _dragOffset;
+ private Float2 _defaultWindowSize;
private Rectangle _rectDock;
private Rectangle _rectWindow;
- private Vector2 _mouse;
+ private Float2 _mouse;
private DockState _toSet;
private DockPanel _toDock;
private bool _lateDragOffsetUpdate;
@@ -42,7 +42,7 @@ namespace FlaxEditor.GUI.Docking
// If the _toMove window was not focused when initializing this window, the result vector only contains zeros
// and to prevent a failure, we need to perform an update for the drag offset at later time which will be done in the OnMouseMove event handler.
- if (mouseScreenPosition != Vector2.Zero)
+ if (mouseScreenPosition != Float2.Zero)
CalculateDragOffset(mouseScreenPosition);
else
_lateDragOffsetUpdate = true;
@@ -103,7 +103,7 @@ namespace FlaxEditor.GUI.Docking
var window = _toMove.Window?.Window;
if (window == null)
return;
- Vector2 mouse = FlaxEngine.Input.MouseScreenPosition;
+ var mouse = FlaxEngine.Input.MouseScreenPosition;
// Move base window
window.Position = mouse - _dragOffset;
@@ -183,8 +183,8 @@ namespace FlaxEditor.GUI.Docking
// Move window to the mouse position (with some offset for caption bar)
var window = (WindowRootControl)toMove.Root;
- Vector2 mouse = FlaxEngine.Input.MouseScreenPosition;
- window.Window.Position = mouse - new Vector2(8, 8);
+ var mouse = FlaxEngine.Input.MouseScreenPosition;
+ window.Window.Position = mouse - new Float2(8, 8);
// Get floating panel
var floatingPanelToMove = window.GetChild(0) as FloatWindowDockPanel;
@@ -225,9 +225,9 @@ namespace FlaxEditor.GUI.Docking
return result;
}
- private void CalculateDragOffset(Vector2 mouseScreenPosition)
+ private void CalculateDragOffset(Float2 mouseScreenPosition)
{
- Vector2 baseWinPos = this._toMove.Window.Window.Position;
+ var baseWinPos = _toMove.Window.Window.Position;
_dragOffset = mouseScreenPosition - baseWinPos;
}
@@ -258,8 +258,8 @@ namespace FlaxEditor.GUI.Docking
_rectDock = _toDock.DockAreaBounds;
// Cache dock rectangles
- Vector2 size = _rectDock.Size;
- Vector2 offset = _rectDock.Location;
+ var size = _rectDock.Size;
+ var offset = _rectDock.Location;
float BorderMargin = 4.0f;
float ProxyHintWindowsSize2 = Proxy.HintWindowsSize * 0.5f;
float centerX = size.X * 0.5f;
@@ -330,7 +330,7 @@ namespace FlaxEditor.GUI.Docking
Proxy.Window.ClientBounds = _rectWindow;
}
- private void OnMouseUp(ref Vector2 location, MouseButton button, ref bool handled)
+ private void OnMouseUp(ref Float2 location, MouseButton button, ref bool handled)
{
if (button == MouseButton.Left)
{
@@ -338,7 +338,7 @@ namespace FlaxEditor.GUI.Docking
}
}
- private void OnMouseMove(ref Vector2 mousePos)
+ private void OnMouseMove(ref Float2 mousePos)
{
// Recalculate the drag offset because the current mouse screen position was invalid when we initialized the window
if (_lateDragOffsetUpdate)
@@ -414,7 +414,7 @@ namespace FlaxEditor.GUI.Docking
/// Initializes the hint window.
///
/// Initial size of the proxy window.
- public static void Init(ref Vector2 initSize)
+ public static void Init(ref Float2 initSize)
{
if (Window == null)
{
@@ -455,7 +455,7 @@ namespace FlaxEditor.GUI.Docking
var settings = CreateWindowSettings.Default;
settings.Title = name;
- settings.Size = new Vector2(HintWindowsSize);
+ settings.Size = new Float2(HintWindowsSize);
settings.AllowInput = false;
settings.AllowMaximize = false;
settings.AllowMinimize = false;
diff --git a/Source/Editor/GUI/Docking/DockPanel.cs b/Source/Editor/GUI/Docking/DockPanel.cs
index 55e7167e4..0ae6ebcd6 100644
--- a/Source/Editor/GUI/Docking/DockPanel.cs
+++ b/Source/Editor/GUI/Docking/DockPanel.cs
@@ -123,7 +123,7 @@ namespace FlaxEditor.GUI.Docking
if (parentWin == null)
throw new InvalidOperationException("Missing parent window.");
var control = _tabsProxy != null ? (Control)_tabsProxy : this;
- var clientPos = control.PointToWindow(Vector2.Zero);
+ var clientPos = control.PointToWindow(Float2.Zero);
return new Rectangle(parentWin.PointToScreen(clientPos), control.Size * DpiScale);
}
}
@@ -305,14 +305,14 @@ namespace FlaxEditor.GUI.Docking
///
/// Screen space position to test
/// Dock panel that has been hit or null if nothing found
- public DockPanel HitTest(ref Vector2 position)
+ public DockPanel HitTest(ref Float2 position)
{
// Get parent window and transform point position into local coordinates system
var parentWin = Root;
if (parentWin == null)
return null;
- Vector2 clientPos = parentWin.PointFromScreen(position);
- Vector2 localPos = PointFromWindow(clientPos);
+ var clientPos = parentWin.PointFromScreen(position);
+ var localPos = PointFromWindow(clientPos);
// Early out
if (localPos.X < 0 || localPos.Y < 0)
diff --git a/Source/Editor/GUI/Docking/DockPanelProxy.cs b/Source/Editor/GUI/Docking/DockPanelProxy.cs
index 98601e67c..7e078ebaf 100644
--- a/Source/Editor/GUI/Docking/DockPanelProxy.cs
+++ b/Source/Editor/GUI/Docking/DockPanelProxy.cs
@@ -42,7 +42,7 @@ namespace FlaxEditor.GUI.Docking
///
/// The mouse position.
///
- public Vector2 MousePosition = Vector2.Minimum;
+ public Float2 MousePosition = Float2.Minimum;
///
/// The start drag asynchronous window.
@@ -65,7 +65,7 @@ namespace FlaxEditor.GUI.Docking
Offsets = Margin.Zero;
}
- private DockWindow GetTabAtPos(Vector2 position, out bool closeButton)
+ private DockWindow GetTabAtPos(Float2 position, out bool closeButton)
{
DockWindow result = null;
closeButton = false;
@@ -298,13 +298,13 @@ namespace FlaxEditor.GUI.Docking
IsMouseRightButtonDown = false;
IsMouseMiddleButtonDown = false;
MouseDownWindow = null;
- MousePosition = Vector2.Minimum;
+ MousePosition = Float2.Minimum;
base.OnLostFocus();
}
///
- public override void OnMouseEnter(Vector2 location)
+ public override void OnMouseEnter(Float2 location)
{
MousePosition = location;
@@ -312,7 +312,7 @@ namespace FlaxEditor.GUI.Docking
}
///
- public override bool OnMouseDoubleClick(Vector2 location, MouseButton button)
+ public override bool OnMouseDoubleClick(Float2 location, MouseButton button)
{
// Maximize/restore on double click
var tab = GetTabAtPos(location, out _);
@@ -330,7 +330,7 @@ namespace FlaxEditor.GUI.Docking
}
///
- public override bool OnMouseDown(Vector2 location, MouseButton button)
+ public override bool OnMouseDown(Float2 location, MouseButton button)
{
MouseDownWindow = GetTabAtPos(location, out IsMouseDownOverCross);
@@ -359,7 +359,7 @@ namespace FlaxEditor.GUI.Docking
}
///
- public override bool OnMouseUp(Vector2 location, MouseButton button)
+ public override bool OnMouseUp(Float2 location, MouseButton button)
{
// Check tabs under mouse position at the beginning and at the end
var tab = GetTabAtPos(location, out var overCross);
@@ -400,7 +400,7 @@ namespace FlaxEditor.GUI.Docking
}
///
- public override void OnMouseMove(Vector2 location)
+ public override void OnMouseMove(Float2 location)
{
MousePosition = location;
if (IsMouseLeftButtonDown)
@@ -460,13 +460,13 @@ namespace FlaxEditor.GUI.Docking
}
IsMouseRightButtonDown = false;
IsMouseMiddleButtonDown = false;
- MousePosition = Vector2.Minimum;
+ MousePosition = Float2.Minimum;
base.OnMouseLeave();
}
///
- public override DragDropEffect OnDragEnter(ref Vector2 location, DragData data)
+ public override DragDropEffect OnDragEnter(ref Float2 location, DragData data)
{
var result = base.OnDragEnter(ref location, data);
if (result != DragDropEffect.None)
@@ -479,7 +479,7 @@ namespace FlaxEditor.GUI.Docking
}
///
- public override DragDropEffect OnDragMove(ref Vector2 location, DragData data)
+ public override DragDropEffect OnDragMove(ref Float2 location, DragData data)
{
var result = base.OnDragMove(ref location, data);
if (result != DragDropEffect.None)
@@ -497,7 +497,7 @@ namespace FlaxEditor.GUI.Docking
rect = new Rectangle(0, DockPanel.DefaultHeaderHeight, Width, Height - DockPanel.DefaultHeaderHeight);
}
- private bool TrySelectTabUnderLocation(ref Vector2 location)
+ private bool TrySelectTabUnderLocation(ref Float2 location)
{
var tab = GetTabAtPos(location, out _);
if (tab != null)
@@ -510,7 +510,7 @@ namespace FlaxEditor.GUI.Docking
return false;
}
- private void ShowContextMenu(DockWindow tab, ref Vector2 location)
+ private void ShowContextMenu(DockWindow tab, ref Float2 location)
{
var menu = new ContextMenu.ContextMenu
{
diff --git a/Source/Editor/GUI/Docking/DockWindow.cs b/Source/Editor/GUI/Docking/DockWindow.cs
index 49b73bfea..de5ccf206 100644
--- a/Source/Editor/GUI/Docking/DockWindow.cs
+++ b/Source/Editor/GUI/Docking/DockWindow.cs
@@ -15,7 +15,7 @@ namespace FlaxEditor.GUI.Docking
public class DockWindow : Panel
{
private string _title;
- private Vector2 _titleSize;
+ private Float2 _titleSize;
///
/// The master panel.
@@ -67,7 +67,7 @@ namespace FlaxEditor.GUI.Docking
///
/// Scaled by the DPI, because the window should be large enough for its content on every monitor
///
- public virtual Vector2 DefaultSize => new Vector2(900, 580) * DpiScale;
+ public virtual Float2 DefaultSize => new Float2(900, 580) * DpiScale;
///
/// Gets the serialization typename.
@@ -85,7 +85,7 @@ namespace FlaxEditor.GUI.Docking
_title = value;
// Invalidate cached title size
- _titleSize = new Vector2(-1);
+ _titleSize = new Float2(-1);
PerformLayoutBeforeChildren();
// Check if is docked to the floating window and is selected so update window title
@@ -104,7 +104,7 @@ namespace FlaxEditor.GUI.Docking
///
/// Gets the size of the title.
///
- public Vector2 TitleSize => _titleSize;
+ public Float2 TitleSize => _titleSize;
///
/// The input actions collection to processed during user input.
@@ -155,7 +155,7 @@ namespace FlaxEditor.GUI.Docking
///
public void ShowFloating()
{
- ShowFloating(Vector2.Zero);
+ ShowFloating(Float2.Zero);
}
///
@@ -164,26 +164,26 @@ namespace FlaxEditor.GUI.Docking
/// Window location.
public void ShowFloating(WindowStartPosition position)
{
- ShowFloating(Vector2.Zero, position);
+ ShowFloating(Float2.Zero, position);
}
///
/// Shows the window in a floating state.
///
- /// Window size, set Vector2.Zero to use default.
+ /// Window size, set to use default.
/// Window location.
- public void ShowFloating(Vector2 size, WindowStartPosition position = WindowStartPosition.CenterParent)
+ public void ShowFloating(Float2 size, WindowStartPosition position = WindowStartPosition.CenterParent)
{
- ShowFloating(new Vector2(200, 200), size, position);
+ ShowFloating(new Float2(200, 200), size, position);
}
///
/// Shows the window in a floating state.
///
/// Window location.
- /// Window size, set Vector2.Zero to use default.
+ /// Window size, set to use default.
/// Window location.
- public void ShowFloating(Vector2 location, Vector2 size, WindowStartPosition position = WindowStartPosition.CenterParent)
+ public void ShowFloating(Float2 location, Float2 size, WindowStartPosition position = WindowStartPosition.CenterParent)
{
Undock();
diff --git a/Source/Editor/GUI/Docking/FloatWindowDockPanel.cs b/Source/Editor/GUI/Docking/FloatWindowDockPanel.cs
index d4a2aef67..c8e0a2b2e 100644
--- a/Source/Editor/GUI/Docking/FloatWindowDockPanel.cs
+++ b/Source/Editor/GUI/Docking/FloatWindowDockPanel.cs
@@ -67,7 +67,7 @@ namespace FlaxEditor.GUI.Docking
/// Window client area size.
/// Window start position.
/// Initial window title.
- internal static Window CreateFloatWindow(RootControl parent, Vector2 location, Vector2 size, WindowStartPosition startPosition, string title)
+ internal static Window CreateFloatWindow(RootControl parent, Float2 location, Float2 size, WindowStartPosition startPosition, string title)
{
// Setup initial window settings
var settings = CreateWindowSettings.Default;
@@ -75,8 +75,8 @@ namespace FlaxEditor.GUI.Docking
settings.Title = title;
settings.Size = size;
settings.Position = location;
- settings.MinimumSize = new Vector2(1);
- settings.MaximumSize = new Vector2(4096);
+ settings.MinimumSize = new Float2(1);
+ settings.MaximumSize = new Float2(4096);
settings.Fullscreen = false;
settings.HasBorder = true;
settings.SupportsTransparency = false;
diff --git a/Source/Editor/GUI/Docking/MasterDockPanel.cs b/Source/Editor/GUI/Docking/MasterDockPanel.cs
index 2afd1151b..19a728857 100644
--- a/Source/Editor/GUI/Docking/MasterDockPanel.cs
+++ b/Source/Editor/GUI/Docking/MasterDockPanel.cs
@@ -78,7 +78,7 @@ namespace FlaxEditor.GUI.Docking
/// Screen space position to test.
/// Floating window to omit during searching (and all docked to that one).
/// Dock panel that has been hit or null if nothing found.
- public DockPanel HitTest(ref Vector2 position, FloatWindowDockPanel excluded)
+ public DockPanel HitTest(ref Float2 position, FloatWindowDockPanel excluded)
{
// Check all floating windows
// TODO: gather windows order and take it into account when performing test
diff --git a/Source/Editor/GUI/Drag/DragHandlers.cs b/Source/Editor/GUI/Drag/DragHandlers.cs
index fc452c7d0..69bf6db86 100644
--- a/Source/Editor/GUI/Drag/DragHandlers.cs
+++ b/Source/Editor/GUI/Drag/DragHandlers.cs
@@ -17,7 +17,7 @@ namespace FlaxEditor.GUI.Drag
///
/// The data.
/// The result.
- public DragDropEffect OnDragEnter( /*ref Vector2 location, */ DragData data)
+ public DragDropEffect OnDragEnter(DragData data)
{
DragDropEffect effect = DragDropEffect.None;
diff --git a/Source/Editor/GUI/IKeyframesEditor.cs b/Source/Editor/GUI/IKeyframesEditor.cs
index 2f5c54260..88494158e 100644
--- a/Source/Editor/GUI/IKeyframesEditor.cs
+++ b/Source/Editor/GUI/IKeyframesEditor.cs
@@ -52,7 +52,7 @@ namespace FlaxEditor.GUI
/// The source movement location (in source control local space).
/// The movement start flag.
/// The movement end flag.
- void OnKeyframesMove(IKeyframesEditor editor, ContainerControl control, Vector2 location, bool start, bool end);
+ void OnKeyframesMove(IKeyframesEditor editor, ContainerControl control, Float2 location, bool start, bool end);
///
/// Called when keyframes selection should be copied.
diff --git a/Source/Editor/GUI/IKeyframesEditorContext.cs b/Source/Editor/GUI/IKeyframesEditorContext.cs
index 6dc06b18f..2ec6f24e2 100644
--- a/Source/Editor/GUI/IKeyframesEditorContext.cs
+++ b/Source/Editor/GUI/IKeyframesEditorContext.cs
@@ -46,7 +46,7 @@ namespace FlaxEditor.GUI
/// The source movement location (in source control local space).
/// The movement start flag.
/// The movement end flag.
- void OnKeyframesMove(IKeyframesEditor editor, ContainerControl control, Vector2 location, bool start, bool end);
+ void OnKeyframesMove(IKeyframesEditor editor, ContainerControl control, Float2 location, bool start, bool end);
///
/// Called when keyframes selection should be copied.
diff --git a/Source/Editor/GUI/Input/ColorValueBox.cs b/Source/Editor/GUI/Input/ColorValueBox.cs
index 5efaf9c46..074cc561a 100644
--- a/Source/Editor/GUI/Input/ColorValueBox.cs
+++ b/Source/Editor/GUI/Input/ColorValueBox.cs
@@ -130,7 +130,7 @@ namespace FlaxEditor.GUI.Input
}
///
- public override bool OnMouseUp(Vector2 location, MouseButton button)
+ public override bool OnMouseUp(Float2 location, MouseButton button)
{
Focus();
OnSubmit();
diff --git a/Source/Editor/GUI/Input/SliderControl.cs b/Source/Editor/GUI/Input/SliderControl.cs
index ef6d443d4..7a8b82622 100644
--- a/Source/Editor/GUI/Input/SliderControl.cs
+++ b/Source/Editor/GUI/Input/SliderControl.cs
@@ -164,7 +164,7 @@ namespace FlaxEditor.GUI.Input
}
///
- public override bool OnMouseDown(Vector2 location, MouseButton button)
+ public override bool OnMouseDown(Float2 location, MouseButton button)
{
if (button == MouseButton.Left)
{
@@ -190,12 +190,12 @@ namespace FlaxEditor.GUI.Input
}
///
- public override void OnMouseMove(Vector2 location)
+ public override void OnMouseMove(Float2 location)
{
if (_isSliding)
{
// Update sliding
- Vector2 slidePosition = location + Root.TrackingMouseOffset;
+ var slidePosition = location + Root.TrackingMouseOffset;
Value = Mathf.Map(slidePosition.X, 4, TrackSize - 4, Minimum, Maximum);
}
else
@@ -205,7 +205,7 @@ namespace FlaxEditor.GUI.Input
}
///
- public override bool OnMouseUp(Vector2 location, MouseButton button)
+ public override bool OnMouseUp(Float2 location, MouseButton button)
{
if (button == MouseButton.Left && _isSliding)
{
@@ -369,8 +369,8 @@ namespace FlaxEditor.GUI.Input
{
Text = _value.ToString(CultureInfo.InvariantCulture),
Parent = this,
- Location = new Vector2(split, 0),
- Size = new Vector2(Height, TextBoxSize),
+ Location = new Float2(split, 0),
+ Size = new Float2(Height, TextBoxSize),
};
_textBox.EditEnd += OnTextBoxEditEnd;
}
diff --git a/Source/Editor/GUI/Input/ValueBox.cs b/Source/Editor/GUI/Input/ValueBox.cs
index c9b264ca2..ff824d76c 100644
--- a/Source/Editor/GUI/Input/ValueBox.cs
+++ b/Source/Editor/GUI/Input/ValueBox.cs
@@ -54,7 +54,7 @@ namespace FlaxEditor.GUI.Input
///
protected string _startEditText;
- private Vector2 _startSlideLocation;
+ private Float2 _startSlideLocation;
private double _clickStartTime = -1;
///
@@ -192,7 +192,7 @@ namespace FlaxEditor.GUI.Input
{
// Draw overlay
// TODO: render nicer overlay with some glow from the borders (inside)
- Render2D.FillRectangle(new Rectangle(Vector2.Zero, Size), Color.Orange * 0.3f);
+ Render2D.FillRectangle(new Rectangle(Float2.Zero, Size), Color.Orange * 0.3f);
}
}
}
@@ -227,7 +227,7 @@ namespace FlaxEditor.GUI.Input
}
///
- public override bool OnMouseDown(Vector2 location, MouseButton button)
+ public override bool OnMouseDown(Float2 location, MouseButton button)
{
if (button == MouseButton.Left && CanUseSliding && SlideRect.Contains(location))
{
@@ -247,12 +247,12 @@ namespace FlaxEditor.GUI.Input
}
///
- public override void OnMouseMove(Vector2 location)
+ public override void OnMouseMove(Float2 location)
{
if (_isSliding)
{
// Update sliding
- Vector2 slideLocation = location + Root.TrackingMouseOffset;
+ var slideLocation = location + Root.TrackingMouseOffset;
ApplySliding(Mathf.RoundToInt(slideLocation.X - _startSlideLocation.X) * _slideSpeed);
return;
}
@@ -261,7 +261,7 @@ namespace FlaxEditor.GUI.Input
}
///
- public override bool OnMouseUp(Vector2 location, MouseButton button)
+ public override bool OnMouseUp(Float2 location, MouseButton button)
{
if (button == MouseButton.Left && _isSliding)
{
diff --git a/Source/Editor/GUI/ItemsListContextMenu.cs b/Source/Editor/GUI/ItemsListContextMenu.cs
index 3bfe912c4..7e593ba38 100644
--- a/Source/Editor/GUI/ItemsListContextMenu.cs
+++ b/Source/Editor/GUI/ItemsListContextMenu.cs
@@ -118,7 +118,7 @@ namespace FlaxEditor.GUI
// Overlay
if (IsMouseOver || IsFocused)
- Render2D.FillRectangle(new Rectangle(Vector2.Zero, Size), style.BackgroundHighlighted);
+ Render2D.FillRectangle(new Rectangle(Float2.Zero, Size), style.BackgroundHighlighted);
// Draw all highlights
if (_highlights != null)
@@ -138,7 +138,7 @@ namespace FlaxEditor.GUI
}
///
- public override bool OnMouseDown(Vector2 location, MouseButton button)
+ public override bool OnMouseDown(Float2 location, MouseButton button)
{
if (button == MouseButton.Left)
{
@@ -149,7 +149,7 @@ namespace FlaxEditor.GUI
}
///
- public override bool OnMouseUp(Vector2 location, MouseButton button)
+ public override bool OnMouseUp(Float2 location, MouseButton button)
{
if (button == MouseButton.Left && _isMouseDown)
{
@@ -200,7 +200,7 @@ namespace FlaxEditor.GUI
public ItemsListContextMenu(float width = 320, float height = 220)
{
// Context menu dimensions
- Size = new Vector2(width, height);
+ Size = new Float2(width, height);
// Search box
_searchBox = new TextBox(false, 1, 1)
diff --git a/Source/Editor/GUI/MainMenu.cs b/Source/Editor/GUI/MainMenu.cs
index c6566949e..e1642436f 100644
--- a/Source/Editor/GUI/MainMenu.cs
+++ b/Source/Editor/GUI/MainMenu.cs
@@ -45,7 +45,7 @@ namespace FlaxEditor.GUI
if (_selected != null && _selected.ContextMenu.HasChildren)
{
- _selected.ContextMenu.Show(_selected, new Vector2(0, _selected.Height));
+ _selected.ContextMenu.Show(_selected, new Float2(0, _selected.Height));
_selected.ContextMenu.VisibleChanged += OnSelectedContextMenuVisibleChanged;
}
}
@@ -187,7 +187,7 @@ namespace FlaxEditor.GUI
}
}
- private WindowHitCodes OnHitTest(ref Vector2 mouse)
+ private WindowHitCodes OnHitTest(ref Float2 mouse)
{
var dpiScale = _window.DpiScale;
@@ -286,7 +286,7 @@ namespace FlaxEditor.GUI
}
///
- public override bool OnMouseDoubleClick(Vector2 location, MouseButton button)
+ public override bool OnMouseDoubleClick(Float2 location, MouseButton button)
{
if (base.OnMouseDoubleClick(location, button))
return true;
@@ -314,7 +314,7 @@ namespace FlaxEditor.GUI
{
// Icon
_icon.X = x;
- _icon.Size = new Vector2(Height);
+ _icon.Size = new Float2(Height);
x += _icon.Width;
}
#endif
diff --git a/Source/Editor/GUI/MainMenuButton.cs b/Source/Editor/GUI/MainMenuButton.cs
index e9da52b54..f64f1e847 100644
--- a/Source/Editor/GUI/MainMenuButton.cs
+++ b/Source/Editor/GUI/MainMenuButton.cs
@@ -76,7 +76,7 @@ namespace FlaxEditor.GUI
}
///
- public override bool OnMouseDown(Vector2 location, MouseButton button)
+ public override bool OnMouseDown(Float2 location, MouseButton button)
{
Focus();
@@ -87,7 +87,7 @@ namespace FlaxEditor.GUI
}
///
- public override void OnMouseEnter(Vector2 location)
+ public override void OnMouseEnter(Float2 location)
{
base.OnMouseEnter(location);
diff --git a/Source/Editor/GUI/NavigationBar.cs b/Source/Editor/GUI/NavigationBar.cs
index 60572b673..e91dc2697 100644
--- a/Source/Editor/GUI/NavigationBar.cs
+++ b/Source/Editor/GUI/NavigationBar.cs
@@ -55,8 +55,8 @@ namespace FlaxEditor.GUI
var parentSize = Parent.Size;
Bounds = new Rectangle
(
- new Vector2(lastToolstripButton.Right + 8.0f, 0),
- new Vector2(parentSize.X - X - 8.0f, toolstrip.Height)
+ new Float2(lastToolstripButton.Right + 8.0f, 0),
+ new Float2(parentSize.X - X - 8.0f, toolstrip.Height)
);
}
}
diff --git a/Source/Editor/GUI/NavigationButton.cs b/Source/Editor/GUI/NavigationButton.cs
index 63f3c47cc..7c96d216a 100644
--- a/Source/Editor/GUI/NavigationButton.cs
+++ b/Source/Editor/GUI/NavigationButton.cs
@@ -39,7 +39,7 @@ namespace FlaxEditor.GUI
{
// Cache data
var style = Style.Current;
- var clientRect = new Rectangle(Vector2.Zero, Size);
+ var clientRect = new Rectangle(Float2.Zero, Size);
var textRect = new Rectangle(4, 0, clientRect.Width - 4, clientRect.Height);
// Draw background
diff --git a/Source/Editor/GUI/PlatformSelector.cs b/Source/Editor/GUI/PlatformSelector.cs
index 88f7fe219..493eac2f9 100644
--- a/Source/Editor/GUI/PlatformSelector.cs
+++ b/Source/Editor/GUI/PlatformSelector.cs
@@ -95,7 +95,7 @@ namespace FlaxEditor.GUI
};
const float IconSize = 64.0f;
- TileSize = new Vector2(IconSize);
+ TileSize = new Float2(IconSize);
AutoResize = true;
Offsets = new Margin(0, 0, 0, IconSize);
diff --git a/Source/Editor/GUI/Popups/ActorSearchPopup.cs b/Source/Editor/GUI/Popups/ActorSearchPopup.cs
index 92482c18e..27743bd5a 100644
--- a/Source/Editor/GUI/Popups/ActorSearchPopup.cs
+++ b/Source/Editor/GUI/Popups/ActorSearchPopup.cs
@@ -99,7 +99,7 @@ namespace FlaxEditor.GUI
/// Event called to check if a given actor item is valid to be used.
/// Event called on actor item pick.
/// The dialog.
- public static ActorSearchPopup Show(Control showTarget, Vector2 showTargetLocation, IsValidDelegate isValid, Action selected)
+ public static ActorSearchPopup Show(Control showTarget, Float2 showTargetLocation, IsValidDelegate isValid, Action selected)
{
var popup = new ActorSearchPopup(isValid, selected);
popup.Show(showTarget, showTargetLocation);
diff --git a/Source/Editor/GUI/Popups/AssetSearchPopup.cs b/Source/Editor/GUI/Popups/AssetSearchPopup.cs
index 8f5e007a0..557dd2548 100644
--- a/Source/Editor/GUI/Popups/AssetSearchPopup.cs
+++ b/Source/Editor/GUI/Popups/AssetSearchPopup.cs
@@ -157,7 +157,7 @@ namespace FlaxEditor.GUI
/// Event called to check if a given asset item is valid to be used.
/// Event called on asset item pick.
/// The dialog.
- public static AssetSearchPopup Show(Control showTarget, Vector2 showTargetLocation, IsValidDelegate isValid, Action selected)
+ public static AssetSearchPopup Show(Control showTarget, Float2 showTargetLocation, IsValidDelegate isValid, Action selected)
{
var popup = new AssetSearchPopup(isValid, selected);
popup.Show(showTarget, showTargetLocation);
diff --git a/Source/Editor/GUI/Popups/RenamePopup.cs b/Source/Editor/GUI/Popups/RenamePopup.cs
index 5d934be9b..891ced9c7 100644
--- a/Source/Editor/GUI/Popups/RenamePopup.cs
+++ b/Source/Editor/GUI/Popups/RenamePopup.cs
@@ -63,7 +63,7 @@ namespace FlaxEditor.GUI
/// The value.
/// The size.
/// Enable/disable multiline text input support
- public RenamePopup(string value, Vector2 size, bool isMultiline)
+ public RenamePopup(string value, Float2 size, bool isMultiline)
{
if (!isMultiline)
size.Y = TextBox.DefaultHeight;
@@ -117,7 +117,7 @@ namespace FlaxEditor.GUI
var size = bottomRight - upperLeft;
var rename = new RenamePopup(value, size, isMultiline);
- rename.Show(control, area.Location + new Vector2(0, (size.Y - rename.Height) * 0.5f));
+ rename.Show(control, area.Location + new Float2(0, (size.Y - rename.Height) * 0.5f));
return rename;
}
diff --git a/Source/Editor/GUI/Popups/ScriptSearchPopup.cs b/Source/Editor/GUI/Popups/ScriptSearchPopup.cs
index ece346895..00a35a5a0 100644
--- a/Source/Editor/GUI/Popups/ScriptSearchPopup.cs
+++ b/Source/Editor/GUI/Popups/ScriptSearchPopup.cs
@@ -114,7 +114,7 @@ namespace FlaxEditor.GUI
/// Event called to check if a given script item is valid to be used.
/// Event called on script item pick.
/// The dialog.
- public static ScriptSearchPopup Show(Control showTarget, Vector2 showTargetLocation, IsValidDelegate isValid, Action