From 5f4bfa36d8f7baa3ce30d76aee53a8e85152b133 Mon Sep 17 00:00:00 2001 From: Wojciech Figat Date: Mon, 13 Dec 2021 17:30:36 +0100 Subject: [PATCH] Add various usability improvements to the Editor --- Source/Editor/CustomEditors/CustomEditor.cs | 17 ++++++----------- .../Dedicated/ParticleEffectEditor.cs | 3 +++ Source/Editor/GUI/Dialogs/ColorSelector.cs | 2 +- Source/Editor/Viewport/PrefabWindowViewport.cs | 2 +- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/Source/Editor/CustomEditors/CustomEditor.cs b/Source/Editor/CustomEditors/CustomEditor.cs index dd921b4ee..8a7a44aeb 100644 --- a/Source/Editor/CustomEditors/CustomEditor.cs +++ b/Source/Editor/CustomEditors/CustomEditor.cs @@ -331,17 +331,12 @@ namespace FlaxEditor.CustomEditors { if (LinkedLabel != null) { - // Prefab value diff - if (Values.HasReferenceValue) - { - var style = FlaxEngine.GUI.Style.Current; - LinkedLabel.HighlightStripColor = CanRevertReferenceValue ? style.BackgroundSelected * 0.8f : Color.Transparent; - } - // Default value diff - else if (Values.HasDefaultValue) - { - LinkedLabel.HighlightStripColor = CanRevertDefaultValue ? Color.Yellow * 0.8f : Color.Transparent; - } + var color = Color.Transparent; + if (Values.HasReferenceValue && CanRevertReferenceValue) + color = FlaxEngine.GUI.Style.Current.BackgroundSelected; + else if (Values.HasDefaultValue && CanRevertDefaultValue) + color = Color.Yellow * 0.8f; + LinkedLabel.HighlightStripColor = color; } } diff --git a/Source/Editor/CustomEditors/Dedicated/ParticleEffectEditor.cs b/Source/Editor/CustomEditors/Dedicated/ParticleEffectEditor.cs index 83d6acacd..9e0c06f7c 100644 --- a/Source/Editor/CustomEditors/Dedicated/ParticleEffectEditor.cs +++ b/Source/Editor/CustomEditors/Dedicated/ParticleEffectEditor.cs @@ -60,7 +60,10 @@ namespace FlaxEditor.CustomEditors.Dedicated public override void Refresh() { if (_isValid != IsValid) + { RebuildLayout(); + return; + } base.Refresh(); } diff --git a/Source/Editor/GUI/Dialogs/ColorSelector.cs b/Source/Editor/GUI/Dialogs/ColorSelector.cs index f06e2a991..a9e6e8def 100644 --- a/Source/Editor/GUI/Dialogs/ColorSelector.cs +++ b/Source/Editor/GUI/Dialogs/ColorSelector.cs @@ -125,7 +125,7 @@ namespace FlaxEditor.GUI.Dialogs hsv.Y = Mathf.Saturate(distance / (_wheelRect.Width * 0.5f)); // Auto set Value to 1 when color is black. Makes editing easier. - if (_color == Color.Black && hsv.Z <= 0.001f) + if ((_color == Color.Black || _color == Color.Transparent) && hsv.Z <= 0.001f) hsv.Z = 1.0f; var color = Color.FromHSV(hsv); diff --git a/Source/Editor/Viewport/PrefabWindowViewport.cs b/Source/Editor/Viewport/PrefabWindowViewport.cs index b81e6c1ef..0ed67ab8e 100644 --- a/Source/Editor/Viewport/PrefabWindowViewport.cs +++ b/Source/Editor/Viewport/PrefabWindowViewport.cs @@ -568,7 +568,7 @@ namespace FlaxEditor.Viewport // Selected UI controls outline for (var i = 0; i < _window.Selection.Count; i++) { - if (_window.Selection[i].EditableObject is UIControl controlActor && controlActor && controlActor.Control != null) + if (_window.Selection[i]?.EditableObject is UIControl controlActor && controlActor && controlActor.Control != null) { var control = controlActor.Control; var bounds = Rectangle.FromPoints(control.PointToParent(this, Vector2.Zero), control.PointToParent(this, control.Size));