Skip to content
This repository has been archived by the owner on May 13, 2022. It is now read-only.

ControllerDataProviderProfile updates #3

Merged
merged 19 commits into from
Apr 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added .gitmodules
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ public class WindowsDictationDataProvider : BaseDictationDataProvider
/// </summary>
/// <param name="name"></param>
/// <param name="priority"></param>

public WindowsDictationDataProvider(string name, uint priority) : base(name, priority)
/// <param name="profile"></param>
public WindowsDictationDataProvider(string name, uint priority, BaseMixedRealityControllerDataProviderProfile profile)
: base(name, priority, profile)
{
#if UNITY_STANDALONE_WIN || UNITY_WSA || UNITY_EDITOR_WIN
if (dictationRecognizer == null)
Expand Down Expand Up @@ -176,7 +177,7 @@ public override async Task StartRecordingAsync(GameObject listener = null, float

// Query the maximum frequency of the default microphone.
deviceName = micDeviceName;
Microphone.GetDeviceCaps(deviceName, out int minSamplingRate, out samplingRate);
Microphone.GetDeviceCaps(deviceName, out var minSamplingRate, out samplingRate);

dictationRecognizer.InitialSilenceTimeoutSeconds = initialSilenceTimeout;
dictationRecognizer.AutoSilenceTimeoutSeconds = autoSilenceTimeout;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the MIT License. See LICENSE in the project root for license information.

using XRTK.Providers.Controllers;
using XRTK.WindowsMixedReality.Profiles;

#if UNITY_WSA
using System.Collections.Generic;
Expand Down Expand Up @@ -38,16 +39,21 @@ public class WindowsMixedRealityDataProvider : BaseControllerDataProvider
/// </summary>
/// <param name="name"></param>
/// <param name="priority"></param>
public WindowsMixedRealityDataProvider(string name, uint priority) : base(name, priority)
/// <param name="profile"></param>
public WindowsMixedRealityDataProvider(string name, uint priority, WindowsMixedRealityControllerDataProviderProfile profile)
: base(name, priority, profile)
{
#if UNITY_WSA
this.profile = profile;
gestureRecognizer = new GestureRecognizer();
navigationGestureRecognizer = new GestureRecognizer();
#endif // UNITY_WSA
}

#if UNITY_WSA

private readonly WindowsMixedRealityControllerDataProviderProfile profile;

/// <summary>
/// Dictionary to capture all active controllers detected
/// </summary>
Expand Down Expand Up @@ -240,10 +246,10 @@ public override void Enable()
MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile.GesturesProfile != null)
{
var gestureProfile = MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile.GesturesProfile;
GestureSettings = gestureProfile.ManipulationGestures;
NavigationSettings = gestureProfile.NavigationGestures;
RailsNavigationSettings = gestureProfile.RailsNavigationGestures;
UseRailsNavigation = gestureProfile.UseRailsNavigation;
GestureSettings = profile.ManipulationGestures;
NavigationSettings = profile.NavigationGestures;
RailsNavigationSettings = profile.RailsNavigationGestures;
UseRailsNavigation = profile.UseRailsNavigation;

for (int i = 0; i < gestureProfile.Gestures.Length; i++)
{
Expand Down Expand Up @@ -289,7 +295,7 @@ public override void Enable()

if (MixedRealityToolkit.Instance.ActiveProfile.IsInputSystemEnabled &&
MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile.GesturesProfile != null &&
MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile.GesturesProfile.WindowsGestureAutoStart == AutoStartBehavior.AutoStart)
profile.WindowsGestureAutoStart == AutoStartBehavior.AutoStart)
{
GestureRecognizerEnabled = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ namespace XRTK.WindowsMixedReality.Controllers
/// </summary>
public class WindowsSpeechDataProvider : BaseSpeechDataProvider
{
public WindowsSpeechDataProvider(string name, uint priority) : base(name, priority)
public WindowsSpeechDataProvider(string name, uint priority, BaseMixedRealityControllerDataProviderProfile profile)
: base(name, priority, profile)
{
if (MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile == null)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// Copyright (c) XRTK. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

using UnityEditor;
using UnityEngine;
using XRTK.Definitions;
using XRTK.Inspectors.Profiles;
using XRTK.Inspectors.Utilities;
using XRTK.Services;
using XRTK.WindowsMixedReality.Profiles;

namespace XRTK.WindowsMixedReality.Inspectors
{
[CustomEditor(typeof(WindowsMixedRealityControllerDataProviderProfile))]
public class WindowsMixedRealityDataProviderProfileInspector : BaseMixedRealityProfileInspector
{
private SerializedProperty windowsManipulationGestureSettings;
private SerializedProperty useRailsNavigation;
private SerializedProperty windowsNavigationGestureSettings;
private SerializedProperty windowsRailsNavigationGestures;
private SerializedProperty windowsGestureAutoStart;

protected override void OnEnable()
{
base.OnEnable();

if (!MixedRealityInspectorUtility.CheckMixedRealityConfigured(false))
{
return;
}

windowsManipulationGestureSettings = serializedObject.FindProperty("manipulationGestures");
useRailsNavigation = serializedObject.FindProperty("useRailsNavigation");
windowsNavigationGestureSettings = serializedObject.FindProperty("navigationGestures");
windowsRailsNavigationGestures = serializedObject.FindProperty("railsNavigationGestures");
windowsGestureAutoStart = serializedObject.FindProperty("windowsGestureAutoStart");
}

public override void OnInspectorGUI()
{
MixedRealityInspectorUtility.RenderMixedRealityToolkitLogo();

if (!MixedRealityInspectorUtility.CheckMixedRealityConfigured()) { return; }

if (GUILayout.Button("Back to Controller Data Providers"))
{
Selection.activeObject = MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile.ControllerDataProvidersProfile;
}

EditorGUILayout.Space();
EditorGUILayout.LabelField("Windows Mixed Reality Controller Data Provider Settings", EditorStyles.boldLabel);
EditorGUILayout.HelpBox("This profile aids in configuring additional platform settings for the registered controller data provider. This can be anything from additional gestures or platform specific settings.", MessageType.Info);

(target as BaseMixedRealityProfile).CheckProfileLock();

serializedObject.Update();
EditorGUILayout.Space();
EditorGUILayout.LabelField("Windows Gesture Settings", EditorStyles.boldLabel);
EditorGUILayout.PropertyField(windowsGestureAutoStart);
EditorGUILayout.PropertyField(windowsManipulationGestureSettings);
EditorGUILayout.PropertyField(windowsNavigationGestureSettings);
EditorGUILayout.PropertyField(useRailsNavigation);
EditorGUILayout.PropertyField(windowsRailsNavigationGestures);
serializedObject.ApplyModifiedProperties();
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@

using UnityEditor;
using XRTK.Inspectors.Profiles;
using XRTK.WindowsMixedReality.Profiles;

namespace XRTK.WindowsMixedReality.Profiles.Inspectors
namespace XRTK.WindowsMixedReality.Inspectors
{
[CustomEditor(typeof(WindowsMixedRealityMotionControllerMappingProfile))]
public class WindowsMixedRealityMotionControllerMappingProfileInspector : BaseMixedRealityControllerMappingProfileInspector { }
public class WindowsMixedRealityMotionControllerMappingProfileInspector : BaseMixedRealityControllerMappingProfileInspector
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
using UnityEngine;
using XRTK.Attributes;
using XRTK.Definitions.InputSystem;
using XRTK.Definitions.Utilities;
using XRTK.Providers.Controllers;

namespace XRTK.WindowsMixedReality.Profiles
{
[CreateAssetMenu(menuName = "Mixed Reality Toolkit/Input System/Controller Data Providers/Windows Mixed Reality", fileName = "WindowsMixedRealityControllerDataProviderProfile", order = (int)CreateProfileMenuItemIndices.Input)]
public class WindowsMixedRealityControllerDataProviderProfile : BaseMixedRealityControllerDataProviderProfile
{
[EnumFlags]
[SerializeField]
[Tooltip("The recognizable Manipulation Gestures.")]
private WindowsGestureSettings manipulationGestures = 0;

/// <summary>
/// The recognizable Manipulation Gestures.
/// </summary>
public WindowsGestureSettings ManipulationGestures => manipulationGestures;

[EnumFlags]
[SerializeField]
[Tooltip("The recognizable Navigation Gestures.")]
private WindowsGestureSettings navigationGestures = 0;

/// <summary>
/// The recognizable Navigation Gestures.
/// </summary>
public WindowsGestureSettings NavigationGestures => navigationGestures;

[SerializeField]
[Tooltip("Should the Navigation use Rails on start?\nNote: This can be changed at runtime to switch between the two Navigation settings.")]
private bool useRailsNavigation = false;

public bool UseRailsNavigation => useRailsNavigation;

[EnumFlags]
[SerializeField]
[Tooltip("The recognizable Rails Navigation Gestures.")]
private WindowsGestureSettings railsNavigationGestures = 0;

/// <summary>
/// The recognizable Navigation Gestures.
/// </summary>
public WindowsGestureSettings RailsNavigationGestures => railsNavigationGestures;

[SerializeField]
private AutoStartBehavior windowsGestureAutoStart = AutoStartBehavior.AutoStart;

public AutoStartBehavior WindowsGestureAutoStart => windowsGestureAutoStart;
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace XRTK.WindowsMixedReality.Profiles
{
[CreateAssetMenu(menuName = "Mixed Reality Toolkit/Mixed Reality Controller Mappings/Windows Mixed Reality Controller Mapping Profile", fileName = "WindowsMixedRealityControllerMappingProfile")]
[CreateAssetMenu(menuName = "Mixed Reality Toolkit/Input System/Controller Mappings/Windows Mixed Reality Controller Mapping Profile", fileName = "WindowsMixedRealityControllerMappingProfile")]
public class WindowsMixedRealityMotionControllerMappingProfile : BaseMixedRealityControllerMappingProfile
{
/// <inheritdoc />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
// Licensed under the MIT License. See LICENSE in the project root for license information.

using UnityEngine;
using XRTK.Definitions.Utilities;
using XRTK.Providers.SpatialObservers;

namespace XRTK.WindowsMixedReality.Profiles
{
[CreateAssetMenu(menuName = "Mixed Reality Toolkit/Spatial Observers/Windows Mixed Reality Spatial Mesh Data Provider Profile", fileName = "WindowsMixedRealitySpatialMeshObserverProfile")]
[CreateAssetMenu(menuName = "Mixed Reality Toolkit/Spatial Observers/Windows Mixed Reality Spatial Mesh Data Provider Profile", fileName = "WindowsMixedRealitySpatialMeshObserverProfile", order = (int)CreateProfileMenuItemIndices.SpatialAwarenessDataProviders)]
public class WindowsMixedRealitySpatialMeshObserverProfile : BaseMixedRealitySpatialMeshObserverProfile { }
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,9 @@ public WindowsMixedRealitySpatialMeshObserver(string name, uint priority, Window
{
UnityEditor.PlayerSettings.WSA.SetCapability(UnityEditor.PlayerSettings.WSACapability.SpatialPerception, true);
}
#endif // UNITY_EDITOR

#endif // UNITY_EDITOR
observer = new SurfaceObserver();

// Apply the initial observer volume settings.
ConfigureObserverVolume(ObserverOrigin, ObservationExtents);
#endif // UNITY_WSA
}

Expand Down Expand Up @@ -168,14 +165,14 @@ void OnDataReady(SurfaceData cookedData, bool outputWritten, float elapsedCookTi
return;
}

if (!SpatialMeshObjects.TryGetValue(cookedData.id.handle, out SpatialMeshObject meshObject))
if (!SpatialMeshObjects.TryGetValue(cookedData.id.handle, out var meshObject))
{
// Likely it was removed before data could be cooked.
return;
}

// Apply the appropriate material to the mesh.
SpatialMeshDisplayOptions displayOption = MeshDisplayOption;
var displayOption = MeshDisplayOption;

if (displayOption != SpatialMeshDisplayOptions.None)
{
Expand Down Expand Up @@ -208,7 +205,7 @@ void OnDataReady(SurfaceData cookedData, bool outputWritten, float elapsedCookTi
}
}
}
else if (SpatialMeshObjects.TryGetValue(surfaceId.handle, out SpatialMeshObject meshObject))
else if (SpatialMeshObjects.TryGetValue(surfaceId.handle, out var meshObject))
{
RaiseMeshRemoved(meshObject);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,12 @@
"XRTK"
],
"optionalUnityReferences": [],
"includePlatforms": [
"Editor",
"WSA",
"WindowsStandalone32",
"WindowsStandalone64",
"XboxOne"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": []
"defineConstraints": [],
"versionDefines": []
}
15 changes: 12 additions & 3 deletions XRTK.WindowsMixedReality/Packages/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
"com.unity.analytics": "3.2.2",
"com.unity.package-manager-ui": "2.0.7",
"com.unity.xr.windowsmr.metro": "1.0.8",
"com.xrtk.core": "https://github.com/XRTK/XRTK-Core.git#0.1.0",
"com.xrtk.sdk": "https://github.com/XRTK/SDK.git#0.1.0",
"com.xrtk.upm-git-extension": "https://github.com/XRTK/UpmGitExtension.git#0.9.1",
"com.xrtk.core": "https://github.com/XRTK/XRTK-Core.git#0.1.2",
"com.xrtk.upm-git-extension": "https://github.com/XRTK/UpmGitExtension.git#0.9.4",
"com.unity.modules.ai": "1.0.0",
"com.unity.modules.animation": "1.0.0",
"com.unity.modules.assetbundle": "1.0.0",
Expand Down Expand Up @@ -36,5 +35,15 @@
"com.unity.modules.vr": "1.0.0",
"com.unity.modules.wind": "1.0.0",
"com.unity.modules.xr": "1.0.0"
},
"lock": {
"com.xrtk.upm-git-extension": {
"hash": "869a63adece6138e88881e85f89f7994983db696",
"revision": "0.9.4"
},
"com.xrtk.core": {
"hash": "c3e3c8fc9ae3549a1a501d07bff5dc3d857e2c94",
"revision": "0.1.2"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ PlayerSettings:
m_Automatic: 1
m_BuildTargetVRSettings:
- m_BuildTarget: Standalone
m_Enabled: 0
m_Enabled: 1
m_Devices:
- Oculus
- OpenVR
Expand Down Expand Up @@ -535,6 +535,7 @@ PlayerSettings:
platformArchitecture: {}
scriptingBackend:
Metro: 1
Standalone: 1
il2cppCompilerConfiguration: {}
managedStrippingLevel: {}
incrementalIl2cppBuild: {}
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
m_EditorVersion: 2018.3.10f1
m_EditorVersion: 2018.3.11f1