From 2e0efff667cce4e663db8c50c1034ee0c45aea8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ha=CC=8Akan=20Sidenvall?= Date: Fri, 18 Oct 2024 15:33:27 +0200 Subject: [PATCH 1/4] Tentative fix --- .../Editor/UITKAssetEditor/Views/ActionsTreeView.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 33f6663aee..e4f06006aa 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ActionsTreeView.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ActionsTreeView.cs @@ -125,8 +125,8 @@ public ActionsTreeView(VisualElement root, StateContainer stateContainer) ContextMenu.GetContextMenuForActionListView(this, m_ActionsTreeView, m_ActionsTreeView.parent); ContextMenu.GetContextMenuForActionsEmptySpace(this, m_ActionsTreeView, root.Q("rclick-area-to-add-new-action")); // Only bring up this context menu for the Tree when it's empty, so we can treat it like right-clicking the empty space: - ContextMenu.GetContextMenuForActionsEmptySpace(this, m_ActionsTreeView, m_ActionsTreeView, onlyShowIfTreeIsEmpty: true); - + //ContextMenu.GetContextMenuForActionsEmptySpace(this, m_ActionsTreeView, m_ActionsTreeView, onlyShowIfTreeIsEmpty: true); + m_ActionsTreeViewSelectionChangeFilter = new CollectionViewSelectionChangeFilter(m_ActionsTreeView); m_ActionsTreeViewSelectionChangeFilter.selectedIndicesChanged += (_) => { From cfaa8bdcb41fc9a08a85c7d47a3a1d0dedd96da7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ha=CC=8Akan=20Sidenvall?= Date: Fri, 18 Oct 2024 15:39:44 +0200 Subject: [PATCH 2/4] FIX: Context menu issue on 2022.3, seems valid also on 6000.21f --- Packages/com.unity.inputsystem/CHANGELOG.md | 3 ++- .../Editor/UITKAssetEditor/Views/ActionsTreeView.cs | 4 +--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Packages/com.unity.inputsystem/CHANGELOG.md b/Packages/com.unity.inputsystem/CHANGELOG.md index 79e1ff562f..10fd9c4724 100644 --- a/Packages/com.unity.inputsystem/CHANGELOG.md +++ b/Packages/com.unity.inputsystem/CHANGELOG.md @@ -10,7 +10,8 @@ however, it has to be formatted properly to pass verification tests. ## [Unreleased] - yyyy-mm-dd - +### Fixed +- Fixed an issue causing the Action context menu to not show on right click when right clicking an action in the Input Action Editor [ISXB-1134](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1134). ## [1.11.2] - 2024-10-16 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 e4f06006aa..5449932711 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ActionsTreeView.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ActionsTreeView.cs @@ -124,9 +124,7 @@ public ActionsTreeView(VisualElement root, StateContainer stateContainer) ContextMenu.GetContextMenuForActionListView(this, m_ActionsTreeView, m_ActionsTreeView.parent); ContextMenu.GetContextMenuForActionsEmptySpace(this, m_ActionsTreeView, root.Q("rclick-area-to-add-new-action")); - // Only bring up this context menu for the Tree when it's empty, so we can treat it like right-clicking the empty space: - //ContextMenu.GetContextMenuForActionsEmptySpace(this, m_ActionsTreeView, m_ActionsTreeView, onlyShowIfTreeIsEmpty: true); - + m_ActionsTreeViewSelectionChangeFilter = new CollectionViewSelectionChangeFilter(m_ActionsTreeView); m_ActionsTreeViewSelectionChangeFilter.selectedIndicesChanged += (_) => { From f49e7d8e9bb5da69f89ff2e1300d1347fac2ed53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ha=CC=8Akan=20Sidenvall?= Date: Fri, 18 Oct 2024 17:41:13 +0200 Subject: [PATCH 3/4] Similar fix for action maps --- .../InputSystem/Editor/UITKAssetEditor/Views/ActionMapsView.cs | 2 -- 1 file changed, 2 deletions(-) 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 300f5281b2..3eb1d9efab 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ActionMapsView.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ActionMapsView.cs @@ -67,8 +67,6 @@ public ActionMapsView(VisualElement root, StateContainer stateContainer) m_AddActionMapButton.clicked += AddActionMap; ContextMenu.GetContextMenuForActionMapsEmptySpace(this, root.Q("rclick-area-to-add-new-action-map")); - // Only bring up this context menu for the List when it's empty, so we can treat it like right-clicking the empty space: - ContextMenu.GetContextMenuForActionMapsEmptySpace(this, m_ListView, onlyShowIfListIsEmpty: true); } void OnDroppedHandler(int mapIndex) From 5ca2539359ba06c5daa9b67b389be3a30e4da75f Mon Sep 17 00:00:00 2001 From: Simon Wittber Date: Wed, 23 Oct 2024 09:04:22 +0800 Subject: [PATCH 4/4] removed unused args --- .../Editor/UITKAssetEditor/Views/ContextMenu.cs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ContextMenu.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ContextMenu.cs index a8163243e3..ef70992280 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ContextMenu.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ContextMenu.cs @@ -47,19 +47,16 @@ public static void GetContextMenuForActionMapItem(ActionMapsView mapView, InputA // Add "Add Action Map" option to empty space under the ListView. Matches with old IMGUI style (ISX-1519). // Include Paste here as well, since it makes sense for adding ActionMaps. - public static void GetContextMenuForActionMapsEmptySpace(ActionMapsView mapView, VisualElement element, bool onlyShowIfListIsEmpty = false) + public static void GetContextMenuForActionMapsEmptySpace(ActionMapsView mapView, VisualElement element) { _ = new ContextualMenuManipulator(menuEvent => { - if (!onlyShowIfListIsEmpty || mapView.GetMapCount() == 0) - { - var copiedAction = CopyPasteHelper.GetCopiedClipboardType() == typeof(InputAction); - if (CopyPasteHelper.HasPastableClipboardData(typeof(InputActionMap))) - menuEvent.menu.AppendAction(paste_String, _ => mapView.PasteItems(copiedAction)); + var copiedAction = CopyPasteHelper.GetCopiedClipboardType() == typeof(InputAction); + if (CopyPasteHelper.HasPastableClipboardData(typeof(InputActionMap))) + menuEvent.menu.AppendAction(paste_String, _ => mapView.PasteItems(copiedAction)); - menuEvent.menu.AppendSeparator(); - menuEvent.menu.AppendAction(add_Action_Map_String, _ => mapView.AddActionMap()); - } + menuEvent.menu.AppendSeparator(); + menuEvent.menu.AppendAction(add_Action_Map_String, _ => mapView.AddActionMap()); }) { target = element }; }