Merge branch 'unit-formatting' of https://github.com/nothingTVatYT/FlaxEngine into nothingTVatYT-unit-formatting

# Conflicts:
#	Source/Editor/CustomEditors/Editors/ActorTransformEditor.cs
#	Source/Editor/Options/InterfaceOptions.cs
#	Source/Engine/Core/Math/Transform.h
This commit is contained in:
2024-03-19 18:04:01 +01:00
24 changed files with 420 additions and 26 deletions
+52
View File
@@ -2,6 +2,7 @@
using System.ComponentModel;
using FlaxEditor.GUI.Docking;
using FlaxEditor.Utilities;
using FlaxEngine;
namespace FlaxEditor.Options
@@ -116,6 +117,25 @@ namespace FlaxEditor.Options
BorderlessWindow,
}
/// <summary>
/// Options for formatting numerical values
/// </summary>
public enum ValueFormattingType
{
/// <summary>
/// No formatting
/// </summary>
None,
/// <summary>
/// Format using the base SI unit
/// </summary>
BaseUnit,
/// <summary>
/// Format using a unit that matches the value best
/// </summary>
AutoUnit
}
/// <summary>
/// Gets or sets the Editor User Interface scale. Applied to all UI elements, windows and text. Can be used to scale the interface up on a bigger display. Editor restart required.
/// </summary>
@@ -174,6 +194,38 @@ namespace FlaxEditor.Options
[EditorDisplay("Interface"), EditorOrder(280), Tooltip("Editor content window orientation.")]
public FlaxEngine.GUI.Orientation ContentWindowOrientation { get; set; } = FlaxEngine.GUI.Orientation.Horizontal;
private ValueFormattingType _valueFormatting = ValueFormattingType.None;
/// <summary>
/// Gets or sets the formatting option for numeric values in the editor.
/// </summary>
[DefaultValue(ValueFormattingType.None)]
[EditorDisplay("Interface"), EditorOrder(300), Tooltip("Formatting of numeric values.")]
public ValueFormattingType ValueFormatting {
get => _valueFormatting;
set
{
_valueFormatting = value;
Units.UseUnitsFormatting = _valueFormatting != ValueFormattingType.None;
Units.AutomaticUnitsFormatting = _valueFormatting == ValueFormattingType.AutoUnit;
}
}
private bool _spaceNumberAndUnits = false;
/// <summary>
/// Gets or sets the option to put a space between numbers and units for unit formatting
/// </summary>
[DefaultValue(false)]
[EditorDisplay("Interface"), EditorOrder(310), Tooltip("Put a space between numbers and units.")]
public bool SpaceNumberAndUnits { get => _spaceNumberAndUnits;
set
{
_spaceNumberAndUnits = value;
Units.SpaceNumberAndUnits = _spaceNumberAndUnits;
}
}
/// <summary>
/// Gets or sets the timestamps prefix mode for output log messages.
/// </summary>