Skip to content

Commit cc5f781

Browse files
authored
Merge pull request #3552 from StephenHodgson/v2-misc-fixes
Misc doc fixes and Unity Object lifetime check bypass fixes
2 parents 017d6fa + 15f50fc commit cc5f781

File tree

29 files changed

+112
-106
lines changed

29 files changed

+112
-106
lines changed

Assets/MixedRealityToolkit.Examples/Demos/SpatialAwareness/Scripts/DemoSpatialMeshHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
namespace Microsoft.MixedReality.Toolkit.Examples.Demos
1313
{
1414
/// <summary>
15-
/// This class is an example of the <see cref="IMixedRealitySpatialAwarenessMeshHandler"/> interface. It keeps track
15+
/// This class is an example of the <see cref=" IMixedRealitySpatialAwarenessObservationHandler{T}"/> interface. It keeps track
1616
/// of the IDs of each mesh and tracks the number of updates they have received.
1717
/// </summary>
1818
public class DemoSpatialMeshHandler : MonoBehaviour, IMixedRealitySpatialAwarenessObservationHandler<SpatialAwarenessMeshObject>

Assets/MixedRealityToolkit.Providers/WindowsMixedReality/WindowsMixedRealitySpatialMeshObserver.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,7 @@ public override void Destroy()
126126
/// <summary>
127127
/// The <see cref="GameObject"/> to which observed objects are parented.
128128
/// </summary>
129-
private GameObject ObservedObjectParent => observedObjectParent ?? (observedObjectParent = SpatialAwarenessSystem?.CreateSpatialAwarenessObjectParent("WindowsMixedRealitySpatialMeshObserver"));
130-
129+
private GameObject ObservedObjectParent => observedObjectParent != null ? observedObjectParent : (observedObjectParent = SpatialAwarenessSystem?.CreateSpatialAwarenessObjectParent("WindowsMixedRealitySpatialMeshObserver"));
131130

132131
private IMixedRealitySpatialAwarenessSystem spatialAwarenessSystem = null;
133132

@@ -248,7 +247,7 @@ public SpatialAwarenessMeshLevelOfDetail LevelOfDetail
248247

249248
/// <inheritdoc />
250249
public Material VisibleMaterial { get; set; } = null;
251-
250+
252251
/// <inheritdoc/>
253252
public override void Resume()
254253
{

Assets/MixedRealityToolkit.SDK/Features/Input/Handlers/ManipulationHandler.cs

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// Licensed under the MIT License. See LICENSE in the project root for license information.
33

44
using UnityEngine;
5-
using System.Linq;
65
using UnityEngine.Assertions;
76
using Microsoft.MixedReality.Toolkit.SDK.Input.Handlers;
87
using Microsoft.MixedReality.Toolkit.Core.EventDatum.Input;
@@ -24,7 +23,7 @@ namespace Microsoft.MixedReality.Toolkit.SDK.UX.Utilities
2423
///
2524
public class ManipulationHandler : BaseFocusHandler,
2625
IMixedRealityInputHandler,
27-
IMixedRealityInputHandler<MixedRealityPose>,
26+
IMixedRealityInputHandler<MixedRealityPose>,
2827
IMixedRealitySourceStateHandler
2928
{
3029
#region Private Enums
@@ -236,40 +235,32 @@ private void InvokeStateUpdateFunctions(State oldState, State newState)
236235
#endregion Private Methods
237236

238237
#region Event Handlers From Interfaces
239-
/// <summary>
240-
/// /// Event Handler receives input from inputSource
241-
/// </summary>
238+
239+
/// <inheritdoc />
242240
public void OnInputDown(InputEventData eventData)
243241
{
244242
gazeHandHelper.AddSource(eventData);
245243
UpdateStateMachine();
246244
eventData.Use();
247245
}
248246

249-
/// <summary>
250-
/// Event Handler receives input from inputSource
251-
/// </summary>
247+
/// <inheritdoc />
252248
public void OnInputUp(InputEventData eventData)
253249
{
254250
gazeHandHelper.RemoveSource(eventData);
255251
UpdateStateMachine();
256252
eventData.Use();
257253
}
258254

259-
/// <summary>
260-
/// Event Handler receives input from IMixedRealityInputHandler<MixedRealityPose>
261-
/// </summary>
262-
/// <param name="eventData"></param>
255+
/// <inheritdoc />
263256
public void OnInputChanged(InputEventData<MixedRealityPose> eventData)
264257
{
265258
gazeHandHelper.UpdateSource(eventData);
266259
UpdateStateMachine();
267260
eventData.Use();
268261
}
269262

270-
/// <summary>
271-
/// Event Handler when a InputSource is lost- part of IMixedRealitySourceStateHander interface
272-
/// </summary>
263+
/// <inheritdoc />
273264
public void OnSourceLost(SourceStateEventData eventData)
274265
{
275266
gazeHandHelper.RemoveSource(eventData);

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@
33

44
using Microsoft.MixedReality.Toolkit.Core.Interfaces.InputSystem;
55
using Microsoft.MixedReality.Toolkit.SDK.UX.Interactable.States;
6-
using System.Collections;
7-
using System.Collections.Generic;
8-
using UnityEngine;
9-
106

117
namespace Microsoft.MixedReality.Toolkit.SDK.UX.Interactable.Events
128
{
@@ -20,13 +16,16 @@ public interface IInteractableHandler
2016
/// <param name="state"></param>
2117
/// <param name="source"></param>
2218
/// <param name="command"></param>
19+
/// <param name="index"></param>
20+
/// <param name="length"></param>
2321
void OnVoiceCommand(InteractableStates state, Interactable source, string command, int index = 0, int length = 1);
2422

2523
/// <summary>
2624
/// A click event happened
2725
/// </summary>
2826
/// <param name="state"></param>
2927
/// <param name="source"></param>
28+
/// <param name="pointer"></param>
3029
void OnClick(InteractableStates state, Interactable source, IMixedRealityPointer pointer = null);
3130
}
3231
}

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33

44
using Microsoft.MixedReality.Toolkit.Core.Interfaces.InputSystem;
55
using Microsoft.MixedReality.Toolkit.SDK.UX.Interactable.States;
6-
using System.Collections;
7-
using System.Collections.Generic;
86
using UnityEngine;
97
using UnityEngine.Events;
108

@@ -39,6 +37,8 @@ public ReceiverBase(UnityEvent ev)
3937
/// <param name="state"></param>
4038
/// <param name="source"></param>
4139
/// <param name="command"></param>
40+
/// <param name="index"></param>
41+
/// <param name="length"></param>
4242
public virtual void OnVoiceCommand(InteractableStates state, Interactable source, string command, int index = 0, int length = 1)
4343
{
4444
// voice command called
@@ -49,6 +49,7 @@ public virtual void OnVoiceCommand(InteractableStates state, Interactable source
4949
/// </summary>
5050
/// <param name="state"></param>
5151
/// <param name="source"></param>
52+
/// <param name="pointer"></param>
5253
public virtual void OnClick(InteractableStates state, Interactable source, IMixedRealityPointer pointer = null)
5354
{
5455
// click called

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

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33

44
using Microsoft.MixedReality.Toolkit.Core.Interfaces.InputSystem;
55
using Microsoft.MixedReality.Toolkit.SDK.UX.Interactable.States;
6-
using System.Collections;
7-
using System.Collections.Generic;
86
using UnityEngine;
97

108
namespace Microsoft.MixedReality.Toolkit.SDK.UX.Interactable.Events
@@ -17,7 +15,7 @@ namespace Microsoft.MixedReality.Toolkit.SDK.UX.Interactable.Events
1715
/// </summary>
1816
public class ReceiverBaseMonoBehavior : MonoBehaviour, IInteractableHandler
1917
{
20-
public enum SearchScopes { Self, Parent, Children};
18+
public enum SearchScopes { Self, Parent, Children };
2119
public Interactable Interactable;
2220
public SearchScopes InteractableSearchScope;
2321
protected State lastState;
@@ -57,7 +55,7 @@ protected virtual void OnEnable()
5755
/// <param name="interactable"></param>
5856
public void AddInteractable(Interactable interactable)
5957
{
60-
if(Interactable != null)
58+
if (Interactable != null)
6159
{
6260
Interactable.RemoveHandler(this);
6361
}
@@ -81,7 +79,7 @@ protected virtual void Update()
8179
{
8280
if (Interactable != null && Interactable.StateManager != null)
8381
{
84-
if(Interactable.StateManager.CurrentState()!= lastState)
82+
if (Interactable.StateManager.CurrentState() != lastState)
8583
{
8684
OnStateChange(Interactable.StateManager, Interactable);
8785

@@ -131,23 +129,13 @@ public virtual void OnStateChange(InteractableStates state, Interactable source)
131129
*/
132130
}
133131

134-
/// <summary>
135-
/// A voice command was called
136-
/// </summary>
137-
/// <param name="state"></param>
138-
/// <param name="source"></param>
139-
/// <param name="command"></param>
132+
/// <inheritdoc />
140133
public virtual void OnVoiceCommand(InteractableStates state, Interactable source, string command, int index = 0, int length = 1)
141134
{
142135
// Voice Command Happened
143136
}
144137

145-
/// <summary>
146-
/// A click event happened
147-
/// </summary>
148-
/// <param name="state"></param>
149-
/// <param name="source"></param>
150-
/// <param name="command"></param>
138+
/// <inheritdoc />
151139
public virtual void OnClick(InteractableStates state, Interactable source, IMixedRealityPointer pointer = null)
152140
{
153141
// Click Happened

Assets/MixedRealityToolkit.SDK/Features/UX/Scripts/Utilities/GazeHandHelper.cs

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License. See LICENSE in the project root for license information.
33

4+
using Microsoft.MixedReality.Toolkit.Core.Definitions.Utilities;
5+
using Microsoft.MixedReality.Toolkit.Core.EventDatum.Input;
46
using Microsoft.MixedReality.Toolkit.Core.Interfaces.InputSystem;
7+
using Microsoft.MixedReality.Toolkit.Core.Interfaces.InputSystem.Handlers;
8+
using System;
59
using System.Collections.Generic;
6-
using Microsoft.MixedReality.Toolkit.Core.EventDatum.Input;
7-
using Microsoft.MixedReality.Toolkit.Core.Definitions.Utilities;
810
using UnityEngine;
9-
using System;
1011

1112
namespace Microsoft.MixedReality.Toolkit.SDK.UX.Utilities
1213
{
1314
/// <summary>
14-
/// This class must be instantiated by a script that implements the IMixedRealitySourceStateHandler, IMixedRealityInputHandler and IMixedRealityInputHandler<MixedRealityPose> interfaces.
15+
/// This class must be instantiated by a script that implements the <see cref="IMixedRealitySourceStateHandler"/>,
16+
/// <see cref="IMixedRealityInputHandler"/> and <see cref="IMixedRealityInputHandler{T}"/>.
1517
///
1618
/// ***It must receive EventData arguments from OnInputDown(), OnInputUp(), OnInputChanged() and OnSourceLost().***
1719
///
@@ -32,16 +34,17 @@ public class GazeHandHelper
3234
#endregion Private Variables
3335

3436
#region Public Methods
37+
3538
/// <summary>
36-
/// This function must be called from the OnInputDown handler in a script implementing the IMixedRealityInputHandler<MixedRealityPose> interface.
39+
/// This function must be called from the OnInputDown handler in a script implementing the <see cref="IMixedRealityInputHandler{T}"/>.
3740
/// </summary>
3841
/// <param name="eventData">The InputEventData argument 'eventData' is passed through to GazeHandHelper</param>
3942
public void AddSource(InputEventData eventData)
4043
{
4144
IMixedRealityInputSource source = eventData.InputSource;
4245
if (source != null && IsInDictionary(source.SourceId) == false && source.Pointers != null && source.Pointers.Length > 0)
4346
{
44-
if (true == source.Pointers[0].TryGetPointerPosition(out Vector3 gazeTargetHitPosition))
47+
if (source.Pointers[0].TryGetPointerPosition(out Vector3 gazeTargetHitPosition) == true)
4548
{
4649
handSourceMap.Add(source.SourceId, source);
4750
gazePointMap.Add(source.SourceId, gazeTargetHitPosition);
@@ -53,7 +56,7 @@ public void AddSource(InputEventData eventData)
5356
}
5457

5558
/// <summary>
56-
/// This function must be called from the OnInputUp hander in a script implementing the IMixedRealityInputHandler<MixedRealityPose> interface.
59+
/// This function must be called from the OnInputUp handler in a script implementing the <see cref="IMixedRealityInputHandler{T}"/>.
5760
/// </summary>
5861
/// <param name="eventData">he InputEventData argument 'eventData' is passed through to GazeHandHelper</param>
5962
public void RemoveSource(InputEventData eventData)
@@ -67,7 +70,7 @@ public void RemoveSource(InputEventData eventData)
6770
}
6871

6972
/// <summary>
70-
/// This function must be called from the OnSourceLost hander in a script implementing the IMixedRealitySourceStateHandler interface.
73+
/// This function must be called from the OnSourceLost handler in a script implementing the IMixedRealitySourceStateHandler interface.
7174
/// </summary>
7275
/// <param name="eventData"></param>
7376
public void RemoveSource(SourceStateEventData eventData)
@@ -81,7 +84,7 @@ public void RemoveSource(SourceStateEventData eventData)
8184
}
8285

8386
/// <summary>
84-
/// This function must be called from the OnInputChanged handler in a script implementing the IMixedRealityInputHandler<MixedRealityPose> interface.
87+
/// This function must be called from the OnInputChanged handler in a script implementing the <see cref="IMixedRealityInputHandler{T}"/>.
8588
/// </summary>
8689
/// <param name="eventData"></param>
8790
public void UpdateSource(InputEventData<MixedRealityPose> eventData)
@@ -187,7 +190,7 @@ public Vector3 GetFirstHand()
187190
}
188191

189192
/// <summary>
190-
/// This function retrieves a reference to the Dictionary that maps handpositions to sourceIds.
193+
/// This function retrieves a reference to the Dictionary that maps hand positions to sourceIds.
191194
/// This return value is NOT filtered for whether the hands are active. User should check first
192195
/// using GetActiveHandCount().
193196
/// </summary>
@@ -227,7 +230,7 @@ public bool TryGetHandPosition(Handedness handedness, out Vector3 position)
227230
/// TryGet style function to return HandPosition of a certain sourceId if available.
228231
/// </summary>
229232
/// <param name="id">asks for the hand position associated with a certain IMixedRealityInputSource id</param>
230-
/// <param name="position">out value that gets filled with a Vector3 representing position</param>
233+
/// <param name="handPosition">out value that gets filled with a Vector3 representing position</param>
231234
/// <returns>true or false- whether the hand existed</returns>
232235
public bool TryGetHandPosition(uint id, out Vector3 handPosition)
233236
{

Assets/MixedRealityToolkit.SDK/Inspectors/UX/Interactable/ThemeInspector.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -961,11 +961,16 @@ public static void RenderThemeSettings(SerializedProperty themeSettings, Seriali
961961
}
962962
}
963963

964-
// check to see if an animatorControll exists
964+
// check to see if an animatorController exists
965965
if (animatorCount > 0 && gameObject != null)
966966
{
967967
GameObject host = gameObject.objectReferenceValue as GameObject;
968-
Animator animator = host?.GetComponent<Animator>();
968+
Animator animator = null;
969+
970+
if (host != null)
971+
{
972+
animator = host.GetComponent<Animator>();
973+
}
969974

970975
if (animator == null && host != null)
971976
{

Assets/MixedRealityToolkit.Services/DiagnosticsSystem/MixedRealityDiagnosticsSystem.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public override void Destroy()
8181
#region IMixedRealityDiagnosticsSystem
8282

8383
private bool showDiagnostics;
84-
84+
8585
public bool ShowDiagnostics
8686
{
8787
get { return showDiagnostics; }
@@ -91,7 +91,11 @@ public bool ShowDiagnostics
9191
if (value != showDiagnostics)
9292
{
9393
showDiagnostics = value;
94-
diagnosticVisualizationParent?.SetActive(value);
94+
95+
if (diagnosticVisualizationParent != null)
96+
{
97+
diagnosticVisualizationParent.SetActive(value);
98+
}
9599
}
96100
}
97101
}

Assets/MixedRealityToolkit.Services/InputSystem/GazeProvider.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ public override bool TryGetPointerRotation(out Quaternion rotation)
243243
/// </summary>
244244
/// <param name="mixedRealityInputAction">The input action that corresponds to the pressed button or axis.</param>
245245
/// <param name="handedness">Optional handedness of the source that pressed the pointer.</param>
246+
/// <param name="inputSource"></param>
246247
public void RaisePointerDown(MixedRealityInputAction mixedRealityInputAction, Handedness handedness = Handedness.None, IMixedRealityInputSource inputSource = null)
247248
{
248249
MixedRealityToolkit.InputSystem.RaisePointerDown(this, mixedRealityInputAction, handedness, inputSource);
@@ -253,6 +254,7 @@ public void RaisePointerDown(MixedRealityInputAction mixedRealityInputAction, Ha
253254
/// </summary>
254255
/// <param name="mixedRealityInputAction">The input action that corresponds to the released button or axis.</param>
255256
/// <param name="handedness">Optional handedness of the source that released the pointer.</param>
257+
/// <param name="inputSource"></param>
256258
public void RaisePointerUp(MixedRealityInputAction mixedRealityInputAction, Handedness handedness = Handedness.None, IMixedRealityInputSource inputSource = null)
257259
{
258260
MixedRealityToolkit.InputSystem.RaisePointerClicked(this, mixedRealityInputAction, 0, handedness, inputSource);

0 commit comments

Comments
 (0)