diff --git a/Source/Editor/CustomEditors/Editors/AssetRefEditor.cs b/Source/Editor/CustomEditors/Editors/AssetRefEditor.cs index 231a4de8a..e9c405207 100644 --- a/Source/Editor/CustomEditors/Editors/AssetRefEditor.cs +++ b/Source/Editor/CustomEditors/Editors/AssetRefEditor.cs @@ -123,7 +123,9 @@ namespace FlaxEditor.CustomEditors.Editors { base.Refresh(); - if (!HasDifferentValues) + var differentValues = HasDifferentValues; + Picker.DifferentValues = differentValues; + if (!differentValues) { _isRefreshing = true; var value = Values[0]; @@ -375,12 +377,9 @@ namespace FlaxEditor.CustomEditors.Editors { base.Refresh(); - if (!HasDifferentValues) - { - _isRefreshing = true; - _textBox.Text = GetPath(); - _isRefreshing = false; - } + _isRefreshing = true; + _textBox.Text = HasDifferentValues ? "Multiple Values" : GetPath(); + _isRefreshing = false; } /// diff --git a/Source/Editor/CustomEditors/Editors/FlaxObjectRefEditor.cs b/Source/Editor/CustomEditors/Editors/FlaxObjectRefEditor.cs index 386d8d518..b4143140d 100644 --- a/Source/Editor/CustomEditors/Editors/FlaxObjectRefEditor.cs +++ b/Source/Editor/CustomEditors/Editors/FlaxObjectRefEditor.cs @@ -129,6 +129,11 @@ namespace FlaxEditor.CustomEditors.Editors /// public Func CheckValid; + /// + /// Utility flag used to indicate that there are different values assigned to this reference editor and user should be informed about it. + /// + public bool DifferentValues; + /// /// Initializes a new instance of the class. /// @@ -197,7 +202,14 @@ namespace FlaxEditor.CustomEditors.Editors Render2D.DrawRectangle(frameRect, isEnabled && (IsMouseOver || IsNavFocused) ? style.BorderHighlighted : style.BorderNormal); // Check if has item selected - if (isSelected) + if (DifferentValues) + { + // Draw info + Render2D.PushClip(nameRect); + Render2D.DrawText(style.FontMedium, Type != null ? $"Multiple Values ({Utilities.Utils.GetPropertyNameUI(Type.ToString())})" : "-", nameRect, isEnabled ? style.ForegroundGrey : style.ForegroundGrey.AlphaMultiplied(0.75f), TextAlignment.Near, TextAlignment.Center); + Render2D.PopClip(); + } + else if (isSelected) { // Draw name Render2D.PushClip(nameRect); @@ -546,7 +558,9 @@ namespace FlaxEditor.CustomEditors.Editors { base.Refresh(); - if (!HasDifferentValues) + var differentValues = HasDifferentValues; + _element.CustomControl.DifferentValues = differentValues; + if (!differentValues) { _element.CustomControl.Value = Values[0] as Object; } diff --git a/Source/Editor/GUI/AssetPicker.cs b/Source/Editor/GUI/AssetPicker.cs index 7aca96c4e..92941be5d 100644 --- a/Source/Editor/GUI/AssetPicker.cs +++ b/Source/Editor/GUI/AssetPicker.cs @@ -48,6 +48,11 @@ namespace FlaxEditor.GUI /// public bool CanEdit = true; + /// + /// Utility flag used to indicate that there are different values assigned to this reference editor and user should be informed about it. + /// + public bool DifferentValues; + /// /// Initializes a new instance of the class. /// @@ -121,7 +126,13 @@ namespace FlaxEditor.GUI if (CanEdit) Render2D.DrawSprite(style.ArrowDown, button1Rect, button1Rect.Contains(_mousePos) ? style.Foreground : style.ForegroundGrey); - if (Validator.SelectedItem != null) + if (DifferentValues) + { + // No element selected + Render2D.FillRectangle(iconRect, style.BackgroundNormal); + Render2D.DrawText(style.FontMedium, "Multiple\nValues", iconRect, style.Foreground, TextAlignment.Center, TextAlignment.Center, TextWrapping.NoWrap, 1.0f, Height / DefaultIconSize); + } + else if (Validator.SelectedItem != null) { // Draw item preview Validator.SelectedItem.DrawThumbnail(ref iconRect);