Skip to content

Commit

Permalink
Merge pull request #9478 from keveleigh/2.6.1-cherrypicks
Browse files Browse the repository at this point in the history
2.6.1 cherrypicks
  • Loading branch information
keveleigh authored Mar 10, 2021
2 parents f178c14 + d796858 commit a12ccc3
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 14 deletions.
21 changes: 12 additions & 9 deletions Assets/MRTK/Core/Utilities/StandardShader/ClippingPrimitive.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,19 @@ public bool UseOnPreRender
cameraMethods = CameraCache.Main.gameObject.EnsureComponent<CameraEventRouter>();
}

if (value)
if (useOnPreRender != value)
{
cameraMethods.OnCameraPreRender += OnCameraPreRender;
}
else
{
cameraMethods.OnCameraPreRender -= OnCameraPreRender;
}
if (value)
{
cameraMethods.OnCameraPreRender += OnCameraPreRender;
}
else if (!value)
{
cameraMethods.OnCameraPreRender -= OnCameraPreRender;
}

useOnPreRender = value;
useOnPreRender = value;
}
}
}

Expand Down Expand Up @@ -240,7 +243,7 @@ protected void OnDisable()

if (cameraMethods != null)
{
cameraMethods.OnCameraPreRender -= OnCameraPreRender;
UseOnPreRender = false;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ public GameObject DialogPrefabSmall
/// </summary>
public void OpenConfirmationDialogLarge()
{
Dialog.Open(DialogPrefabLarge, DialogButtonType.OK, "Confirmation Dialog, Large, Far", "This is an example of a large dialog with only one button, placed at near interaction range", false);
Dialog.Open(DialogPrefabLarge, DialogButtonType.OK, "Confirmation Dialog, Large, Far", "This is an example of a large dialog with only one button, placed at far interaction range", false);
}

/// <summary>
/// Opens choice dialog example
/// </summary>
public void OpenChoiceDialogLarge()
{
Dialog myDialog = Dialog.Open(DialogPrefabLarge, DialogButtonType.Yes | DialogButtonType.No, "Choice Dialog, Large, Near", "This is an example of a large dialog with a choice message for the user, placed at far interaction range", true);
Dialog myDialog = Dialog.Open(DialogPrefabLarge, DialogButtonType.Yes | DialogButtonType.No, "Choice Dialog, Large, Near", "This is an example of a large dialog with a choice message for the user, placed at near interaction range", true);
if (myDialog != null)
{
myDialog.OnClosed += OnClosedDialogEvent;
Expand Down Expand Up @@ -96,15 +96,15 @@ public void OpenChoiceDialogMedium()
/// </summary>
public void OpenConfirmationDialogSmall()
{
Dialog.Open(DialogPrefabSmall, DialogButtonType.OK, "Confirmation Dialog, Small, Far", "This is an example of a small dialog with only one button, placed at near interaction range", false);
Dialog.Open(DialogPrefabSmall, DialogButtonType.OK, "Confirmation Dialog, Small, Far", "This is an example of a small dialog with only one button, placed at far interaction range", false);
}

/// <summary>
/// Opens choice dialog example
/// </summary>
public void OpenChoiceDialogSmall()
{
Dialog myDialog = Dialog.Open(DialogPrefabSmall, DialogButtonType.Yes | DialogButtonType.No, "Choice Dialog, Small, Near", "This is an example of a small dialog with a choice message for the user, placed at far interaction range", true);
Dialog myDialog = Dialog.Open(DialogPrefabSmall, DialogButtonType.Yes | DialogButtonType.No, "Choice Dialog, Small, Near", "This is an example of a small dialog with a choice message for the user, placed at near interaction range", true);
if (myDialog != null)
{
myDialog.OnClosed += OnClosedDialogEvent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ private bool IsActiveLoader
#if UNITY_OPENXR
if (!isActiveLoader.HasValue)
{
isActiveLoader = IsLoaderActive<OpenXRLoader>();
isActiveLoader = IsLoaderActive<OpenXRLoaderBase>();
}
#endif // UNITY_OPENXR

Expand Down
37 changes: 37 additions & 0 deletions Assets/MRTK/Tests/PlayModeTests/ScrollViewTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1478,6 +1478,43 @@ public IEnumerator ScrollAmountHasCorrectDamp()
Assert.AreEqual((handTouchDelta - scrollView.HandDeltaScrollThreshold) / newScale, scrollView.ScrollContainerPosition.y, 0.005, "Scroll drag amount was not 1:1");
}

/// <summary>
/// Tests that no errors are raised after the scrolling object collection is removed from the scene
/// </summary>
[UnityTest]
public IEnumerator ScrollViewCleanup()
{
// Setting up a vertical 1x2 scroll view with three pressable buttons items
var contentItems = InstantiatePrefabItems(AssetDatabase.GUIDToAssetPath(PressableHololens2PrefabGuid), 3);

GridObjectCollection objectCollection = InstantiateObjectCollection(contentItems,
LayoutOrder.ColumnThenRow,
LayoutAnchor.UpperLeft,
1,
Vector3.forward,
Quaternion.identity,
0.032f,
0.032f);

ScrollingObjectCollection scrollView = InstantiateScrollView(1,
2,
objectCollection.CellWidth,
objectCollection.CellHeight,
0.016f,
Vector3.forward,
Quaternion.identity);
scrollView.AddContent(objectCollection.gameObject);

PressableButton button1Component = contentItems[0].GetComponentInChildren<PressableButton>();

Assert.IsNotNull(button1Component);
yield return PlayModeTestUtilities.WaitForInputSystemUpdate();

Object.Destroy(scrollView.gameObject);

yield return PlayModeTestUtilities.WaitForInputSystemUpdate();
}

#endregion Tests

#region Utilities
Expand Down

0 comments on commit a12ccc3

Please sign in to comment.