Skip to content

Commit f1f8b05

Browse files
authored
Update rigged hand mesh flicker bug fix to not be a breaking interface change (#10831)
* Add some guards * Remove breaking change
1 parent 1d18e27 commit f1f8b05

File tree

9 files changed

+9
-27
lines changed

9 files changed

+9
-27
lines changed

Assets/MRTK/Core/Interfaces/Devices/IMixedRealityHand.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@ namespace Microsoft.MixedReality.Toolkit.Input
1010
/// </summary>
1111
public interface IMixedRealityHand : IMixedRealityController
1212
{
13-
/// <summary>
14-
/// Has the hand any joint data available.
15-
/// </summary>
16-
bool IsJointDataAvailable { get; }
17-
1813
/// <summary>
1914
/// Get the current pose of a hand joint.
2015
/// </summary>
@@ -24,4 +19,4 @@ public interface IMixedRealityHand : IMixedRealityController
2419
/// </remarks>
2520
bool TryGetJoint(TrackedHandJoint joint, out MixedRealityPose pose);
2621
}
27-
}
22+
}

Assets/MRTK/Core/Providers/Hands/BaseHand.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,6 @@ protected void UpdateVelocity()
7878

7979
#endregion Gesture Definitions
8080

81-
/// <inheritdoc />
82-
public abstract bool IsJointDataAvailable { get; }
83-
8481
/// <inheritdoc />
8582
public abstract bool TryGetJoint(TrackedHandJoint joint, out MixedRealityPose pose);
8683

@@ -126,4 +123,4 @@ private float DistanceSqrPointToLine(Vector3 lineStart, Vector3 lineEnd, Vector3
126123

127124
#endregion Private InputSource Helpers
128125
}
129-
}
126+
}

Assets/MRTK/Core/Providers/InputSimulation/SimulatedHand.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,6 @@ protected SimulatedHand(
100100
: base(trackingState, controllerHandedness, inputSource, interactions, definition)
101101
{ }
102102

103-
/// <inheritdoc/>
104-
public override bool IsJointDataAvailable => jointPoses.Count > 0;
105-
106103
/// <inheritdoc />
107104
public override bool TryGetJoint(TrackedHandJoint joint, out MixedRealityPose pose) => jointPoses.TryGetValue(joint, out pose);
108105

@@ -126,4 +123,4 @@ public void UpdateState(SimulatedHandData handData)
126123
/// <param name="handData">hand data provided by the simulation</param>
127124
protected abstract void UpdateInteractions(SimulatedHandData handData);
128125
}
129-
}
126+
}

Assets/MRTK/Providers/LeapMotion/LeapMotionArticulatedHand.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@ public LeapMotionArticulatedHand(
4444

4545
#region IMixedRealityHand Implementation
4646

47-
/// <inheritdoc />
48-
public override bool IsJointDataAvailable => jointPoses.Count > 0;
49-
5047
/// <inheritdoc/>
5148
public override bool TryGetJoint(TrackedHandJoint joint, out MixedRealityPose pose) => jointPoses.TryGetValue(joint, out pose);
5249

Assets/MRTK/Providers/Oculus/XRSDK/MRTK-Quest/Scripts/Input/Controllers/OculusHand.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,6 @@ public override void SetupDefaultInteractions()
8383

8484
protected readonly Dictionary<TrackedHandJoint, MixedRealityPose> jointPoses = new Dictionary<TrackedHandJoint, MixedRealityPose>();
8585

86-
/// <inheritdoc/>
87-
public override bool IsJointDataAvailable => jointPoses.Count > 0;
88-
8986
/// <inheritdoc/>
9087
public override bool TryGetJoint(TrackedHandJoint joint, out MixedRealityPose pose)
9188
{

Assets/MRTK/Providers/OpenXR/Scripts/MicrosoftArticulatedHand.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,6 @@ public MicrosoftArticulatedHand(TrackingState trackingState, Handedness controll
5050

5151
#region IMixedRealityHand Implementation
5252

53-
/// <inheritdoc/>
54-
public bool IsJointDataAvailable => unityJointPoses != null;
55-
5653
/// <inheritdoc/>
5754
public bool TryGetJoint(TrackedHandJoint joint, out MixedRealityPose pose)
5855
{

Assets/MRTK/Providers/WindowsMixedReality/XR2018/Controllers/WindowsMixedRealityArticulatedHand.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,21 @@ public WindowsMixedRealityArticulatedHand(
4848
handMeshProvider = (controllerHandedness == Handedness.Left) ? WindowsMixedRealityHandMeshProvider.Left : WindowsMixedRealityHandMeshProvider.Right;
4949
handMeshProvider.SetInputSource(inputSource);
5050

51+
#if WINDOWS_UWP || DOTNETWINRT_PRESENT
5152
articulatedHandApiAvailable = WindowsApiChecker.IsMethodAvailable(
5253
"Windows.UI.Input.Spatial",
5354
"SpatialInteractionSourceState",
5455
"TryGetHandPose");
56+
#endif // WINDOWS_UWP || DOTNETWINRT_PRESENT
5557
}
5658

5759
private readonly Dictionary<TrackedHandJoint, MixedRealityPose> unityJointPoses = new Dictionary<TrackedHandJoint, MixedRealityPose>();
5860
private readonly ArticulatedHandDefinition handDefinition;
5961
private readonly WindowsMixedRealityHandMeshProvider handMeshProvider;
62+
63+
#if WINDOWS_UWP || DOTNETWINRT_PRESENT
6064
private readonly bool articulatedHandApiAvailable = false;
65+
#endif // WINDOWS_UWP || DOTNETWINRT_PRESENT
6166

6267
#region IMixedRealityHand Implementation
6368

Assets/MRTK/Providers/WindowsMixedReality/XRSDK/Controllers/WindowsMixedRealityXRSDKArticulatedHand.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,6 @@ public WindowsMixedRealityXRSDKArticulatedHand(
6363

6464
#region IMixedRealityHand Implementation
6565

66-
/// <inheritdoc/>
67-
public bool IsJointDataAvailable => jointPoses != null;
68-
6966
/// <inheritdoc/>
7067
public bool TryGetJoint(TrackedHandJoint joint, out MixedRealityPose pose)
7168
{

Assets/MRTK/SDK/Features/UX/Scripts/RiggedHandVisualizer/RiggedHandVisualizer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ protected override bool UpdateHandJoints()
305305
MixedRealityHandTrackingProfile handTrackingProfile = inputSystem?.InputSystemProfile != null ? inputSystem.InputSystemProfile.HandTrackingProfile : null;
306306

307307
// Only runs if render hand mesh is true
308-
bool renderHandmesh = handTrackingProfile != null && handTrackingProfile.EnableHandMeshVisualization && MixedRealityHand.IsJointDataAvailable;
308+
bool renderHandmesh = handTrackingProfile != null && handTrackingProfile.EnableHandMeshVisualization && MixedRealityHand.TryGetJoint(TrackedHandJoint.Palm, out _);
309309
HandRenderer.enabled = renderHandmesh;
310310
if (renderHandmesh)
311311
{

0 commit comments

Comments
 (0)