@@ -24,9 +24,9 @@ public static void FreezeActionToggled(object o, EventArgs eventArgs)
2424 {
2525 Shared . General . GeneralTabSetupFinished = false ; // Boiler
2626 Shared . General . ToggleFreezeButton . IsChecked = Interfacing . IsTrackingFrozen ;
27- Shared . General . ToggleFreezeButton . Content = Interfacing . IsTrackingFrozen
28- ? Interfacing . LocalizedJsonString ( "/GeneralPage/Buttons/Skeleton/Unfreeze" )
29- : Interfacing . LocalizedJsonString ( "/GeneralPage/Buttons/Skeleton/Freeze" ) ;
27+ Shared . General . ToggleFreezeButton . Content = Interfacing . IsTrackingFrozen ?
28+ Interfacing . LocalizedJsonString ( "/GeneralPage/Buttons/Skeleton/Unfreeze" ) :
29+ Interfacing . LocalizedJsonString ( "/GeneralPage/Buttons/Skeleton/Freeze" ) ;
3030
3131 Shared . General . GeneralTabSetupFinished = true ; // Boiler end
3232 } ) ;
@@ -45,9 +45,7 @@ public static void FlipActionToggled(object o, EventArgs eventArgs)
4545
4646 // Play a Sound and Update UI
4747 AppSounds . PlayAppSound (
48- AppData . Settings . IsFlipEnabled
49- ? AppSounds . AppSoundType . ToggleOff
50- : AppSounds . AppSoundType . ToggleOn ) ;
48+ AppData . Settings . IsFlipEnabled ? AppSounds . AppSoundType . ToggleOff : AppSounds . AppSoundType . ToggleOn ) ;
5149
5250 if ( Shared . Settings . FlipToggle is not null )
5351 Dispatcher . UIThread . Post ( ( ) =>
@@ -169,7 +167,7 @@ await AppPlugins.CurrentServiceEndpoint.UpdateTrackerPoses(Interfacing.ReplayMan
169167 // Run the worker (if applicable)
170168 if ( AppData . Settings . CheckForOverlappingTrackers &&
171169 ! Interfacing . IsAlreadyAddedTrackersScanRunning )
172- Dispatcher . UIThread . Post ( async ( ) =>
170+ Dispatcher . UIThread . Post ( async void ( ) =>
173171 {
174172 Interfacing . IsAlreadyAddedTrackersScanRunning = true ;
175173 var wereChangesMade = false ; // At least not yet
@@ -247,33 +245,30 @@ private static void UpdateAppTrackers()
247245 AppData . Settings . TrackersVector [ 0 ] . IsOrientationOverridden ;
248246
249247 // Compose flip
250- var dotFacing = 1.0 ;
251- // var dotFacing =
252- // Support.OrientationDot(
253- // // Check for external-flip
254- // extFlip
255- //
256- // // Check for internal overrides
257- // ? extFlipInternal
258- //
259- // // Overriden internal amethyst tracker
260- // ? AppData.Settings.TrackersVector[0].Orientation.Projected()
261- //
262- // // External VR waist tracker
263- // : Interfacing.GetVrTrackerPoseCalibrated("waist").Orientation.Projected()
264- //
265- // // Default: VR HMD orientation
266- // : Interfacing.Plugins.GetHmdPose.Orientation.Projected(),
267- //
268- // // Check for external-flip
269- // extFlip
270- //
271- // // If ExtFlip is enabled compare to its calibration
272- // ? AppData.Settings.ExternalFlipCalibrationMatrix.Projected()
273- //
274- // // Default: use the default calibration rotation
275- // : AppData.Settings.DeviceCalibrationRotationMatrices.GetValueOrDefault(
276- // AppData.Settings.TrackingDeviceGuid, Quaternion.Identity).Projected()); // TODO
248+ var dotFacing = Support . OrientationDot (
249+ // Check for external-flip
250+ extFlip ?
251+ // Check for internal overrides
252+ extFlipInternal ?
253+
254+ // Overriden internal amethyst tracker
255+ AppData . Settings . TrackersVector [ 0 ] . Orientation :
256+
257+ // External VR waist tracker
258+ Interfacing . GetVrTrackerPoseCalibrated ( "waist" ) . Orientation :
259+
260+ // Default: VR HMD orientation
261+ Interfacing . Plugins . GetHmdPose . Orientation ,
262+
263+ // Check for external-flip
264+ extFlip ?
265+
266+ // If ExtFlip is enabled compare to its calibration
267+ AppData . Settings . ExternalFlipCalibrationMatrix :
268+
269+ // Default: use the default calibration rotation
270+ AppData . Settings . DeviceCalibrationRotationMatrices . GetValueOrDefault (
271+ AppData . Settings . TrackingDeviceGuid , Quaternion . Identity ) ) ;
277272
278273 // Not in transition angle area, can compute
279274 if ( Math . Abs ( dotFacing ) >= flipThreshold )
@@ -295,14 +290,16 @@ private static void UpdateAppTrackers()
295290 var joint = isJointFlipped
296291
297292 // If flip : the device contains a joint for the mirrored role
298- ? device . TrackedJoints . FirstOrDefault (
293+ ?
294+ device . TrackedJoints . FirstOrDefault (
299295 x => x . Role == TypeUtils . FlippedJointTypeDictionary [
300296 device . TrackedJoints [ ( int ) tracker . SelectedTrackedJointId ] . Role ] ,
301297 // Otherwise, default to the non-flipped (selected one)
302298 device . TrackedJoints [ ( int ) tracker . SelectedTrackedJointId ] )
303299
304300 // If no flip
305- : device . TrackedJoints [ ( int ) tracker . SelectedTrackedJointId ] ;
301+ :
302+ device . TrackedJoints [ ( int ) tracker . SelectedTrackedJointId ] ;
306303
307304 // Copy the orientation to the tracker
308305 tracker . Orientation = tracker . OrientationTrackingOption switch
@@ -317,9 +314,7 @@ private static void UpdateAppTrackers()
317314 JointRotationTrackingOption . DisableJointRotation => Quaternion . Identity ,
318315
319316 // Default
320- _ => isJointFlipped
321- ? Quaternion . Inverse ( joint . Orientation )
322- : joint . Orientation
317+ _ => isJointFlipped ? Quaternion . Inverse ( joint . Orientation ) : joint . Orientation
323318 } ;
324319
325320 // Copy the previous orientation to the tracker
@@ -335,9 +330,7 @@ private static void UpdateAppTrackers()
335330 JointRotationTrackingOption . DisableJointRotation => Quaternion . Identity ,
336331
337332 // Default
338- _ => isJointFlipped
339- ? Quaternion . Inverse ( joint . PreviousOrientation )
340- : joint . PreviousOrientation
333+ _ => isJointFlipped ? Quaternion . Inverse ( joint . PreviousOrientation ) : joint . PreviousOrientation
341334 } ;
342335
343336 // If math-based orientation is supported, overwrite the orientation with it
@@ -449,27 +442,25 @@ private static void UpdateAppTrackers()
449442 var joint = isJointFlipped
450443
451444 // If flip : the device contains a joint for the mirrored role
452- ? device . TrackedJoints . FirstOrDefault (
445+ ?
446+ device . TrackedJoints . FirstOrDefault (
453447 x => x . Role == TypeUtils . FlippedJointTypeDictionary [
454448 device . TrackedJoints [ ( int ) tracker . OverrideJointId ] . Role ] ,
455449 // Otherwise, default to the non-flipped (selected one)
456450 device . TrackedJoints [ ( int ) tracker . OverrideJointId ] )
457451
458452 // If no flip
459- : device . TrackedJoints [ ( int ) tracker . OverrideJointId ] ;
453+ :
454+ device . TrackedJoints [ ( int ) tracker . OverrideJointId ] ;
460455
461456 // If overridden w/ orientation and the selected option is 'device'
462457 if ( tracker . IsOrientationOverridden && tracker . OrientationTrackingOption ==
463458 JointRotationTrackingOption . DeviceInferredRotation )
464459 {
465460 // Standard, also apply calibration-related flipped orientation fixes
466- tracker . Orientation = isJointFlipped
467- ? Quaternion . Inverse ( joint . Orientation )
468- : joint . Orientation ;
461+ tracker . Orientation = isJointFlipped ? Quaternion . Inverse ( joint . Orientation ) : joint . Orientation ;
469462
470- tracker . PreviousOrientation = isJointFlipped
471- ? Quaternion . Inverse ( joint . PreviousOrientation )
472- : joint . PreviousOrientation ;
463+ tracker . PreviousOrientation = isJointFlipped ? Quaternion . Inverse ( joint . PreviousOrientation ) : joint . PreviousOrientation ;
473464
474465 // Apply calibration-related flipped orientation fixes
475466 if ( isJointFlipped && tracker . OrientationTrackingOption
0 commit comments