Skip to content

Commit 1144641

Browse files
author
David Kline
authored
Merge pull request #3511 from Microsoft/mrtk_release
mrtk release -> mrtk development
2 parents 1fb91d9 + 2b939bf commit 1144641

File tree

63 files changed

+469
-209
lines changed

Some content is hidden

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

63 files changed

+469
-209
lines changed

Assets/MixedRealityToolkit.Examples/Demos/Diagnostics/Scripts/DiagnosticsDemoControls.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ private async void Start()
1919

2020
await new WaitUntil(() => MixedRealityToolkit.DiagnosticsSystem != null);
2121

22-
// Turn on the diagnotic visualizations for this demo.
22+
// Turn on the diagnostic visualizations for this demo.
2323
MixedRealityToolkit.DiagnosticsSystem.ShowDiagnostics = true;
2424
}
2525

Assets/MixedRealityToolkit.Examples/Demos/Utilities/InspectorFields/Inspectors/InspectorFieldsExampleInspector.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public override void OnInspectorGUI()
4141

4242
serializedObject.ApplyModifiedProperties();
4343

44-
// to apply during runtime - only needed for monobehaviors
44+
// to apply during runtime - only needed for MonoBehaviours
4545
InspectorGenericFields<InspectorFieldsExample>.LoadSettings(example, example.Settings);
4646
}
4747
}

Assets/MixedRealityToolkit.Examples/Demos/Utilities/InspectorFields/Scripts/InspectorFieldsExample.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace Microsoft.MixedReality.Toolkit.Core.Utilities.InspectorFields
1111
/// Example of using InspectorFields attributes in a class to create custom inspectors
1212
/// This is on approach for building complex inspectors that need to be customized or the need to overcome lack of polymorphism support
1313
/// They provide a way to create one inspector for multiple classes
14-
/// Example: Create a monobehavior or scriptable object with a custom inspector.
14+
/// Example: Create a MonoBehaviour or scriptable object with a custom inspector.
1515
/// The functionality or settings can be changed by assigning a custom script to the object
1616
/// Use InspectorFields to render the custom properties inside the custom script in the inspector
1717
/// When the app launches, copy the properties to the new instance of the script

