Skip to content

Commit 95debef

Browse files
Merge branch 'mrtk_development' into vNEXT-SpatialMouse
# Conflicts: # Assets/MixedRealityToolkit-SDK/Profiles/DefaultMixedRealityRegisteredComponentsProfile.asset
2 parents 1ac8e87 + 60e6a6f commit 95debef

File tree

8 files changed

+122
-46
lines changed

8 files changed

+122
-46
lines changed

Assets/MixedRealityToolkit-SDK/Profiles/DefaultMixedRealityRegisteredComponentsProfile.asset

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,52 +19,45 @@ MonoBehaviour:
1919
priority: 10
2020
runtimePlatform: -1
2121
configurationProfile: {fileID: 0}
22-
editorPlatform: -1
2322
- componentType:
2423
reference: Microsoft.MixedReality.Toolkit.Core.Devices.OpenVR.OpenVRDeviceManager,
2524
Microsoft.MixedReality.Toolkit
2625
componentName: Unity Open VR Device Manager
2726
priority: 10
28-
runtimePlatform: 20548
27+
runtimePlatform: -1
2928
configurationProfile: {fileID: 0}
30-
editorPlatform: 2884080
3129
- componentType:
3230
reference: Microsoft.MixedReality.Toolkit.Core.Devices.WindowsMixedReality.WindowsMixedRealityDeviceManager,
3331
Microsoft.MixedReality.Toolkit
3432
componentName: Mixed Reality Device Manager
3533
priority: 10
36-
runtimePlatform: 2752512
34+
runtimePlatform: 8
3735
configurationProfile: {fileID: 0}
38-
editorPlatform: 131204
3936
- componentType:
4037
reference: Microsoft.MixedReality.Toolkit.Core.Devices.VoiceInput.WindowsSpeechInputDeviceManager,
4138
Microsoft.MixedReality.Toolkit
4239
componentName: Windows Speech Input Manager
4340
priority: 10
44-
runtimePlatform: 2752580
41+
runtimePlatform: 9
4542
configurationProfile: {fileID: 0}
46-
editorPlatform: 131204
4743
- componentType:
4844
reference: Microsoft.MixedReality.Toolkit.Core.Devices.VoiceInput.WindowsDictationInputDeviceManager,
4945
Microsoft.MixedReality.Toolkit
5046
componentName: Windows Dictation Input Manager
5147
priority: 10
52-
runtimePlatform: 2752580
48+
runtimePlatform: 9
5349
configurationProfile: {fileID: 0}
54-
editorPlatform: 131204
5550
- componentType:
5651
reference: Microsoft.MixedReality.Toolkit.Core.Devices.UnityInput.UnityTouchDeviceManager,
5752
Microsoft.MixedReality.Toolkit
5853
componentName: Unity Touch Input Manger
5954
priority: 10
6055
runtimePlatform: -1
6156
configurationProfile: {fileID: 0}
62-
editorPlatform: -1
6357
- componentType:
6458
reference: Microsoft.MixedReality.Toolkit.Core.Devices.UnityInput.MouseDeviceManager,
6559
Microsoft.MixedReality.Toolkit
66-
componentName: Mouse Device Manager
60+
componentName: Unity Spatial Mouse Input
6761
priority: 10
6862
runtimePlatform: -1
6963
configurationProfile: {fileID: 0}
70-
editorPlatform: -1

Assets/MixedRealityToolkit/_Core/Definitions/MixedRealityComponentConfiguration.cs

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,13 @@ public struct MixedRealityComponentConfiguration
2323
/// <param name="priority">The priority this system, feature, or manager will be initialized in.</param>
2424
/// <param name="runtimePlatform">The runtime platform(s) to run this system, feature, or manager on.</param>
2525
/// <param name="configurationProfile">The configuration profile for the system, feature, or manager.</param>
26-
/// <param name="editorPlatform">The editor platform(s) to run this system, feature, or manager on.</param>
27-
public MixedRealityComponentConfiguration(SystemType componentType, string componentName, uint priority, RuntimePlatform runtimePlatform, ScriptableObject configurationProfile
28-
#if UNITY_EDITOR
29-
, UnityEditor.BuildTarget editorPlatform
30-
#endif
31-
)
26+
public MixedRealityComponentConfiguration(SystemType componentType, string componentName, uint priority, SupportedPlatforms runtimePlatform, ScriptableObject configurationProfile)
3227
{
3328
this.componentType = componentType;
3429
this.componentName = componentName;
3530
this.priority = priority;
3631
this.runtimePlatform = runtimePlatform;
3732
this.configurationProfile = configurationProfile;
38-
#if UNITY_EDITOR
39-
this.editorPlatform = editorPlatform;
40-
#endif
4133
}
4234

