Skip to content

Commit

Permalink
Fixing XML documentation warnings and some variable spellings, pass 3 (
Browse files Browse the repository at this point in the history
…#11723)

Fixing XML documentation warnings and some variable spellings
  • Loading branch information
AMollis committed Jul 20, 2023
1 parent 95cce22 commit 98bec17
Show file tree
Hide file tree
Showing 27 changed files with 266 additions and 104 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -989,7 +989,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
filenameToUse: mrtk_log_mostRecentET
addTimestampToLogfileName: 0
addTimestampToLogFileName: 0
logStructure: {fileID: 9111033687875367441}
userName: tester
sessionDescription: Session00
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ MonoBehaviour:
useEyeSupportedTargetPlacement: 1
minLookAwayDistToEnableEyeWarp: 5
handInputEnabled: 1
handmapping: 2
handMapping: 2
deltaHandMovementThreshold: 0.05
transparencyInTransition: 0.50980395
transparencyPreview: 0.2
Expand Down Expand Up @@ -1248,7 +1248,7 @@ MonoBehaviour:
useEyeSupportedTargetPlacement: 1
minLookAwayDistToEnableEyeWarp: 5
handInputEnabled: 1
handmapping: 2
handMapping: 2
deltaHandMovementThreshold: 0.05
transparencyInTransition: 0.50980395
transparencyPreview: 0.2
Expand Down Expand Up @@ -14041,7 +14041,7 @@ MonoBehaviour:
useEyeSupportedTargetPlacement: 1
minLookAwayDistToEnableEyeWarp: 5
handInputEnabled: 1
handmapping: 2
handMapping: 2
deltaHandMovementThreshold: 0.05
transparencyInTransition: 0.50980395
transparencyPreview: 0.2
Expand Down Expand Up @@ -14905,7 +14905,7 @@ MonoBehaviour:
useEyeSupportedTargetPlacement: 1
minLookAwayDistToEnableEyeWarp: 5
handInputEnabled: 1
handmapping: 2
handMapping: 2
deltaHandMovementThreshold: 0.05
transparencyInTransition: 0.50980395
transparencyPreview: 0.2
Expand Down Expand Up @@ -35993,7 +35993,7 @@ MonoBehaviour:
useEyeSupportedTargetPlacement: 1
minLookAwayDistToEnableEyeWarp: 5
handInputEnabled: 1
handmapping: 2
handMapping: 2
deltaHandMovementThreshold: 0.05
transparencyInTransition: 0.50980395
transparencyPreview: 0.2
Expand Down Expand Up @@ -36961,7 +36961,7 @@ MonoBehaviour:
useEyeSupportedTargetPlacement: 1
minLookAwayDistToEnableEyeWarp: 5
handInputEnabled: 1
handmapping: 2
handMapping: 2
deltaHandMovementThreshold: 0.05
transparencyInTransition: 0.50980395
transparencyPreview: 0.2
Expand Down
23 changes: 21 additions & 2 deletions UnityProjects/MRTKDevTemplate/Assets/Scripts/DisableInteractors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,27 @@ public class DisableInteractors : MonoBehaviour

private InteractorBehaviorControls interactorBehaviorControls;

/// <summary>
/// A Unity event function that is called when an enabled script instance is being loaded.
/// </summary>
private void Awake()
{
interactorBehaviorControls = GetComponent<InteractorBehaviorControls>();

SetupSpeechCommand();
}

/// <summary>
/// A Unity event function that is called on the frame when a script is enabled just before any of the update methods are called the first time.
/// </summary>
private void Start()
{
ResetExample();
}

/// <summary>
/// A Unity event function that is called when the script component has been enabled.
/// </summary>
private void OnEnable()
{
interactorBehaviorControls.onControllerRayToggled += OnControllerRayToggled;
Expand All @@ -68,6 +77,9 @@ private void OnEnable()
interactorBehaviorControls.onPokeToggled += OnPokeToggled;
}

/// <summary>
/// A Unity event function that is called when the script component has been disabled.
/// </summary>
private void OnDisable()
{
interactorBehaviorControls.onControllerRayToggled -= OnControllerRayToggled;
Expand All @@ -82,9 +94,16 @@ private void SetupSpeechCommand()
XRSubsystemHelpers.GetFirstSubsystem<KeywordRecognitionSubsystem>().CreateOrGetEventForKeyword("Reset Example").AddListener(ResetExample);
}

/// <summary>
/// Reset the interactors of this scene, based of the availability of articulated hand input.
/// </summary>
/// <remarks>
/// If the application has configured a <see cref="IHandsAggregatorSubsystem"/>, this will put the interactors into HoloLens mode,
/// otherwise the interactors are put into VR mode.
/// </remarks>
public void ResetExample()
{
if(XRSubsystemHelpers.HandsAggregator != null)
if (XRSubsystemHelpers.HandsAggregator != null)
{
SetHololensModeActive();
}
Expand All @@ -93,7 +112,7 @@ public void ResetExample()
List<InputDevice> motionControllers = new List<InputDevice>();
InputDevices.GetDevicesWithCharacteristics(InputDeviceCharacteristics.HeldInHand, motionControllers);

if(motionControllers.Count > 0)
if (motionControllers.Count > 0)
{
SetVRModeActive();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Licensed under the MIT License.

using System.Collections;
using System.IO;
using UnityEngine;
using UnityEngine.SceneManagement;

Expand Down Expand Up @@ -48,14 +47,17 @@ public static IEnumerator LoadNewScene(string sceneToBeLoaded, float delayInSeco
}

/// <summary>
/// Change the color of game object "gameObject".
/// Change the material color of the given <see cref="GameObject"/>.
/// </summary>
/// <param name="originalColor">Enter "null" in case you're passing the original object and want to save the original color.</param>
public static void GameObject_ChangeColor(GameObject gobj, Color newColor, ref Color? originalColor, bool onlyApplyToRootObj)
/// <param name="gameObject">The object whose material colors will be changed.</param>
/// <param name="newColor">The new color to apply to the object's materials.</param>
/// <param name="originalColor">Obtain the original color of the first material's <see cref="Material.color"/>. This must be <see langword="null"/> to obtain this original color.</param>
/// <param name="onlyApplyToRoot"><see langword="true"/> to only change materials on the root <see cref="GameObject"/>, and <see langword="false"/> to change children's materials too.</param>
public static void SetGameObjectColor(GameObject gameObject, Color newColor, ref Color? originalColor, bool onlyApplyToRoot)
{
try
{
Renderer[] renderers = gobj.GetComponents<Renderer>();
Renderer[] renderers = gameObject.GetComponents<Renderer>();
for (int i = 0; i < renderers.Length; i++)
{
Material[] mats = renderers[i].materials;
Expand All @@ -64,15 +66,17 @@ public static void GameObject_ChangeColor(GameObject gobj, Color newColor, ref C
Color c = mat.color;

if (!originalColor.HasValue)
{
originalColor = c;
}

mat.color = newColor;
}
}

if (!onlyApplyToRootObj)
if (!onlyApplyToRoot)
{
renderers = gobj.GetComponentsInChildren<Renderer>();
renderers = gameObject.GetComponentsInChildren<Renderer>();
for (int i = 0; i < renderers.Length; i++)
{
Material[] mats = renderers[i].materials;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,20 +76,22 @@ private void Initialize(float newAspectRatio)
/// <summary>
/// Returns the pan speed.
/// </summary>
/// <param name="uvCursorVal">Normalized cursor position in the hit box. Center is assumed to be at [-0.5, 0.5].</param>
protected override float ComputePanSpeed(float uvCursorPos, float maxSpeed, float minDistFromCenterForAutoPan)
/// <param name="uvCursorPosition">Normalized cursor position in the hit box. Center is assumed to be at (-0.5, 0.5).</param>
/// <param name="maxSpeed">The maximum speed that can be returned by this function.</param>
/// <param name="minDistanceFromCenterForAutoPan">The minium distances from the center at which to start panning.</param>
protected override float ComputePanSpeed(float uvCursorPosition, float maxSpeed, float minDistanceFromCenterForAutoPan)
{
// UV space from [0,1] -> Center: [-0.5, 0.5]
float centeredVal = uvCursorPos - 0.5f;
float centeredVal = uvCursorPosition - 0.5f;

// If the UV cursor is close to the center of the image, prevent continuous movements to limit distractions
if (Mathf.Abs(centeredVal) < minDistFromCenterForAutoPan)
if (Mathf.Abs(centeredVal) < minDistanceFromCenterForAutoPan)
{
return 0f;
}
else
{
float normalizedVal = (centeredVal - Mathf.Sign(centeredVal) * minDistFromCenterForAutoPan) / (Mathf.Sign(centeredVal) * (0.5f - minDistFromCenterForAutoPan));
float normalizedVal = (centeredVal - Mathf.Sign(centeredVal) * minDistanceFromCenterForAutoPan) / (Mathf.Sign(centeredVal) * (0.5f - minDistanceFromCenterForAutoPan));
float speed = normalizedVal * normalizedVal * maxSpeed * Mathf.Sign(centeredVal);
return speed;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ public class PanZoomTexture : PanZoomBaseTexture
[Range(0, 10)]
private float skimProofUpdateSpeed = 5f;

/// <summary>
/// A Unity event function that is called on the frame when a script is enabled just before any of the update methods are called the first time.
/// </summary>
protected override void Start()
{
// Assigning values to base PanZoom class
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class ScrollRectTransform : PanZoomBaseRectTransform
[SerializeField]
private RectTransform rectTransformToNavigate = null;

[Tooltip("Reference to the viewport restricting the viewbox. This is important for identifying the max constrains for panning.")]
[Tooltip("Reference to the viewport restricting the view box. This is important for identifying the max constrains for panning.")]
[SerializeField]
private RectTransform referenceToViewPort = null;

Expand Down Expand Up @@ -53,8 +53,16 @@ public class ScrollRectTransform : PanZoomBaseRectTransform

[Tooltip("Custom anchor start position.")]
[SerializeField]
public Vector2 customStartPosition;
private Vector2 customStartPosition;

/// <summary>
/// Custom anchor start position.
/// </summary>
public Vector2 CustomStartPosition => customStartPosition;

/// <summary>
/// A Unity event function that is called on the frame when a script is enabled just before any of the update methods are called the first time.
/// </summary>
protected override void Start()
{
// Assigning values to base PanZoom class
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using Microsoft.MixedReality.Toolkit.Input;
using Microsoft.MixedReality.Toolkit.Subsystems;
using UnityEngine.XR;
using UnityEngine.XR.Interaction.Toolkit;
using UnityEngine;
using UnityEngine.Events;

namespace Microsoft.MixedReality.Toolkit.Examples
{
using Input;
using Subsystems;
using UnityEngine.XR;
using UnityEngine.XR.Interaction.Toolkit;

/// <summary>
/// Specifies the allowed surface orientations to place GameObjects with attached <see cref="MoveObjectByEyeGaze"/> on.
/// Specifies whether the <see cref="GameObject"/> moves on horizontal or vertical surfaces.
/// </summary>
internal enum PlacementSurfaces
{
/// <summary>
/// The <see cref="GameObject"/> can moves on horizontal surfaces.
/// </summary>
Horizontal,

/// <summary>
/// The <see cref="GameObject"/> can moves on vertical surfaces.
/// </summary>
Vertical
}

Expand Down Expand Up @@ -49,10 +55,9 @@ public class MoveObjectByEyeGaze : StatefulInteractable
[SerializeField]
private bool handInputEnabled = true;

[Tooltip(
"To control whether the hand motion is used 1:1 to move a target or to use different gains to allow for smaller hand motions.")]
[Tooltip("To control whether the hand motion is used 1:1 to move a target or to use different gains to allow for smaller hand motions.")]
[SerializeField]
private float handmapping = 1f;
private float handMapping = 1f;

[Tooltip("Minimal amount of hand movement to trigger target repositioning.")]
[SerializeField]
Expand Down Expand Up @@ -629,7 +634,7 @@ private void MoveTargetBy(Vector3 delta)
// Continuous manual target movement
Vector3 oldPos = gameObject.transform.position;
Vector3 d = new Vector3(-delta.x * ConstraintX, -delta.y * ConstraintY, -delta.z * ConstraintZ);
gameObject.transform.position = oldPos + d * handmapping;
gameObject.transform.position = oldPos + d * handMapping;

ConstrainMovement();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ private void Start()
audioSource = GetComponent<AudioSource>();

// Set default color
EyeTrackingUtilities.GameObject_ChangeColor(gameObject, statusColorIdle, ref originalColor, false);
EyeTrackingUtilities.SetGameObjectColor(gameObject, statusColorIdle, ref originalColor, false);
}

#region Handle collision detection
Expand Down Expand Up @@ -120,13 +120,13 @@ private void AllObjectsPlacedInZone()
// Only change color if the status has changed
if (allObjectsInZone && !wereAllObjectsInZone)
{
EyeTrackingUtilities.GameObject_ChangeColor(gameObject, statusColorAchieved, ref originalColor, false);
EyeTrackingUtilities.SetGameObjectColor(gameObject, statusColorAchieved, ref originalColor, false);
audioSource.PlayOneShot(audioFxSuccess);

}
else if (!allObjectsInZone && wereAllObjectsInZone)
{
EyeTrackingUtilities.GameObject_ChangeColor(gameObject, statusColorIdle, ref originalColor, false);
EyeTrackingUtilities.SetGameObjectColor(gameObject, statusColorIdle, ref originalColor, false);
}

wereAllObjectsInZone = allObjectsInZone;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ namespace Microsoft.MixedReality.Toolkit.Examples
{
/// <summary>
/// Example of how to use interactors to create a heatmap of eye tracking data.
/// Uses MRTKBaseInteractable, but not StatefulInteractable.
/// </summary>
[AddComponentMenu("MRTK/Examples/DrawOnTexture")]
[RequireComponent(typeof(Renderer))]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ namespace Microsoft.MixedReality.Toolkit.Examples
{
/// <summary>
/// Allows the user to record a log file of eye gaze interactions for playback at another time.
/// The log file is a CSV file and is created and written to while this behaviour is <see cref="MonoBehaviour.isActiveAndEnabled"/>
/// </summary>
/// <remarks>
/// The log file is a CSV file which is created and written to while this behaviour is enabled.
/// </remarks>
[AddComponentMenu("Scripts/MRTK/Examples/UserInputRecorder")]
public class UserInputRecorder : MonoBehaviour
{
Expand All @@ -21,7 +23,7 @@ public class UserInputRecorder : MonoBehaviour

[Tooltip("Prepends a timestamp to the log file name if enabled")]
[SerializeField]
private bool addTimestampToLogfileName = false;
private bool addTimestampToLogFileName = false;

[Tooltip("The log structure to gather eye gaze samples from")]
[SerializeField]
Expand Down Expand Up @@ -72,7 +74,7 @@ private static string FormattedTimeStamp

private string Filename
{
get { return addTimestampToLogfileName ? FilenameWithTimestamp : FilenameNoTimestamp; }
get { return addTimestampToLogFileName ? FilenameWithTimestamp : FilenameNoTimestamp; }
}

private string FilenameWithTimestamp
Expand Down
Loading

0 comments on commit 98bec17

Please sign in to comment.