Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update rigged hand mesh flicker bug fix to not be a breaking interface change #10831

Merged
merged 2 commits into from Aug 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 1 addition & 6 deletions Assets/MRTK/Core/Interfaces/Devices/IMixedRealityHand.cs
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
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
}
}
}
Expand Up @@ -100,9 +100,6 @@ public abstract class SimulatedHand : BaseHand
: 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);
}
}
}
Expand Up @@ -44,9 +44,6 @@ public class LeapMotionArticulatedHand : BaseHand

#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
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
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
Expand Up @@ -48,16 +48,21 @@ public class WindowsMixedRealityArticulatedHand : BaseWindowsMixedRealitySource,
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
Expand Up @@ -63,9 +63,6 @@ public class WindowsMixedRealityXRSDKArticulatedHand : BaseWindowsMixedRealityXR

#region IMixedRealityHand Implementation

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

/// <inheritdoc/>
public bool TryGetJoint(TrackedHandJoint joint, out MixedRealityPose pose)
{
Expand Down
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