Skip to content

Commit 1a2eed7

Browse files
authored
Merge main into feature/XRI3 (#1050)
Merge main into feature/XRI3
2 parents 61585c7 + 90b2cee commit 1a2eed7

File tree

21 files changed

+455
-238
lines changed

21 files changed

+455
-238
lines changed

org.mixedrealitytoolkit.core/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
4747

4848
## Unreleased 3.x
4949

50+
### Changed
51+
52+
* Updated tests to follow existing MRTK test patterns. [PR #1046](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/1046)
53+
5054
### Fixed
5155

5256
* Fixed broken project validation help link, for item 'MRTK3 profile may need to be assigned for the Standalone build target' (Issue #882) [PR #886](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/886)

org.mixedrealitytoolkit.core/Tests/Runtime/InteractableEventRouterTests.cs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// Disable "missing XML comment" warning for tests. While nice to have, this documentation is not required.
55
#pragma warning disable CS1591
66

7+
using MixedReality.Toolkit.Core.Tests;
78
using MixedReality.Toolkit.Experimental;
89
using NUnit.Framework;
910
using System.Collections;
@@ -17,7 +18,7 @@ namespace MixedReality.Toolkit.UX.Runtime.Tests
1718
/// <summary>
1819
/// Tests for the <see cref="InteractableEventRouter"/> class.
1920
/// </summary>
20-
public class InteractableEventRouterTests : MonoBehaviour
21+
public class InteractableEventRouterTests : BaseRuntimeTests
2122
{
2223
private GameObject level0 = null;
2324
private GameObject interactorObject = null;
@@ -39,7 +40,7 @@ public class InteractableEventRouterTests : MonoBehaviour
3940

4041
/// <summary>
4142
/// A cached reference to the <see cref="XRInteractionManager"/> in the scene.
42-
/// Cleared during <see cref="Teardown"/> at the end of each test.
43+
/// Cleared during <see cref="TearDown"/> at the end of each test.
4344
/// </summary>
4445
private XRInteractionManager CachedInteractionManager
4546
{
@@ -53,18 +54,17 @@ private XRInteractionManager CachedInteractionManager
5354
}
5455
}
5556

56-
[SetUp]
57-
public void Init()
57+
public override IEnumerator Setup()
5858
{
59+
yield return base.Setup();
5960
CreateTestObjectsWithEventRouter();
6061
}
6162

62-
[TearDown]
63-
public void Teardown()
63+
public override IEnumerator TearDown()
6464
{
6565
if (level0 != null)
6666
{
67-
Destroy(level0);
67+
Object.Destroy(level0);
6868
}
6969

7070
interactorObject = null;
@@ -81,6 +81,8 @@ public void Teardown()
8181
level1_testInteractableParent = null;
8282
level2_statefulInteractableChild = null;
8383
level2_testInteractableChild = null;
84+
85+
yield return base.TearDown();
8486
}
8587

8688
[UnityTest]
@@ -271,7 +273,7 @@ public IEnumerator MultipleInteractableEventRoutersOnlyOneBubbledEventTest()
271273
{
272274
var levelA = new GameObject("level a");
273275
var levelB = new GameObject("level b");
274-
276+
275277
// Setup level b
276278
levelB.AddComponent<StatefulInteractable>();
277279
var levelB_testInteractableParent = levelB.AddComponent<TestInteractableParent>();
@@ -303,7 +305,7 @@ public IEnumerator MultipleInteractableEventRoutersOnlyOneBubbledEventTest()
303305
Assert.AreEqual(1, levelB_testInteractableParent.ChildSelectExitedCount, "The child select exited event should have occurred once.");
304306

305307

306-
Destroy(levelA);
308+
Object.Destroy(levelA);
307309
level0 = null;
308310
level1 = null;
309311
level2 = null;
@@ -347,7 +349,7 @@ public IEnumerator MultipleInteractableEventRoutersOnlyOneTrickledEventTest()
347349
Assert.AreEqual(1, level2_testInteractableChild.ParentSelectExitedCount, "The parent select exited event should have occurred once.");
348350

349351

350-
Destroy(levelA);
352+
Object.Destroy(levelA);
351353
level0 = null;
352354
level1 = null;
353355
level2 = null;

org.mixedrealitytoolkit.input/Assets/Default Configs/MRTKSyntheticHandsConfig.asset

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ MonoBehaviour:
4949
m_Interactions:
5050
m_SingletonActionBindings: []
5151
m_Flags: 0
52-
m_Reference: {fileID: -6131295136447488360, guid: 18c412191cdc9274897f101c7fd5316f, type: 3}
52+
m_Reference: {fileID: -294446728694031702, guid: 18c412191cdc9274897f101c7fd5316f, type: 3}
5353
rightHandPosition:
5454
m_UseReference: 1
5555
m_Action:
@@ -85,4 +85,4 @@ MonoBehaviour:
8585
m_Interactions:
8686
m_SingletonActionBindings: []
8787
m_Flags: 0
88-
m_Reference: {fileID: 187161793506945269, guid: 18c412191cdc9274897f101c7fd5316f, type: 3}
88+
m_Reference: {fileID: 2995356199736570127, guid: 18c412191cdc9274897f101c7fd5316f, type: 3}

org.mixedrealitytoolkit.input/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
99
* Added a project validation rule to ensure the Unity XR Hands subsystem is enabled in the OpenXR settings when the corresponding MRTK subsystem is enabled. [PR #973](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/973)
1010
* Added support for Unity's com.unity.cloud.gltfast and com.unity.cloud.ktx packages when loading controller models. [PR #631](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/631)
1111
* Added toggle for frame rate independent smoothing in camera simulation. [PR #1011](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/1011)
12+
* Added implementation for the synthesized TriggerButton, accounting for animation smoothing. [PR #1043](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/1043)
13+
* Added a "squeeze" alias for the grip states, to account for broader input action mapping support. [PR #1043](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/1043)
1214

1315
### Fixed
1416

@@ -17,6 +19,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
1719
### Changed
1820

1921
* Updated the minimum editor version to 2022.3.6f1 [PR #1003](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/1003)
22+
* Updated tests to follow existing MRTK test patterns. [PR #1046](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/1046)
23+
* Remapped the synthetic hands config to read the float "select value" action instead of the bool "select" action, since it's read as a float. [PR #1043](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/1043)
2024

2125
### Removed
2226

org.mixedrealitytoolkit.input/Controllers/ArticulatedHandController.cs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,8 @@ protected override void UpdateInput(XRControllerState controllerState)
7878
// If we still don't have an aggregator, then don't update selects.
7979
if (XRSubsystemHelpers.HandsAggregator == null) { return; }
8080

81-
bool gotPinchData = XRSubsystemHelpers.HandsAggregator.TryGetPinchProgress(
82-
handNode,
83-
out bool isPinchReady,
84-
out bool isPinching,
85-
out float pinchAmount
86-
);
87-
8881
// If we got pinch data, write it into our select interaction state.
89-
if (gotPinchData)
82+
if (XRSubsystemHelpers.HandsAggregator.TryGetPinchProgress(handNode, out bool isPinchReady, out _, out float pinchAmount))
9083
{
9184
// Workaround for missing select actions on devices without interaction profiles
9285
// for hands, such as Varjo and Quest. Should be removed once we have universal

org.mixedrealitytoolkit.input/Simulation/Devices/MRTKSimulatedControllerState.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public struct MRTKSimulatedControllerState : IInputStateTypeInfo
4242
/// <summary>
4343
/// Represents the user's grip on the controller.
4444
/// </summary>
45-
[InputControl(usage = "Grip", layout = "Axis")]
45+
[InputControl(usage = "Grip", alias = "squeeze", layout = "Axis")]
4646
[FieldOffset(12)]
4747
public float grip;
4848

@@ -60,7 +60,7 @@ public struct MRTKSimulatedControllerState : IInputStateTypeInfo
6060
[InputControl(name = nameof(XRSimulatedController.primaryTouch), usage = "PrimaryTouch", layout = "Button", bit = (uint)ControllerButton.PrimaryTouch)]
6161
[InputControl(name = nameof(XRSimulatedController.secondaryButton), usage = "SecondaryButton", layout = "Button", bit = (uint)ControllerButton.SecondaryButton)]
6262
[InputControl(name = nameof(XRSimulatedController.secondaryTouch), usage = "SecondaryTouch", layout = "Button", bit = (uint)ControllerButton.SecondaryTouch)]
63-
[InputControl(name = nameof(XRSimulatedController.gripButton), usage = "GripButton", layout = "Button", bit = (uint)ControllerButton.GripButton, alias = "gripPressed")]
63+
[InputControl(name = nameof(XRSimulatedController.gripButton), usage = "GripButton", layout = "Button", bit = (uint)ControllerButton.GripButton, aliases = new[] { "gripPressed", "squeezeClicked" })]
6464
[InputControl(name = nameof(XRSimulatedController.triggerButton), usage = "TriggerButton", layout = "Button", bit = (uint)ControllerButton.TriggerButton, alias = "triggerPressed")]
6565
[InputControl(name = nameof(XRSimulatedController.menuButton), usage = "MenuButton", layout = "Button", bit = (uint)ControllerButton.MenuButton)]
6666
[InputControl(name = nameof(XRSimulatedController.primary2DAxisClick), usage = "Primary2DAxisClick", layout = "Button", bit = (uint)ControllerButton.Primary2DAxisClick)]

org.mixedrealitytoolkit.input/Simulation/Devices/SimulatedController.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -435,10 +435,7 @@ private void ApplyState(ControllerControls controls)
435435
// simulatedControllerState.primary2DAxis = controls.Primary2DAxis;
436436
// simulatedControllerState.secondary2DAxis = controls.Secondary2DAxis;
437437

438-
// Note: if trigger button is activated, the joint synthesizer will instantly pinch, without smoothing.
439-
// If smoothed pinch is desired, use controls.TriggerAxis.
440438
simulatedControllerState.WithButton(ControllerButton.TriggerButton, controls.TriggerButton);
441-
442439
simulatedControllerState.WithButton(ControllerButton.GripButton, controls.GripButton);
443440

444441
// todo: "soon"

org.mixedrealitytoolkit.input/Simulation/InputSimulator.cs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -314,11 +314,6 @@ public ControllerSimulationSettings RightControllerSettings
314314
set => rightControllerSettings = value;
315315
}
316316

317-
// Should we pass the trigger button straight through to the device?
318-
// This will not smooth the trigger press; typically, we should
319-
// modulate the trigger axis control ourselves for smooth pinch/unpinch.
320-
private bool shouldUseTriggerButton = false;
321-
322317
// TODO: Drive from inspector/simulator options.
323318
private float triggerSmoothTime = 0.1f;
324319

@@ -556,14 +551,7 @@ private void UpdateSimulatedController(Handedness handedness)
556551
#endif // LATER
557552

558553
// Buttons available to hands and controllers
559-
// Should we pass the trigger button straight through to the device?
560-
// This will not smooth the trigger press; typically, we should
561-
// modulate the trigger axis control ourselves for smooth pinch/unpinch,
562-
// and this is false.
563-
if (shouldUseTriggerButton)
564-
{
565-
controls.TriggerButton = ctrlSettings.TriggerButton.action.IsPressed();
566-
}
554+
controls.TriggerButton = controls.TriggerAxis >= InputSystem.settings.defaultButtonPressPoint;
567555
controls.GripButton = ctrlSettings.GripButton.action.IsPressed();
568556

569557
if (ctrlSettings.SimulationMode == ControllerSimulationMode.MotionController)

org.mixedrealitytoolkit.input/Tests/Runtime/Utilities/InputTestUtilities.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
using System.Collections.Concurrent;
1111
using UnityEngine;
1212
using UnityEngine.InputSystem;
13-
using UnityEngine.XR.Interaction.Toolkit;
1413

1514
using Object = UnityEngine.Object;
1615

@@ -22,7 +21,7 @@
2221

2322
namespace MixedReality.Toolkit.Input.Tests
2423
{
25-
public class InputTestUtilities
24+
public static class InputTestUtilities
2625
{
2726
private const string MRTKRigPrefabGuid = "4d7e2f87fefe0ba468719b15288b46e7";
2827
private static readonly string MRTKRigPrefabPath = AssetDatabase.GUIDToAssetPath(MRTKRigPrefabGuid);
@@ -59,7 +58,7 @@ public class InputTestUtilities
5958
/// to ensure that tests will run quickly in general, and can be set to true manually in specific
6059
/// test cases using the example below.
6160
/// </summary>
62-
/// <example>
61+
/// <example>
6362
/// <code>
6463
/// [UnityTest]
6564
/// public IEnumerator YourTestCase()
@@ -221,7 +220,7 @@ public static void TeardownRig()
221220
/// </summary>
222221
/// <remarks>
223222
/// This will create two <see cref="SimulatedController"/> object, a <see cref="SimulatedHMD"/>
224-
/// object, and the associated <see cref="ControllerControls"/> objects.
223+
/// object, and the associated <see cref="ControllerControls"/> objects.
225224
/// </remarks>
226225
/// <param name="rayHalfLife">
227226
/// Optional value for ray smoothing halflife, handy for suppressing smoothing during automated tests.
@@ -300,7 +299,7 @@ public static IEnumerator SetHandTrackingState(Handedness handedness, bool isTra
300299
/// </summary>
301300
/// <remarks>
302301
/// <para>
303-
/// This moves the hand from <paramref name="startPosition"/> to <paramref name="endPosition"/>, rotates the hand from
302+
/// This moves the hand from <paramref name="startPosition"/> to <paramref name="endPosition"/>, rotates the hand from
304303
/// <paramref name="startRotation"/> to <paramref name="endRotation"/>, and smooths the handshape
305304
/// based on the provided <paramref name="handshapeId"/> over the number of steps provided by <paramref name="numSteps"/>.
306305
/// </para>
@@ -411,7 +410,7 @@ public static IEnumerator RotateHand(
411410
/// </summary>
412411
/// <remarks>
413412
/// <para>
414-
/// This rotates the hand to <paramref name="newRotation"/>, and smooths the handshape based on the provided
413+
/// This rotates the hand to <paramref name="newRotation"/>, and smooths the handshape based on the provided
415414
/// <paramref name="handshapeId"/> over the number of steps provided by <paramref name="numSteps"/>.
416415
/// </para>
417416
/// <para>
@@ -453,7 +452,7 @@ public static IEnumerator PointHandToTarget(Vector3 target, HandshapeId handshap
453452
/// </summary>
454453
/// <remarks>
455454
/// <para>
456-
/// This smooths the handshape based on the provided/ <paramref name="handshapeId"/> over the number of
455+
/// This smooths the handshape based on the provided/ <paramref name="handshapeId"/> over the number of
457456
/// steps provided by <paramref name="numSteps"/>.
458457
/// </para>
459458
/// <para>
@@ -711,7 +710,7 @@ public enum RigVersion
711710
/// Force the use of a rig that does not use the deprecated XRI controller components, but still utilizes
712711
/// all the custom MRTK interactors.
713712
/// </summary>
714-
Version2 = 2,
713+
Version2 = 2,
715714
}
716715

717716
/// <summary>
@@ -831,6 +830,7 @@ public bool Update()
831830
);
832831
float pinchAmount = Mathf.Lerp(startingPinchAmount, isPinching ? 1 : 0, t);
833832

833+
request.controls.TriggerButton = pinchAmount >= InputSystem.settings.defaultButtonPressPoint;
834834
request.controls.TriggerAxis = pinchAmount;
835835
switch (request.anchorPoint)
836836
{

org.mixedrealitytoolkit.spatialmanipulation/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
3434
* Fixed tap to place `StartPlacement()` when called just after instantiation of the component. [PR #785](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/785)
3535
* Fix null ref in SpatialManipulationReticle when multiple interactables are hovered. [PR #873](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/873)
3636
* ConstantViewSize solver now retains the initial scale and aspect ratio [PR #719](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/719)
37+
* Fixed Follow solver frequently logging "Look Rotation Viewing Vector Is Zero" [PR #895](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/895)
3738

3839
## [3.3.0] - 2024-04-30
3940

0 commit comments

Comments
 (0)