Skip to content

Commit 83e8db6

Browse files
author
davidkline-ms
committed
Merge remote-tracking branch 'upstream/main' into handConstraintTidy
2 parents 9dbd307 + a91fa96 commit 83e8db6

File tree

36 files changed

+357
-148
lines changed

36 files changed

+357
-148
lines changed

Assets/MRTK/Core/Inspectors/ControllerPopupWindow.cs

Lines changed: 4 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -316,40 +316,13 @@ private void RenderMappingList(List<string> controllerList)
316316
return;
317317
}
318318

319-
GUIStyle headerStyle = new GUIStyle();
320-
headerStyle.richText = true;
321-
322-
if (currentControllerOption == null || currentControllerTexture == null)
319+
using (new EditorGUILayout.VerticalScope())
323320
{
324-
GUILayout.BeginVertical();
325-
using (new EditorGUILayout.VerticalScope())
326-
{
327-
GUILayout.FlexibleSpace();
328-
EditorGUILayout.LabelField("<b>Controllers affected by this mapping</b>", headerStyle);
329-
for (int i = 0; i < controllerList.Count; i++)
330-
{
331-
EditorGUILayout.LabelField(controllerList[i]);
332-
}
333-
}
334-
GUILayout.EndVertical();
335-
}
336-
else
337-
{
338-
float max_y = currentControllerOption.InputLabelPositions.Max(x => x.y);
339-
340-
var titleRectPosition = Vector2.up * (max_y + 4 * EditorGUIUtility.singleLineHeight);
341-
var titleRectSize = new Vector2(500, EditorGUIUtility.singleLineHeight);
342-
343-
var titleRect = new Rect(titleRectPosition, titleRectSize);
344-
EditorGUI.LabelField(titleRect, "<b>Controllers affected by this mapping</b>", headerStyle);
345-
321+
GUILayout.FlexibleSpace();
322+
EditorGUILayout.LabelField("Controllers affected by this mapping", EditorStyles.boldLabel);
346323
for (int i = 0; i < controllerList.Count; i++)
347324
{
348-
var rectPosition = Vector2.up * (max_y + (i + 5) * EditorGUIUtility.singleLineHeight);
349-
var rectSize = new Vector2(1000, EditorGUIUtility.singleLineHeight);
350-
351-
var labelRect = new Rect(rectPosition, rectSize);
352-
EditorGUI.LabelField(labelRect, controllerList[i]);
325+
EditorGUILayout.LabelField(controllerList[i]);
353326
}
354327
}
355328
}

