From 6c12ffa983c636607e8e49ee468ebd122ab47d69 Mon Sep 17 00:00:00 2001 From: Trudy Spiller Date: Fri, 13 Dec 2024 11:19:54 +0000 Subject: [PATCH 1/2] Mark Action Maps and Actions as disabled for renaming when in cut mode --- .../Editor/UITKAssetEditor/Views/ActionMapsView.cs | 1 + .../Editor/UITKAssetEditor/Views/ActionsTreeView.cs | 1 + .../UITKAssetEditor/Views/InputActionMapsTreeViewItem.cs | 4 +++- .../Editor/UITKAssetEditor/Views/InputActionsTreeViewItem.cs | 5 +++-- 4 files changed, 8 insertions(+), 3 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 2659eaabe1..7665970d7e 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ActionMapsView.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ActionMapsView.cs @@ -32,6 +32,7 @@ public ActionMapsView(VisualElement root, StateContainer stateContainer) treeViewItem.EditTextFinished += treeViewItem.EditTextFinishedCallback; treeViewItem.userData = i; element.SetEnabled(!mapData.isDisabled); + treeViewItem.isDisabledActionMap = mapData.isDisabled; ContextMenu.GetContextMenuForActionMapItem(this, treeViewItem, i); }; 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 a0b6029a9b..4fd20e9b0b 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ActionsTreeView.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ActionsTreeView.cs @@ -94,6 +94,7 @@ public ActionsTreeView(VisualElement root, StateContainer stateContainer) EditorInputControlLayoutCache.GetIconForLayout("Control")); e.SetEnabled(!item.isCut); + treeViewItem.isCut = item.isCut; }; m_ActionsTreeView.itemsChosen += objects => diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/InputActionMapsTreeViewItem.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/InputActionMapsTreeViewItem.cs index 8c99f99ae4..1313f6682e 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/InputActionMapsTreeViewItem.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/InputActionMapsTreeViewItem.cs @@ -26,6 +26,8 @@ internal class InputActionMapsTreeViewItem : VisualElement private bool m_IsEditing; private static InputActionMapsTreeViewItem s_EditingItem = null; + internal bool isDisabledActionMap { get; set; } + public InputActionMapsTreeViewItem() { var template = AssetDatabase.LoadAssetAtPath( @@ -98,7 +100,7 @@ public void Reset() public void FocusOnRenameTextField() { - if (m_IsEditing) + if (m_IsEditing || isDisabledActionMap) return; delegatesFocus = true; diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/InputActionsTreeViewItem.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/InputActionsTreeViewItem.cs index d1b49d2bb1..ccaae924e9 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/InputActionsTreeViewItem.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/InputActionsTreeViewItem.cs @@ -20,6 +20,8 @@ internal class InputActionsTreeViewItem : VisualElement private bool m_IsEditing; private static InputActionsTreeViewItem s_EditingItem = null; + internal bool isCut { get; set; } + public InputActionsTreeViewItem() { var template = AssetDatabase.LoadAssetAtPath( @@ -42,7 +44,6 @@ public InputActionsTreeViewItem() public Label label => this.Q