From 2bec653b81a48a9043df3fbab1766ed9f4bdeba7 Mon Sep 17 00:00:00 2001 From: Edu Garcia <28616+Arcnor@users.noreply.github.com> Date: Sat, 7 Oct 2023 10:12:37 +0100 Subject: [PATCH] Add color picker option to accept changes on dismissal --- Source/Editor/GUI/Dialogs/ColorPickerDialog.cs | 5 ++++- Source/Editor/Options/InterfaceOptions.cs | 7 +++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Source/Editor/GUI/Dialogs/ColorPickerDialog.cs b/Source/Editor/GUI/Dialogs/ColorPickerDialog.cs index 161b3f4ae..0995635b0 100644 --- a/Source/Editor/GUI/Dialogs/ColorPickerDialog.cs +++ b/Source/Editor/GUI/Dialogs/ColorPickerDialog.cs @@ -362,7 +362,10 @@ namespace FlaxEditor.GUI.Dialogs _disableEvents = true; // Restore color if modified - if (_useDynamicEditing && _initialValue != _value) + var options = Editor.Instance.Options.Options; + + if (!options.Interface.ColorPickerAlwaysChangesColor && + _useDynamicEditing && _initialValue != _value) { _onChanged?.Invoke(_initialValue, false); } diff --git a/Source/Editor/Options/InterfaceOptions.cs b/Source/Editor/Options/InterfaceOptions.cs index 95a273f19..6d362602f 100644 --- a/Source/Editor/Options/InterfaceOptions.cs +++ b/Source/Editor/Options/InterfaceOptions.cs @@ -148,6 +148,13 @@ namespace FlaxEditor.Options [EditorDisplay("Interface"), EditorOrder(280), Tooltip("Editor content window orientation.")] public FlaxEngine.GUI.Orientation ContentWindowOrientation { get; set; } = FlaxEngine.GUI.Orientation.Horizontal; + /// + /// Gets or sets the editor content window orientation. + /// + [DefaultValue(false)] + [EditorDisplay("Interface"), EditorOrder(300), Tooltip("If checked, color pickers will always modify the color unless 'Cancel' if pressed, otherwise color won't change unless 'Ok' is pressed (default)")] + public bool ColorPickerAlwaysChangesColor { get; set; } = false; + /// /// Gets or sets the timestamps prefix mode for output log messages. ///