Skip to content

Commit 2c09226

Browse files
author
David Kline (ANALOG)
committed
Merge remote-tracking branch 'upstream/mrtk_development' into serviceRegistrar
2 parents 1843b38 + 85bec97 commit 2c09226

File tree

64 files changed

+1664
-1447
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+1664
-1447
lines changed

Assets/MixedRealityToolkit.Examples/Demos/UX/Interactables/MixedRealityToolkit-Examples.Demos.UX.Interactables.asmdef renamed to Assets/MixedRealityToolkit.Examples/Demos/UX/Interactables/MixedRealityToolkit.Examples.Demos.UX.Interactables.asmdef

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "MixedRealityToolkit-Examples.Demos.UX.Interactables",
2+
"name": "MixedRealityToolkit.Examples.Demos.UX.Interactables",
33
"references": [
44
"Microsoft.MixedReality.Toolkit.SDK",
55
"Microsoft.MixedReality.Toolkit",
@@ -8,5 +8,9 @@
88
"optionalUnityReferences": [],
99
"includePlatforms": [],
1010
"excludePlatforms": [],
11-
"allowUnsafeCode": false
11+
"allowUnsafeCode": false,
12+
"overrideReferences": false,
13+
"precompiledReferences": [],
14+
"autoReferenced": true,
15+
"defineConstraints": []
1216
}

Assets/MixedRealityToolkit.Examples/Demos/UX/Interactables/MixedRealityToolkit-Examples.Demos.UX.Interactables.asmdef.meta renamed to Assets/MixedRealityToolkit.Examples/Demos/UX/Interactables/MixedRealityToolkit.Examples.Demos.UX.Interactables.asmdef.meta

File renamed without changes.

Assets/MixedRealityToolkit.Examples/Demos/Utilities/InspectorFields/Inspectors/MixedRealityToolkit-Examples.Demos.Utilities.InspectorFields.Inspectors.asmdef renamed to Assets/MixedRealityToolkit.Examples/Demos/Utilities/InspectorFields/Inspectors/MixedRealityToolkit.Examples.Demos.Utilities.InspectorFields.Inspectors.asmdef

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "MixedRealityToolkit-Examples.Demos.Utilities.InspectorFields.Inspectors",
2+
"name": "MixedRealityToolkit.Examples.Demos.Utilities.InspectorFields.Inspectors",
33
"references": [
44
"Microsoft.MixedReality.Toolkit.Core.Inspectors",
55
"Microsoft.MixedReality.Toolkit",
@@ -10,5 +10,9 @@
1010
"Editor"
1111
],
1212
"excludePlatforms": [],
13-
"allowUnsafeCode": false
13+
"allowUnsafeCode": false,
14+
"overrideReferences": false,
15+
"precompiledReferences": [],
16+
"autoReferenced": true,
17+
"defineConstraints": []
1418
}

Assets/MixedRealityToolkit.Examples/Demos/Utilities/InspectorFields/Inspectors/MixedRealityToolkit-Examples.Demos.Utilities.InspectorFields.Inspectors.asmdef.meta renamed to Assets/MixedRealityToolkit.Examples/Demos/Utilities/InspectorFields/Inspectors/MixedRealityToolkit.Examples.Demos.Utilities.InspectorFields.Inspectors.asmdef.meta

File renamed without changes.