Assets/MRTK/Core/Inspectors/Profiles/MixedRealityToolkitConfigurationProfileInspector.cs

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -153,21 +153,32 @@ protected override void OnEnable()
153153
using (var c = new EditorGUI.ChangeCheckScope())
154154
{
155155
// Reconciling old Experience Scale property with the Experience Settings Profile
156-
var oldExperienceSettigsScale = (experienceSettingsProfile.objectReferenceValue as MixedRealityExperienceSettingsProfile)?.TargetExperienceScale;
156+
ExperienceScale? oldExperienceSettingsScale = null;
157+
if (experienceSettingsProfile.objectReferenceValue is MixedRealityExperienceSettingsProfile oldExperienceSettingsProfile
158+
&& oldExperienceSettingsProfile != null)
159+
{
160+
oldExperienceSettingsScale = oldExperienceSettingsProfile.TargetExperienceScale;
161+
}
157162

158163
changed |= RenderProfile(experienceSettingsProfile, typeof(MixedRealityExperienceSettingsProfile), true, false, null, true);
159164

160165
// Experience configuration
161-
if(!mrtkConfigProfile.ExperienceSettingsProfile.IsNull())
162-
{
166+
if (mrtkConfigProfile.ExperienceSettingsProfile != null)
167+
{
163168
// If the Experience Scale property changed, make sure we also alter the configuration profile's target experience scale property for compatibility
164-
var newExperienceSettigs = (experienceSettingsProfile.objectReferenceValue as MixedRealityExperienceSettingsProfile)?.TargetExperienceScale;
165-
if(oldExperienceSettigsScale.HasValue && newExperienceSettigs.HasValue && oldExperienceSettigsScale != newExperienceSettigs)
169+
ExperienceScale? newExperienceSettingsScale = null;
170+
if (experienceSettingsProfile.objectReferenceValue is MixedRealityExperienceSettingsProfile newExperienceSettingsProfile
171+
&& newExperienceSettingsProfile != null)
172+
{
173+
newExperienceSettingsScale = newExperienceSettingsProfile.TargetExperienceScale;
174+
}
175+
176+
if (oldExperienceSettingsScale.HasValue && newExperienceSettingsScale.HasValue && oldExperienceSettingsScale != newExperienceSettingsScale)
166177
{
167-
experienceScaleMigration.intValue = (int)newExperienceSettigs;
178+
experienceScaleMigration.intValue = (int)newExperienceSettingsScale;
168179
experienceScaleMigration.serializedObject.ApplyModifiedProperties();
169180
}
170-
// If we have not changed the Experience Settings profile and it's value is out of sync with the top level configuration profile, display a migration prompt
181+
// If we have not changed the Experience Settings profile and its value is out of sync with the top level configuration profile, display a migration prompt
171182
else if ((ExperienceScale)experienceScaleMigration.intValue != mrtkConfigProfile.ExperienceSettingsProfile.TargetExperienceScale)
172183
{
173184
Color errorColor = Color.Lerp(Color.white, Color.red, 0.5f);
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
// Copyright (c) Microsoft Corporation.
2+
// Licensed under the MIT License.
3+
4+
using Microsoft.MixedReality.Toolkit.Utilities.Editor;
5+
using System;
6+
using UnityEditor;
7+
using UnityEngine;
8+
9+
namespace Microsoft.MixedReality.Toolkit.Editor
10+
{
11+
internal class MRTKVersionPopup : EditorWindow
12+
{
13+
private const string DefaultVersion = "0.0.0.0";
14+
private const string NotFoundMessage = "The version could not be read. This is most often due to (and expected when) using MRTK directly from the repo. If you're using an official distribution and seeing this message, please file a GitHub issue!";
15+
private static readonly Version MRTKVersion = typeof(MixedRealityToolkit).Assembly.GetName().Version;
16+
private static readonly bool FoundVersion = MRTKVersion.ToString() != DefaultVersion;
17+
private static readonly Vector2 WindowSize = new Vector2(300, 140);
18+
private static readonly Vector2 NotFoundWindowSize = new Vector2(300, 175);
19+
private static readonly GUIContent Title = new GUIContent("Mixed Reality Toolkit");
20+
private static MRTKVersionPopup window;
21+
22+
[MenuItem("Mixed Reality/Toolkit/Show version...", priority = int.MaxValue)]
23+
private static void Init()
24+
{
25+
if (window != null)
26+
{
27+
window.ShowUtility();
28+
return;
29+
}
30+
31+
window = CreateInstance<MRTKVersionPopup>();
32+
window.titleContent = Title;
33+
window.maxSize = FoundVersion ? WindowSize : NotFoundWindowSize;
34+
window.minSize = FoundVersion ? WindowSize : NotFoundWindowSize;
35+
window.ShowUtility();
36+
}
37+
38+
private void OnGUI()
39+
{
40+
using (new EditorGUILayout.VerticalScope())
41+
{
42+
MixedRealityInspectorUtility.RenderMixedRealityToolkitLogo();
43+
44+
using (new EditorGUILayout.HorizontalScope())
45+
{
46+
GUILayout.FlexibleSpace();
47+
EditorGUILayout.LabelField(FoundVersion ? $"Version {MRTKVersion}" : NotFoundMessage, EditorStyles.wordWrappedLabel);
48+
GUILayout.FlexibleSpace();
49+
}
50+
}
51+
}
52+
}
53+
}

Assets/MRTK/Core/Inspectors/Setup/MRTKVersionPopup.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/MRTK/Core/Inspectors/Utilities/InspectorUIUtility.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,11 @@ static public bool DrawScriptableFoldout<T>(SerializedProperty scriptable, strin
650650
else
651651
{
652652
bool isNestedInCurrentPrefab = false;
653-
var prefabStage = PrefabStageUtility.GetCurrentPrefabStage();
653+
#if UNITY_2021_2_OR_NEWER
654+
var prefabStage = UnityEditor.SceneManagement.PrefabStageUtility.GetCurrentPrefabStage();
655+
#else
656+
var prefabStage = UnityEditor.Experimental.SceneManagement.PrefabStageUtility.GetCurrentPrefabStage();
657+
#endif
654658
if (prefabStage != null)
655659
{
656660
var instancePath = AssetDatabase.GetAssetPath(scriptable.objectReferenceValue);

Assets/MRTK/Core/Providers/UnityInput/UnityJoystickManager.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ namespace Microsoft.MixedReality.Toolkit.Input.UnityInput
1717
[MixedRealityDataProvider(
1818
typeof(IMixedRealityInputSystem),
1919
(SupportedPlatforms)(-1), // All platforms supported by Unity
20-
"Unity Joystick Manager",
21-
supportedUnityXRPipelines: SupportedUnityXRPipelines.LegacyXR)]
20+
"Unity Joystick Manager")]
2221
#if UNITY_2020_1_OR_NEWER
2322
[Obsolete("The legacy XR pipeline has been removed in Unity 2020 or newer. Please migrate to XR SDK.")]
2423
#endif // UNITY_2020_1_OR_NEWER

Assets/MRTK/Core/Utilities/BuildAndDeploy/UwpAppxBuildTools.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,11 @@ public static void AddCapabilities(IBuildInfo buildInfo, XElement rootElement =
531531
AddGazeInputCapability(rootElement);
532532
}
533533

534-
if (uwpBuildInfo.ResearchModeCapabilityEnabled && EditorUserBuildSettings.wsaSubtarget == WSASubtarget.HoloLens)
534+
if (uwpBuildInfo.ResearchModeCapabilityEnabled
535+
#if !UNITY_2021_2_OR_NEWER
536+
&& EditorUserBuildSettings.wsaSubtarget == WSASubtarget.HoloLens
537+
#endif // !UNITY_2021_2_OR_NEWER
538+
)
535539
{
536540
AddResearchModeCapability(rootElement);
537541
}

0 commit comments

Comments
 (0)