Skip to content

Commit 7115015

Browse files
authored
[2.8.1] Fix null ref in WindowsMixedRealityXRSDKArticulatedHand (#10622)
* Fix null ref in WindowsMixedRealityXRSDKArticulatedHand * Update to 2.8.1
1 parent 70d5731 commit 7115015

File tree

4 files changed

+15
-10
lines changed

4 files changed

+15
-10
lines changed

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

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public WindowsMixedRealityXRSDKArticulatedHand(
4747
private readonly ArticulatedHandDefinition handDefinition;
4848
private readonly WindowsMixedRealityHandMeshProvider handMeshProvider;
4949

50-
private readonly MixedRealityPose[] unityJointPoses = null;
50+
private MixedRealityPose[] jointPoses = null;
5151

5252
private static readonly HandFinger[] handFingers = Enum.GetValues(typeof(HandFinger)) as HandFinger[];
5353
private readonly List<Bone> fingerBones = new List<Bone>();
@@ -66,9 +66,9 @@ public WindowsMixedRealityXRSDKArticulatedHand(
6666
/// <inheritdoc/>
6767
public bool TryGetJoint(TrackedHandJoint joint, out MixedRealityPose pose)
6868
{
69-
if (unityJointPoses != null)
69+
if (jointPoses != null)
7070
{
71-
pose = unityJointPoses[(int)joint];
71+
pose = jointPoses[(int)joint];
7272
return pose != default(MixedRealityPose);
7373
}
7474

@@ -136,6 +136,11 @@ private void UpdateHandData(InputDevice inputDevice)
136136

137137
if (inputDevice.TryGetFeatureValue(CommonUsages.handData, out Hand hand))
138138
{
139+
if (jointPoses == null)
140+
{
141+
jointPoses = new MixedRealityPose[ArticulatedHandPose.JointCount];
142+
}
143+
139144
foreach (HandFinger finger in handFingers)
140145
{
141146
if (hand.TryGetFingerBones(finger, fingerBones))
@@ -157,18 +162,18 @@ private void UpdateHandData(InputDevice inputDevice)
157162
position = MixedRealityPlayspace.TransformPoint(position);
158163
rotation = MixedRealityPlayspace.Rotation * rotation;
159164

160-
unityJointPoses[ConvertToArrayIndex(finger, i)] = new MixedRealityPose(position, rotation);
165+
jointPoses[ConvertToArrayIndex(finger, i)] = new MixedRealityPose(position, rotation);
161166
}
162167
}
163168

164169
// Unity doesn't provide a palm joint, so we synthesize one here
165170
MixedRealityPose palmPose = CurrentControllerPose;
166171
palmPose.Rotation *= (ControllerHandedness == Handedness.Left ? leftPalmOffset : rightPalmOffset);
167-
unityJointPoses[(int)TrackedHandJoint.Palm] = palmPose;
172+
jointPoses[(int)TrackedHandJoint.Palm] = palmPose;
168173
}
169174
}
170175

171-
handDefinition?.UpdateHandJoints(unityJointPoses);
176+
handDefinition?.UpdateHandJoints(jointPoses);
172177
}
173178
}
174179
}

Assets/MRTK/Tests/EditModeTests/Core/Utilities/BuildAndDeploy/UwpAppxBuildToolsTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class UwpAppxBuildToolsTest
2626
xmlns:mobile='http://schemas.microsoft.com/appx/manifest/mobile/windows10'
2727
IgnorableNamespaces='uap uap2 uap3 uap4 mp mobile iot'
2828
xmlns='http://schemas.microsoft.com/appx/manifest/foundation/windows10'>
29-
<Identity Name='Microsoft.MixedReality.Toolkit' Publisher='CN=Microsoft' Version='2.8.0.0' />
29+
<Identity Name='Microsoft.MixedReality.Toolkit' Publisher='CN=Microsoft' Version='2.8.1.0' />
3030
<mp:PhoneIdentity PhoneProductId='85c8bcd4-fbac-44ed-adf6-bfc01242a27f' PhonePublisherId='00000000-0000-0000-0000-000000000000' />
3131
<Properties>
3232
<DisplayName>MixedRealityToolkit</DisplayName>

ProjectSettings/ProjectSettings.asset

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ PlayerSettings:
121121
16:10: 1
122122
16:9: 1
123123
Others: 1
124-
bundleVersion: 2.8.0
124+
bundleVersion: 2.8.1
125125
preloadedAssets: []
126126
metroInputSource: 0
127127
wsaTransparentSwapchain: 0
@@ -700,7 +700,7 @@ PlayerSettings:
700700
m_RenderingPath: 1
701701
m_MobileRenderingPath: 1
702702
metroPackageName: Microsoft.MixedReality.Toolkit
703-
metroPackageVersion: 2.8.0.0
703+
metroPackageVersion: 2.8.1.0
704704
metroCertificatePath: Assets/WSATestCertificate.pfx
705705
metroCertificatePassword:
706706
metroCertificateSubject: Microsoft

pipelines/config/settings.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ variables:
1212
# match (see scripts/packaging/versionmetadata.ps1)
1313
# ProjectSettings/ProjectSettings.asset: bundleVersion: x.x.x
1414
# ProjectSettings/ProjectSettings.asset: metroPackageVersion: x.x.x.0
15-
MRTKVersion: 2.8.0
15+
MRTKVersion: 2.8.1
1616
MRTKReleaseTag: '' # final version component, e.g. 'RC2.1' or empty string
1717
ToolsRepoName: mixedrealitytoolkit.build
1818
ToolsDir: $(Build.SourcesDirectory)\$(ToolsRepoName)

0 commit comments

Comments
 (0)