Skip to content

Commit

Permalink
Update rigged hand mesh flicker bug fix to not be a breaking interfac…
Browse files Browse the repository at this point in the history
…e change (#10831)

* Add some guards

* Remove breaking change
  • Loading branch information
keveleigh authored Aug 5, 2022
1 parent 1d18e27 commit f1f8b05
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 27 deletions.
7 changes: 1 addition & 6 deletions Assets/MRTK/Core/Interfaces/Devices/IMixedRealityHand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ namespace Microsoft.MixedReality.Toolkit.Input
/// </summary>
public interface IMixedRealityHand : IMixedRealityController
{
/// <summary>
/// Has the hand any joint data available.
/// </summary>
bool IsJointDataAvailable { get; }

/// <summary>
/// Get the current pose of a hand joint.
/// </summary>
Expand All @@ -24,4 +19,4 @@ public interface IMixedRealityHand : IMixedRealityController
/// </remarks>
bool TryGetJoint(TrackedHandJoint joint, out MixedRealityPose pose);
}
}
}
5 changes: 1 addition & 4 deletions Assets/MRTK/Core/Providers/Hands/BaseHand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,6 @@ protected void UpdateVelocity()

#endregion Gesture Definitions

/// <inheritdoc />
public abstract bool IsJointDataAvailable { get; }

/// <inheritdoc />
public abstract bool TryGetJoint(TrackedHandJoint joint, out MixedRealityPose pose);

Expand Down Expand Up @@ -126,4 +123,4 @@ private float DistanceSqrPointToLine(Vector3 lineStart, Vector3 lineEnd, Vector3

#endregion Private InputSource Helpers
}
}
}
5 changes: 1 addition & 4 deletions Assets/MRTK/Core/Providers/InputSimulation/SimulatedHand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,6 @@ protected SimulatedHand(
: base(trackingState, controllerHandedness, inputSource, interactions, definition)
{ }

/// <inheritdoc/>
public override bool IsJointDataAvailable => jointPoses.Count > 0;

/// <inheritdoc />
public override bool TryGetJoint(TrackedHandJoint joint, out MixedRealityPose pose) => jointPoses.TryGetValue(joint, out pose);

Expand All @@ -126,4 +123,4 @@ public void UpdateState(SimulatedHandData handData)
/// <param name="handData">hand data provided by the simulation</param>
protected abstract void UpdateInteractions(SimulatedHandData handData);
}
}
}
3 changes: 0 additions & 3 deletions Assets/MRTK/Providers/LeapMotion/LeapMotionArticulatedHand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ public LeapMotionArticulatedHand(

#region IMixedRealityHand Implementation

/// <inheritdoc />
public override bool IsJointDataAvailable => jointPoses.Count > 0;

/// <inheritdoc/>
public override bool TryGetJoint(TrackedHandJoint joint, out MixedRealityPose pose) => jointPoses.TryGetValue(joint, out pose);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,6 @@ public override void SetupDefaultInteractions()

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

/// <inheritdoc/>
public override bool IsJointDataAvailable => jointPoses.Count > 0;

/// <inheritdoc/>
public override bool TryGetJoint(TrackedHandJoint joint, out MixedRealityPose pose)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@ public MicrosoftArticulatedHand(TrackingState trackingState, Handedness controll

#region IMixedRealityHand Implementation

/// <inheritdoc/>
public bool IsJointDataAvailable => unityJointPoses != null;

/// <inheritdoc/>
public bool TryGetJoint(TrackedHandJoint joint, out MixedRealityPose pose)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,21 @@ public WindowsMixedRealityArticulatedHand(
handMeshProvider = (controllerHandedness == Handedness.Left) ? WindowsMixedRealityHandMeshProvider.Left : WindowsMixedRealityHandMeshProvider.Right;
handMeshProvider.SetInputSource(inputSource);

#if WINDOWS_UWP || DOTNETWINRT_PRESENT
articulatedHandApiAvailable = WindowsApiChecker.IsMethodAvailable(
"Windows.UI.Input.Spatial",
"SpatialInteractionSourceState",
"TryGetHandPose");
#endif // WINDOWS_UWP || DOTNETWINRT_PRESENT
}

private readonly Dictionary<TrackedHandJoint, MixedRealityPose> unityJointPoses = new Dictionary<TrackedHandJoint, MixedRealityPose>();
private readonly ArticulatedHandDefinition handDefinition;
private readonly WindowsMixedRealityHandMeshProvider handMeshProvider;

#if WINDOWS_UWP || DOTNETWINRT_PRESENT
private readonly bool articulatedHandApiAvailable = false;
#endif // WINDOWS_UWP || DOTNETWINRT_PRESENT

#region IMixedRealityHand Implementation

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,6 @@ public WindowsMixedRealityXRSDKArticulatedHand(

#region IMixedRealityHand Implementation

/// <inheritdoc/>
public bool IsJointDataAvailable => jointPoses != null;

/// <inheritdoc/>
public bool TryGetJoint(TrackedHandJoint joint, out MixedRealityPose pose)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ protected override bool UpdateHandJoints()
MixedRealityHandTrackingProfile handTrackingProfile = inputSystem?.InputSystemProfile != null ? inputSystem.InputSystemProfile.HandTrackingProfile : null;

// Only runs if render hand mesh is true
bool renderHandmesh = handTrackingProfile != null && handTrackingProfile.EnableHandMeshVisualization && MixedRealityHand.IsJointDataAvailable;
bool renderHandmesh = handTrackingProfile != null && handTrackingProfile.EnableHandMeshVisualization && MixedRealityHand.TryGetJoint(TrackedHandJoint.Palm, out _);
HandRenderer.enabled = renderHandmesh;
if (renderHandmesh)
{
Expand Down

0 comments on commit f1f8b05

Please sign in to comment.