diff --git a/Source/Editor/GUI/ComboBox.cs b/Source/Editor/GUI/ComboBox.cs index 06eabd1da..99be6a605 100644 --- a/Source/Editor/GUI/ComboBox.cs +++ b/Source/Editor/GUI/ComboBox.cs @@ -486,6 +486,15 @@ namespace FlaxEditor.GUI button.TooltipText = _tooltips[index]; } + /// + /// Gets the text for selected item(s). + /// + /// The display text. + protected virtual string GetSelectedText() + { + return _selectedIndices.Count == 1 ? (_selectedIndices[0] >= 0 && _selectedIndices[0] < _items.Count ? _items[_selectedIndices[0]] : "") : "Multiple Values"; + } + /// /// Creates the popup menu. /// @@ -554,7 +563,7 @@ namespace FlaxEditor.GUI // Check if has selected item if (_selectedIndices != null && _selectedIndices.Count > 0) { - string text = _selectedIndices.Count == 1 ? (_selectedIndices[0] >= 0 && _selectedIndices[0] < _items.Count ? _items[_selectedIndices[0]] : "") : "Multiple Values"; + string text = GetSelectedText(); // Draw text of the selected item float textScale = Height / DefaultHeight; diff --git a/Source/Editor/GUI/EnumComboBox.cs b/Source/Editor/GUI/EnumComboBox.cs index 67e538d39..a463f8b7c 100644 --- a/Source/Editor/GUI/EnumComboBox.cs +++ b/Source/Editor/GUI/EnumComboBox.cs @@ -112,7 +112,7 @@ namespace FlaxEditor.GUI for (int i = 0; i < _entries.Count; i++) { var e = _entries[i].Value; - if (e != 0 && (e & value) == e) + if ((e != 0 || value == 0) && (e & value) == e) { selection.Add(i); } @@ -294,6 +294,22 @@ namespace FlaxEditor.GUI button.CloseMenuOnClick = false; } + /// + protected override string GetSelectedText() + { + // If multiple values are selected then try to find an enum item that matches the mask value + if (_selectedIndices.Count > 1) + { + foreach (var e in _entries) + { + if (e.Value == Value) + return e.Name; + } + } + + return base.GetSelectedText(); + } + /// protected override void OnItemClicked(int index) {