Skip to content

Commit ee78332

Browse files
authored
Fixed issue where hand joint lookup would throw dictionary exceptions for visualizers (#10574)
* fixed issue where hand joint lookup would throw dictionary exceptions * whitepsace fix
1 parent e754eac commit ee78332

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,11 @@ public virtual void OnHandJointsUpdated(InputEventData<IDictionary<TrackedHandJo
126126
for (int i = 1; i < ArticulatedHandPose.JointCount; i++)
127127
{
128128
TrackedHandJoint handJoint = (TrackedHandJoint)i;
129+
// Skip this hand joint if the event data doesn't have an entry for it
130+
if (!eventData.InputData.ContainsKey(handJoint))
131+
{
132+
continue;
133+
}
129134
MixedRealityPose handJointPose = eventData.InputData[handJoint];
130135
Transform jointTransform = jointsArray[i];
131136

Assets/MRTK/Providers/Oculus/XRSDK/MRTK-Quest/Editor/OculusXRSDKHandtrackingConfigurationChecker.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,10 @@ internal static void ReconcileOculusIntegrationDefine(bool oculusIntegrationPres
211211
}
212212

213213
/// <summary>
214-
/// Adds warnings to the nowarn line in the csc.rsp file located at the root of assets. Warning 618 and 649 are added to the nowarn line because if
214+
/// Adds warnings to the nowarn line in the csc.rsp file located at the root of assets. Warning 414, 618 and 649 are added to the nowarn line because if
215215
/// the MRTK source is from the repo, warnings are converted to errors. Warnings are not converted to errors if the MRTK source is from the unity packages.
216-
/// Warning 618 and 649 are logged when Oculus Integration is imported into the project, 618 is the obsolete warning and 649 is a null on start warning.
216+
/// Warning 414, 618 and 649 are logged when Oculus Integration is imported into the project, 414 is an unsued variable warning,
217+
/// 618 is the obsolete warning and 649 is a null on start warning.
217218
/// </summary>
218219
static void UpdateCSC()
219220
{
@@ -229,6 +230,7 @@ static void UpdateCSC()
229230
// List of new warning numbers to add to the csc file
230231
List<string> warningNumbersToAdd = new List<string>()
231232
{
233+
"414",
232234
"618",
233235
"649"
234236
};

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ protected bool UpdateHandData(OVRHand ovrHand, OVRSkeleton ovrSkeleton)
268268

269269
UpdatePalm();
270270
}
271-
271+
272272
HandDefinition?.UpdateHandJoints(jointPoses);
273273

274274
// Note: After some testing, it seems when moving your hand fast, Oculus's pinch estimation data gets frozen, which leads to stuck pinches.
@@ -371,8 +371,6 @@ protected void UpdatePalm()
371371

372372
protected void UpdateJointPose(TrackedHandJoint joint, Vector3 position, Quaternion rotation)
373373
{
374-
Vector3 jointPosition = position;
375-
376374
// TODO Figure out kalman filter coefficients to get good quality smoothing
377375
#if LATER
378376
if (joint == TrackedHandJoint.IndexTip)
@@ -385,7 +383,7 @@ protected void UpdateJointPose(TrackedHandJoint joint, Vector3 position, Quatern
385383
}
386384
#endif
387385

388-
MixedRealityPose pose = new MixedRealityPose(jointPosition, rotation);
386+
MixedRealityPose pose = new MixedRealityPose(position, rotation);
389387
if (!jointPoses.ContainsKey(joint))
390388
{
391389
jointPoses.Add(joint, pose);

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,11 @@ public override void OnHandJointsUpdated(InputEventData<IDictionary<TrackedHandJ
319319
for (int i = 1; i < ArticulatedHandPose.JointCount; i++)
320320
{
321321
TrackedHandJoint handJoint = (TrackedHandJoint)i;
322+
// Skip this hand joint if the event data doesn't have an entry for it
323+
if (!eventData.InputData.ContainsKey(handJoint))
324+
{
325+
continue;
326+
}
322327
MixedRealityPose handJointPose = eventData.InputData[handJoint];
323328
Transform jointTransform = riggedVisualJointsArray[i];
324329

0 commit comments

Comments
 (0)