From 481fc3013088ea8953c905c880e73b0888b9449c Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Sun, 26 Apr 2020 13:53:37 -0400 Subject: [PATCH] Feature/controller mapping refactor (#71) * updated wmr controller data provider * removed commented out class * added controller data provider reference to the controller * updated references * fixed references * Added default controller definitions * updated the controller data provider inspector fixed naming for controller definition * updated hand data provider profile inspector * removed redundant inspector * cleaned up the controller interaction mappings a bit * updated references * updated controller instance creation * added default constructor * updated TryRenderController method * removed asset menu * fixed compiler error * Remove obsolete SetupDefaultIntreactions (#65) * updated reference * added WMR Camera Data Provider * updated WMR Camera Data Provider * updated camera rig reference * updated icon * moved WMR Camera data provider into correct file location * updated data provider constructors * added service parent reference * Change requests for controller provider inspectors (#67) * Update indent levels for WMR settings * Cache GUIContent * Added rig reset override * reverted changes * removed unused reference * added camera profile * Updated windows controller type name to get the controller textures to show up correctly based on the type name * fixed reference to renamed controller class * fixed more type references Co-authored-by: Dino Fejzagic --- ...ndowsMixedRealityControllerDataProvider.cs | 41 ++++++++---------- ...sMixedRealityHandControllerDataProvider.cs | 27 ++++++------ ...=> WindowsMixedRealityMotionController.cs} | 43 ++++++++----------- ...ndowsMixedRealityMotionController.cs.meta} | 0 .../SpatialInteractionSourceKindExtensions.cs | 2 +- ...yControllerDataProviderProfileInspector.cs | 31 +++++++------ ...dControllerDataProviderProfileInspector.cs | 23 ---------- ...rollerDataProviderProfileInspector.cs.meta | 11 ----- ...MotionControllerMappingProfileInspector.cs | 14 ------ ...nControllerMappingProfileInspector.cs.meta | 11 ----- ...xedRealityControllerDataProviderProfile.cs | 17 +++++++- ...ealityHandControllerDataProviderProfile.cs | 3 -- ...edRealityMotionControllerMappingProfile.cs | 40 ----------------- ...lityMotionControllerMappingProfile.cs.meta | 11 ----- 14 files changed, 83 insertions(+), 191 deletions(-) rename Controllers/{WindowsMixedRealityController.cs => WindowsMixedRealityMotionController.cs} (86%) rename Controllers/{WindowsMixedRealityController.cs.meta => WindowsMixedRealityMotionController.cs.meta} (100%) delete mode 100644 Inspectors/WindowsMixedRealityHandControllerDataProviderProfileInspector.cs delete mode 100644 Inspectors/WindowsMixedRealityHandControllerDataProviderProfileInspector.cs.meta delete mode 100644 Inspectors/WindowsMixedRealityMotionControllerMappingProfileInspector.cs delete mode 100644 Inspectors/WindowsMixedRealityMotionControllerMappingProfileInspector.cs.meta delete mode 100644 Profiles/WindowsMixedRealityMotionControllerMappingProfile.cs delete mode 100644 Profiles/WindowsMixedRealityMotionControllerMappingProfile.cs.meta diff --git a/Controllers/WindowsMixedRealityControllerDataProvider.cs b/Controllers/WindowsMixedRealityControllerDataProvider.cs index 347b730..1ee9dee 100644 --- a/Controllers/WindowsMixedRealityControllerDataProvider.cs +++ b/Controllers/WindowsMixedRealityControllerDataProvider.cs @@ -6,6 +6,7 @@ using XRTK.WindowsMixedReality.Profiles; #if UNITY_WSA +using System; using System.Collections.Generic; using UnityEngine; using UnityEngine.XR.WSA.Input; @@ -19,7 +20,6 @@ #endif // UNITY_WSA #if WINDOWS_UWP -using System; using Windows.ApplicationModel.Core; using Windows.Perception; using Windows.Storage.Streams; @@ -387,57 +387,53 @@ protected override void OnDispose(bool finalizing) /// Source State provided by the SDK /// Should the Source be added as a controller if it isn't found? /// New or Existing Controller Input Source - private WindowsMixedRealityController GetController(InteractionSource interactionSource, bool addController = false) + private WindowsMixedRealityMotionController GetController(InteractionSource interactionSource, bool addController = false) { //If a device is already registered with the ID provided, just return it. if (activeControllers.ContainsKey(interactionSource.id)) { - var controller = activeControllers[interactionSource.id] as WindowsMixedRealityController; + var controller = activeControllers[interactionSource.id] as WindowsMixedRealityMotionController; Debug.Assert(controller != null); return controller; } if (!addController) { return null; } - Handedness controllingHand; + Handedness handedness; + switch (interactionSource.handedness) { default: - controllingHand = Handedness.None; + handedness = Handedness.None; break; case InteractionSourceHandedness.Left: - controllingHand = Handedness.Left; + handedness = Handedness.Left; break; case InteractionSourceHandedness.Right: - controllingHand = Handedness.Right; + handedness = Handedness.Right; break; } - var pointers = interactionSource.supportsPointing ? RequestPointers(typeof(WindowsMixedRealityController), controllingHand) : null; - var nameModifier = controllingHand == Handedness.None ? interactionSource.kind.ToString() : controllingHand.ToString(); - var inputSource = MixedRealityToolkit.InputSystem?.RequestNewGenericInputSource($"Mixed Reality Controller {nameModifier}", pointers); - var detectedController = new WindowsMixedRealityController(this, TrackingState.NotApplicable, controllingHand, inputSource); + WindowsMixedRealityMotionController detectedController; - if (!detectedController.SetupConfiguration(typeof(WindowsMixedRealityController))) + try + { + detectedController = new WindowsMixedRealityMotionController(this, TrackingState.NotApplicable, handedness, GetControllerMappingProfile(typeof(WindowsMixedRealityMotionController), handedness)); + } + catch (Exception e) { - // Controller failed to be setup correctly. - // Return null so we don't raise the source detected. + Debug.LogError($"Failed to create {nameof(WindowsMixedRealityMotionController)}!\n{e}"); return null; } TryRenderControllerModel(interactionSource, detectedController); - for (int i = 0; i < detectedController.InputSource?.Pointers?.Length; i++) - { - detectedController.InputSource.Pointers[i].Controller = detectedController; - } - activeControllers.Add(interactionSource.id, detectedController); AddController(detectedController); return detectedController; } - private static async void TryRenderControllerModel(InteractionSource interactionSource, WindowsMixedRealityController controller) + private static async void TryRenderControllerModel(InteractionSource interactionSource, WindowsMixedRealityMotionController controller) { #if WINDOWS_UWP if (!UnityEngine.XR.WSA.HolographicSettings.IsDisplayOpaque) { return; } @@ -481,11 +477,10 @@ async void DispatchedHandler() Debug.LogError("Failed to load model data!"); } - // This really isn't an error, we actually can call TryRenderControllerModelAsync here. - await controller.TryRenderControllerModelAsync(typeof(WindowsMixedRealityController), glbModelData, interactionSource.kind == InteractionSourceKind.Hand); + await controller.TryRenderControllerModelAsync(glbModelData, interactionSource.kind == InteractionSourceKind.Hand); } #else - await controller.TryRenderControllerModelAsync(typeof(WindowsMixedRealityController), null, interactionSource.kind == InteractionSourceKind.Hand); + await controller.TryRenderControllerModelAsync(null, interactionSource.kind == InteractionSourceKind.Hand); #endif // WINDOWS_UWP } diff --git a/Controllers/WindowsMixedRealityHandControllerDataProvider.cs b/Controllers/WindowsMixedRealityHandControllerDataProvider.cs index 328481d..5fdc8ce 100644 --- a/Controllers/WindowsMixedRealityHandControllerDataProvider.cs +++ b/Controllers/WindowsMixedRealityHandControllerDataProvider.cs @@ -197,7 +197,7 @@ private bool TryGetController(Handedness handedness, out MixedRealityHandControl private MixedRealityHandController CreateController(SpatialInteractionSource spatialInteractionSource) { // We are creating a new controller for the source, determine the type of controller to use. - Type controllerType = spatialInteractionSource.Kind.ToControllerType(); + var controllerType = spatialInteractionSource.Kind.ToControllerType(); if (controllerType == null || controllerType != typeof(MixedRealityHandController)) { @@ -205,17 +205,17 @@ private MixedRealityHandController CreateController(SpatialInteractionSource spa return null; } - // Ready to create the controller instance. - var controllingHand = spatialInteractionSource.Handedness.ToHandedness(); - var pointers = spatialInteractionSource.IsPointingSupported ? RequestPointers(controllerType, controllingHand, true) : null; - var nameModifier = controllingHand == Handedness.None ? spatialInteractionSource.Kind.ToString() : controllingHand.ToString(); - var inputSource = MixedRealityToolkit.InputSystem?.RequestNewGenericInputSource($"Mixed Reality Hand Controller {nameModifier}", pointers); - var detectedController = new MixedRealityHandController(this, TrackingState.NotApplicable, controllingHand, inputSource); + var handedness = spatialInteractionSource.Handedness.ToHandedness(); - if (!detectedController.SetupConfiguration(controllerType)) + MixedRealityHandController detectedController; + + try + { + detectedController = new MixedRealityHandController(this, TrackingState.NotApplicable, handedness, GetControllerMappingProfile(typeof(MixedRealityHandController), handedness)); + } + catch (Exception e) { - // Controller failed to be setup correctly. - // Return null so we don't raise the source detected. + Debug.LogError($"Failed to create {nameof(MixedRealityHandController)}!\n{e}"); return null; } @@ -226,13 +226,10 @@ private MixedRealityHandController CreateController(SpatialInteractionSource spa MixedRealityToolkit.InputSystem?.RaiseSourceDetected(detectedController.InputSource, detectedController); - if (MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile.ControllerVisualizationProfile.RenderMotionControllers) - { - detectedController.TryRenderControllerModel(controllerType); - } + detectedController.TryRenderControllerModel(); AddController(detectedController); - activeControllers.Add(controllingHand, detectedController); + activeControllers.Add(handedness, detectedController); return detectedController; } diff --git a/Controllers/WindowsMixedRealityController.cs b/Controllers/WindowsMixedRealityMotionController.cs similarity index 86% rename from Controllers/WindowsMixedRealityController.cs rename to Controllers/WindowsMixedRealityMotionController.cs index 73c19ad..33d7855 100644 --- a/Controllers/WindowsMixedRealityController.cs +++ b/Controllers/WindowsMixedRealityMotionController.cs @@ -1,10 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. +using XRTK.Definitions.Controllers; using XRTK.Definitions.Devices; -using XRTK.Definitions.InputSystem; using XRTK.Definitions.Utilities; -using XRTK.Interfaces.InputSystem; using XRTK.Interfaces.Providers.Controllers; using XRTK.Providers.Controllers; @@ -20,11 +19,13 @@ namespace XRTK.WindowsMixedReality.Controllers /// /// A Windows Mixed Reality Controller Instance. /// - public class WindowsMixedRealityController : BaseController + public class WindowsMixedRealityMotionController : BaseController { + public WindowsMixedRealityMotionController() : base() { } + /// - public WindowsMixedRealityController(IMixedRealityControllerDataProvider controllerDataProvider, TrackingState trackingState, Handedness controllerHandedness, IMixedRealityInputSource inputSource = null, MixedRealityInteractionMapping[] interactions = null) - : base(controllerDataProvider, trackingState, controllerHandedness, inputSource, interactions) + public WindowsMixedRealityMotionController(IMixedRealityControllerDataProvider controllerDataProvider, TrackingState trackingState, Handedness controllerHandedness, MixedRealityControllerMappingProfile controllerMappingProfile) + : base(controllerDataProvider, trackingState, controllerHandedness, controllerMappingProfile) { } @@ -34,18 +35,18 @@ public WindowsMixedRealityController(IMixedRealityControllerDataProvider control /// A single interaction mapping works for both left and right controllers. public override MixedRealityInteractionMapping[] DefaultInteractions => new[] { - new MixedRealityInteractionMapping(0, "Spatial Pointer", AxisType.SixDof, DeviceInputType.SpatialPointer, MixedRealityInputAction.None), - new MixedRealityInteractionMapping(1, "Spatial Grip", AxisType.SixDof, DeviceInputType.SpatialGrip, MixedRealityInputAction.None), - new MixedRealityInteractionMapping(2, "Grip Press", AxisType.SingleAxis, DeviceInputType.TriggerPress, MixedRealityInputAction.None), - new MixedRealityInteractionMapping(3, "Trigger Position", AxisType.SingleAxis, DeviceInputType.Trigger, MixedRealityInputAction.None), - new MixedRealityInteractionMapping(4, "Trigger Touched", AxisType.Digital, DeviceInputType.TriggerTouch, MixedRealityInputAction.None), - new MixedRealityInteractionMapping(5, "Trigger Press (Select)", AxisType.Digital, DeviceInputType.Select, MixedRealityInputAction.None), - new MixedRealityInteractionMapping(6, "Touchpad Position", AxisType.DualAxis, DeviceInputType.Touchpad, MixedRealityInputAction.None), - new MixedRealityInteractionMapping(7, "Touchpad Touch", AxisType.Digital, DeviceInputType.TouchpadTouch, MixedRealityInputAction.None), - new MixedRealityInteractionMapping(8, "Touchpad Press", AxisType.Digital, DeviceInputType.TouchpadPress, MixedRealityInputAction.None), - new MixedRealityInteractionMapping(9, "Menu Press", AxisType.Digital, DeviceInputType.Menu, MixedRealityInputAction.None), - new MixedRealityInteractionMapping(10, "Thumbstick Position", AxisType.DualAxis, DeviceInputType.ThumbStick, MixedRealityInputAction.None), - new MixedRealityInteractionMapping(11, "Thumbstick Press", AxisType.Digital, DeviceInputType.ThumbStickPress, MixedRealityInputAction.None), + new MixedRealityInteractionMapping("Spatial Pointer", AxisType.SixDof, DeviceInputType.SpatialPointer), + new MixedRealityInteractionMapping("Spatial Grip", AxisType.SixDof, DeviceInputType.SpatialGrip), + new MixedRealityInteractionMapping("Grip Press", AxisType.SingleAxis, DeviceInputType.TriggerPress), + new MixedRealityInteractionMapping("Trigger Position", AxisType.SingleAxis, DeviceInputType.Trigger), + new MixedRealityInteractionMapping("Trigger Touched", AxisType.Digital, DeviceInputType.TriggerTouch), + new MixedRealityInteractionMapping("Trigger Press (Select)", AxisType.Digital, DeviceInputType.Select), + new MixedRealityInteractionMapping("Touchpad Position", AxisType.DualAxis, DeviceInputType.Touchpad), + new MixedRealityInteractionMapping("Touchpad Touch", AxisType.Digital, DeviceInputType.TouchpadTouch), + new MixedRealityInteractionMapping("Touchpad Press", AxisType.Digital, DeviceInputType.TouchpadPress), + new MixedRealityInteractionMapping("Menu Press", AxisType.Digital, DeviceInputType.Menu), + new MixedRealityInteractionMapping("Thumbstick Position", AxisType.DualAxis, DeviceInputType.ThumbStick), + new MixedRealityInteractionMapping("Thumbstick Press", AxisType.Digital, DeviceInputType.ThumbStickPress), }; /// @@ -54,12 +55,6 @@ public WindowsMixedRealityController(IMixedRealityControllerDataProvider control /// public override MixedRealityInteractionMapping[] DefaultRightHandedInteractions => DefaultInteractions; - /// - public override void SetupDefaultInteractions(Handedness controllerHandedness) - { - AssignControllerMappings(DefaultInteractions); - } - #if UNITY_WSA /// @@ -133,7 +128,7 @@ public void UpdateController(InteractionSourceState interactionSourceState) UpdateMenuData(interactionSourceState, interactionMapping); break; default: - Debug.LogError($"Input [{interactionMapping.InputType}] is not handled for this controller [{GetType().Name}]"); + Debug.LogError($"Input [{interactionMapping.Description}.{interactionMapping.InputType}] is not handled for this controller [{GetType().Name}]"); Enabled = false; break; } diff --git a/Controllers/WindowsMixedRealityController.cs.meta b/Controllers/WindowsMixedRealityMotionController.cs.meta similarity index 100% rename from Controllers/WindowsMixedRealityController.cs.meta rename to Controllers/WindowsMixedRealityMotionController.cs.meta diff --git a/Extensions/SpatialInteractionSourceKindExtensions.cs b/Extensions/SpatialInteractionSourceKindExtensions.cs index 08c1c4f..a60d454 100644 --- a/Extensions/SpatialInteractionSourceKindExtensions.cs +++ b/Extensions/SpatialInteractionSourceKindExtensions.cs @@ -22,7 +22,7 @@ public static Type ToControllerType(this SpatialInteractionSourceKind spatialInt switch (spatialInteractionSourceKind) { case SpatialInteractionSourceKind.Controller: - return typeof(WindowsMixedRealityController); + return typeof(WindowsMixedRealityMotionController); case SpatialInteractionSourceKind.Hand: return typeof(MixedRealityHandController); default: diff --git a/Inspectors/WindowsMixedRealityControllerDataProviderProfileInspector.cs b/Inspectors/WindowsMixedRealityControllerDataProviderProfileInspector.cs index 75f4f9f..39f7d9f 100644 --- a/Inspectors/WindowsMixedRealityControllerDataProviderProfileInspector.cs +++ b/Inspectors/WindowsMixedRealityControllerDataProviderProfileInspector.cs @@ -2,13 +2,15 @@ // Licensed under the MIT License. See LICENSE in the project root for license information. using UnityEditor; -using XRTK.Inspectors.Profiles; +using UnityEngine; +using XRTK.Inspectors.Extensions; +using XRTK.Inspectors.Profiles.InputSystem.Controllers; using XRTK.WindowsMixedReality.Profiles; namespace XRTK.WindowsMixedReality.Inspectors { [CustomEditor(typeof(WindowsMixedRealityControllerDataProviderProfile))] - public class WindowsMixedRealityControllerDataProviderProfileInspector : BaseMixedRealityProfileInspector + public class WindowsMixedRealityControllerDataProviderProfileInspector : BaseMixedRealityControllerDataProviderProfileInspector { private SerializedProperty manipulationGestures; private SerializedProperty useRailsNavigation; @@ -16,6 +18,9 @@ public class WindowsMixedRealityControllerDataProviderProfileInspector : BaseMix private SerializedProperty railsNavigationGestures; private SerializedProperty windowsGestureAutoStart; + bool showGestureSettings = true; + private static readonly GUIContent gestureSettingsFoldoutHeader = new GUIContent("Windows Gesture Settings"); + protected override void OnEnable() { base.OnEnable(); @@ -29,20 +34,20 @@ protected override void OnEnable() public override void OnInspectorGUI() { - RenderHeader(); - - 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); + base.OnInspectorGUI(); serializedObject.Update(); EditorGUILayout.Space(); - EditorGUILayout.LabelField("Windows Gesture Settings", EditorStyles.boldLabel); - EditorGUILayout.PropertyField(windowsGestureAutoStart); - EditorGUILayout.PropertyField(manipulationGestures); - EditorGUILayout.PropertyField(navigationGestures); - EditorGUILayout.PropertyField(useRailsNavigation); - EditorGUILayout.PropertyField(railsNavigationGestures); + showGestureSettings = EditorGUILayoutExtensions.FoldoutWithBoldLabel(showGestureSettings, gestureSettingsFoldoutHeader, true); + if (showGestureSettings) + { + EditorGUILayout.PropertyField(windowsGestureAutoStart); + EditorGUILayout.PropertyField(manipulationGestures); + EditorGUILayout.PropertyField(navigationGestures); + EditorGUILayout.PropertyField(useRailsNavigation); + EditorGUILayout.PropertyField(railsNavigationGestures); + } + serializedObject.ApplyModifiedProperties(); } } diff --git a/Inspectors/WindowsMixedRealityHandControllerDataProviderProfileInspector.cs b/Inspectors/WindowsMixedRealityHandControllerDataProviderProfileInspector.cs deleted file mode 100644 index b99814d..0000000 --- a/Inspectors/WindowsMixedRealityHandControllerDataProviderProfileInspector.cs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) XRTK. All rights reserved. -// Licensed under the MIT License. See LICENSE in the project root for license information. - -using UnityEditor; -using XRTK.Inspectors.Profiles.InputSystem.Controllers; -using XRTK.WindowsMixedReality.Profiles; - -namespace XRTK.WindowsMixedReality.Inspectors -{ - [CustomEditor(typeof(WindowsMixedRealityHandControllerDataProviderProfile))] - public class WindowsMixedRealityHandControllerDataProviderProfileInspector : BaseMixedRealityHandControllerDataProviderProfileInspector - { - public override void OnInspectorGUI() - { - RenderHeader(); - - EditorGUILayout.Space(); - EditorGUILayout.LabelField("Windows Mixed Reality Hand Controller Data Provider Settings", EditorStyles.boldLabel); - - base.OnInspectorGUI(); - } - } -} \ No newline at end of file diff --git a/Inspectors/WindowsMixedRealityHandControllerDataProviderProfileInspector.cs.meta b/Inspectors/WindowsMixedRealityHandControllerDataProviderProfileInspector.cs.meta deleted file mode 100644 index c7b976e..0000000 --- a/Inspectors/WindowsMixedRealityHandControllerDataProviderProfileInspector.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: fd86308f7d99ef344bf0b3259392f28a -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {fileID: 2800000, guid: 6e2e9d716bbb4d8382bd53f11996b90e, type: 3} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Inspectors/WindowsMixedRealityMotionControllerMappingProfileInspector.cs b/Inspectors/WindowsMixedRealityMotionControllerMappingProfileInspector.cs deleted file mode 100644 index 1ce9782..0000000 --- a/Inspectors/WindowsMixedRealityMotionControllerMappingProfileInspector.cs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE in the project root for license information. - -using UnityEditor; -using XRTK.Inspectors.Profiles.InputSystem.Controllers; -using XRTK.WindowsMixedReality.Profiles; - -namespace XRTK.WindowsMixedReality.Inspectors -{ - [CustomEditor(typeof(WindowsMixedRealityMotionControllerMappingProfile))] - public class WindowsMixedRealityMotionControllerMappingProfileInspector : BaseMixedRealityControllerMappingProfileInspector - { - } -} \ No newline at end of file diff --git a/Inspectors/WindowsMixedRealityMotionControllerMappingProfileInspector.cs.meta b/Inspectors/WindowsMixedRealityMotionControllerMappingProfileInspector.cs.meta deleted file mode 100644 index ff6e36c..0000000 --- a/Inspectors/WindowsMixedRealityMotionControllerMappingProfileInspector.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 29d5fb20be1d4120acd4fa19b95b8aeb -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {fileID: 2800000, guid: 6e2e9d716bbb4d8382bd53f11996b90e, type: 3} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Profiles/WindowsMixedRealityControllerDataProviderProfile.cs b/Profiles/WindowsMixedRealityControllerDataProviderProfile.cs index 4be8456..9c38b99 100644 --- a/Profiles/WindowsMixedRealityControllerDataProviderProfile.cs +++ b/Profiles/WindowsMixedRealityControllerDataProviderProfile.cs @@ -1,12 +1,15 @@ -using UnityEngine; +// Copyright (c) XRTK. All rights reserved. +// Licensed under the MIT License. See LICENSE in the project root for license information. + +using UnityEngine; using XRTK.Attributes; using XRTK.Definitions.InputSystem; using XRTK.Definitions.Utilities; using XRTK.Definitions.Controllers; +using XRTK.WindowsMixedReality.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] @@ -49,5 +52,15 @@ public class WindowsMixedRealityControllerDataProviderProfile : BaseMixedReality private AutoStartBehavior windowsGestureAutoStart = AutoStartBehavior.AutoStart; public AutoStartBehavior WindowsGestureAutoStart => windowsGestureAutoStart; + + public override ControllerDefinition[] GetDefaultControllerOptions() + { + return new[] + { + new ControllerDefinition("HoloLensController", typeof(WindowsMixedRealityMotionController)), + new ControllerDefinition(typeof(WindowsMixedRealityMotionController), Handedness.Left), + new ControllerDefinition(typeof(WindowsMixedRealityMotionController), Handedness.Right), + }; + } } } \ No newline at end of file diff --git a/Profiles/WindowsMixedRealityHandControllerDataProviderProfile.cs b/Profiles/WindowsMixedRealityHandControllerDataProviderProfile.cs index b1e7ffb..93717af 100644 --- a/Profiles/WindowsMixedRealityHandControllerDataProviderProfile.cs +++ b/Profiles/WindowsMixedRealityHandControllerDataProviderProfile.cs @@ -1,13 +1,10 @@ // Copyright (c) XRTK. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. -using UnityEngine; -using XRTK.Definitions.Utilities; using XRTK.Definitions.Controllers.Hands; namespace XRTK.WindowsMixedReality.Profiles { - [CreateAssetMenu(menuName = "Mixed Reality Toolkit/Input System/Controller Data Providers/Windows Mixed Reality Hand", fileName = "WindowsMixedRealityHandControllerDataProviderProfile", order = (int)CreateProfileMenuItemIndices.Input)] public class WindowsMixedRealityHandControllerDataProviderProfile : BaseHandControllerDataProviderProfile { } diff --git a/Profiles/WindowsMixedRealityMotionControllerMappingProfile.cs b/Profiles/WindowsMixedRealityMotionControllerMappingProfile.cs deleted file mode 100644 index 604f723..0000000 --- a/Profiles/WindowsMixedRealityMotionControllerMappingProfile.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE in the project root for license information. - -using UnityEngine; -using XRTK.Definitions.Controllers; -using XRTK.Definitions.Devices; -using XRTK.Definitions.Utilities; -using XRTK.Providers.Controllers; -using XRTK.Providers.Controllers.OpenVR; -using XRTK.WindowsMixedReality.Controllers; - -namespace XRTK.WindowsMixedReality.Profiles -{ - [CreateAssetMenu(menuName = "Mixed Reality Toolkit/Input System/Controller Mappings/Windows Mixed Reality Controller Mapping Profile", fileName = "WindowsMixedRealityControllerMappingProfile")] - public class WindowsMixedRealityMotionControllerMappingProfile : BaseMixedRealityControllerMappingProfile - { - /// - public override SupportedControllerType ControllerType => SupportedControllerType.WindowsMixedReality; - - /// - public override string TexturePath => $"{base.TexturePath}MotionController"; - - protected override void Awake() - { - if (!HasSetupDefaults) - { - ControllerMappings = new[] - { - new MixedRealityControllerMapping("Windows Mixed Reality HoloLens Hand Input", typeof(WindowsMixedRealityController)), - new MixedRealityControllerMapping("Windows Mixed Reality Motion Controller Left", typeof(WindowsMixedRealityController), Handedness.Left), - new MixedRealityControllerMapping("Windows Mixed Reality Motion Controller Right", typeof(WindowsMixedRealityController), Handedness.Right), - new MixedRealityControllerMapping("Open VR Motion Controller Left", typeof(WindowsMixedRealityOpenVRMotionController), Handedness.Left), - new MixedRealityControllerMapping("Open VR Motion Controller Right", typeof(WindowsMixedRealityOpenVRMotionController), Handedness.Right), - }; - } - - base.Awake(); - } - } -} \ No newline at end of file diff --git a/Profiles/WindowsMixedRealityMotionControllerMappingProfile.cs.meta b/Profiles/WindowsMixedRealityMotionControllerMappingProfile.cs.meta deleted file mode 100644 index e7b1e75..0000000 --- a/Profiles/WindowsMixedRealityMotionControllerMappingProfile.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: a77269983a934c18a85a96fdff6e0ef6 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {fileID: 2800000, guid: 6e2e9d716bbb4d8382bd53f11996b90e, type: 3} - userData: - assetBundleName: - assetBundleVariant: