From 2fe1e77a89f6a33c612c83254aea7f3c05237992 Mon Sep 17 00:00:00 2001 From: Kurtis Eveleigh Date: Thu, 17 May 2018 16:28:06 -0700 Subject: [PATCH] Updating scripts to support 2017.3 --- .../SpatialMapping/Scripts/PlaneFindingTest.cs | 4 ++++ .../Editor/SurfaceMeshesToPlanesEditor.cs | 10 ++++++++++ .../Utilities/Scripts/Editor/EditorGUIExtensions.cs | 4 ++++ 3 files changed, 18 insertions(+) diff --git a/Assets/MixedRealityToolkit-Examples/SpatialMapping/Scripts/PlaneFindingTest.cs b/Assets/MixedRealityToolkit-Examples/SpatialMapping/Scripts/PlaneFindingTest.cs index bbc57f56b96..5bba68467bb 100644 --- a/Assets/MixedRealityToolkit-Examples/SpatialMapping/Scripts/PlaneFindingTest.cs +++ b/Assets/MixedRealityToolkit-Examples/SpatialMapping/Scripts/PlaneFindingTest.cs @@ -112,7 +112,11 @@ private void OnDrawGizmosSelected() UnityEditor.Handles.DrawLine(corners[1], corners[2]); UnityEditor.Handles.DrawLine(corners[1], corners[3]); UnityEditor.Handles.DrawLine(corners[2], corners[3]); +#if UNITY_2017_3_OR_NEWER + UnityEditor.Handles.ArrowHandleCap(0, center, Quaternion.FromToRotation(Vector3.forward, normal), 0.4f, EventType.Ignore); +#else UnityEditor.Handles.ArrowHandleCap(0, center, Quaternion.FromToRotation(Vector3.forward, normal), 0.4f, EventType.ignore); +#endif // If this plane is currently in the center of the camera's field of view, highlight it by drawing a // solid rectangle, and display the important details about this plane. diff --git a/Assets/MixedRealityToolkit/SpatialMapping/Scripts/SpatialProcessing/Editor/SurfaceMeshesToPlanesEditor.cs b/Assets/MixedRealityToolkit/SpatialMapping/Scripts/SpatialProcessing/Editor/SurfaceMeshesToPlanesEditor.cs index dc225fdf26f..6ba270937d1 100644 --- a/Assets/MixedRealityToolkit/SpatialMapping/Scripts/SpatialProcessing/Editor/SurfaceMeshesToPlanesEditor.cs +++ b/Assets/MixedRealityToolkit/SpatialMapping/Scripts/SpatialProcessing/Editor/SurfaceMeshesToPlanesEditor.cs @@ -26,11 +26,21 @@ public override void OnInspectorGUI() base.OnInspectorGUI(); serializedObject.Update(); +#if UNITY_2017_3_OR_NEWER + drawPlanesMask.intValue = (int)((PlaneTypes)EditorGUILayout.EnumFlagsField("Draw Planes", + (PlaneTypes)drawPlanesMask.intValue)); +#else drawPlanesMask.intValue = (int)((PlaneTypes)EditorGUILayout.EnumMaskField("Draw Planes", (PlaneTypes)drawPlanesMask.intValue)); +#endif +#if UNITY_2017_3_OR_NEWER + destroyPlanesMask.intValue = (int)((PlaneTypes)EditorGUILayout.EnumFlagsField("Destroy Planes", + (PlaneTypes)destroyPlanesMask.intValue)); +#else destroyPlanesMask.intValue = (int)((PlaneTypes)EditorGUILayout.EnumMaskField("Destroy Planes", (PlaneTypes)destroyPlanesMask.intValue)); +#endif serializedObject.ApplyModifiedProperties(); } diff --git a/Assets/MixedRealityToolkit/Utilities/Scripts/Editor/EditorGUIExtensions.cs b/Assets/MixedRealityToolkit/Utilities/Scripts/Editor/EditorGUIExtensions.cs index 4d4cadd9380..63256668e27 100644 --- a/Assets/MixedRealityToolkit/Utilities/Scripts/Editor/EditorGUIExtensions.cs +++ b/Assets/MixedRealityToolkit/Utilities/Scripts/Editor/EditorGUIExtensions.cs @@ -116,7 +116,11 @@ public static T ObjectField(Rect position, GUIContent label, T value, bool al { if (valueType.GetCustomAttributes(typeof(FlagsAttribute), true).Length > 0) { +#if UNITY_2017_3_OR_NEWER + objValue = EditorGUI.EnumFlagsField(position, label, (Enum)objValue); +#else objValue = EditorGUI.EnumMaskField(position, label, (Enum)objValue); +#endif } else {