Skip to content

Commit 65905f8

Browse files
Updated project to 2018_2
Fixed some warning errors Resolved a Post OpenVR editor runtime issue (Editor only runs as standalone :D)
1 parent bb40bda commit 65905f8

File tree

8 files changed

+129
-52
lines changed

8 files changed

+129
-52
lines changed

Assets/MixedRealityToolkit/_Core/Devices/MixedReality/WindowsMixedRealityController.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
using Microsoft.MixedReality.Toolkit.Internal.Definitions.Devices;
55
using Microsoft.MixedReality.Toolkit.Internal.Definitions.Utilities;
66
using Microsoft.MixedReality.Toolkit.Internal.Interfaces.InputSystem;
7+
8+
#if UNITY_WSA
79
using Microsoft.MixedReality.Toolkit.Internal.Utilities;
810
using System;
911
using UnityEngine;
10-
11-
#if UNITY_WSA
1212
using UnityEngine.XR.WSA.Input;
1313
#endif
1414

Assets/MixedRealityToolkit/_Core/Devices/MixedReality/WindowsMixedRealityDeviceManager.cs

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License. See LICENSE in the project root for license information.
33

4-
using Microsoft.MixedReality.Toolkit.Internal.Definitions.Devices;
5-
using Microsoft.MixedReality.Toolkit.Internal.Definitions.Utilities;
64
using Microsoft.MixedReality.Toolkit.Internal.Interfaces;
7-
using System;
85
using System.Collections.Generic;
96
using System.Linq;
10-
using UnityEngine;
117

128
#if UNITY_WSA
9+
using Microsoft.MixedReality.Toolkit.Internal.Definitions.Devices;
10+
using Microsoft.MixedReality.Toolkit.Internal.Definitions.Utilities;
11+
using System;
1312
using UnityEngine.XR.WSA.Input;
14-
#endif
13+
using UnityEngine;
14+
#endif // UNITY_WSA
1515

