diff --git a/Packages/com.unity.inputsystem/CHANGELOG.md b/Packages/com.unity.inputsystem/CHANGELOG.md index 1437473c32..bc6b9c45d5 100644 --- a/Packages/com.unity.inputsystem/CHANGELOG.md +++ b/Packages/com.unity.inputsystem/CHANGELOG.md @@ -33,6 +33,7 @@ however, it has to be formatted properly to pass verification tests. - Fixed Documentation~/filter.yml GlobalNamespace rule removing all API documentation. - Fixed `Destroy may not be called from edit mode` error [ISXB-695](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-695) - Fixed possible exceptions thrown when deleting and adding Action Maps. +- Fixed selection not changing when right-clicking an Action Map or Action in the Project Settings Input Action Editor. - Fixed potential race condition on access to GCHandle in DefferedResolutionOfBindings and halved number of calls to GCHandle resolution [ISXB-726](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-726) - Fixed issue where composite part dropdown manipulates binding path and leaves composite part field unchanged. - Fixed lingering highlight effect on Save Asset button after clicking. diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ActionMapsView.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ActionMapsView.cs index 2ede37ecf4..c40971dcd4 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ActionMapsView.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ActionMapsView.cs @@ -56,6 +56,7 @@ public ActionMapsView(VisualElement root, StateContainer stateContainer) m_ListView.RegisterCallback(OnExecuteCommand); m_ListView.RegisterCallback(OnValidateCommand); + m_ListView.RegisterCallback(OnPointerDown, TrickleDown.TrickleDown); var treeView = root.Q("actions-tree-view"); m_ListView.AddManipulator(new DropManipulator(OnDroppedHandler, treeView)); m_ListView.itemIndexChanged += OnReorder; @@ -194,6 +195,16 @@ private void OnValidateCommand(ValidateCommandEvent evt) } } + private void OnPointerDown(PointerDownEvent evt) + { + // Allow right clicks to select an item before we bring up the matching context menu. + if (evt.button == (int)MouseButton.RightMouse && evt.clickCount == 1) + { + var actionMap = (evt.target as VisualElement).GetFirstAncestorOfType(); + m_ListView.SetSelection(actionMap.parent.IndexOf(actionMap)); + } + } + private readonly CollectionViewSelectionChangeFilter m_ListViewSelectionChangeFilter; private bool m_EnterRenamingMode; private readonly ListView m_ListView; diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ActionsTreeView.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ActionsTreeView.cs index f445487dc6..493b66a0b3 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ActionsTreeView.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ActionsTreeView.cs @@ -58,7 +58,9 @@ public ActionsTreeView(VisualElement root, StateContainer stateContainer) if (item.isAction) { - addBindingButton.clicked += ContextMenu.GetContextMenuForActionAddItem(treeViewItem, item.controlLayout); + Action action = ContextMenu.GetContextMenuForActionAddItem(treeViewItem, item.controlLayout); + addBindingButton.clicked += action; + addBindingButton.userData = action; // Store to use in unbindItem addBindingButton.clickable.activators.Add(new ManipulatorActivationFilter(){button = MouseButton.RightMouse}); addBindingButton.style.display = DisplayStyle.Flex; treeViewItem.EditTextFinishedCallback = newName => @@ -111,6 +113,12 @@ public ActionsTreeView(VisualElement root, StateContainer stateContainer) if (item.isAction || item.isComposite) treeViewItem.Reset(); + if (item.isAction) + { + var button = element.Q