4335
[SerializeField]
@@ -67,12 +59,12 @@ public MixedRealityComponentConfiguration(SystemType componentType, string compo
6759

6860
[EnumFlags]
6961
[SerializeField]
70-
private RuntimePlatform runtimePlatform;
62+
private SupportedPlatforms runtimePlatform;
7163

7264
/// <summary>
7365
/// The runtime platform(s) to run this system, feature, or manager on.
7466
/// </summary>
75-
public RuntimePlatform RuntimePlatform => runtimePlatform;
67+
public SupportedPlatforms RuntimePlatform => runtimePlatform;
7668

7769
[SerializeField]
7870
private ScriptableObject configurationProfile;
@@ -81,16 +73,5 @@ public MixedRealityComponentConfiguration(SystemType componentType, string compo
8173
/// The configuration profile for the system, feature, or manager.
8274
/// </summary>
8375
public ScriptableObject ConfigurationProfile => configurationProfile;
84-
85-
#if UNITY_EDITOR
86-
[EnumFlags]
87-
[SerializeField]
88-
private UnityEditor.BuildTarget editorPlatform;
89-
90-
/// <summary>
91-
/// The editor platform(s) to run this system, feature, or manager on.
92-
/// </summary>
93-
public UnityEditor.BuildTarget EditorPlatform => editorPlatform;
94-
#endif
9576
}
9677
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License. See LICENSE in the project root for license information.
3+
4+
using System;
5+
6+
namespace Microsoft.MixedReality.Toolkit.Core.Definitions.Utilities
7+
{
8+
/// <summary>
9+
/// The supported platforms for Mixed Reality Toolkit Components and Features.
10+
/// </summary>
11+
[Flags]
12+
public enum SupportedPlatforms
13+
{
14+
WindowsStandalone = 1 << 0,
15+
MacStandalone = 1 << 1,
16+
LinuxStandalone = 1 << 2,
17+
WindowsUniversal = 1 << 3,
18+
}
19+
}

Assets/MixedRealityToolkit/_Core/Definitions/Utilities/SupportedPlatforms.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/MixedRealityToolkit/_Core/Inspectors/Profiles/MixedRealityRegisteredComponentsProfileInspector.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,9 @@ private void RenderList(SerializedProperty list)
6363
var priority = managerConfig.FindPropertyRelative("priority");
6464
priority.intValue = 10;
6565
var runtimePlatform = managerConfig.FindPropertyRelative("runtimePlatform");
66-
runtimePlatform.intValue = (int)Application.platform;
66+
runtimePlatform.intValue = -1;
6767
var configurationProfile = managerConfig.FindPropertyRelative("configurationProfile");
6868
configurationProfile.objectReferenceValue = null;
69-
var editorPlatform = managerConfig.FindPropertyRelative("editorPlatform");
70-
editorPlatform.intValue = (int)EditorUserBuildSettings.activeBuildTarget;
7169
serializedObject.ApplyModifiedProperties();
7270
var componentType = ((MixedRealityRegisteredComponentsProfile)serializedObject.targetObject).Configurations[list.arraySize - 1].ComponentType;
7371
componentType.Type = null;
@@ -98,7 +96,6 @@ private void RenderList(SerializedProperty list)
9896
var componentType = managerConfig.FindPropertyRelative("componentType");
9997
var priority = managerConfig.FindPropertyRelative("priority");
10098
var runtimePlatform = managerConfig.FindPropertyRelative("runtimePlatform");
101-
var editorPlatform = managerConfig.FindPropertyRelative("editorPlatform");
10299
var configurationProfile = managerConfig.FindPropertyRelative("configurationProfile");
103100

104101
GUILayout.BeginVertical();
@@ -125,11 +122,11 @@ private void RenderList(SerializedProperty list)
125122
EditorGUILayout.PropertyField(componentType);
126123
EditorGUILayout.PropertyField(priority);
127124
EditorGUILayout.PropertyField(runtimePlatform);
128-
EditorGUILayout.PropertyField(editorPlatform);
129125
EditorGUILayout.PropertyField(configurationProfile);
130126

131127
if (EditorGUI.EndChangeCheck())
132128
{
129+
serializedObject.ApplyModifiedProperties();
133130
MixedRealityManager.Instance.ResetConfiguration(MixedRealityManager.Instance.ActiveProfile);
134131
}
135132

Assets/MixedRealityToolkit/_Core/Managers/MixedRealityManager.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -192,21 +192,18 @@ private void Initialize()
192192
for (int i = 0; i < ActiveProfile.RegisteredComponentsProfile.Configurations?.Length; i++)
193193
{
194194
var configuration = ActiveProfile.RegisteredComponentsProfile.Configurations[i];
195+
195196
#if UNITY_EDITOR
196-
if ((UnityEditor.EditorUserBuildSettings.activeBuildTarget & configuration.EditorPlatform) != 0 &&
197-
configuration.ComponentType.Type != null)
198-
{
199-
AddManager(typeof(IMixedRealityComponent), Activator.CreateInstance(configuration.ComponentType, configuration.ComponentName, configuration.Priority) as IMixedRealityComponent);
200-
}
197+
if (UnityEditor.EditorUserBuildSettings.activeBuildTarget.IsPlatformSupported(configuration.RuntimePlatform))
201198
#else
202-
if ((Application.platform & configuration.RuntimePlatform) != 0)
199+
if (Application.platform.IsPlatformSupported(configuration.RuntimePlatform))
200+
#endif
203201
{
204202
if (configuration.ComponentType.Type != null)
205203
{
206204
AddManager(typeof(IMixedRealityComponent), Activator.CreateInstance(configuration.ComponentType, configuration.ComponentName, configuration.Priority) as IMixedRealityComponent);
207205
}
208206
}
209-
#endif
210207
}
211208
}
212209

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License. See LICENSE in the project root for license information.
3+
4+
using Microsoft.MixedReality.Toolkit.Core.Definitions.Utilities;
5+
using UnityEngine;
6+
7+
namespace Microsoft.MixedReality.Toolkit.Core.Utilities
8+
{
9+
public static class PlatformUtility
10+
{
11+
public static bool IsPlatformSupported(this RuntimePlatform runtimePlatform, SupportedPlatforms platform)
12+
{
13+
if (platform == (SupportedPlatforms)(-1))
14+
{
15+
return true;
16+
}
17+
18+
switch (runtimePlatform)
19+
{
20+
case RuntimePlatform.WindowsPlayer:
21+
case RuntimePlatform.WindowsEditor:
22+
return (platform & SupportedPlatforms.WindowsStandalone) != 0;
23+
case RuntimePlatform.WSAPlayerARM:
24+
case RuntimePlatform.WSAPlayerX86:
25+
case RuntimePlatform.WSAPlayerX64:
26+
case RuntimePlatform.XboxOne:
27+
return (platform & SupportedPlatforms.WindowsUniversal) != 0;
28+
case RuntimePlatform.OSXEditor:
29+
case RuntimePlatform.OSXPlayer:
30+
return (platform & SupportedPlatforms.MacStandalone) != 0;
31+
case RuntimePlatform.LinuxPlayer:
32+
case RuntimePlatform.LinuxEditor:
33+
return (platform & SupportedPlatforms.LinuxStandalone) != 0;
34+
default:
35+
return false;
36+
}
37+
}
38+
39+
#if UNITY_EDITOR
40+
public static bool IsPlatformSupported(this UnityEditor.BuildTarget editorBuildTarget, SupportedPlatforms platform)
41+
{
42+
if (platform == (SupportedPlatforms)(-1))
43+
{
44+
return true;
45+
}
46+
47+
switch (editorBuildTarget)
48+
{
49+
case UnityEditor.BuildTarget.StandaloneWindows:
50+
case UnityEditor.BuildTarget.StandaloneWindows64:
51+
return (platform & SupportedPlatforms.WindowsStandalone) != 0;
52+
case UnityEditor.BuildTarget.WSAPlayer:
53+
case UnityEditor.BuildTarget.XboxOne:
54+
return (platform & SupportedPlatforms.WindowsUniversal) != 0;
55+
case UnityEditor.BuildTarget.StandaloneOSX:
56+
return (platform & SupportedPlatforms.MacStandalone) != 0;
57+
case UnityEditor.BuildTarget.StandaloneLinux:
58+
case UnityEditor.BuildTarget.StandaloneLinux64:
59+
case UnityEditor.BuildTarget.StandaloneLinuxUniversal:
60+
return (platform & SupportedPlatforms.LinuxStandalone) != 0;
61+
default:
62+
return false;
63+
}
64+
}
65+
#endif
66+
}
67+
}

Assets/MixedRealityToolkit/_Core/Utilities/PlatformUtility.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)