1616
namespace Microsoft.MixedReality.Toolkit.Internal.Devices.WindowsMixedReality
1717
{
@@ -29,9 +29,15 @@ public WindowsMixedRealityDeviceManager(string name, uint priority) : base(name,
2929
/// </summary>
3030
private readonly Dictionary<uint, IMixedRealityController> activeControllers = new Dictionary<uint, IMixedRealityController>();
3131

32+
/// <inheritdoc/>
33+
public override IMixedRealityController[] GetActiveControllers()
34+
{
35+
return activeControllers.Values.ToArray();
36+
}
37+
3238
#if UNITY_WSA
3339

34-
#region IMixedRealityDeviceManager Interface
40+
#region IMixedRealityDeviceManager Interface
3541

3642
/// <inheritdoc/>
3743
public override void Enable()
@@ -42,7 +48,7 @@ public override void Enable()
4248
InteractionManager.InteractionSourceReleased += InteractionManager_InteractionSourceReleased;
4349
InteractionManager.InteractionSourceLost += InteractionManager_InteractionSourceLost;
4450

45-
InteractionSourceState[] states = InteractionManager.GetCurrentReading();
51+
UnityEngine.XR.WSA.Input.InteractionSourceState[] states = InteractionManager.GetCurrentReading();
4652

4753
// NOTE: We update the source state data, in case an app wants to query it on source detected.
4854
for (var i = 0; i < states.Length; i++)
@@ -60,29 +66,23 @@ public override void Disable()
6066
InteractionManager.InteractionSourceReleased -= InteractionManager_InteractionSourceReleased;
6167
InteractionManager.InteractionSourceLost -= InteractionManager_InteractionSourceLost;
6268

63-
InteractionSourceState[] states = InteractionManager.GetCurrentReading();
69+
UnityEngine.XR.WSA.Input.InteractionSourceState[] states = InteractionManager.GetCurrentReading();
6470
for (var i = 0; i < states.Length; i++)
6571
{
6672
RemoveController(states[i]);
6773
}
6874
}
6975

70-
/// <inheritdoc/>
71-
public override IMixedRealityController[] GetActiveControllers()
72-
{
73-
return activeControllers.Values.ToArray();
74-
}
76+
#endregion IMixedRealityDeviceManager Interface
7577

76-
#endregion IMixedRealityDeviceManager Interface
77-
78-
#region Controller Utilities
78+
#region Controller Utilities
7979

8080
/// <summary>
8181
/// Retrieve the source controller from the Active Store, or create a new device and register it
8282
/// </summary>
8383
/// <param name="interactionSourceState">Source State provided by the SDK</param>
8484
/// <returns>New or Existing Controller Input Source</returns>
85-
private WindowsMixedRealityController GetOrAddController(InteractionSourceState interactionSourceState, bool updateControllerData = true)
85+
private WindowsMixedRealityController GetOrAddController(UnityEngine.XR.WSA.Input.InteractionSourceState interactionSourceState, bool updateControllerData = true)
8686
{
8787
//If a device is already registered with the ID provided, just return it.
8888
if (activeControllers.ContainsKey(interactionSourceState.source.id))
@@ -127,16 +127,16 @@ private WindowsMixedRealityController GetOrAddController(InteractionSourceState
127127
/// Remove the selected controller from the Active Store
128128
/// </summary>
129129
/// <param name="interactionSourceState">Source State provided by the SDK to remove</param>
130-
private void RemoveController(InteractionSourceState interactionSourceState)
130+
private void RemoveController(UnityEngine.XR.WSA.Input.InteractionSourceState interactionSourceState)
131131
{
132132
var controller = GetOrAddController(interactionSourceState, false);
133133
InputSystem?.RaiseSourceLost(controller?.InputSource, controller);
134134
activeControllers.Remove(interactionSourceState.source.id);
135135
}
136136

137-
#endregion Controller Utilities
137+
#endregion Controller Utilities
138138

139-
#region Unity InteractionManager Events
139+
#region Unity InteractionManager Events
140140

141141
/// <summary>
142142
/// SDK Interaction Source Detected Event handler
@@ -184,8 +184,9 @@ private void InteractionManager_InteractionSourceLost(InteractionSourceLostEvent
184184
RemoveController(args.state);
185185
}
186186

187-
#endregion Unity InteractionManager Events
187+
#endregion Unity InteractionManager Events
188188

189189
#endif // UNITY_WSA
190+
190191
}
191192
}

Assets/MixedRealityToolkit/_Core/Managers/MixedRealityManager.cs

Lines changed: 59 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -167,30 +167,12 @@ private void Initialize()
167167
#endregion Managers Registration
168168

169169
#region SDK Initialization
170-
switch (Application.platform)
171-
{
172-
case RuntimePlatform.WindowsPlayer:
173-
case RuntimePlatform.WindowsEditor:
174-
AddManager(typeof(IMixedRealityDeviceManager), new OpenVRDeviceManager("OpenVR Device Manager", 10));
175-
break;
176-
case RuntimePlatform.OSXPlayer:
177-
case RuntimePlatform.OSXEditor:
178-
case RuntimePlatform.IPhonePlayer:
179-
break;
180-
case RuntimePlatform.Android:
181-
break;
182-
case RuntimePlatform.WebGLPlayer:
183-
break;
184-
case RuntimePlatform.WSAPlayerX86:
185-
case RuntimePlatform.WSAPlayerX64:
186-
case RuntimePlatform.WSAPlayerARM:
187-
AddManager(typeof(IMixedRealityDeviceManager), new WindowsMixedRealityDeviceManager("Mixed Reality Device Manager", 10));
188-
break;
189-
case RuntimePlatform.TizenPlayer:
190-
break;
191-
default:
192-
break;
193-
}
170+
171+
#if UNITY_EDITOR
172+
AddManagersForTheCurrentPlatformEditor();
173+
#else
174+
AddManagersForTheCurrentPlatform();
175+
#endif
194176

195177
#endregion SDK Initialization
196178

@@ -913,5 +895,58 @@ private void GetComponentByTypeAndName(Type type, string managerName, out IMixed
913895
#endregion Manager Utilities
914896

915897
#endregion Manager Container Management
898+
899+
#region Platform Selectors
900+
901+
private void AddManagersForTheCurrentPlatform()
902+
{
903+
switch (Application.platform)
904+
{
905+
case RuntimePlatform.WindowsPlayer:
906+
case RuntimePlatform.WindowsEditor:
907+
AddManager(typeof(IMixedRealityDeviceManager), new OpenVRDeviceManager("OpenVR Device Manager", 10));
908+
break;
909+
case RuntimePlatform.OSXPlayer:
910+
case RuntimePlatform.OSXEditor:
911+
case RuntimePlatform.IPhonePlayer:
912+
break;
913+
case RuntimePlatform.Android:
914+
break;
915+
case RuntimePlatform.WebGLPlayer:
916+
break;
917+
case RuntimePlatform.WSAPlayerX86:
918+
case RuntimePlatform.WSAPlayerX64:
919+
case RuntimePlatform.WSAPlayerARM:
920+
AddManager(typeof(IMixedRealityDeviceManager), new WindowsMixedRealityDeviceManager("Mixed Reality Device Manager", 10));
921+
break;
922+
default:
923+
break;
924+
}
925+
}
926+
927+
private void AddManagersForTheCurrentPlatformEditor()
928+
{
929+
switch (UnityEditor.EditorUserBuildSettings.activeBuildTarget)
930+
{
931+
case UnityEditor.BuildTarget.StandaloneWindows:
932+
case UnityEditor.BuildTarget.StandaloneWindows64:
933+
AddManager(typeof(IMixedRealityDeviceManager), new OpenVRDeviceManager("OpenVR Device Manager", 10));
934+
break;
935+
case UnityEditor.BuildTarget.StandaloneOSX:
936+
case UnityEditor.BuildTarget.iOS:
937+
break;
938+
case UnityEditor.BuildTarget.Android:
939+
break;
940+
case UnityEditor.BuildTarget.WebGL:
941+
break;
942+
case UnityEditor.BuildTarget.WSAPlayer:
943+
AddManager(typeof(IMixedRealityDeviceManager), new WindowsMixedRealityDeviceManager("Mixed Reality Device Manager", 10));
944+
break;
945+
default:
946+
break;
947+
}
948+
}
949+
950+
#endregion Platform Selectors
916951
}
917952
}