Assets/MixedRealityToolkit.Providers/OpenVR/MixedRealityToolkit.Providers.OpenVR.asmdef

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"optionalUnityReferences": [],
77
"includePlatforms": [
88
"Editor",
9-
"LinuxStandalone32",
109
"LinuxStandalone64",
1110
"macOSStandalone",
1211
"WindowsStandalone32",

Assets/MixedRealityToolkit.SDK/Features/UX/Interactable/Scripts/Interactable.cs

Lines changed: 39 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
using Microsoft.MixedReality.Toolkit.SDK.UX.Interactable.Profile;
1212
using Microsoft.MixedReality.Toolkit.SDK.UX.Interactable.States;
1313
using Microsoft.MixedReality.Toolkit.SDK.UX.Interactable.Themes;
14+
using System;
1415
using System.Collections;
1516
using System.Collections.Generic;
1617
using UnityEngine;
@@ -41,7 +42,7 @@ public class Interactable : MonoBehaviour, IMixedRealityFocusHandler, IMixedReal
4142
/// </summary>
4243
private static IMixedRealityInputSystem inputSystem = null;
4344
protected static IMixedRealityInputSystem InputSystem => inputSystem ?? (inputSystem = MixedRealityToolkit.Instance.GetService<IMixedRealityInputSystem>());
44-
45+
4546
// list of pointers
4647
protected List<IMixedRealityPointer> pointers = new List<IMixedRealityPointer>();
4748
public List<IMixedRealityPointer> Focusers => pointers;
@@ -156,23 +157,25 @@ public void RemoveHandler(IInteractableHandler handler)
156157
}
157158

158159
#region InspectorHelpers
159-
/// <summary>
160-
/// Gets a list of input actions, used by the inspector
161-
/// </summary>
162-
/// <returns></returns>
163-
public static string[] GetInputActions()
160+
public static bool TryGetInputActions(out string[] descriptionsArray)
164161
{
162+
if (!MixedRealityToolkit.IsInitialized || !MixedRealityToolkit.HasActiveProfile)
163+
{
164+
descriptionsArray = null;
165+
return false;
166+
}
167+
165168
MixedRealityInputAction[] actions = MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile.InputActionsProfile.InputActions;
166169

167-
List<string> list = new List<string>();
170+
descriptionsArray = new string[actions.Length];
168171
for (int i = 0; i < actions.Length; i++)
169172
{
170-
list.Add(actions[i].Description);
173+
descriptionsArray[i] = actions[i].Description;
171174
}
172175

173-
return list.ToArray();
176+
return true;
174177
}
175-
178+
176179
/// <summary>
177180
/// Returns a list of states assigned to the Interactable
178181
/// </summary>
@@ -183,7 +186,7 @@ public State[] GetStates()
183186
{
184187
return States.GetStates();
185188
}
186-
189+
187190
return new State[0];
188191
}
189192
#endregion InspectorHelpers
@@ -208,17 +211,17 @@ private void OnEnable()
208211

