Skip to content

Commit

Permalink
Move input subsystem implementations to the input package.
Browse files Browse the repository at this point in the history
  • Loading branch information
shaynie committed Jun 22, 2023
1 parent 14ba625 commit 570be7a
Show file tree
Hide file tree
Showing 28 changed files with 32 additions and 18 deletions.
1 change: 1 addition & 0 deletions UnityProjects/MRTKDevTemplate/Packages/packages-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@
"source": "local",
"dependencies": {
"com.microsoft.mrtk.core": "3.0.0",
"com.microsoft.mrtk.input": "3.0.0",
"com.microsoft.mrtk.tts.windows": "1.0.1"
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.XR;

namespace Microsoft.MixedReality.Toolkit.Subsystems
Expand All @@ -20,7 +21,7 @@ namespace Microsoft.MixedReality.Toolkit.Subsystems
/// See <see cref="MRTKHandsAggregatorSubsystem"> for the MRTK implementation.
/// </remarks>
/// </summary>
public interface IHandsAggregatorSubsystem
public interface IHandsAggregatorSubsystem : ISubsystem
{
/// <summary>
/// The playspace-local pose of the near interaction point.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the MIT License.

using System;
using UnityEngine;

namespace Microsoft.MixedReality.Toolkit.Subsystems
{
Expand All @@ -11,7 +12,7 @@ namespace Microsoft.MixedReality.Toolkit.Subsystems
/// MUST implement this interface, preferably with a direct 1:1 mapping
/// between the provider surface and the subsystem surface.
/// </summary>
public interface IDictationSubsystem
public interface IDictationSubsystem : ISubsystem
{
/// <summary>
/// Start dictation with default configurations.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the MIT License.

using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;

namespace Microsoft.MixedReality.Toolkit.Subsystems
Expand All @@ -12,7 +13,7 @@ namespace Microsoft.MixedReality.Toolkit.Subsystems
/// MUST implement this interface, preferably with a direct 1:1 mapping
/// between the provider surface and the subsystem surface.
/// </summary>
public interface IKeywordRecognitionSubsystem
public interface IKeywordRecognitionSubsystem : ISubsystem
{
/// <summary>
/// Add or update a keyword to recognize.
Expand Down
2 changes: 1 addition & 1 deletion com.microsoft.mrtk.core/Utilities/HandsUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static class HandsUtils
/// The first running <see cref="HandsAggregatorSubsystem"/> instance, or null.
/// </returns>
[Obsolete("Deprecated, please use XRSubsystemHelpers.HandsAggregator")]
public static HandsAggregatorSubsystem GetSubsystem() => XRSubsystemHelpers.HandsAggregator;
public static IHandsAggregatorSubsystem GetSubsystem() => XRSubsystemHelpers.HandsAggregator;

internal static readonly HandFinger[] HandFingers = Enum.GetValues(typeof(HandFinger)) as HandFinger[];

Expand Down
18 changes: 9 additions & 9 deletions com.microsoft.mrtk.core/Utilities/XRSubsystemHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,52 +152,52 @@ public static XRDisplaySubsystem DisplaySubsystem
}
}

private static HandsAggregatorSubsystem handsAggregator = null;
private static IHandsAggregatorSubsystem handsAggregator = null;

/// <summary>
/// The currently loaded and running hands aggregator, if any.
/// </summary>
public static HandsAggregatorSubsystem HandsAggregator
public static IHandsAggregatorSubsystem HandsAggregator
{
get
{
if (handsAggregator == null || !handsAggregator.running)
{
handsAggregator = GetFirstRunningSubsystem<HandsAggregatorSubsystem>();
handsAggregator = GetFirstRunningSubsystem<IHandsAggregatorSubsystem>();
}
return handsAggregator;
}
}

private static DictationSubsystem dictationSubsystem = null;
private static IDictationSubsystem dictationSubsystem = null;

/// <summary>
/// The currently loaded and running dictation subsystem, if any.
/// </summary>
public static DictationSubsystem DictationSubsystem
public static IDictationSubsystem DictationSubsystem
{
get
{
if (dictationSubsystem == null || !dictationSubsystem.running)
{
dictationSubsystem = GetFirstRunningSubsystem<DictationSubsystem>();
dictationSubsystem = GetFirstRunningSubsystem<IDictationSubsystem>();
}
return dictationSubsystem;
}
}

private static KeywordRecognitionSubsystem keywordRecognitionSubsystem = null;
private static IKeywordRecognitionSubsystem keywordRecognitionSubsystem = null;

/// <summary>
/// The currently loaded and running keyword recognition subsystem, if any.
/// </summary>
public static KeywordRecognitionSubsystem KeywordRecognitionSubsystem
public static IKeywordRecognitionSubsystem KeywordRecognitionSubsystem
{
get
{
if (keywordRecognitionSubsystem == null || !keywordRecognitionSubsystem.running)
{
keywordRecognitionSubsystem = GetFirstRunningSubsystem<KeywordRecognitionSubsystem>();
keywordRecognitionSubsystem = GetFirstRunningSubsystem<IKeywordRecognitionSubsystem>();
}
return keywordRecognitionSubsystem;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class ArticulatedHandController : ActionBasedController
#region Properties

[Obsolete("Deprecated, please use XRSubsystemHelpers.HandsAggregator instead.")]
protected HandsAggregatorSubsystem HandsAggregator => XRSubsystemHelpers.HandsAggregator;
protected HandsAggregatorSubsystem HandsAggregator => (HandsAggregatorSubsystem)XRSubsystemHelpers.HandsAggregator;

#endregion Properties

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class MRTKRayInteractor :
/// Cached reference to hands aggregator for efficient per-frame use.
/// </summary>
[Obsolete("Deprecated, please use XRSubsystemHelpers.HandsAggregator instead.")]
protected HandsAggregatorSubsystem HandsAggregator => XRSubsystemHelpers.HandsAggregator;
protected HandsAggregatorSubsystem HandsAggregator => (HandsAggregatorSubsystem)XRSubsystemHelpers.HandsAggregator;

/// <summary>
/// How unselected the interactor must be to initiate a new hover or selection on a new target.
Expand Down
8 changes: 8 additions & 0 deletions com.microsoft.mrtk.input/Subsystems/Speech.meta

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 @@ -16,7 +16,7 @@ public abstract class HandBasedPoseSource : IPoseSource
/// Cached reference to hands aggregator for efficient per-frame use.
/// </summary>
[Obsolete("Deprecated, please use XRSubsystemHelpers.HandsAggregator instead.")]
protected HandsAggregatorSubsystem HandsAggregator => XRSubsystemHelpers.HandsAggregator;
protected HandsAggregatorSubsystem HandsAggregator => (HandsAggregatorSubsystem)XRSubsystemHelpers.HandsAggregator;

[SerializeField]
[Tooltip("The hand on which to track the joint.")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class ControllerVisualizer : MonoBehaviour
/// Cached reference to hands aggregator for efficient per-frame use.
/// </summary>
[Obsolete("Deprecated, please use XRSubsystemHelpers.HandsAggregator instead.")]
protected HandsAggregatorSubsystem HandsAggregator => XRSubsystemHelpers.HandsAggregator;
protected HandsAggregatorSubsystem HandsAggregator => (HandsAggregatorSubsystem)XRSubsystemHelpers.HandsAggregator;

[SerializeField]
[Tooltip("The input action we key into to determine whether this controller is tracked or not")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ private set
/// <summary>
/// The keyword recognition subsystem that was stopped by this component.
/// </summary>
private KeywordRecognitionSubsystem keywordRecognitionSubsystem = null;
private IKeywordRecognitionSubsystem keywordRecognitionSubsystem = null;

/// <summary>
/// The inner text value set via the `Text` property
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"rootNamespace": "Microsoft.MixedReality.Toolkit.Speech.Windows",
"references": [
"Microsoft.MixedReality.Toolkit.Core",
"Microsoft.MixedReality.Toolkit.Input",
"Microsoft.MixedReality.OpenXR",
"Microsoft.MixedReality.Toolkit.TextToSpeech.Windows"
],
Expand Down
1 change: 1 addition & 0 deletions com.microsoft.mrtk.windowsspeech/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"unity": "2021.3",
"dependencies": {
"com.microsoft.mrtk.core": "3.0.0",
"com.microsoft.mrtk.input": "3.0.0",
"com.microsoft.mrtk.tts.windows": "1.0.1"
}
}

0 comments on commit 570be7a

Please sign in to comment.