Skip to content

Commit 54f2c58

Browse files
committed
Formatting and region clarifications
1 parent d8784d2 commit 54f2c58

File tree

3 files changed

+27
-40
lines changed

3 files changed

+27
-40
lines changed

Assets/MRTK/Providers/Oculus/XRSDK/OculusXRSDKDeviceManager.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,16 @@
66
using Microsoft.MixedReality.Toolkit.XRSDK.Input;
77
using System;
88
using System.Linq;
9-
using System.Collections.Generic;
9+
using UnityEngine.XR;
10+
1011
#if OCULUSINTEGRATION_PRESENT
12+
using System.Collections.Generic;
13+
#if OCULUS_ENABLED
1114
using Unity.XR.Oculus;
12-
#endif
15+
#endif // OCULUS_ENABLED
1316
using UnityEngine;
14-
using UnityEngine.XR;
1517
using UnityEngine.XR.Management;
18+
#endif // OCULUSINTEGRATION_PRESENT
1619

1720
namespace Microsoft.MixedReality.Toolkit.XRSDK.Oculus.Input
1821
{
@@ -55,14 +58,11 @@ public override void Initialize()
5558
private OVRCameraRig cameraRig;
5659

5760
private OVRHand rightHand;
58-
private OVRMeshRenderer rightMeshRenderer;
5961
private OVRSkeleton rightSkeleton;
6062

6163
private OVRHand leftHand;
62-
private OVRMeshRenderer leftMeshRenderer;
6364
private OVRSkeleton leftSkeleton;
6465

65-
6666
/// <summary>
6767
/// The profile that contains settings for the Oculus XRSDK Device Manager input data provider. This profile is nested under
6868
/// Input > Input Data Providers > Oculus XRSDK Device Manager in the MixedRealityToolkit object in the hierarchy.
@@ -144,8 +144,8 @@ protected override SupportedControllerType GetCurrentControllerType(InputDevice
144144
public override void Enable()
145145
{
146146
base.Enable();
147-
148147
if (!XRGeneralSettings.Instance.Manager.loaders.Any(l => l is OculusLoader loader && loader.displaySubsystem != null))
148+
149149
{
150150
return;
151151
}
@@ -159,6 +159,7 @@ public override void Enable()
159159
public override void Update()
160160
{
161161
base.Update();
162+
162163
if (OVRPlugin.GetHandTrackingEnabled())
163164
{
164165
UpdateHands();
@@ -203,7 +204,7 @@ private void SetupInput()
203204
}
204205

205206
bool useAvatarHands = SettingsProfile.RenderAvatarHandsInsteadOfController;
206-
// If using Avatar hands, de-activate ovr controller rendering
207+
// If using Avatar hands, deactivate ovr controller rendering
207208
foreach (var controllerHelper in cameraRig.gameObject.GetComponentsInChildren<OVRControllerHelper>())
208209
{
209210
controllerHelper.gameObject.SetActive(!useAvatarHands);
@@ -280,8 +281,7 @@ private OculusHand GetOrAddHand(Handedness handedness, OVRHand ovrHand)
280281
var pointers = RequestPointers(SupportedControllerType.ArticulatedHand, handedness);
281282
var inputSourceType = InputSourceType.Hand;
282283

283-
IMixedRealityInputSystem inputSystem = Service as IMixedRealityInputSystem;
284-
var inputSource = inputSystem?.RequestNewGenericInputSource($"Oculus Quest {handedness} Hand", pointers, inputSourceType);
284+
var inputSource = Service?.RequestNewGenericInputSource($"Oculus Quest {handedness} Hand", pointers, inputSourceType);
285285

286286

287287
OculusHand handDevice = new OculusHand(TrackingState.Tracked, handedness, inputSource);
@@ -292,7 +292,7 @@ private OculusHand GetOrAddHand(Handedness handedness, OVRHand ovrHand)
292292
handDevice.InputSource.Pointers[i].Controller = handDevice;
293293
}
294294

295-
inputSystem?.RaiseSourceDetected(handDevice.InputSource, handDevice);
295+
Service?.RaiseSourceDetected(handDevice.InputSource, handDevice);
296296

297297
trackedHands.Add(handedness, handDevice);
298298

Assets/MRTK/Providers/WindowsMixedReality/XRSDK/WindowsMixedRealityDeviceManager.cs

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,16 @@
44
using Microsoft.MixedReality.Toolkit.Input;
55
using Microsoft.MixedReality.Toolkit.Utilities;
66
using Microsoft.MixedReality.Toolkit.Windows.Utilities;
7+
using Microsoft.MixedReality.Toolkit.WindowsMixedReality;
78
using Microsoft.MixedReality.Toolkit.XRSDK.Input;
89
using System;
9-
using System.Linq;
10-
using System.Collections.Generic;
11-
using UnityEngine;
1210
using UnityEngine.XR;
13-
using UnityEngine.XR.Management;
14-
#if WMR_ENABLED
15-
using UnityEngine.XR.WindowsMR;
16-
#endif
17-
using Unity.Profiling;
18-
using Microsoft.MixedReality.Toolkit.WindowsMixedReality;
1911

2012
#if HP_CONTROLLER_ENABLED
2113
using Microsoft.MixedReality.Input;
2214
using MotionControllerHandedness = Microsoft.MixedReality.Input.Handedness;
23-
using Handedness = Microsoft.MixedReality.Toolkit.Utilities.Handedness;
15+
using System.Collections.Generic;
16+
using Unity.Profiling;
2417
#endif
2518

2619
#if WINDOWS_UWP
@@ -72,7 +65,7 @@ public override void Enable()
7265
{
7366
return;
7467
}
75-
#endif
68+
#endif // WMR_ENABLED
7669

7770
if (WindowsMixedRealityUtilities.UtilitiesProvider == null)
7871
{
@@ -87,7 +80,7 @@ public override void Enable()
8780
motionControllerWatcher.MotionControllerAdded += AddTrackedMotionController;
8881
motionControllerWatcher.MotionControllerRemoved += RemoveTrackedMotionController;
8982
var nowait = motionControllerWatcher.StartAsync();
90-
#endif
83+
#endif // HP_CONTROLLER_ENABLED
9184
}
9285

9386
/// <inheritdoc />
@@ -161,7 +154,7 @@ public override bool CheckCapability(MixedRealityCapability capability)
161154
private readonly Dictionary<uint, MotionControllerState> trackedMotionControllerStates = new Dictionary<uint, MotionControllerState>();
162155

163156
private readonly Dictionary<uint, GenericXRSDKController> activeMotionControllers = new Dictionary<uint, GenericXRSDKController>();
164-
#endif
157+
#endif // HP_CONTROLLER_ENABLED
165158

166159
#endregion IMixedRealityCapabilityCheck Implementation
167160

@@ -177,7 +170,7 @@ protected override GenericXRSDKController GetOrAddController(InputDevice inputDe
177170
{
178171
return null;
179172
}
180-
#endif
173+
#endif // WMR_ENABLED
181174

182175
using (GetOrAddControllerPerfMarker.Auto())
183176
{
@@ -228,29 +221,25 @@ private void RemoveTrackedMotionController(object sender, MotionController motio
228221
}
229222
}
230223
}
231-
#endif
232224

233-
#if HP_CONTROLLER_ENABLED
234-
// Creates a unique key for the controller based on it's vendor ID, product ID, version number, and handedness
225+
// Creates a unique key for the controller based on its vendor ID, product ID, version number, and handedness
235226
private uint GetControllerId(uint handedness)
236227
{
237228
return handedness;
238229
}
239230

240-
#if HP_CONTROLLER_ENABLED
241231
private uint GetControllerId(MotionController mc)
242232
{
243-
var handedness = ((uint)(mc.Handedness == MotionControllerHandedness.Right ? 2 : (mc.Handedness == MotionControllerHandedness.Left ? 1 : 0)));
233+
var handedness = (uint)(mc.Handedness == MotionControllerHandedness.Right ? 2 : (mc.Handedness == MotionControllerHandedness.Left ? 1 : 0));
244234
return GetControllerId(handedness);
245235
}
246-
#endif
247236

248237
private uint GetControllerId(InputDevice inputDevice)
249238
{
250-
var handedness = ((uint)(inputDevice.characteristics.HasFlag(InputDeviceCharacteristics.Right) ? 2 : inputDevice.characteristics.HasFlag(InputDeviceCharacteristics.Left) ? 1 : 0));
239+
var handedness = (uint)(inputDevice.characteristics.HasFlag(InputDeviceCharacteristics.Right) ? 2 : (inputDevice.characteristics.HasFlag(InputDeviceCharacteristics.Left) ? 1 : 0));
251240
return GetControllerId(handedness);
252241
}
253-
#endif
242+
#endif // HP_CONTROLLER_ENABLED
254243

255244
/// <inheritdoc />
256245
protected override Type GetControllerType(SupportedControllerType supportedControllerType)
@@ -260,7 +249,8 @@ protected override Type GetControllerType(SupportedControllerType supportedContr
260249
{
261250
return null;
262251
}
263-
#endif
252+
#endif // WMR_ENABLED
253+
264254
switch (supportedControllerType)
265255
{
266256
case SupportedControllerType.WindowsMixedReality:

Assets/MRTK/Providers/XRSDK/XRSDKDeviceManager.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,11 @@ public virtual bool CheckCapability(MixedRealityCapability capability)
4646
private readonly List<InputDevice> inputDevicesSubset = new List<InputDevice>();
4747
private readonly List<InputDevice> lastInputDevices = new List<InputDevice>();
4848

49-
private List<InputDeviceCharacteristics> GenericDesiredInputCharacteristics = new List<InputDeviceCharacteristics>()
49+
protected virtual List<InputDeviceCharacteristics> DesiredInputCharacteristics { get; set; } = new List<InputDeviceCharacteristics>()
5050
{
5151
InputDeviceCharacteristics.Controller,
5252
InputDeviceCharacteristics.HandTracking
5353
};
54-
protected virtual List<InputDeviceCharacteristics> DesiredInputCharacteristics
55-
{
56-
get { return GenericDesiredInputCharacteristics; }
57-
set { GenericDesiredInputCharacteristics = value; }
58-
}
5954

6055
private static readonly ProfilerMarker UpdatePerfMarker = new ProfilerMarker("[MRTK] XRSDKDeviceManager.Update");
6156

@@ -163,7 +158,9 @@ protected virtual GenericXRSDKController GetOrAddController(InputDevice inputDev
163158
Type controllerType = GetControllerType(currentControllerType);
164159

165160
if (controllerType == null)
161+
{
166162
return null;
163+
}
167164

168165
InputSourceType inputSourceType = GetInputSourceType(currentControllerType);
169166

0 commit comments

Comments
 (0)