From be8eccd1f1bff5f7aebb8d37fc754d399acfa4a8 Mon Sep 17 00:00:00 2001 From: Adam Mollis Date: Wed, 7 Jun 2023 19:05:49 -0700 Subject: [PATCH 1/3] Removing warning from NonNativeKeyboard and addressing Unity 2022 api changes --- .../Editor/Utilities/InspectorUIUtility.cs | 21 +++++++++++++++++++ .../PressableButtonInspector.cs | 5 +++++ .../Inspectors/Slider/SliderInspector.cs | 17 ++++++++++++++- .../Keyboard/NonNative/NonNativeKeyboard.cs | 5 ----- 4 files changed, 42 insertions(+), 6 deletions(-) diff --git a/com.microsoft.mrtk.core/Editor/Utilities/InspectorUIUtility.cs b/com.microsoft.mrtk.core/Editor/Utilities/InspectorUIUtility.cs index e218f58feef..1a859ad2c48 100644 --- a/com.microsoft.mrtk.core/Editor/Utilities/InspectorUIUtility.cs +++ b/com.microsoft.mrtk.core/Editor/Utilities/InspectorUIUtility.cs @@ -751,7 +751,11 @@ public static float AxisMoveHandle(Object target, Vector3 origin, Vector3 direct Handles.DrawDottedLine(origin, position, DottedLineScreenSpace); Handles.ArrowHandleCap(0, position, Quaternion.LookRotation(direction), handleSize * 2, EventType.Repaint); +#if UNITY_2022_1_OR_NEWER + Vector3 newPosition = Handles.FreeMoveHandle(position, handleSize, Vector3.zero, Handles.CircleHandleCap); +#else Vector3 newPosition = Handles.FreeMoveHandle(position, Quaternion.identity, handleSize, Vector3.zero, Handles.CircleHandleCap); +#endif if (recordUndo) { @@ -788,7 +792,11 @@ public static Vector3 CircleMoveHandle(Object target, Vector3 position, float xS handleSize = Mathf.Lerp(handleSize, HandleUtility.GetHandleSize(position) * handleSize, 0.75f); } +#if UNITY_2022_1_OR_NEWER + Vector3 newPosition = Handles.FreeMoveHandle(position, handleSize, Vector3.zero, Handles.CircleHandleCap); +#else Vector3 newPosition = Handles.FreeMoveHandle(position, Quaternion.identity, handleSize, Vector3.zero, Handles.CircleHandleCap); +#endif if (recordUndo && position != newPosition) { @@ -824,7 +832,11 @@ public static Vector3 SquareMoveHandle(Object target, Vector3 position, float xS } // Multiply square handle to match other types +#if UNITY_2022_1_OR_NEWER + Vector3 newPosition = Handles.FreeMoveHandle(position, handleSize * 0.8f, Vector3.zero, Handles.RectangleHandleCap); +#else Vector3 newPosition = Handles.FreeMoveHandle(position, Quaternion.identity, handleSize * 0.8f, Vector3.zero, Handles.RectangleHandleCap); +#endif if (recordUndo && position != newPosition) { @@ -860,7 +872,11 @@ public static Vector3 SphereMoveHandle(Object target, Vector3 position, float xS } // Multiply sphere handle size to match other types +#if UNITY_2022_1_OR_NEWER + Vector3 newPosition = Handles.FreeMoveHandle(position, handleSize * 2, Vector3.zero, Handles.SphereHandleCap); +#else Vector3 newPosition = Handles.FreeMoveHandle(position, Quaternion.identity, handleSize * 2, Vector3.zero, Handles.SphereHandleCap); +#endif if (recordUndo && position != newPosition) { @@ -926,7 +942,12 @@ public static Vector3 VectorHandle(Object target, Vector3 origin, Vector3 vector rotation = Quaternion.LookRotation(vector); } + // TODO: rotation needs to be applied somehow in 2022 +#if UNITY_2022_1_OR_NEWER + Vector3 newPosition = Handles.FreeMoveHandle(handlePosition, handleSize, Vector3.zero, Handles.DotHandleCap); +#else Vector3 newPosition = Handles.FreeMoveHandle(handlePosition, rotation, handleSize, Vector3.zero, Handles.DotHandleCap); +#endif if (recordUndo && handlePosition != newPosition) { diff --git a/com.microsoft.mrtk.uxcore/Editor/Inspectors/PressableButton/PressableButtonInspector.cs b/com.microsoft.mrtk.uxcore/Editor/Inspectors/PressableButton/PressableButtonInspector.cs index 7d3e05b0c41..8e5fd079676 100644 --- a/com.microsoft.mrtk.uxcore/Editor/Inspectors/PressableButton/PressableButtonInspector.cs +++ b/com.microsoft.mrtk.uxcore/Editor/Inspectors/PressableButton/PressableButtonInspector.cs @@ -188,7 +188,12 @@ private float DrawPlaneAndHandle(Vector3[] vertices, Vector2 halfExtents, float Handles.ArrowHandleCap(0, vertices[1], Quaternion.LookRotation(planeNormal), handleSize * 2, EventType.Repaint); Handles.ArrowHandleCap(0, vertices[1], Quaternion.LookRotation(-planeNormal), handleSize * 2, EventType.Repaint); +#if UNITY_2022_1_OR_NEWER + Vector3 newPosition = Handles.FreeMoveHandle(vertices[1], handleSize, Vector3.zero, Handles.SphereHandleCap); +#else Vector3 newPosition = Handles.FreeMoveHandle(vertices[1], Quaternion.identity, handleSize, Vector3.zero, Handles.SphereHandleCap); +#endif + if (!newPosition.Equals(vertices[1])) { distance = button.GetDistanceAlongPushDirection(newPosition); diff --git a/com.microsoft.mrtk.uxcore/Editor/Inspectors/Slider/SliderInspector.cs b/com.microsoft.mrtk.uxcore/Editor/Inspectors/Slider/SliderInspector.cs index 65d5e919fb0..56900d80b01 100644 --- a/com.microsoft.mrtk.uxcore/Editor/Inspectors/Slider/SliderInspector.cs +++ b/com.microsoft.mrtk.uxcore/Editor/Inspectors/Slider/SliderInspector.cs @@ -63,17 +63,32 @@ private void OnSceneGUI() } EditorGUI.BeginChangeCheck(); - + +#if UNITY_2022_1_OR_NEWER + Vector3 newStartPosition = Handles.FreeMoveHandle(startPos, + handleSize, + Vector3.zero, + Handles.SphereHandleCap); +#else Vector3 newStartPosition = Handles.FreeMoveHandle(startPos, Quaternion.identity, handleSize, Vector3.zero, Handles.SphereHandleCap); +#endif + +#if UNITY_2022_1_OR_NEWER + Vector3 newEndPosition = Handles.FreeMoveHandle(endPos, + handleSize, + Vector3.zero, + Handles.SphereHandleCap); +#else Vector3 newEndPosition = Handles.FreeMoveHandle(endPos, Quaternion.identity, handleSize, Vector3.zero, Handles.SphereHandleCap); +#endif if (EditorGUI.EndChangeCheck()) { diff --git a/com.microsoft.mrtk.uxcore/Keyboard/NonNative/NonNativeKeyboard.cs b/com.microsoft.mrtk.uxcore/Keyboard/NonNative/NonNativeKeyboard.cs index 1a0b6b2d07f..82174a16f41 100644 --- a/com.microsoft.mrtk.uxcore/Keyboard/NonNative/NonNativeKeyboard.cs +++ b/com.microsoft.mrtk.uxcore/Keyboard/NonNative/NonNativeKeyboard.cs @@ -246,11 +246,6 @@ private set /// private bool isRecording = false; - /// - /// On the first recording - /// - private bool firstRecording = true; - /// /// Tracking the previous keyboard layout. /// From 20549ffbdb579868b9ea18d49257d5253d65954d Mon Sep 17 00:00:00 2001 From: Adam Mollis Date: Mon, 3 Jul 2023 09:24:19 -0700 Subject: [PATCH 2/3] Removing uneeded package --- UnityProjects/MRTKDevTemplate/Packages/manifest.json | 1 - .../MRTKDevTemplate/Packages/packages-lock.json | 10 +--------- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/UnityProjects/MRTKDevTemplate/Packages/manifest.json b/UnityProjects/MRTKDevTemplate/Packages/manifest.json index 500c914222d..d175c826a9d 100644 --- a/UnityProjects/MRTKDevTemplate/Packages/manifest.json +++ b/UnityProjects/MRTKDevTemplate/Packages/manifest.json @@ -28,7 +28,6 @@ "com.unity.inputsystem": "1.5.1", "com.unity.mobile.android-logcat": "1.3.2", "com.unity.performance.profile-analyzer": "1.2.2", - "com.unity.project-auditor": "https://github.com/Unity-Technologies/ProjectAuditor.git", "com.unity.test-framework": "1.1.33", "com.unity.textmeshpro": "3.0.6", "com.unity.timeline": "1.6.4", diff --git a/UnityProjects/MRTKDevTemplate/Packages/packages-lock.json b/UnityProjects/MRTKDevTemplate/Packages/packages-lock.json index 13148740dda..dd6baf51c8d 100644 --- a/UnityProjects/MRTKDevTemplate/Packages/packages-lock.json +++ b/UnityProjects/MRTKDevTemplate/Packages/packages-lock.json @@ -289,15 +289,7 @@ "dependencies": {}, "url": "https://packages.unity.com" }, - "com.unity.project-auditor": { - "version": "https://github.com/Unity-Technologies/ProjectAuditor.git", - "depth": 0, - "source": "git", - "dependencies": { - "com.unity.nuget.mono-cecil": "1.10.1" - }, - "hash": "0fc705630268255b07f06dacd61f3205f5d5ff3c" - }, + "com.unity.subsystemregistration": { "version": "1.1.0", "depth": 1, From 8a7130f7419fcf4da51df80dd1269ced1b279986 Mon Sep 17 00:00:00 2001 From: Adam Mollis Date: Mon, 3 Jul 2023 11:00:10 -0700 Subject: [PATCH 3/3] Removing rotation...since it's nolong supported --- .../Editor/Utilities/InspectorUIUtility.cs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/com.microsoft.mrtk.core/Editor/Utilities/InspectorUIUtility.cs b/com.microsoft.mrtk.core/Editor/Utilities/InspectorUIUtility.cs index 1a859ad2c48..915b5e31198 100644 --- a/com.microsoft.mrtk.core/Editor/Utilities/InspectorUIUtility.cs +++ b/com.microsoft.mrtk.core/Editor/Utilities/InspectorUIUtility.cs @@ -936,17 +936,10 @@ public static Vector3 VectorHandle(Object target, Vector3 origin, Vector3 vector // Draw a line from origin to origin + direction Handles.DrawLine(origin, handlePosition); - Quaternion rotation = Quaternion.identity; - if (vector != Vector3.zero) - { - rotation = Quaternion.LookRotation(vector); - } - - // TODO: rotation needs to be applied somehow in 2022 #if UNITY_2022_1_OR_NEWER Vector3 newPosition = Handles.FreeMoveHandle(handlePosition, handleSize, Vector3.zero, Handles.DotHandleCap); #else - Vector3 newPosition = Handles.FreeMoveHandle(handlePosition, rotation, handleSize, Vector3.zero, Handles.DotHandleCap); + Vector3 newPosition = Handles.FreeMoveHandle(handlePosition, Quaternion.identity, handleSize, Vector3.zero, Handles.DotHandleCap); #endif if (recordUndo && handlePosition != newPosition)