From 95e0712551759f5a45e5cd4123eaf0b583cd3afc Mon Sep 17 00:00:00 2001 From: Simon Wittber Date: Wed, 14 Aug 2024 11:05:21 +0800 Subject: [PATCH 1/4] changelog entry --- Packages/com.unity.inputsystem/CHANGELOG.md | 1 + .../Editor/UITKAssetEditor/Views/ActionsTreeView.cs | 5 ----- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/Packages/com.unity.inputsystem/CHANGELOG.md b/Packages/com.unity.inputsystem/CHANGELOG.md index e67daf3fe4..386df8fb80 100644 --- a/Packages/com.unity.inputsystem/CHANGELOG.md +++ b/Packages/com.unity.inputsystem/CHANGELOG.md @@ -13,6 +13,7 @@ however, it has to be formatted properly to pass verification tests. ### Fixed - Fixed memory allocation on every frame when using UIDocument without EventSystem. [ISXB-953](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-953) - Fixed Action Maps name edition which could be inconsistent in Input Action Editor UI. +- Fixed an update loop in the asset editor. ### Added - Added Hinge Angle sensor support for foldable devices. 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 b4e9e2e222..40fafc86e4 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ActionsTreeView.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ActionsTreeView.cs @@ -135,11 +135,6 @@ public ActionsTreeView(VisualElement root, StateContainer stateContainer) var item = m_ActionsTreeView.GetItemDataForIndex(m_ActionsTreeView.selectedIndex); Dispatch(item.isAction ? Commands.SelectAction(item.name) : Commands.SelectBinding(item.bindingIndex)); } - else - { - Dispatch(Commands.SelectAction(null)); - Dispatch(Commands.SelectBinding(-1)); - } }; m_ActionsTreeView.RegisterCallback(OnExecuteCommand); From ee22064f46946356d4a033141e81ca4a8ec50b26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Malrat?= Date: Wed, 14 Aug 2024 14:00:55 +0200 Subject: [PATCH 2/4] Improve ui test CanRenameActionMap to take the scheduler in account --- .../InputSystem.Editor/InputActionsEditorTests.cs | 2 ++ .../InputSystem.Editor/UIToolkitBaseTestWindow.cs | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/Assets/Tests/InputSystem.Editor/InputActionsEditorTests.cs b/Assets/Tests/InputSystem.Editor/InputActionsEditorTests.cs index aa2f1093b2..ffe160c38f 100644 --- a/Assets/Tests/InputSystem.Editor/InputActionsEditorTests.cs +++ b/Assets/Tests/InputSystem.Editor/InputActionsEditorTests.cs @@ -109,6 +109,8 @@ public IEnumerator CanRenameActionMap() m_Window.rootVisualElement.Q("action-maps-list-view").Focus(); m_Window.rootVisualElement.Q("action-maps-list-view").selectedIndex = 1; + // changing the selection triggers a state change, wait for the scheduler to process the frame + yield return WaitForSchedulerLoop(); yield return WaitForNotDirty(); yield return WaitForFocus(m_Window.rootVisualElement.Q("action-maps-list-view")); diff --git a/Assets/Tests/InputSystem.Editor/UIToolkitBaseTestWindow.cs b/Assets/Tests/InputSystem.Editor/UIToolkitBaseTestWindow.cs index aa63ceceb8..172c310318 100644 --- a/Assets/Tests/InputSystem.Editor/UIToolkitBaseTestWindow.cs +++ b/Assets/Tests/InputSystem.Editor/UIToolkitBaseTestWindow.cs @@ -120,6 +120,17 @@ protected void SimulateDeleteCommand() m_Window.rootVisualElement.SendEvent(ce); } + /// + /// Wait for UI toolkit scheduler to process the frame + /// + /// Maximum time to wait in seconds. + protected IEnumerator WaitForSchedulerLoop(double timeoutSecs = 5.0) + { + bool done = false; + m_Window.rootVisualElement.schedule.Execute(() => done = true); + return WaitUntil(() => done == true, "WaitForSchedulerLoop", timeoutSecs); + } + /// /// Wait for the visual element to be focused /// From 7f4d89de2ba9aab6b0502084dcfe5498ba7b8fa3 Mon Sep 17 00:00:00 2001 From: Simon Wittber Date: Mon, 19 Aug 2024 15:31:24 +0800 Subject: [PATCH 3/4] updated changelog entry --- Packages/com.unity.inputsystem/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Packages/com.unity.inputsystem/CHANGELOG.md b/Packages/com.unity.inputsystem/CHANGELOG.md index 062826ab8a..b4dfa6e99b 100644 --- a/Packages/com.unity.inputsystem/CHANGELOG.md +++ b/Packages/com.unity.inputsystem/CHANGELOG.md @@ -13,7 +13,7 @@ however, it has to be formatted properly to pass verification tests. ### Fixed - Fixed memory allocation on every frame when using UIDocument without EventSystem. [ISXB-953](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-953) - Fixed Action Maps name edition which could be inconsistent in Input Action Editor UI. -- Fixed an update loop in the asset editor. +- Fixed an update loop in the asset editor that occurs when selecint an Action Map that has no Actions. ### Added - Added Hinge Angle sensor support for foldable devices. From be2d68627e17201becfbad4fc7e0520450f3ef44 Mon Sep 17 00:00:00 2001 From: Simon Wittber Date: Mon, 19 Aug 2024 15:32:14 +0800 Subject: [PATCH 4/4] updated changelog entry --- Packages/com.unity.inputsystem/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Packages/com.unity.inputsystem/CHANGELOG.md b/Packages/com.unity.inputsystem/CHANGELOG.md index b4dfa6e99b..6f5294d786 100644 --- a/Packages/com.unity.inputsystem/CHANGELOG.md +++ b/Packages/com.unity.inputsystem/CHANGELOG.md @@ -13,7 +13,7 @@ however, it has to be formatted properly to pass verification tests. ### Fixed - Fixed memory allocation on every frame when using UIDocument without EventSystem. [ISXB-953](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-953) - Fixed Action Maps name edition which could be inconsistent in Input Action Editor UI. -- Fixed an update loop in the asset editor that occurs when selecint an Action Map that has no Actions. +- Fixed an update loop in the asset editor that occurs when selecting an Action Map that has no Actions. ### Added - Added Hinge Angle sensor support for foldable devices.