From 2a0320677849698e388dcf95cb2e6e769f2634a5 Mon Sep 17 00:00:00 2001 From: nothingTVatYT <34131388+nothingTVatYT@users.noreply.github.com> Date: Tue, 30 Jan 2024 09:24:44 +0100 Subject: [PATCH] add formatting preference to editor options --- Source/Editor/Options/InterfaceOptions.cs | 37 +++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/Source/Editor/Options/InterfaceOptions.cs b/Source/Editor/Options/InterfaceOptions.cs index 95a273f19..482946e9a 100644 --- a/Source/Editor/Options/InterfaceOptions.cs +++ b/Source/Editor/Options/InterfaceOptions.cs @@ -2,6 +2,7 @@ using System.ComponentModel; using FlaxEditor.GUI.Docking; +using FlaxEditor.Utilities; using FlaxEngine; namespace FlaxEditor.Options @@ -90,6 +91,25 @@ namespace FlaxEditor.Options PlayScenes, } + /// + /// Options for formatting numerical values + /// + public enum ValueFormattingType + { + /// + /// No formatting + /// + None, + /// + /// Format using the base SI unit + /// + BaseUnit, + /// + /// Format using a unit that matches the value best + /// + AutoUnit + } + /// /// 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. /// @@ -148,6 +168,23 @@ 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; + + /// + /// Gets or sets the formatting option for numeric values in the editor. + /// + [DefaultValue(ValueFormattingType.None)] + [EditorDisplay("Interface"), EditorOrder(300), Tooltip("Formatting of numeric values.")] + public ValueFormattingType ValueFormating { + get => _valueFormatting; + set + { + _valueFormatting = value; + Units.UseUnitsFormatting = _valueFormatting != ValueFormattingType.None; + Units.AutomaticUnitsFormatting = _valueFormatting == ValueFormattingType.AutoUnit; + } + } + /// /// Gets or sets the timestamps prefix mode for output log messages. ///