add units support in float, double and Float3 input

This commit is contained in:
nothingTVatYT
2024-01-28 20:52:25 +01:00
parent 1094abce5a
commit 9e38a01acc
13 changed files with 182 additions and 7 deletions

View File

@@ -3,6 +3,7 @@
using System;
using FlaxEditor.Utilities;
using FlaxEngine;
using Utils = FlaxEditor.Utilities.Utils;
namespace FlaxEditor.GUI.Input
{
@@ -129,10 +130,15 @@ namespace FlaxEditor.GUI.Input
Value = Value;
}
/// <summary>
/// Get or set the category of the value. This can either be none for just a number, a distance or an angle.
/// </summary>
public Utils.ValueCategory Category = Utils.ValueCategory.None;
/// <inheritdoc />
protected sealed override void UpdateText()
{
SetText(Utilities.Utils.FormatFloat(_value));
SetText(Utilities.Utils.FormatFloat(_value, Category));
}
/// <inheritdoc />

View File

@@ -4,6 +4,7 @@ using System;
using System.Globalization;
using FlaxEditor.Utilities;
using FlaxEngine;
using Utils = FlaxEditor.Utilities.Utils;
namespace FlaxEditor.GUI.Input
{
@@ -137,10 +138,15 @@ namespace FlaxEditor.GUI.Input
Value = Value;
}
/// <summary>
/// Get or set the category of the value. This can either be none for just a number, a distance or an angle.
/// </summary>
public Utils.ValueCategory Category = Utils.ValueCategory.None;
/// <inheritdoc />
protected sealed override void UpdateText()
{
SetText(Utilities.Utils.FormatFloat(_value));
SetText(Utilities.Utils.FormatFloat(_value, Category));
}
/// <inheritdoc />