From ab7936c9ff93a8fd989558c15e0bd29532ae3f15 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Sat, 29 Aug 2026 23:46:54 +0200 Subject: [PATCH] Add middle and right mouse button actions to asset/object pickers to clear value or show popup quickly --- .../CustomEditors/Editors/FlaxObjectRefEditor.cs | 16 ++++++++++++++++ Source/Editor/GUI/AssetPicker.cs | 13 +++++++++++++ 2 files changed, 29 insertions(+) diff --git a/Source/Editor/CustomEditors/Editors/FlaxObjectRefEditor.cs b/Source/Editor/CustomEditors/Editors/FlaxObjectRefEditor.cs index d7ab6d12b..a6a02ae1f 100644 --- a/Source/Editor/CustomEditors/Editors/FlaxObjectRefEditor.cs +++ b/Source/Editor/CustomEditors/Editors/FlaxObjectRefEditor.cs @@ -322,7 +322,11 @@ namespace FlaxEditor.CustomEditors.Editors // Deselect if (_value != null && button1Rect.Contains(ref location)) + { + Focus(); Value = null; + return true; + } // Picker dropdown menu if (_supportsPickDropDown && (isSelected ? button2Rect : button1Rect).Contains(ref location)) @@ -372,6 +376,18 @@ namespace FlaxEditor.CustomEditors.Editors if (_hasValidDragOver) _hasValidDragOver = false; } + if (button == MouseButton.Middle) + { + // Clear value + Focus(); + Value = null; + return true; + } + if (button == MouseButton.Right && _supportsPickDropDown) + { + // Show picker + ShowDropDownMenu(); + } return base.OnMouseUp(location, button); } diff --git a/Source/Editor/GUI/AssetPicker.cs b/Source/Editor/GUI/AssetPicker.cs index 56c358c2f..98e9a0730 100644 --- a/Source/Editor/GUI/AssetPicker.cs +++ b/Source/Editor/GUI/AssetPicker.cs @@ -299,6 +299,7 @@ namespace FlaxEditor.GUI } else if (Button1Rect.Contains(location)) { + // Show picker Focus(); OnSubmit(); } @@ -318,6 +319,18 @@ namespace FlaxEditor.GUI } } } + if (button == MouseButton.Middle && IconRect.Contains(ref location)) + { + // Clear value + Focus(); + Validator.SelectedItem = null; + } + if (button == MouseButton.Right && IconRect.Contains(ref location)) + { + // Show picker + Focus(); + OnSubmit(); + } // Handled return true;