209212
SetupVoiceCommand();
210213
}
211-
214+
212215
private void OnDisable()
213216
{
214217
if (IsGlobal)
215218
{
216219
InputSystem.Unregister(gameObject);
217220
}
218-
221+
219222
StopVoiceCommand();
220223
}
221-
224+
222225
protected virtual void Update()
223226
{
224227
if (rollOffTimer < rollOffTime && HasPress)
@@ -289,7 +292,7 @@ protected virtual void SetupStates()
289292
protected virtual void SetupEvents()
290293
{
291294
InteractableEvent.EventLists lists = InteractableEvent.GetEventTypes();
292-
295+
293296
for (int i = 0; i < Events.Count; i++)
294297
{
295298
Events[i].Receiver = InteractableEvent.GetReceiver(Events[i], lists);
@@ -323,7 +326,7 @@ protected virtual void SetupThemes()
323326
InteractableThemePropertySettings settings = theme.Settings[n];
324327

325328
settings.Theme = InteractableProfileItem.GetTheme(settings, Profiles[i].Target, lists);
326-
329+
327330
// add themes to theme list based on dimension
328331
if (j == dimensionIndex)
329332
{
@@ -332,7 +335,7 @@ protected virtual void SetupThemes()
332335

333336
tempSettings.Add(settings);
334337
}
335-
338+
336339
themeSettings.Settings = tempSettings;
337340
themeSettingsList.Add(themeSettings);
338341
}
@@ -344,7 +347,7 @@ protected virtual void SetupThemes()
344347
}
345348

346349
#endregion InteractableInitiation
347-
350+
348351
#region SetButtonStates
349352

350353
/// <summary>
@@ -364,7 +367,7 @@ public int GetStateValue(InteractableStates.InteractableStateEnum state)
364367
public virtual void SetFocus(bool focus)
365368
{
366369
HasFocus = focus;
367-
if(!focus && HasPress)
370+
if (!focus && HasPress)
368371
{
369372
rollOffTimer = 0;
370373
}
@@ -376,14 +379,14 @@ public virtual void SetFocus(bool focus)
376379
StateManager.SetStateValue(InteractableStates.InteractableStateEnum.Focus, focus ? 1 : 0);
377380
UpdateState();
378381
}
379-
382+
380383
public virtual void SetPress(bool press)
381384
{
382385
HasPress = press;
383386
StateManager.SetStateValue(InteractableStates.InteractableStateEnum.Pressed, press ? 1 : 0);
384387
UpdateState();
385388
}
386-
389+
387390
public virtual void SetDisabled(bool disabled)
388391
{
389392
IsDisabled = disabled;
@@ -546,7 +549,7 @@ public void OnFocusExit(FocusEventData eventData)
546549
#endregion MixedRealityFocusHandlers
547550

548551
#region MixedRealityPointerHandlers
549-
552+
550553
/// <summary>
551554
/// pointer up event has fired
552555
/// </summary>
@@ -692,7 +695,7 @@ public void OnInputDown(InputEventData eventData)
692695
{
693696
return;
694697
}
695-
698+
696699
if (StateManager != null)
697700
{
698701
if (eventData != null && ShouldListen(eventData.MixedRealityInputAction) && (eventData.MixedRealityInputAction != pointerInputAction || pointerInputAction == MixedRealityInputAction.None))
@@ -786,8 +789,8 @@ protected void IncreaseDimensionIndex()
786789
{
787790
dimensionIndex = 0;
788791
}
789-
790-
if(currentIndex != dimensionIndex)
792+
793+
if (currentIndex != dimensionIndex)
791794
{
792795
FilterThemesByDimensions();
793796
forceUpdate = true;
@@ -850,7 +853,7 @@ protected virtual bool CanInteract()
850853
return false;
851854
}
852855

853-
if (Dimensions > 1 && ((dimensionIndex != Dimensions -1 & !CanSelect) || (dimensionIndex == Dimensions - 1 & !CanDeselect)) )
856+
if (Dimensions > 1 && ((dimensionIndex != Dimensions - 1 & !CanSelect) || (dimensionIndex == Dimensions - 1 & !CanDeselect)))
854857
{
855858
return false;
856859
}
@@ -914,9 +917,10 @@ protected void StartGlobalVisual(bool voiceCommand = false)
914917
protected IEnumerator GlobalVisualReset(float time)
915918
{
916919
yield return new WaitForSeconds(time);
917-
920+
918921
StateManager.SetStateValue(InteractableStates.InteractableStateEnum.VoiceCommand, 0);
919-
if (!HasFocus) {
922+
if (!HasFocus)
923+
{
920924
StateManager.SetStateValue(InteractableStates.InteractableStateEnum.Focus, 0);
921925
}
922926

@@ -955,7 +959,7 @@ public void OnSpeechKeywordRecognized(SpeechEventData eventData)
955959
if (Enabled && ShouldListen(eventData.MixedRealityInputAction))
956960
{
957961
StartGlobalVisual(true);
958-
962+
959963
IncreaseDimensionIndex();
960964
SendVoiceCommands(eventData.RecognizedText, 0, 1);
961965

@@ -972,15 +976,15 @@ protected void SetupVoiceCommand()
972976
#if UNITY_STANDALONE_WIN || UNITY_WSA || UNITY_EDITOR_WIN
973977
if (!string.IsNullOrEmpty(VoiceCommand) && VoiceCommand.Length > 2)
974978
{
975-
voiceCommands = new string[] { VoiceCommand };
979+
voiceCommands = new string[] { VoiceCommand };
976980
if (VoiceCommand.IndexOf(",") > -1)
977981
{
978982
voiceCommands = VoiceCommand.Split(',');
979983
}
980984

981985
recognitionConfidenceLevel = MixedRealityToolkit.Instance.ActiveProfile.InputSystemProfile.SpeechCommandsProfile.SpeechRecognitionConfidenceLevel;
982986

983-
if(keywordRecognizer == null)
987+
if (keywordRecognizer == null)
984988
{
985989
keywordRecognizer = new KeywordRecognizer(voiceCommands, (ConfidenceLevel)recognitionConfidenceLevel);
986990
keywordRecognizer.OnPhraseRecognized += KeywordRecognizer_OnPhraseRecognized;
@@ -1015,7 +1019,7 @@ protected void KeywordRecognizer_OnPhraseRecognized(PhraseRecognizedEventArgs ar
10151019
{
10161020
if (args.text == VoiceCommand && (!RequiresFocus || HasFocus) && CanInteract())
10171021
{
1018-
1022+
10191023
if (CanInteract())
10201024
{
10211025
StartGlobalVisual(true);
@@ -1066,11 +1070,11 @@ protected void SendVoiceCommands(string command, int index, int length)
10661070
/// <returns></returns>
10671071
protected int GetVoiceCommandIndex(string command)
10681072
{
1069-
if(voiceCommands.Length > 1)
1073+
if (voiceCommands.Length > 1)
10701074
{
10711075
for (int i = 0; i < voiceCommands.Length; i++)
10721076
{
1073-
if(command == voiceCommands[i])
1077+
if (command == voiceCommands[i])
10741078
{
10751079
return i;
10761080
}
@@ -1079,7 +1083,7 @@ protected int GetVoiceCommandIndex(string command)
10791083

10801084
return 0;
10811085
}
1082-
1086+
10831087
#endregion VoiceCommands
10841088

10851089
}

Assets/MixedRealityToolkit.SDK/Features/UX/Scripts/Pointers/BaseControllerPointer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ protected override void OnEnable()
129129
{
130130
base.OnEnable();
131131

132-
if (MixedRealityToolkit.IsInitialized && MixedRealityToolkit.TeleportSystem != null && !lateRegisterTeleport)
132+
if (MixedRealityToolkit.IsTeleportSystemEnabled && MixedRealityToolkit.TeleportSystem != null && !lateRegisterTeleport)
133133
{
134134
MixedRealityToolkit.TeleportSystem.Register(gameObject);
135135
}
@@ -139,7 +139,7 @@ protected override async void Start()
139139
{
140140
base.Start();
141141

142-
if (lateRegisterTeleport && MixedRealityToolkit.Instance.ActiveProfile.IsTeleportSystemEnabled)
142+
if (lateRegisterTeleport && MixedRealityToolkit.IsTeleportSystemEnabled)
143143
{
144144
if (MixedRealityToolkit.TeleportSystem == null)
145145
{

Assets/MixedRealityToolkit.SDK/Features/UX/Scripts/Pointers/LinePointer.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ public override void OnPreRaycast()
120120
Vector3 pointerPosition;
121121
TryGetPointerPosition(out pointerPosition);
122122

123+
lineBase.UpdateMatrix();
124+
123125
// Set our first and last points
124126
lineBase.FirstPoint = pointerPosition;
125127

Assets/MixedRealityToolkit.SDK/Features/UX/Scripts/Pointers/TeleportPointer.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ protected Gradient GetLineGradient(TeleportSurfaceResult targetResult)
101101
#region IMixedRealityPointer Implementation
102102

103103
/// <inheritdoc />
104-
public override bool IsInteractionEnabled => !IsTeleportRequestActive && teleportEnabled;
104+
public override bool IsInteractionEnabled => !IsTeleportRequestActive && teleportEnabled && MixedRealityToolkit.IsTeleportSystemEnabled;
105105

106106
/// <inheritdoc />
107107
public override float PointerOrientation
@@ -251,7 +251,10 @@ public override void OnPostRaycast()
251251
public override void OnInputChanged(InputEventData<Vector2> eventData)
252252
{
253253
// Don't process input if we've got an active teleport request in progress.
254-
if (IsTeleportRequestActive) { return; }
254+
if (IsTeleportRequestActive || !MixedRealityToolkit.IsTeleportSystemEnabled)
255+
{
256+
return;
257+
}
255258

256259
if (eventData.SourceId == InputSourceParent.SourceId &&
257260
eventData.Handedness == Handedness &&

0 commit comments

Comments
 (0)