Assets/MixedRealityToolkit.Providers/WindowsMixedReality/WindowsMixedRealityController.cs

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,14 +414,37 @@ private void UpdateTriggerData(InteractionSourceState interactionSourceState, Mi
414414
break;
415415
case DeviceInputType.Select:
416416
{
417+
bool selectPressed = interactionSourceState.selectPressed;
418+
419+
// BEGIN WORKAROUND: Unity issue #1033526
420+
// See https://issuetracker.unity3d.com/issues/hololens-interactionsourcestate-dot-selectpressed-is-false-when-air-tap-and-hold
421+
// Bug was discovered May 2018 and still exists as of today Feb 2019 in version 2018.3.4f1, timeline for fix is unknown
422+
// The bug only affects the development workflow via Holographic Remoting or Simulation
423+
if (interactionSourceState.source.kind == InteractionSourceKind.Hand)
424+
{
425+
Debug.Assert(!(UnityEngine.XR.WSA.HolographicRemoting.ConnectionState == UnityEngine.XR.WSA.HolographicStreamerConnectionState.Connected
426+
&& interactionSourceState.selectPressed),
427+
"Unity issue #1033526 seems to have been resolved. Please remove this ugly workaround!");
428+
429+
// This workaround is safe as long as all these assumptions hold:
430+
Debug.Assert(!interactionSourceState.source.supportsGrasp);
431+
Debug.Assert(!interactionSourceState.source.supportsMenu);
432+
Debug.Assert(!interactionSourceState.source.supportsPointing);
433+
Debug.Assert(!interactionSourceState.source.supportsThumbstick);
434+
Debug.Assert(!interactionSourceState.source.supportsTouchpad);
435+
436+
selectPressed = interactionSourceState.anyPressed;
437+
}
438+
// END WORKAROUND: Unity issue #1033526
439+
417440
// Update the interaction data source
418-
interactionMapping.BoolData = interactionSourceState.selectPressed;
441+
interactionMapping.BoolData = selectPressed;
419442

420443
// If our value changed raise it.
421444
if (interactionMapping.Changed)
422445
{
423446
// Raise input system Event if it enabled
424-
if (interactionSourceState.selectPressed)
447+
if (selectPressed)
425448
{
426449
MixedRealityToolkit.InputSystem?.RaiseOnInputDown(InputSource, ControllerHandedness, interactionMapping.MixedRealityInputAction);
427450
}

Assets/MixedRealityToolkit.Providers/WindowsMixedReality/WindowsMixedRealitySpatialMeshObserver.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ namespace Microsoft.MixedReality.Toolkit.Providers.WindowsMixedReality
2121
{
2222
[MixedRealityDataProvider(
2323
typeof(IMixedRealitySpatialAwarenessSystem),
24-
SupportedPlatforms.WindowsUniversal)]
24+
SupportedPlatforms.WindowsUniversal,
25+
"Profiles/DefaultMixedRealitySpatialAwarenessMeshObserverProfile.asset", "MixedRealityToolkit.SDK")]
2526
public class WindowsMixedRealitySpatialMeshObserver : BaseSpatialObserver, IMixedRealitySpatialAwarenessMeshObserver
2627
{
2728
/// <summary>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ private enum State
8888
private GazeHandHelper gazeHandHelper;
8989
#endregion
9090

91-
#region Monobehaviour Functions
91+
#region MonoBehaviour Functions
9292
private void Awake()
9393
{
9494
gazeHandHelper = new GazeHandHelper();
@@ -110,7 +110,7 @@ private void Update()
110110
UpdateStateMachine();
111111
}
112112
}
113-
#endregion Monobehaviour Functions
113+
#endregion MonoBehaviour Functions
114114

115115
#region Private Methods
116116
private void SetManipulationMode(TwoHandedManipulation mode)

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace Microsoft.MixedReality.Toolkit.SDK.UX.Interactable
2323
{
2424
/// <summary>
2525
/// Uses input and action data to declare a set of states
26-
/// Maintains a collection of themes that react to state changes and provide scensory feedback
26+
/// Maintains a collection of themes that react to state changes and provide sensory feedback
2727
/// Passes state information and input data on to receivers that detect patterns and does stuff.
2828
/// </summary>
2929

@@ -76,7 +76,7 @@ public class Interactable : MonoBehaviour, IMixedRealityFocusHandler, IMixedReal
7676
/// </summary>
7777
public bool FocusEnabled { get { return !IsGlobal; } set { IsGlobal = !value; } }
7878

79-
// list of profiles can match themes with gameObjects
79+
// list of profiles can match themes with GameObjects
8080
public List<InteractableProfileItem> Profiles = new List<InteractableProfileItem>();
8181
// Base onclick event
8282
public UnityEvent OnClick;
@@ -117,10 +117,10 @@ public class Interactable : MonoBehaviour, IMixedRealityFocusHandler, IMixedReal
117117
protected State lastState;
118118
protected bool wasDisabled = false;
119119

120-
// cache of current dimenion
120+
// cache of current dimension
121121
protected int dimensionIndex = 0;
122122

123-
// allows for switching colliders without firing a lose focus imediately
123+
// allows for switching colliders without firing a lose focus immediately
124124
// for advanced controls like drop-downs
125125
protected float rollOffTime = 0.25f;
126126
protected float rollOffTimer = 0.25f;
@@ -782,7 +782,7 @@ public void SetDimensionIndex(int index)
782782
}
783783

784784
/// <summary>
785-
/// internal deminsion cycling
785+
/// internal dimension cycling
786786
/// </summary>
787787
protected void IncreaseDimensionIndex()
788788
{
@@ -975,7 +975,7 @@ public void OnSpeechKeywordRecognized(SpeechEventData eventData)
975975

976976
/// <summary>
977977
/// Setup voice commands from component VoiceCommand input field
978-
/// Supports toggles using a comma to seperate keywords, no spaces please
978+
/// Supports toggles using a comma to separate keywords, no spaces please
979979
/// </summary>
980980
protected void SetupVoiceCommand()
981981
{

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace Microsoft.MixedReality.Toolkit.SDK.UX.Interactable.Layout
99
{
1010
/// <summary>
1111
/// The base layout component for a button or UI elements - easily build UI with Unity Primitives.
12-
/// Helps to create consistancy by using values that scale to a designer's 2D layout program.
12+
/// Helps to create consistency by using values that scale to a designer's 2D layout program.
1313
/// Based on a ratio of 2048 pixels for 1 meter of surface area.
1414
///
1515
/// Use case:
@@ -24,7 +24,7 @@ public class ButtonBackgroundSize : MonoBehaviour
2424
{
2525
/// <summary>
2626
/// A scale factor for button layouts, default is based on 2048 pixels to 1 meter.
27-
/// Similar to values used in designer and 2D art programs and helps create consistancy across teams.
27+
/// Similar to values used in designer and 2D art programs and helps create consistency across teams.
2828
/// </summary>
2929
[Tooltip("A pixel to Unity unit conversion, Default: 2048x2048 pixels covers a 1x1 Unity Unit or default primitive size")]
3030
[SerializeField]

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public Vector3 GetSOffset()
9090
}
9191

9292
/// <summary>
93-
/// Set the size based on the Achor's size and the buffers
93+
/// Set the size based on the Anchor's size and the buffers
9494
/// </summary>
9595
private void UpdateSize()
9696
{

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

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,29 @@ public class ButtonBorder : MonoBehaviour
8080
[SerializeField]
8181
private bool OnlyInEditMode = true;
8282

83+
private Vector3 scale;
84+
private Vector3 startPosition;
85+
private Vector3 weighDirection;
86+
private Vector3 localPosition;
87+
private Vector3 anchorTransformLocalPosition;
88+
private Vector3 anchorTransformLocalScale;
89+
8390
/// <summary>
8491
/// Set the size and position
8592
/// </summary>
8693
private void UpdateSize()
8794
{
88-
Vector3 weighDireciton = new Vector3(Mathf.Abs(Alignment.x), Mathf.Abs(Alignment.y), Mathf.Abs(Alignment.z));
89-
Vector3 scale = weighDireciton * (Weight / BasePixelScale);// Vector3.Scale(Alignment, Scale) + Offset / BasePixelScale;
95+
// Vector3 weighDireciton = new Vector3(Mathf.Abs(Alignment.x), Mathf.Abs(Alignment.y), Mathf.Abs(Alignment.z));
96+
// Vector3 scale = weighDireciton * (Weight / BasePixelScale);// Vector3.Scale(Alignment, Scale) + Offset / BasePixelScale;
97+
98+
weighDirection.x = Mathf.Abs(Alignment.x);
99+
weighDirection.y = Mathf.Abs(Alignment.y);
100+
weighDirection.z = Mathf.Abs(Alignment.z);
101+
102+
scale.x = weighDirection.x * (Weight / BasePixelScale);
103+
scale.y = weighDirection.y * (Weight / BasePixelScale);
104+
scale.z = weighDirection.z * (Weight / BasePixelScale);
105+
90106
float size = ((Weight * 2) / BasePixelScale);
91107
if (scale.x > scale.y)
92108
{
@@ -100,14 +116,24 @@ private void UpdateSize()
100116

101117
transform.localScale = scale;
102118

103-
Vector3 startPosition = AnchorTransform.localPosition;
119+
anchorTransformLocalPosition = AnchorTransform.localPosition;
120+
anchorTransformLocalScale = AnchorTransform.localScale;
121+
122+
startPosition = anchorTransformLocalPosition;
104123

105124
if (AnchorTransform != this.transform)
106125
{
107-
startPosition = AnchorTransform.localPosition + (Vector3.Scale(AnchorTransform.localScale * 0.5f, Alignment));
126+
// startPosition = AnchorTransform.localPosition + (Vector3.Scale(AnchorTransform.localScale * 0.5f, Alignment));
127+
startPosition.x = anchorTransformLocalPosition.x + ((anchorTransformLocalScale.x * 0.5f) * Alignment.x);
128+
startPosition.y = anchorTransformLocalPosition.y + ((anchorTransformLocalScale.y * 0.5f) * Alignment.y);
129+
startPosition.z = anchorTransformLocalPosition.z + ((anchorTransformLocalScale.z * 0.5f) * Alignment.z);
108130
}
109131

110-
transform.localPosition = startPosition + (Alignment * Weight * 0.5f / BasePixelScale) + (PositionOffset / BasePixelScale);
132+
// transform.localPosition = startPosition + (Alignment * Weight * 0.5f / BasePixelScale) + (PositionOffset / BasePixelScale);
133+
localPosition.x = startPosition.x + (Alignment.x * Weight * 0.5f / BasePixelScale) + (PositionOffset.x / BasePixelScale);
134+
localPosition.y = startPosition.y + (Alignment.y * Weight * 0.5f / BasePixelScale) + (PositionOffset.y / BasePixelScale);
135+
localPosition.z = startPosition.z + (Alignment.z * Weight * 0.5f / BasePixelScale) + (PositionOffset.z / BasePixelScale);
136+
transform.localPosition = localPosition;
111137
}
112138

113139
// Update is called once per frame

0 commit comments

Comments
 (0)