Assets/MixedRealityToolkit/_Core/Utilities/MotionController/MotionControllerVisualizer.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ namespace Microsoft.MixedReality.Toolkit.Internal.Utilities
3131
/// </summary>
3232
public class MotionControllerVisualizer : MonoBehaviour
3333
{
34+
#if UNITY_WSA
3435
[SerializeField]
3536
[Tooltip("This setting will be used to determine if the model, override or otherwise, should attempt to be animated based on the user's input.")]
3637
private bool animateControllerModel = true;
@@ -42,6 +43,7 @@ public class MotionControllerVisualizer : MonoBehaviour
4243
[SerializeField]
4344
[Tooltip("This setting will be used to determine if the model should always be the right alternate. If false, the platform controller models will be preferred, only if they can't be loaded will the alternate be used. Otherwise, it will always use the alternate model.")]
4445
private bool alwaysUseAlternateRightModel = false;
46+
#endif
4547

4648
[SerializeField]
4749
[Tooltip("Use a model with the tip in the positive Z direction and the front face in the positive Y direction. To override the platform left controller model set AlwaysUseAlternateModel to true; otherwise this will be the default if the model can't be found.")]

Packages/manifest.json

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,39 @@
11
{
2-
"dependencies": {
3-
}
2+
"dependencies": {
3+
"com.unity.ads": "2.0.8",
4+
"com.unity.analytics": "2.0.16",
5+
"com.unity.package-manager-ui": "1.9.11",
6+
"com.unity.purchasing": "2.0.3",
7+
"com.unity.textmeshpro": "1.2.4",
8+
"com.unity.modules.ai": "1.0.0",
9+
"com.unity.modules.animation": "1.0.0",
10+
"com.unity.modules.assetbundle": "1.0.0",
11+
"com.unity.modules.audio": "1.0.0",
12+
"com.unity.modules.cloth": "1.0.0",
13+
"com.unity.modules.director": "1.0.0",
14+
"com.unity.modules.imageconversion": "1.0.0",
15+
"com.unity.modules.imgui": "1.0.0",
16+
"com.unity.modules.jsonserialize": "1.0.0",
17+
"com.unity.modules.particlesystem": "1.0.0",
18+
"com.unity.modules.physics": "1.0.0",
19+
"com.unity.modules.physics2d": "1.0.0",
20+
"com.unity.modules.screencapture": "1.0.0",
21+
"com.unity.modules.terrain": "1.0.0",
22+
"com.unity.modules.terrainphysics": "1.0.0",
23+
"com.unity.modules.tilemap": "1.0.0",
24+
"com.unity.modules.ui": "1.0.0",
25+
"com.unity.modules.uielements": "1.0.0",
26+
"com.unity.modules.umbra": "1.0.0",
27+
"com.unity.modules.unityanalytics": "1.0.0",
28+
"com.unity.modules.unitywebrequest": "1.0.0",
29+
"com.unity.modules.unitywebrequestassetbundle": "1.0.0",
30+
"com.unity.modules.unitywebrequestaudio": "1.0.0",
31+
"com.unity.modules.unitywebrequesttexture": "1.0.0",
32+
"com.unity.modules.unitywebrequestwww": "1.0.0",
33+
"com.unity.modules.vehicles": "1.0.0",
34+
"com.unity.modules.video": "1.0.0",
35+
"com.unity.modules.vr": "1.0.0",
36+
"com.unity.modules.wind": "1.0.0",
37+
"com.unity.modules.xr": "1.0.0"
38+
}
439
}

ProjectSettings/EditorBuildSettings.asset

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,8 @@
44
EditorBuildSettings:
55
m_ObjectHideFlags: 0
66
serializedVersion: 2
7-
m_Scenes: []
7+
m_Scenes:
8+
- enabled: 1
9+
path: Assets/MixedRealityToolkit-SDK/TestData/01-Basic.unity
10+
guid: 40062d557f4d86642a5be478601540c2
11+
m_configObjects: {}

ProjectSettings/ProjectVersion.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
m_EditorVersion: 2018.1.7f1
1+
m_EditorVersion: 2018.2.0f2

ProjectSettings/UnityConnectSettings.asset

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
--- !u!310 &1
44
UnityConnectSettings:
55
m_ObjectHideFlags: 0
6-
m_Enabled: 0
6+
m_Enabled: 1
77
m_TestMode: 0
88
m_TestEventUrl:
99
m_TestConfigUrl:

0 commit comments

Comments
 (0)