diff --git a/Pipelines/Templates/tests.yaml b/Pipelines/Templates/tests.yaml index 49cf061f2f0..7bb2db286e6 100644 --- a/Pipelines/Templates/tests.yaml +++ b/Pipelines/Templates/tests.yaml @@ -1,90 +1,123 @@ # Copyright (c) Microsoft Corporation. - #Licensed under the MIT License. +# Licensed under the MIT License. # [Template] Run MRTK tests. parameters: -- name: UnityVersion - type: string - default: '' - -- name: BuildTarget - type: string - values: - - StandaloneWindows64 - - WSAPlayer - - Android - default: StandaloneWindows64 - -- name: PathToProject - type: string - -- name: AdditionalArguments - type: string - default: '' + - name: UnityVersion + type: string + default: "" + + - name: BuildTarget + type: string + values: + - StandaloneWindows64 + - WSAPlayer + - Android + default: StandaloneWindows64 + + - name: PathToProject + type: string + + - name: AdditionalArguments + type: string + default: "" steps: -# No edit mode tests (yet!) -# - pwsh: | - # Write-Host "======================= EditMode Tests =======================" - - # $logFile = Join-Path $(Build.ArtifactStagingDirectory) "editmode-test-run.log" - # New-Item -Path $logFile -ItemType File -Force - - # $resultFile = Join-Path $(Build.ArtifactStagingDirectory) "test-results-editmode.xml" - # New-Item -Path $resultFile -ItemType File -Force - - # if ("${{ parameters.UnityVersion }}" -eq "Latest") { - # $proc = Start-UnityEditor -Project "${{ parameters.PathToProject }}" -Latest -RunTests -TestPlatform EditMode -BuildTarget ${{ parameters.BuildTarget }} -BatchMode -Quit -PassThru -LogFile $logFile -EditorTestsResultFile $resultFile -AdditionalArguments "${{ parameters.AdditionalArguments }}" - # } - # else { - # $proc = Start-UnityEditor -Project "${{ parameters.PathToProject }}" -Version ${{ parameters.UnityVersion }} -RunTests -TestPlatform PlayMode -BuildTarget ${{ parameters.BuildTarget }} -BatchMode -Quit -PassThru -LogFile $logFile -EditorTestsResultFile ".\test-editmode-default.xml" -AdditionalArguments "${{ parameters.AdditionalArguments }}" - # } - - # $ljob = Start-Job -ScriptBlock { param($log) Get-Content "$log" -Wait } -ArgumentList $logFile - - # while (-not $proc.HasExited -and $ljob.HasMoreData) - # { - # Receive-Job $ljob - # Start-Sleep -Milliseconds 200 - # } - # Stop-Job $ljob - # Remove-Job $ljob - # Stop-Process $proc - - # Write-Output '=====================================================' - # Write-Output ' PlayMode Tests Finished ' - # Write-Output '=====================================================' -# displayName: 'Run EditMode tests' + - pwsh: | + Write-Host "======================= EditMode Tests =======================" + + $logFile = Join-Path $(Build.ArtifactStagingDirectory) "editmode-test-run.log" + New-Item -Path $logFile -ItemType File -Force + + $resultFile = Join-Path $(Build.ArtifactStagingDirectory) "test-results-editmode.xml" + New-Item -Path $resultFile -ItemType File -Force + + try { + if ("${{ parameters.UnityVersion }}" -eq "Latest") { + $proc = Start-UnityEditor -Project "${{ parameters.PathToProject }}" -Latest -RunTests -TestPlatform EditMode -BuildTarget ${{ parameters.BuildTarget }} -BatchMode -PassThru -LogFile $logFile -EditorTestsResultFile $resultFile -AdditionalArguments "${{ parameters.AdditionalArguments }}" + } + else { + $proc = Start-UnityEditor -Project "${{ parameters.PathToProject }}" -Version ${{ parameters.UnityVersion }} -RunTests -TestPlatform EditMode -BuildTarget ${{ parameters.BuildTarget }} -BatchMode -PassThru -LogFile $logFile -EditorTestsResultFile $resultFile -AdditionalArguments "${{ parameters.AdditionalArguments }}" + } + + $ljob = Start-Job -ScriptBlock { param($log) Get-Content "$log" -Wait } -ArgumentList $logFile + while (-not $proc.HasExited -and $ljob.HasMoreData) + { + Receive-Job $ljob + Start-Sleep -Milliseconds 200 + } + Stop-Job $ljob + Remove-Job $ljob + Stop-Process $proc + } + finally { + Write-Output '=====================================================' + Write-Output ' EditMode Tests Finished ' + Write-Output '=====================================================' + + if (Test-Path $logFile) { + Write-Output '=====================================================' + Write-Output ' Begin EditMode Tests Logs ' + Write-Output '=====================================================' + + Get-Content $logFile + + Write-Output '=====================================================' + Write-Output ' End EditMode Tests Logs ' + Write-Output '=====================================================' + } + else { + Write-Output 'EditMode Tests log missing!' + } + + if (Test-Path $resultFile) { + Write-Output '=====================================================' + Write-Output ' Begin EditMode Tests Results ' + Write-Output '=====================================================' + + Get-Content $resultFile + + Write-Output '=====================================================' + Write-Output ' End EditMode Tests Results ' + Write-Output '=====================================================' + } + else { + Write-Output 'EditMode Tests results missing!' + } + + Write-Output "Exit code: $($proc.ExitCode)" + } + displayName: Run EditMode tests - pwsh: | Write-Host "======================= PlayMode Tests =======================" - + $logFile = Join-Path $(Build.ArtifactStagingDirectory) "playmode-test-run.log" New-Item -Path $logFile -ItemType File -Force - + $resultFile = Join-Path $(Build.ArtifactStagingDirectory) "test-results-playmode.xml" New-Item -Path $resultFile -ItemType File -Force $setupMethod = "Microsoft.MixedReality.Toolkit.Examples.Build.BuildApp.EnsureTMPro" try { - if ("${{ parameters.UnityVersion }}" -eq "Latest") { - $proc = Start-UnityEditor -Project "${{ parameters.PathToProject }}" -Latest -ExecuteMethod $setupMethod -RunTests -TestPlatform PlayMode -BuildTarget ${{ parameters.BuildTarget }} -BatchMode -PassThru -LogFile $logFile -EditorTestsResultFile $resultFile -AdditionalArguments "${{ parameters.AdditionalArguments }}" - } - else { - $proc = Start-UnityEditor -Project "${{ parameters.PathToProject }}" -Version ${{ parameters.UnityVersion }} -ExecuteMethod $setupMethod -RunTests -TestPlatform PlayMode -BuildTarget ${{ parameters.BuildTarget }} -BatchMode -PassThru -LogFile $logFile -EditorTestsResultFile $resultFile -AdditionalArguments "${{ parameters.AdditionalArguments }}" - } + if ("${{ parameters.UnityVersion }}" -eq "Latest") { + $proc = Start-UnityEditor -Project "${{ parameters.PathToProject }}" -Latest -ExecuteMethod $setupMethod -RunTests -TestPlatform PlayMode -BuildTarget ${{ parameters.BuildTarget }} -BatchMode -PassThru -LogFile $logFile -EditorTestsResultFile $resultFile -AdditionalArguments "${{ parameters.AdditionalArguments }}" + } + else { + $proc = Start-UnityEditor -Project "${{ parameters.PathToProject }}" -Version ${{ parameters.UnityVersion }} -ExecuteMethod $setupMethod -RunTests -TestPlatform PlayMode -BuildTarget ${{ parameters.BuildTarget }} -BatchMode -PassThru -LogFile $logFile -EditorTestsResultFile $resultFile -AdditionalArguments "${{ parameters.AdditionalArguments }}" + } - $ljob = Start-Job -ScriptBlock { param($log) Get-Content "$log" -Wait } -ArgumentList $logFile - while (-not $proc.HasExited -and $ljob.HasMoreData) - { - Receive-Job $ljob - Start-Sleep -Milliseconds 200 - } - Stop-Job $ljob - Remove-Job $ljob - Stop-Process $proc + $ljob = Start-Job -ScriptBlock { param($log) Get-Content "$log" -Wait } -ArgumentList $logFile + while (-not $proc.HasExited -and $ljob.HasMoreData) + { + Receive-Job $ljob + Start-Sleep -Milliseconds 200 + } + Stop-Job $ljob + Remove-Job $ljob + Stop-Process $proc } finally { Write-Output '=====================================================' @@ -105,6 +138,7 @@ steps: else { Write-Output 'PlayMode Tests log missing!' } + if (Test-Path $resultFile) { Write-Output '=====================================================' Write-Output ' Begin PlayMode Tests Results ' @@ -119,16 +153,16 @@ steps: else { Write-Output 'PlayMode Tests results missing!' } - Write-Output "Exit code: $($proc.ExitCode)" - } - displayName: 'Run PlayMode tests' + Write-Output "Exit code: $($proc.ExitCode)" + } + displayName: Run PlayMode tests - task: PublishTestResults@2 - displayName: 'Publish Test Results' + displayName: Publish Test Results inputs: testResultsFormat: NUnit - testResultsFiles: 'test*.xml' + testResultsFiles: "test*.xml" searchFolder: $(Build.ArtifactStagingDirectory) failTaskOnFailedTests: true continueOnError: false diff --git a/com.microsoft.mrtk.core/Editor/AboutMRTK.cs b/com.microsoft.mrtk.core/Editor/AboutMRTK.cs index 5836245cdc5..0449b1155fd 100644 --- a/com.microsoft.mrtk.core/Editor/AboutMRTK.cs +++ b/com.microsoft.mrtk.core/Editor/AboutMRTK.cs @@ -42,7 +42,7 @@ private static void Init() window = GetWindow(); window.titleContent = WindowTitle; - if (MixedRealityInspectorUtility.IsMixedRealityToolkitLogoAssetPresent()) + if (InspectorUIUtility.IsMixedRealityToolkitLogoAssetPresent()) { window.minSize = WindowSizeWithLogo; window.maxSize = WindowSizeWithLogo; @@ -78,18 +78,18 @@ private void OnGUI() using (new EditorGUILayout.VerticalScope()) { EditorGUILayout.Space(2); - if (!MixedRealityInspectorUtility.RenderMixedRealityToolkitLogo()) + if (!InspectorUIUtility.RenderMixedRealityToolkitLogo()) { // Only add additional space if the text fallback is used in RenderMixedRealityToolkitLogo(). EditorGUILayout.Space(3); } - EditorGUILayout.LabelField("Copyright (c) Microsoft Corporation. Licensed under the MIT License.", MixedRealityStylesUtility.LicenseStyle); + EditorGUILayout.LabelField("Copyright (c) Microsoft Corporation. Licensed under the MIT License.", MRTKEditorStyles.LicenseStyle); EditorGUILayout.Space(12); if (packageListRequest != null && packageListRequest.IsCompleted == false) { EditorGUILayout.Space(30); - EditorGUILayout.LabelField("Loading package information...", MixedRealityStylesUtility.LicenseStyle); + EditorGUILayout.LabelField("Loading package information...", MRTKEditorStyles.LicenseStyle); } else { diff --git a/com.microsoft.mrtk.core/Editor/Inspectors.meta b/com.microsoft.mrtk.core/Editor/Editors.meta similarity index 100% rename from com.microsoft.mrtk.core/Editor/Inspectors.meta rename to com.microsoft.mrtk.core/Editor/Editors.meta diff --git a/com.microsoft.mrtk.core/Editor/BaseInteractableEditor.cs b/com.microsoft.mrtk.core/Editor/Editors/BaseInteractableEditor.cs similarity index 100% rename from com.microsoft.mrtk.core/Editor/BaseInteractableEditor.cs rename to com.microsoft.mrtk.core/Editor/Editors/BaseInteractableEditor.cs diff --git a/com.microsoft.mrtk.core/Editor/BaseInteractableEditor.cs.meta b/com.microsoft.mrtk.core/Editor/Editors/BaseInteractableEditor.cs.meta similarity index 100% rename from com.microsoft.mrtk.core/Editor/BaseInteractableEditor.cs.meta rename to com.microsoft.mrtk.core/Editor/Editors/BaseInteractableEditor.cs.meta diff --git a/com.microsoft.mrtk.core/Editor/MRTKProfileInspector.cs b/com.microsoft.mrtk.core/Editor/Editors/MRTKProfileEditor.cs similarity index 98% rename from com.microsoft.mrtk.core/Editor/MRTKProfileInspector.cs rename to com.microsoft.mrtk.core/Editor/Editors/MRTKProfileEditor.cs index afbf61bb833..1b049fe1229 100644 --- a/com.microsoft.mrtk.core/Editor/MRTKProfileInspector.cs +++ b/com.microsoft.mrtk.core/Editor/Editors/MRTKProfileEditor.cs @@ -17,7 +17,7 @@ namespace Microsoft.MixedReality.Toolkit.Editor /// as the configurations assigned to each subsystem. /// [CustomEditor(typeof(MRTKProfile))] - public class MRTKProfileInspector : UnityEditor.Editor + public class MRTKProfileEditor : UnityEditor.Editor { /// /// A container class, intended to wrap all information about a subsystem @@ -290,13 +290,13 @@ private void DrawSubsystemList() { using (new EditorGUILayout.VerticalScope(Styles.SubsystemSelectionPanel, GUILayout.Width(Styles.SubsystemListWidth), GUILayout.ExpandWidth(true))) { - EditorGUILayout.LabelField("Available MRTK Subsystems", MixedRealityStylesUtility.BoldLargeTitleStyle); + EditorGUILayout.LabelField("Available MRTK Subsystems", MRTKEditorStyles.BoldLargeTitleStyle); foreach (KeyValuePair> pair in allSubsystemTypes) { using (new EditorGUILayout.VerticalScope(Styles.SubsystemListStyle, GUILayout.ExpandHeight(true))) { - EditorGUILayout.LabelField(pair.Key, MixedRealityStylesUtility.BoldLargeTitleStyle); + EditorGUILayout.LabelField(pair.Key, MRTKEditorStyles.BoldLargeTitleStyle); foreach (SubsystemItem subsystemItem in pair.Value) { @@ -330,7 +330,7 @@ private void DrawSubsystemInspector() { using (new EditorGUILayout.VerticalScope(Styles.SubsystemDetailsPanel)) { - EditorGUILayout.LabelField("Subsystem Details", MixedRealityStylesUtility.BoldLargeTitleStyle); + EditorGUILayout.LabelField("Subsystem Details", MRTKEditorStyles.BoldLargeTitleStyle); if (selectedItem == null) { diff --git a/com.microsoft.mrtk.core/Editor/MRTKProfileInspector.cs.meta b/com.microsoft.mrtk.core/Editor/Editors/MRTKProfileEditor.cs.meta similarity index 100% rename from com.microsoft.mrtk.core/Editor/MRTKProfileInspector.cs.meta rename to com.microsoft.mrtk.core/Editor/Editors/MRTKProfileEditor.cs.meta diff --git a/com.microsoft.mrtk.core/Editor/MRTKSettingsEditor.cs b/com.microsoft.mrtk.core/Editor/Editors/MRTKSettingsEditor.cs similarity index 100% rename from com.microsoft.mrtk.core/Editor/MRTKSettingsEditor.cs rename to com.microsoft.mrtk.core/Editor/Editors/MRTKSettingsEditor.cs diff --git a/com.microsoft.mrtk.core/Editor/MRTKSettingsEditor.cs.meta b/com.microsoft.mrtk.core/Editor/Editors/MRTKSettingsEditor.cs.meta similarity index 100% rename from com.microsoft.mrtk.core/Editor/MRTKSettingsEditor.cs.meta rename to com.microsoft.mrtk.core/Editor/Editors/MRTKSettingsEditor.cs.meta diff --git a/com.microsoft.mrtk.core/Editor/Inspectors/StatefulInteractableInspector.cs b/com.microsoft.mrtk.core/Editor/Editors/StatefulInteractableEditor.cs similarity index 99% rename from com.microsoft.mrtk.core/Editor/Inspectors/StatefulInteractableInspector.cs rename to com.microsoft.mrtk.core/Editor/Editors/StatefulInteractableEditor.cs index cfe5bde3674..087820b400d 100644 --- a/com.microsoft.mrtk.core/Editor/Inspectors/StatefulInteractableInspector.cs +++ b/com.microsoft.mrtk.core/Editor/Editors/StatefulInteractableEditor.cs @@ -8,7 +8,7 @@ namespace Microsoft.MixedReality.Toolkit.Editor { [CustomEditor(typeof(StatefulInteractable), true)] [CanEditMultipleObjects] - public class StatefulInteractableInspector : BaseInteractableEditor + public class StatefulInteractableEditor : BaseInteractableEditor { private SerializedProperty IsToggled; private SerializedProperty IsToggledStateActive; diff --git a/com.microsoft.mrtk.core/Editor/Inspectors/StatefulInteractableInspector.cs.meta b/com.microsoft.mrtk.core/Editor/Editors/StatefulInteractableEditor.cs.meta similarity index 100% rename from com.microsoft.mrtk.core/Editor/Inspectors/StatefulInteractableInspector.cs.meta rename to com.microsoft.mrtk.core/Editor/Editors/StatefulInteractableEditor.cs.meta diff --git a/com.microsoft.mrtk.core/Editor/Inspectors/Utilities/MixedRealityInspectorUtility.cs b/com.microsoft.mrtk.core/Editor/Inspectors/Utilities/MixedRealityInspectorUtility.cs deleted file mode 100644 index b894d163ad5..00000000000 --- a/com.microsoft.mrtk.core/Editor/Inspectors/Utilities/MixedRealityInspectorUtility.cs +++ /dev/null @@ -1,586 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using UnityEditor; -using UnityEngine; -using Object = UnityEngine.Object; - -namespace Microsoft.MixedReality.Toolkit.Editor -{ - /// - /// This class has handy inspector utilities and functions. - /// - public static class MixedRealityInspectorUtility - { - #region Colors - - public static Color DefaultBackgroundColor - { - get - { - return EditorGUIUtility.isProSkin - ? new Color32(56, 56, 56, 255) - : new Color32(194, 194, 194, 255); - } - } - - public static readonly Color DisabledColor = new Color(0.6f, 0.6f, 0.6f); - public static readonly Color WarningColor = new Color(1f, 0.85f, 0.6f); - public static readonly Color ErrorColor = new Color(1f, 0.55f, 0.5f); - public static readonly Color SuccessColor = new Color(0.8f, 1f, 0.75f); - public static readonly Color SectionColor = new Color(0.85f, 0.9f, 1f); - public static readonly Color DarkColor = new Color(0.1f, 0.1f, 0.1f); - public static readonly Color HandleColorSquare = new Color(0.0f, 0.9f, 1f); - public static readonly Color HandleColorCircle = new Color(1f, 0.5f, 1f); - public static readonly Color HandleColorSphere = new Color(1f, 0.5f, 1f); - public static readonly Color HandleColorAxis = new Color(0.0f, 1f, 0.2f); - public static readonly Color HandleColorRotation = new Color(0.0f, 1f, 0.2f); - public static readonly Color HandleColorTangent = new Color(0.1f, 0.8f, 0.5f, 0.7f); - public static readonly Color LineVelocityColor = new Color(0.9f, 1f, 0f, 0.8f); - - #endregion Colors - - public const float DottedLineScreenSpace = 4.65f; - public const string DefaultConfigProfileName = "DefaultMixedRealityToolkitConfigurationProfile"; - - // StandardAssets/Textures/MRTK_Logo_Black.png - private const string LogoLightThemeGuid = "fa0038d8d2df1dd4c99f346c8ec9e746"; - // StandardAssets/Textures/MRTK_Logo_White.png - private const string LogoDarkThemeGuid = "fe5cc215f12ea5e40b5021c4040bce24"; - - public static readonly Texture2D LogoLightTheme = AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(LogoLightThemeGuid)); - public static readonly Texture2D LogoDarkTheme = AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(LogoDarkThemeGuid)); - - public static readonly GUIStyle ProductNameStyle = new GUIStyle(EditorStyles.boldLabel) - { - fontSize = 26, - alignment = TextAnchor.UpperCenter, - fixedHeight = 32 - }; - - internal static bool IsMixedRealityToolkitLogoAssetPresent() - { - return EditorGUIUtility.isProSkin ? LogoDarkTheme != null : LogoLightTheme != null; - } - - /// - /// Render the Mixed Reality Toolkit Logo. - /// - /// True if the logo was loadable and renderable or false if a text fallback was used. - public static bool RenderMixedRealityToolkitLogo() - { - if (IsMixedRealityToolkitLogoAssetPresent()) - { - using (new EditorGUILayout.HorizontalScope()) - { - GUILayout.FlexibleSpace(); - GUILayout.Label(EditorGUIUtility.isProSkin ? LogoDarkTheme : LogoLightTheme, GUILayout.MaxHeight(96f)); - GUILayout.FlexibleSpace(); - } - GUILayout.Space(3f); - return true; - } - else - { - EditorGUILayout.LabelField("Microsoft Mixed Reality Toolkit", ProductNameStyle); - GUILayout.Space(3f); - return false; - } - } - - /// - /// Found at https://answers.unity.com/questions/960413/editor-window-how-to-center-a-window.html - /// - public static Rect GetEditorMainWindowPos() - { - var containerWinType = AppDomain.CurrentDomain.GetAllDerivedTypes(typeof(ScriptableObject)).FirstOrDefault(t => t.Name == "ContainerWindow"); - - if (containerWinType == null) - { - throw new MissingMemberException("Can't find internal type ContainerWindow. Maybe something has changed inside Unity"); - } - - var showModeField = containerWinType.GetField("m_ShowMode", BindingFlags.NonPublic | BindingFlags.Instance); - var positionProperty = containerWinType.GetProperty("position", BindingFlags.Public | BindingFlags.Instance); - - if (showModeField == null || positionProperty == null) - { - throw new MissingFieldException("Can't find internal fields 'm_ShowMode' or 'position'. Maybe something has changed inside Unity"); - } - - var windows = Resources.FindObjectsOfTypeAll(containerWinType); - - foreach (var win in windows) - { - - var showMode = (int)showModeField.GetValue(win); - if (showMode == 4) // main window - { - var pos = (Rect)positionProperty.GetValue(win, null); - return pos; - } - } - - throw new NotSupportedException("Can't find internal main window. Maybe something has changed inside Unity"); - } - - private static Type[] GetAllDerivedTypes(this AppDomain appDomain, Type aType) - { - var result = new List(); - var assemblies = appDomain.GetAssemblies(); - - foreach (var assembly in assemblies) - { - var types = assembly.GetLoadableTypes(); - result.AddRange(types.Where(type => type.IsSubclassOf(aType))); - } - - return result.ToArray(); - } - - /// - /// Centers an editor window on the main display. - /// - public static void CenterOnMainWin(this EditorWindow window) - { - var main = GetEditorMainWindowPos(); - var pos = window.position; - float w = (main.width - pos.width) * 0.5f; - float h = (main.height - pos.height) * 0.5f; - pos.x = main.x + w; - pos.y = main.y + h; - window.position = pos; - } - - #region Handles - - /// - /// Draw an axis move handle. - /// - /// Object that is undergoing the transformation. Also used for recording undo. - /// The initial position of the axis. - /// The direction the axis is facing. - /// Distance from the axis. - /// Optional handle size. - /// Optional, auto sizes the handles based on position and handle size. - /// Optional, records undo state. - /// The new value. - public static float AxisMoveHandle(Object target, Vector3 origin, Vector3 direction, float distance, float handleSize = 0.2f, bool autoSize = true, bool recordUndo = true) - { - Vector3 position = origin + (direction.normalized * distance); - - Handles.color = HandleColorAxis; - - if (autoSize) - { - handleSize = Mathf.Lerp(handleSize, HandleUtility.GetHandleSize(position) * handleSize, 0.75f); - } - - Handles.DrawDottedLine(origin, position, DottedLineScreenSpace); - Handles.ArrowHandleCap(0, position, Quaternion.LookRotation(direction), handleSize * 2, EventType.Repaint); - Vector3 newPosition = Handles.FreeMoveHandle(position, Quaternion.identity, handleSize, Vector3.zero, Handles.CircleHandleCap); - - if (recordUndo) - { - float newDistance = Vector3.Distance(origin, newPosition); - - if (!distance.Equals(newDistance)) - { - Undo.RegisterCompleteObjectUndo(target, target.name); - distance = newDistance; - } - } - - return distance; - } - - /// - /// Draw a Circle Move Handle. - /// - /// Object that is undergoing the transformation. Also used for recording undo. - /// The position to draw the handle. - /// Scale the new value on the x axis by this amount. - /// Scale the new value on the x axis by this amount. - /// Scale the new value on the x axis by this amount. - /// Optional handle size. - /// Optional, auto sizes the handles based on position and handle size. - /// Optional, records undo state. - /// The new Vector3 value. - public static Vector3 CircleMoveHandle(Object target, Vector3 position, float xScale = 1f, float yScale = 1f, float zScale = 1f, float handleSize = 0.2f, bool autoSize = true, bool recordUndo = true) - { - Handles.color = HandleColorCircle; - - if (autoSize) - { - handleSize = Mathf.Lerp(handleSize, HandleUtility.GetHandleSize(position) * handleSize, 0.75f); - } - - Vector3 newPosition = Handles.FreeMoveHandle(position, Quaternion.identity, handleSize, Vector3.zero, Handles.CircleHandleCap); - - if (recordUndo && position != newPosition) - { - Undo.RegisterCompleteObjectUndo(target, target.name); - - position.x = Mathf.Lerp(position.x, newPosition.x, Mathf.Clamp01(xScale)); - position.y = Mathf.Lerp(position.z, newPosition.y, Mathf.Clamp01(yScale)); - position.z = Mathf.Lerp(position.y, newPosition.z, Mathf.Clamp01(zScale)); - } - - return position; - } - - /// - /// Draw a square move handle. - /// - /// Object that is undergoing the transformation. Also used for recording undo. - /// The position to draw the handle. - /// Scale the new value on the x axis by this amount. - /// Scale the new value on the x axis by this amount. - /// Scale the new value on the x axis by this amount. - /// Optional handle size. - /// Optional, auto sizes the handles based on position and handle size. - /// Optional, records undo state. - /// The new Vector3 value. - public static Vector3 SquareMoveHandle(Object target, Vector3 position, float xScale = 1f, float yScale = 1f, float zScale = 1f, float handleSize = 0.2f, bool autoSize = true, bool recordUndo = true) - { - Handles.color = HandleColorSquare; - - if (autoSize) - { - handleSize = Mathf.Lerp(handleSize, HandleUtility.GetHandleSize(position) * handleSize, 0.75f); - } - - // Multiply square handle to match other types - Vector3 newPosition = Handles.FreeMoveHandle(position, Quaternion.identity, handleSize * 0.8f, Vector3.zero, Handles.RectangleHandleCap); - - if (recordUndo && position != newPosition) - { - Undo.RegisterCompleteObjectUndo(target, target.name); - - position.x = Mathf.Lerp(position.x, newPosition.x, Mathf.Clamp01(xScale)); - position.y = Mathf.Lerp(position.z, newPosition.y, Mathf.Clamp01(yScale)); - position.z = Mathf.Lerp(position.y, newPosition.z, Mathf.Clamp01(zScale)); - } - - return position; - } - - /// - /// Draw a sphere move handle. - /// - /// Object that is undergoing the transformation. Also used for recording undo. - /// The position to draw the handle. - /// Scale the new value on the x axis by this amount. - /// Scale the new value on the x axis by this amount. - /// Scale the new value on the x axis by this amount. - /// Optional handle size. - /// Optional, auto sizes the handles based on position and handle size. - /// Optional, records undo state. - /// The new Vector3 value. - public static Vector3 SphereMoveHandle(Object target, Vector3 position, float xScale = 1f, float yScale = 1f, float zScale = 1f, float handleSize = 0.2f, bool autoSize = true, bool recordUndo = true) - { - Handles.color = HandleColorSphere; - - if (autoSize) - { - handleSize = Mathf.Lerp(handleSize, HandleUtility.GetHandleSize(position) * handleSize, 0.75f); - } - - // Multiply sphere handle size to match other types - Vector3 newPosition = Handles.FreeMoveHandle(position, Quaternion.identity, handleSize * 2, Vector3.zero, Handles.SphereHandleCap); - - if (recordUndo && position != newPosition) - { - Undo.RegisterCompleteObjectUndo(target, target.name); - - position.x = Mathf.Lerp(position.x, newPosition.x, Mathf.Clamp01(xScale)); - position.y = Mathf.Lerp(position.z, newPosition.y, Mathf.Clamp01(yScale)); - position.z = Mathf.Lerp(position.y, newPosition.z, Mathf.Clamp01(zScale)); - } - - return position; - } - - /// - /// Draw a vector handle. - /// - /// Object that is undergoing the transformation. Also used for recording undo. - /// Optional, Normalize the new vector value. - /// Optional, Clamp new vector's value based on the distance to the origin. - /// Optional, handle length. - /// Optional, handle size. - /// Optional, auto sizes the handles based on position and handle size. - /// Optional, records undo state. - /// The new Vector3 value. - public static Vector3 VectorHandle(Object target, Vector3 origin, Vector3 vector, bool normalize = true, bool clamp = true, float handleLength = 1f, float handleSize = 0.1f, bool recordUndo = true, bool autoSize = true) - { - Handles.color = HandleColorTangent; - - if (autoSize) - { - handleSize = Mathf.Lerp(handleSize, HandleUtility.GetHandleSize(origin) * handleSize, 0.75f); - } - - Vector3 handlePosition = origin + (vector * handleLength); - float distanceToOrigin = Vector3.Distance(origin, handlePosition) / handleLength; - - if (normalize) - { - vector.Normalize(); - } - else - { - // If the handle isn't normalized, brighten based on distance to origin - Handles.color = Color.Lerp(Color.gray, HandleColorTangent, distanceToOrigin * 0.85f); - - if (clamp) - { - // To indicate that we're at the clamped limit, make the handle 'pop' slightly larger - if (distanceToOrigin >= 0.98f) - { - Handles.color = Color.Lerp(HandleColorTangent, Color.white, 0.5f); - handleSize *= 1.5f; - } - } - } - - // Draw a line from origin to origin + direction - Handles.DrawLine(origin, handlePosition); - - Quaternion rotation = Quaternion.identity; - if (vector != Vector3.zero) - { - rotation = Quaternion.LookRotation(vector); - } - - Vector3 newPosition = Handles.FreeMoveHandle(handlePosition, rotation, handleSize, Vector3.zero, Handles.DotHandleCap); - - if (recordUndo && handlePosition != newPosition) - { - Undo.RegisterCompleteObjectUndo(target, target.name); - vector = (newPosition - origin).normalized; - - // If we normalize, we're done - // Otherwise, multiply the vector by the distance between origin and target - if (!normalize) - { - distanceToOrigin = Vector3.Distance(origin, newPosition) / handleLength; - - if (clamp) - { - distanceToOrigin = Mathf.Clamp01(distanceToOrigin); - } - - vector *= distanceToOrigin; - } - } - - return vector; - } - - /// - /// Draw a rotation handle. - /// - /// Object that is undergoing the transformation. Also used for recording undo. - /// The position to draw the handle. - /// The rotation to draw the handle. - /// Optional, handle size. - /// Optional, auto sizes the handles based on position and handle size. - /// Optional, records undo state. - /// The new Quaternion value. - public static Quaternion RotationHandle(Object target, Vector3 position, Quaternion rotation, float handleSize = 0.2f, bool autoSize = true, bool recordUndo = true) - { - Handles.color = HandleColorRotation; - - if (autoSize) - { - handleSize = Mathf.Lerp(handleSize, HandleUtility.GetHandleSize(position) * handleSize, 0.75f); - } - - // Make rotation handles larger so they can overlay movement handles - Quaternion newRotation = Handles.FreeRotateHandle(rotation, position, handleSize * 2); - - if (recordUndo) - { - Handles.color = Handles.zAxisColor; - Handles.ArrowHandleCap(0, position, Quaternion.LookRotation(newRotation * Vector3.forward), handleSize * 2, EventType.Repaint); - Handles.color = Handles.xAxisColor; - Handles.ArrowHandleCap(0, position, Quaternion.LookRotation(newRotation * Vector3.right), handleSize * 2, EventType.Repaint); - Handles.color = Handles.yAxisColor; - Handles.ArrowHandleCap(0, position, Quaternion.LookRotation(newRotation * Vector3.up), handleSize * 2, EventType.Repaint); - - if (rotation != newRotation) - { - Undo.RegisterCompleteObjectUndo(target, target.name); - rotation = newRotation; - } - } - - return rotation; - } - - #endregion Handles - - #region Profiles - - // private static readonly GUIContent NewProfileContent = new GUIContent("+", "Create New Profile"); - // private static Dictionary profileEditorCache = new Dictionary(); - - // /// - // /// Draws an editor for a profile object. - // /// - // public static void DrawSubProfileEditor(Object profileObject, bool renderProfileInBox) - // { - // if (profileObject == null) - // { - // return; - // } - - // UnityEditor.Editor subProfileEditor = null; - // if (!profileEditorCache.TryGetValue(profileObject, out subProfileEditor)) - // { - // subProfileEditor = UnityEditor.Editor.CreateEditor(profileObject); - // profileEditorCache.Add(profileObject, subProfileEditor); - // } - - // // If this is a default MRTK configuration profile, ask it to render as a sub-profile - // if (typeof(BaseMixedRealityToolkitConfigurationProfileInspector).IsAssignableFrom(subProfileEditor.GetType())) - // { - // BaseMixedRealityToolkitConfigurationProfileInspector configProfile = (BaseMixedRealityToolkitConfigurationProfileInspector)subProfileEditor; - // configProfile.RenderAsSubProfile = true; - // } - - // var subProfile = profileObject as BaseMixedRealityProfile; - // if (subProfile != null && !subProfile.IsCustomProfile) - // { - // string msg = MixedRealityProjectPreferences.LockProfiles ? CloneProfileHelpLockedLabel : CloneProfileHelpLabel; - // EditorGUILayout.HelpBox(msg, MessageType.Warning); - // } - - // if (renderProfileInBox) - // { - // EditorGUILayout.BeginVertical(EditorStyles.helpBox); - // } - // else - // { - // EditorGUILayout.BeginVertical(); - // } - - // EditorGUILayout.Space(); - // subProfileEditor.OnInspectorGUI(); - // EditorGUILayout.Space(); - - // EditorGUILayout.EndVertical(); - // } - - // /// - // /// Draws a dropdown with all available profiles of profileType. - // /// - // /// True if property was changed. - // public static bool DrawProfileDropDownList(SerializedProperty property, BaseMixedRealityProfile profile, Object oldProfileObject, Type profileType, bool requiresProfile, bool showAddButton) - // { - // return DrawProfileDropDownList(property, profile, oldProfileObject, new Type[] { profileType }, requiresProfile, showAddButton); - // } - - // /// - // /// Draws a dropdown with all available profiles of types contained in the array profileTypes. - // /// - // /// True if property was changed. - // public static bool DrawProfileDropDownList(SerializedProperty property, BaseMixedRealityProfile profile, Object oldProfileObject, Type[] profileTypes, bool requiresProfile, bool showAddButton) - // { - // bool changed = false; - - // using (new EditorGUILayout.HorizontalScope()) - // { - // List profileInstanceList = new List(); - // List profileContentList = new List(); - - // // Pull profile instances and profile content from cache - // for(int i = 0; i < profileTypes.Length; i++) - // { - // Type profileType = profileTypes[i]; - // profileInstanceList.AddRange(MixedRealityProfileUtility.GetProfilesOfType(profileType)); - // profileContentList.AddRange(MixedRealityProfileUtility.GetProfilePopupOptionsByType(profileType)); - // } - - // int dropdownOffset = 0; - // if (!requiresProfile || profileInstanceList.Count == 0) - // { - // profileContentList.Insert(0, new GUIContent("(None)")); - // dropdownOffset = 1; - // } - - // ScriptableObject[] profileInstances = profileInstanceList.ToArray(); - // GUIContent[] profileContent = profileContentList.ToArray(); - - // int selectedIndex = 0; - // // Find our selected index - // for (int i = 0; i < profileInstances.Length; i++) - // { - // if (profileInstances[i] == oldProfileObject) - // { // If a profile is required, then the selected index is the same as the profile instance index, otherwise it is offset by the dropdownOffset - // // due to the pre-existing (None) option - // selectedIndex = i + dropdownOffset; - // break; - // } - // } - - // int newIndex = EditorGUILayout.Popup( - // new GUIContent(oldProfileObject != null ? "" : property.displayName), - // selectedIndex, - // profileContent, - // GUILayout.ExpandWidth(true)); - - // int profileInstanceIndex = newIndex - dropdownOffset; - // property.objectReferenceValue = (profileInstanceIndex >= 0) ? profileInstances[profileInstanceIndex] : null; - // changed = property.objectReferenceValue != oldProfileObject; - - // // Draw a button that finds the profile in the project window - // if (property.objectReferenceValue != null) - // { - // // The view asset button should always be enabled. - // using (new GUIEnabledWrapper()) - // { - // if (GUILayout.Button("View Asset", EditorStyles.miniButton, GUILayout.Width(80))) - // { - // EditorGUIUtility.PingObject(property.objectReferenceValue); - // } - // } - // } - - // // Draw the clone button - // if (property.objectReferenceValue == null) - // { - // if (showAddButton && MixedRealityProfileUtility.IsConcreteProfileType(Selection.activeObject.GetType())) - // { - // if (GUILayout.Button(NewProfileContent, EditorStyles.miniButton, GUILayout.Width(20f))) - // { - // ScriptableObject instance = ScriptableObject.CreateInstance(Selection.activeObject.GetType()); - // var newProfile = instance.CreateAsset(AssetDatabase.GetAssetPath(Selection.activeObject)) as BaseMixedRealityProfile; - // property.objectReferenceValue = newProfile; - // property.serializedObject.ApplyModifiedProperties(); - // changed = true; - // } - // } - // } - // else - // { - // var renderedProfile = property.objectReferenceValue as BaseMixedRealityProfile; - // Debug.Assert(renderedProfile != null); - // if (GUILayout.Button(new GUIContent("Clone", "Replace with a copy of the default profile."), EditorStyles.miniButton, GUILayout.Width(45f))) - // { - // MixedRealityProfileCloneWindow.OpenWindow(profile, renderedProfile, property); - // } - // } - // } - - // return changed; - // } - - #endregion - } -} diff --git a/com.microsoft.mrtk.core/Editor/Inspectors/Utilities/MixedRealityInspectorUtility.cs.meta b/com.microsoft.mrtk.core/Editor/Inspectors/Utilities/MixedRealityInspectorUtility.cs.meta deleted file mode 100644 index a65e3c1cd11..00000000000 --- a/com.microsoft.mrtk.core/Editor/Inspectors/Utilities/MixedRealityInspectorUtility.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: b84dcb0ba4bcc1c49ae2f5bbcc31746f -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/com.microsoft.mrtk.core/Editor/Inspectors/Utilities/MixedRealityStylesUtility.cs b/com.microsoft.mrtk.core/Editor/Inspectors/Utilities/MixedRealityStylesUtility.cs deleted file mode 100644 index 591fde18a92..00000000000 --- a/com.microsoft.mrtk.core/Editor/Inspectors/Utilities/MixedRealityStylesUtility.cs +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -using UnityEditor; -using UnityEngine; - -namespace Microsoft.MixedReality.Toolkit.Editor -{ - public static class MixedRealityStylesUtility - { - /// - /// Default style for foldouts with bold title - /// - public static readonly GUIStyle BoldFoldoutStyle = - new GUIStyle(EditorStyles.foldout) - { - fontStyle = FontStyle.Bold - }; - - /// - /// Default style for foldouts with bold large font size title - /// - public static readonly GUIStyle BoldTitleFoldoutStyle = - new GUIStyle(EditorStyles.foldout) - { - fontStyle = FontStyle.Bold, - fontSize = InspectorUIUtility.TitleFontSize, - }; - - /// - /// Default style for foldouts with large font size title - /// - public static readonly GUIStyle TitleFoldoutStyle = - new GUIStyle(EditorStyles.foldout) - { - fontSize = InspectorUIUtility.TitleFontSize, - }; - - /// - /// Default style for controller mapping buttons - /// - public static readonly GUIStyle ControllerButtonStyle = new GUIStyle("iconButton") - { - imagePosition = ImagePosition.ImageAbove, - fixedHeight = 128, - fontStyle = FontStyle.Bold, - stretchHeight = true, - stretchWidth = true, - wordWrap = true, - fontSize = 10, - alignment = TextAnchor.UpperCenter, - fixedWidth = 0, - margin = new RectOffset(0, 0, 0, 0) - }; - - /// - /// Default style for bold large font size title - /// - public static readonly GUIStyle BoldLargeTitleStyle = new GUIStyle(EditorStyles.boldLabel) - { - fontSize = InspectorUIUtility.TitleFontSize, - }; - - internal static readonly GUIStyle LicenseStyle = new GUIStyle(EditorStyles.label) - { - alignment = TextAnchor.MiddleCenter - }; - } -} diff --git a/com.microsoft.mrtk.core/Editor/Inspectors/PropertyDrawers.meta b/com.microsoft.mrtk.core/Editor/PropertyDrawers.meta similarity index 100% rename from com.microsoft.mrtk.core/Editor/Inspectors/PropertyDrawers.meta rename to com.microsoft.mrtk.core/Editor/PropertyDrawers.meta diff --git a/com.microsoft.mrtk.core/Editor/Inspectors/PropertyDrawers/DrawIfPropertyDrawer.cs b/com.microsoft.mrtk.core/Editor/PropertyDrawers/DrawIfPropertyDrawer.cs similarity index 100% rename from com.microsoft.mrtk.core/Editor/Inspectors/PropertyDrawers/DrawIfPropertyDrawer.cs rename to com.microsoft.mrtk.core/Editor/PropertyDrawers/DrawIfPropertyDrawer.cs diff --git a/com.microsoft.mrtk.core/Editor/Inspectors/PropertyDrawers/DrawIfPropertyDrawer.cs.meta b/com.microsoft.mrtk.core/Editor/PropertyDrawers/DrawIfPropertyDrawer.cs.meta similarity index 100% rename from com.microsoft.mrtk.core/Editor/Inspectors/PropertyDrawers/DrawIfPropertyDrawer.cs.meta rename to com.microsoft.mrtk.core/Editor/PropertyDrawers/DrawIfPropertyDrawer.cs.meta diff --git a/com.microsoft.mrtk.core/Editor/Inspectors/PropertyDrawers/InterfaceSelectorDrawer.cs b/com.microsoft.mrtk.core/Editor/PropertyDrawers/InterfaceSelectorDrawer.cs similarity index 100% rename from com.microsoft.mrtk.core/Editor/Inspectors/PropertyDrawers/InterfaceSelectorDrawer.cs rename to com.microsoft.mrtk.core/Editor/PropertyDrawers/InterfaceSelectorDrawer.cs diff --git a/com.microsoft.mrtk.core/Editor/Inspectors/PropertyDrawers/InterfaceSelectorDrawer.cs.meta b/com.microsoft.mrtk.core/Editor/PropertyDrawers/InterfaceSelectorDrawer.cs.meta similarity index 100% rename from com.microsoft.mrtk.core/Editor/Inspectors/PropertyDrawers/InterfaceSelectorDrawer.cs.meta rename to com.microsoft.mrtk.core/Editor/PropertyDrawers/InterfaceSelectorDrawer.cs.meta diff --git a/com.microsoft.mrtk.core/Editor/Inspectors/PropertyDrawers/LabelWidthAttributeDrawer.cs b/com.microsoft.mrtk.core/Editor/PropertyDrawers/LabelWidthAttributeDrawer.cs similarity index 100% rename from com.microsoft.mrtk.core/Editor/Inspectors/PropertyDrawers/LabelWidthAttributeDrawer.cs rename to com.microsoft.mrtk.core/Editor/PropertyDrawers/LabelWidthAttributeDrawer.cs diff --git a/com.microsoft.mrtk.core/Editor/Inspectors/PropertyDrawers/LabelWidthAttributeDrawer.cs.meta b/com.microsoft.mrtk.core/Editor/PropertyDrawers/LabelWidthAttributeDrawer.cs.meta similarity index 100% rename from com.microsoft.mrtk.core/Editor/Inspectors/PropertyDrawers/LabelWidthAttributeDrawer.cs.meta rename to com.microsoft.mrtk.core/Editor/PropertyDrawers/LabelWidthAttributeDrawer.cs.meta diff --git a/com.microsoft.mrtk.core/Editor/Inspectors/PropertyDrawers/SelectRepairedTypeWindow.cs b/com.microsoft.mrtk.core/Editor/PropertyDrawers/SelectRepairedTypeWindow.cs similarity index 100% rename from com.microsoft.mrtk.core/Editor/Inspectors/PropertyDrawers/SelectRepairedTypeWindow.cs rename to com.microsoft.mrtk.core/Editor/PropertyDrawers/SelectRepairedTypeWindow.cs diff --git a/com.microsoft.mrtk.core/Editor/Inspectors/PropertyDrawers/SelectRepairedTypeWindow.cs.meta b/com.microsoft.mrtk.core/Editor/PropertyDrawers/SelectRepairedTypeWindow.cs.meta similarity index 100% rename from com.microsoft.mrtk.core/Editor/Inspectors/PropertyDrawers/SelectRepairedTypeWindow.cs.meta rename to com.microsoft.mrtk.core/Editor/PropertyDrawers/SelectRepairedTypeWindow.cs.meta diff --git a/com.microsoft.mrtk.core/Editor/Inspectors/PropertyDrawers/TimedFlagPropertyDrawer.cs b/com.microsoft.mrtk.core/Editor/PropertyDrawers/TimedFlagPropertyDrawer.cs similarity index 100% rename from com.microsoft.mrtk.core/Editor/Inspectors/PropertyDrawers/TimedFlagPropertyDrawer.cs rename to com.microsoft.mrtk.core/Editor/PropertyDrawers/TimedFlagPropertyDrawer.cs diff --git a/com.microsoft.mrtk.core/Editor/Inspectors/PropertyDrawers/TimedFlagPropertyDrawer.cs.meta b/com.microsoft.mrtk.core/Editor/PropertyDrawers/TimedFlagPropertyDrawer.cs.meta similarity index 100% rename from com.microsoft.mrtk.core/Editor/Inspectors/PropertyDrawers/TimedFlagPropertyDrawer.cs.meta rename to com.microsoft.mrtk.core/Editor/PropertyDrawers/TimedFlagPropertyDrawer.cs.meta diff --git a/com.microsoft.mrtk.core/Editor/Inspectors/PropertyDrawers/TypeReferencePropertyDrawer.cs b/com.microsoft.mrtk.core/Editor/PropertyDrawers/TypeReferencePropertyDrawer.cs similarity index 100% rename from com.microsoft.mrtk.core/Editor/Inspectors/PropertyDrawers/TypeReferencePropertyDrawer.cs rename to com.microsoft.mrtk.core/Editor/PropertyDrawers/TypeReferencePropertyDrawer.cs diff --git a/com.microsoft.mrtk.core/Editor/Inspectors/PropertyDrawers/TypeReferencePropertyDrawer.cs.meta b/com.microsoft.mrtk.core/Editor/PropertyDrawers/TypeReferencePropertyDrawer.cs.meta similarity index 100% rename from com.microsoft.mrtk.core/Editor/Inspectors/PropertyDrawers/TypeReferencePropertyDrawer.cs.meta rename to com.microsoft.mrtk.core/Editor/PropertyDrawers/TypeReferencePropertyDrawer.cs.meta diff --git a/com.microsoft.mrtk.core/Editor/Inspectors/PropertyDrawers/VariableRangeAttributeDrawer.cs b/com.microsoft.mrtk.core/Editor/PropertyDrawers/VariableRangeAttributeDrawer.cs similarity index 100% rename from com.microsoft.mrtk.core/Editor/Inspectors/PropertyDrawers/VariableRangeAttributeDrawer.cs rename to com.microsoft.mrtk.core/Editor/PropertyDrawers/VariableRangeAttributeDrawer.cs diff --git a/com.microsoft.mrtk.core/Editor/Inspectors/PropertyDrawers/VariableRangeAttributeDrawer.cs.meta b/com.microsoft.mrtk.core/Editor/PropertyDrawers/VariableRangeAttributeDrawer.cs.meta similarity index 100% rename from com.microsoft.mrtk.core/Editor/Inspectors/PropertyDrawers/VariableRangeAttributeDrawer.cs.meta rename to com.microsoft.mrtk.core/Editor/PropertyDrawers/VariableRangeAttributeDrawer.cs.meta diff --git a/com.microsoft.mrtk.core/Editor/Inspectors/Utilities.meta b/com.microsoft.mrtk.core/Editor/Utilities.meta similarity index 100% rename from com.microsoft.mrtk.core/Editor/Inspectors/Utilities.meta rename to com.microsoft.mrtk.core/Editor/Utilities.meta diff --git a/com.microsoft.mrtk.core/Editor/Inspectors/Utilities/GUIEnabledWrapper.cs b/com.microsoft.mrtk.core/Editor/Utilities/GUIEnabledWrapper.cs similarity index 100% rename from com.microsoft.mrtk.core/Editor/Inspectors/Utilities/GUIEnabledWrapper.cs rename to com.microsoft.mrtk.core/Editor/Utilities/GUIEnabledWrapper.cs diff --git a/com.microsoft.mrtk.core/Editor/Inspectors/Utilities/GUIEnabledWrapper.cs.meta b/com.microsoft.mrtk.core/Editor/Utilities/GUIEnabledWrapper.cs.meta similarity index 100% rename from com.microsoft.mrtk.core/Editor/Inspectors/Utilities/GUIEnabledWrapper.cs.meta rename to com.microsoft.mrtk.core/Editor/Utilities/GUIEnabledWrapper.cs.meta diff --git a/com.microsoft.mrtk.core/Editor/Inspectors/Utilities/InspectorUIUtility.cs b/com.microsoft.mrtk.core/Editor/Utilities/InspectorUIUtility.cs similarity index 54% rename from com.microsoft.mrtk.core/Editor/Inspectors/Utilities/InspectorUIUtility.cs rename to com.microsoft.mrtk.core/Editor/Utilities/InspectorUIUtility.cs index 7a294a24a8d..5783f902ae4 100644 --- a/com.microsoft.mrtk.core/Editor/Inspectors/Utilities/InspectorUIUtility.cs +++ b/com.microsoft.mrtk.core/Editor/Utilities/InspectorUIUtility.cs @@ -8,6 +8,8 @@ using UnityEditor; using UnityEngine; +using Object = UnityEngine.Object; + namespace Microsoft.MixedReality.Toolkit.Editor { /// @@ -15,6 +17,16 @@ namespace Microsoft.MixedReality.Toolkit.Editor /// public static class InspectorUIUtility { + #region Color + + /// + /// Default background color, depending + /// on light/dark theme. + /// + public static Color DefaultBackgroundColor => EditorGUIUtility.isProSkin + ? new Color32(56, 56, 56, 255) + : new Color32(194, 194, 194, 255); + // Colors private static readonly Color PersonalThemeColorTint100 = new Color(1f, 1f, 1f); private static readonly Color PersonalThemeColorTint75 = new Color(0.75f, 0.75f, 0.75f); @@ -34,12 +46,34 @@ public static class InspectorUIUtility public static Color ColorTint25 => EditorGUIUtility.isProSkin ? ProfessionalThemeColorTint25 : PersonalThemeColorTint25; public static Color ColorTint10 => EditorGUIUtility.isProSkin ? ProfessionalThemeColorTint10 : PersonalThemeColorTint10; + public static readonly Color DisabledColor = new Color(0.6f, 0.6f, 0.6f); + public static readonly Color WarningColor = new Color(1f, 0.85f, 0.6f); + public static readonly Color ErrorColor = new Color(1f, 0.55f, 0.5f); + public static readonly Color SuccessColor = new Color(0.8f, 1f, 0.75f); + public static readonly Color SectionColor = new Color(0.85f, 0.9f, 1f); + public static readonly Color DarkColor = new Color(0.1f, 0.1f, 0.1f); + public static readonly Color HandleColorSquare = new Color(0.0f, 0.9f, 1f); + public static readonly Color HandleColorCircle = new Color(1f, 0.5f, 1f); + public static readonly Color HandleColorSphere = new Color(1f, 0.5f, 1f); + public static readonly Color HandleColorAxis = new Color(0.0f, 1f, 0.2f); + public static readonly Color HandleColorRotation = new Color(0.0f, 1f, 0.2f); + public static readonly Color HandleColorTangent = new Color(0.1f, 0.8f, 0.5f, 0.7f); + public static readonly Color LineVelocityColor = new Color(0.9f, 1f, 0f, 0.8f); + + #endregion Color + + #region Sizes + // default UI sizes public const int TitleFontSize = 14; public const int HeaderFontSize = 11; public const int DefaultFontSize = 10; public const float DocLinkWidth = 175f; + #endregion Sizes + + #region Special unicode characters + // special characters public static readonly string Minus = "\u2212"; public static readonly string Plus = "\u002B"; @@ -54,11 +88,31 @@ public static class InspectorUIUtility public static readonly string Emoji = "\u263A"; public static readonly string Reload = "\u21BB"; + #endregion Special unicode characters + + #region Handy icon textures + public static readonly Texture HelpIcon = EditorGUIUtility.IconContent("_Help").image; public static readonly Texture SuccessIcon = EditorGUIUtility.IconContent("Collab").image; public static readonly Texture WarningIcon = EditorGUIUtility.IconContent("console.warnicon").image; public static readonly Texture InfoIcon = EditorGUIUtility.IconContent("console.infoicon").image; + // StandardAssets/Textures/MRTK_Logo_Black.png + private const string LogoLightThemeGuid = "fa0038d8d2df1dd4c99f346c8ec9e746"; + + // StandardAssets/Textures/MRTK_Logo_White.png + private const string LogoDarkThemeGuid = "fe5cc215f12ea5e40b5021c4040bce24"; + + /// MRTK Logo texture suitable for light theme. + public static readonly Texture2D LogoLightTheme = AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(LogoLightThemeGuid)); + + /// MRTK Logo texture suitable for light theme. + public static readonly Texture2D LogoDarkTheme = AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(LogoDarkThemeGuid)); + + #endregion Handy icon textures + + #region Handy drawables/controls + /// /// A data container for managing scrolling lists or nested drawers in custom inspectors. /// @@ -82,39 +136,34 @@ public struct ListSettings /// A serialize property containing information needed if the button was clicked public delegate void MultiListButtonEvent(int[] indexArray, SerializedProperty prop = null); - /// - /// Box style with left margin - /// - public static GUIStyle Box(int margin) - { - GUIStyle box = new GUIStyle(GUI.skin.box); - box.margin.left = margin; - return box; - } - - /// - /// Help box style with left margin - /// - /// amount of left margin - /// Configured helpbox GUIStyle - public static GUIStyle HelpBox(int margin) + internal static bool IsMixedRealityToolkitLogoAssetPresent() { - GUIStyle box = new GUIStyle(EditorStyles.helpBox); - box.margin.left = margin; - return box; + return EditorGUIUtility.isProSkin ? LogoDarkTheme != null : LogoLightTheme != null; } /// - /// Create a custom label style based on color and size + /// Render the Mixed Reality Toolkit Logo. /// - public static GUIStyle LabelStyle(int size, Color color) + /// True if the logo was loadable and renderable or false if a text fallback was used. + public static bool RenderMixedRealityToolkitLogo() { - GUIStyle labelStyle = new GUIStyle(EditorStyles.boldLabel); - labelStyle.fontStyle = FontStyle.Bold; - labelStyle.fontSize = size; - labelStyle.fixedHeight = size * 2; - labelStyle.normal.textColor = color; - return labelStyle; + if (IsMixedRealityToolkitLogoAssetPresent()) + { + using (new EditorGUILayout.HorizontalScope()) + { + GUILayout.FlexibleSpace(); + GUILayout.Label(EditorGUIUtility.isProSkin ? LogoDarkTheme : LogoLightTheme, GUILayout.MaxHeight(96f)); + GUILayout.FlexibleSpace(); + } + GUILayout.Space(3f); + return true; + } + else + { + EditorGUILayout.LabelField("Microsoft Mixed Reality Toolkit", MRTKEditorStyles.ProductNameStyle); + GUILayout.Space(3f); + return false; + } } /// @@ -385,7 +434,7 @@ public static bool SmallButton(GUIContent label) /// public static void DrawTitle(string title) { - GUIStyle labelStyle = LabelStyle(TitleFontSize, ColorTint50); + GUIStyle labelStyle = MRTKEditorStyles.LabelStyle(TitleFontSize, ColorTint50); EditorGUILayout.LabelField(new GUIContent(title), labelStyle); GUILayout.Space(TitleFontSize * 0.5f); } @@ -396,7 +445,7 @@ public static void DrawTitle(string title) /// string content to render public static void DrawHeader(string header) { - GUIStyle labelStyle = LabelStyle(HeaderFontSize, ColorTint10); + GUIStyle labelStyle = MRTKEditorStyles.LabelStyle(HeaderFontSize, ColorTint10); EditorGUILayout.LabelField(new GUIContent(header), labelStyle); } @@ -405,7 +454,7 @@ public static void DrawHeader(string header) /// public static void DrawLabel(string title, int size, Color color) { - GUIStyle labelStyle = LabelStyle(size, color); + GUIStyle labelStyle = MRTKEditorStyles.LabelStyle(size, color); EditorGUILayout.LabelField(new GUIContent(title), labelStyle); } @@ -416,7 +465,7 @@ public static void DrawWarning(string warning) { Color prevColor = GUI.color; - GUI.color = MixedRealityInspectorUtility.WarningColor; + GUI.color = WarningColor; EditorGUILayout.BeginVertical(EditorStyles.textArea); EditorGUILayout.LabelField(warning, EditorStyles.wordWrappedMiniLabel); EditorGUILayout.EndVertical(); @@ -447,7 +496,7 @@ public static void DrawSuccess(string notice) { Color prevColor = GUI.color; - GUI.color = MixedRealityInspectorUtility.SuccessColor; + GUI.color = SuccessColor; EditorGUILayout.BeginVertical(EditorStyles.textArea); EditorGUILayout.LabelField(notice, EditorStyles.wordWrappedMiniLabel); EditorGUILayout.EndVertical(); @@ -462,7 +511,7 @@ public static void DrawError(string error) { Color prevColor = GUI.color; - GUI.color = MixedRealityInspectorUtility.ErrorColor; + GUI.color = ErrorColor; EditorGUILayout.BeginVertical(EditorStyles.textArea); EditorGUILayout.LabelField(error, EditorStyles.wordWrappedMiniLabel); EditorGUILayout.EndVertical(); @@ -541,229 +590,408 @@ public static Enum DrawEnumSerializedProperty(Rect position, SerializedProperty } /// - /// adjust list settings as things change + /// Draws a foldout enlisting all components (or derived types) of the given type attached to the passed GameObject. + /// Adds a button for adding any of the component (or derived types) and a follow button to highlight existing attached components. /// - public static List AdjustListSettings(List listSettings, int count) + public static bool DrawComponentTypeFoldout(GameObject gameObject, bool isExpanded, string typeDescription) where T : MonoBehaviour { - listSettings ??= new List(); + isExpanded = EditorGUILayout.Foldout(isExpanded, typeDescription + "s", true); - int diff = count - listSettings.Count; - if (diff > 0) + if (isExpanded) { - for (int i = 0; i < diff; i++) + if (EditorGUILayout.DropdownButton(new GUIContent("Add " + typeDescription), FocusType.Keyboard)) { - listSettings.Add(new ListSettings() { Show = false, Scroll = new Vector2() }); + // create the menu and add items to it + GenericMenu menu = new GenericMenu(); + + var type = typeof(T); + var types = AppDomain.CurrentDomain.GetAssemblies() + .SelectMany(s => s.GetLoadableTypes()) + .Where(p => type.IsAssignableFrom(p) && !p.IsAbstract); + + foreach (var derivedType in types) + { + menu.AddItem(new GUIContent(derivedType.Name), false, t => gameObject.AddComponent((Type)t), derivedType); + } + + menu.ShowAsContext(); } - } - else if (diff < 0) - { - int removeCnt = 0; - for (int i = listSettings.Count - 1; i > -1; i--) + + var constraints = gameObject.GetComponents(); + + foreach (var constraint in constraints) { - if (removeCnt > diff) + EditorGUILayout.BeginHorizontal(); + string constraintName = constraint.GetType().Name; + EditorGUILayout.LabelField(constraintName); + if (GUILayout.Button("Go to component")) { - listSettings.RemoveAt(i); - removeCnt--; + Highlighter.Highlight("Inspector", $"{ObjectNames.NicifyVariableName(constraintName)} (Script)"); + EditorGUIUtility.ExitGUI(); } + EditorGUILayout.EndHorizontal(); } } - return listSettings; + return isExpanded; + } + + + static private void DrawScriptableSubEditor(SerializedProperty scriptable) + { + if (scriptable.objectReferenceValue != null) + { + UnityEditor.Editor configEditor = UnityEditor.Editor.CreateEditor(scriptable.objectReferenceValue); + EditorGUILayout.BeginVertical(EditorStyles.helpBox); + EditorGUILayout.Space(); + configEditor.OnInspectorGUI(); + EditorGUILayout.Space(); + EditorGUILayout.EndVertical(); + } } + #endregion Handy drawables/controls + + #region Utilities + + public static string GetBackingField(string propertyName) => $"<{propertyName}>k__BackingField"; + /// - /// Get an array of strings from a serialized list of strings, pop-up field helper + /// Found at https://answers.unity.com/questions/960413/editor-window-how-to-center-a-window.html /// - public static string[] GetOptions(SerializedProperty options) + public static Rect GetEditorMainWindowPos() + { + var containerWinType = AppDomain.CurrentDomain.GetAllDerivedTypes(typeof(ScriptableObject)).FirstOrDefault(t => t.Name == "ContainerWindow"); + + if (containerWinType == null) + { + throw new MissingMemberException("Can't find internal type ContainerWindow. Maybe something has changed inside Unity"); + } + + var showModeField = containerWinType.GetField("m_ShowMode", BindingFlags.NonPublic | BindingFlags.Instance); + var positionProperty = containerWinType.GetProperty("position", BindingFlags.Public | BindingFlags.Instance); + + if (showModeField == null || positionProperty == null) + { + throw new MissingFieldException("Can't find internal fields 'm_ShowMode' or 'position'. Maybe something has changed inside Unity"); + } + + var windows = Resources.FindObjectsOfTypeAll(containerWinType); + + foreach (var win in windows) + { + + var showMode = (int)showModeField.GetValue(win); + if (showMode == 4) // main window + { + var pos = (Rect)positionProperty.GetValue(win, null); + return pos; + } + } + + throw new NotSupportedException("Can't find internal main window. Maybe something has changed inside Unity"); + } + + private static Type[] GetAllDerivedTypes(this AppDomain appDomain, Type aType) { - List list = new List(); - for (int i = 0; i < options.arraySize; i++) + var result = new List(); + var assemblies = appDomain.GetAssemblies(); + + foreach (var assembly in assemblies) { - list.Add(options.GetArrayElementAtIndex(i).stringValue); + var types = assembly.GetLoadableTypes(); + result.AddRange(types.Where(type => type.IsSubclassOf(aType))); } - return list.ToArray(); + return result.ToArray(); } /// - /// Get the index of a serialized array item based on its name, pop-up field helper + /// Centers an editor window on the main display. + /// + public static void CenterOnMainWin(this EditorWindow window) + { + var main = GetEditorMainWindowPos(); + var pos = window.position; + float w = (main.width - pos.width) * 0.5f; + float h = (main.height - pos.height) * 0.5f; + pos.x = main.x + w; + pos.y = main.y + h; + window.position = pos; + } + + #endregion Utilities + + #region Handles + + // Magic number for dashed lines for editor handles/affordances. + private const float DottedLineScreenSpace = 4.65f; + + /// + /// Draw an axis move handle. /// - public static int GetOptionsIndex(SerializedProperty options, string selection) + /// Object that is undergoing the transformation. Also used for recording undo. + /// The initial position of the axis. + /// The direction the axis is facing. + /// Distance from the axis. + /// Optional handle size. + /// Optional, auto sizes the handles based on position and handle size. + /// Optional, records undo state. + /// The new value. + public static float AxisMoveHandle(Object target, Vector3 origin, Vector3 direction, float distance, float handleSize = 0.2f, bool autoSize = true, bool recordUndo = true) { - for (int i = 0; i < options.arraySize; i++) + Vector3 position = origin + (direction.normalized * distance); + + Handles.color = HandleColorAxis; + + if (autoSize) + { + handleSize = Mathf.Lerp(handleSize, HandleUtility.GetHandleSize(position) * handleSize, 0.75f); + } + + Handles.DrawDottedLine(origin, position, DottedLineScreenSpace); + Handles.ArrowHandleCap(0, position, Quaternion.LookRotation(direction), handleSize * 2, EventType.Repaint); + Vector3 newPosition = Handles.FreeMoveHandle(position, Quaternion.identity, handleSize, Vector3.zero, Handles.CircleHandleCap); + + if (recordUndo) { - if (options.GetArrayElementAtIndex(i).stringValue == selection) + float newDistance = Vector3.Distance(origin, newPosition); + + if (!distance.Equals(newDistance)) { - return i; + Undo.RegisterCompleteObjectUndo(target, target.name); + distance = newDistance; } } - return 0; + return distance; } /// - /// Draws the contents of a scriptable inline inside a foldout. Depending on if there's an actual scriptable - /// linked, the values will be greyed out or editable in case the scriptable is created inside the serialized object. + /// Draw a Circle Move Handle. /// - static public bool DrawScriptableFoldout(SerializedProperty scriptable, string description, bool isExpanded) where T : ScriptableObject + /// Object that is undergoing the transformation. Also used for recording undo. + /// The position to draw the handle. + /// Scale the new value on the x axis by this amount. + /// Scale the new value on the x axis by this amount. + /// Scale the new value on the x axis by this amount. + /// Optional handle size. + /// Optional, auto sizes the handles based on position and handle size. + /// Optional, records undo state. + /// The new Vector3 value. + public static Vector3 CircleMoveHandle(Object target, Vector3 position, float xScale = 1f, float yScale = 1f, float zScale = 1f, float handleSize = 0.2f, bool autoSize = true, bool recordUndo = true) { - isExpanded = EditorGUILayout.Foldout(isExpanded, description, true, MixedRealityStylesUtility.BoldFoldoutStyle); - if (isExpanded) + Handles.color = HandleColorCircle; + + if (autoSize) { - using (new EditorGUI.IndentLevelScope()) - { - if (scriptable.objectReferenceValue == null) - { - // If there's no scriptable linked we're creating a local instance that allows to store a - // local version of the scriptable in the serialized object owning the scriptable property. - scriptable.objectReferenceValue = ScriptableObject.CreateInstance(); - } + handleSize = Mathf.Lerp(handleSize, HandleUtility.GetHandleSize(position) * handleSize, 0.75f); + } - // We have currently 5 different states to display to the user: - // 1. the scriptable is local to the object instance - // 2. the scriptable is a linked nested scriptable inside of the currently displayed prefab - // 3. the scriptable is a linked nested scriptable inside of another prefab - // 4. the scriptable is a shared standalone asset - // 5. the scriptable slot is empty but inside of a prefab asset which needs special handling as - // prefabs can only display linked or nested scriptables. - - // Depending on the type of link we show the user the scriptable configuration either: - // case 1 &2: editable inlined - // case 3 & 4: greyed out readonly - // case 5: only show the link - - // case 5 -> can't create and/or store the local scriptable above - show link - bool isStoredAsset = scriptable.objectReferenceValue != null && AssetDatabase.Contains(scriptable.objectReferenceValue); - bool isEmptyInStagedPrefab = !isStoredAsset && ((Component)scriptable.serializedObject.targetObject).gameObject.scene.path == ""; - if (scriptable.objectReferenceValue == null || isEmptyInStagedPrefab) - { - EditorGUILayout.HelpBox("No scriptable " + scriptable.displayName + " linked to this prefab. Prefabs can't store " + - "local versions of scriptables and need to be linked to a scriptable asset.", MessageType.Warning); - EditorGUILayout.PropertyField(scriptable, new GUIContent(scriptable.displayName + " (Empty): ")); - } - else - { - bool isNestedInCurrentPrefab = false; -#if UNITY_2021_2_OR_NEWER - var prefabStage = UnityEditor.SceneManagement.PrefabStageUtility.GetCurrentPrefabStage(); -#else - var prefabStage = UnityEditor.Experimental.SceneManagement.PrefabStageUtility.GetCurrentPrefabStage(); -#endif - if (prefabStage != null) - { - var instancePath = AssetDatabase.GetAssetPath(scriptable.objectReferenceValue); - isNestedInCurrentPrefab = instancePath != "" && -#if UNITY_2020_1_OR_NEWER - instancePath == prefabStage.assetPath -#else - instancePath == prefabStage.prefabAssetPath -#endif - ; - } - - if (isStoredAsset && !isNestedInCurrentPrefab) - { - // case 3 & 4 - greyed out drawer - bool isMainAsset = AssetDatabase.IsMainAsset(scriptable.objectReferenceValue); - var sharedAssetPath = AssetDatabase.GetAssetPath(scriptable.objectReferenceValue); - if (isMainAsset) - { - EditorGUILayout.HelpBox("Editing a shared " + scriptable.displayName + ", located at " + sharedAssetPath, MessageType.Warning); - } - else - { - EditorGUILayout.HelpBox("Editing a nested " + scriptable.displayName + ", located inside of " + sharedAssetPath, MessageType.Warning); - } - EditorGUILayout.PropertyField(scriptable, new GUIContent(scriptable.displayName + " (Shared asset): ")); - - // In case there's a shared scriptable linked we're disabling the inlined scriptable properties - // (this will render them grayed out) so users won't accidentally modify the shared scriptable. - GUI.enabled = false; - DrawScriptableSubEditor(scriptable); - GUI.enabled = true; - } - else - { - // case 1 & 2 - inline editable drawer - if (isNestedInCurrentPrefab) - { - EditorGUILayout.HelpBox("Editing a nested version of " + scriptable.displayName + ".", MessageType.Info); - } - else - { - EditorGUILayout.HelpBox("Editing a local version of " + scriptable.displayName + ".", MessageType.Info); - } - EditorGUILayout.PropertyField(scriptable, new GUIContent(scriptable.displayName + " (local): ")); - DrawScriptableSubEditor(scriptable); - } - } - } + Vector3 newPosition = Handles.FreeMoveHandle(position, Quaternion.identity, handleSize, Vector3.zero, Handles.CircleHandleCap); + + if (recordUndo && position != newPosition) + { + Undo.RegisterCompleteObjectUndo(target, target.name); + + position.x = Mathf.Lerp(position.x, newPosition.x, Mathf.Clamp01(xScale)); + position.y = Mathf.Lerp(position.z, newPosition.y, Mathf.Clamp01(yScale)); + position.z = Mathf.Lerp(position.y, newPosition.z, Mathf.Clamp01(zScale)); } - return isExpanded; + return position; } /// - /// Draws a foldout enlisting all components (or derived types) of the given type attached to the passed GameObject. - /// Adds a button for adding any of the component (or derived types) and a follow button to highlight existing attached components. + /// Draw a square move handle. /// - static public bool DrawComponentTypeFoldout(GameObject gameObject, bool isExpanded, string typeDescription) where T : MonoBehaviour + /// Object that is undergoing the transformation. Also used for recording undo. + /// The position to draw the handle. + /// Scale the new value on the x axis by this amount. + /// Scale the new value on the x axis by this amount. + /// Scale the new value on the x axis by this amount. + /// Optional handle size. + /// Optional, auto sizes the handles based on position and handle size. + /// Optional, records undo state. + /// The new Vector3 value. + public static Vector3 SquareMoveHandle(Object target, Vector3 position, float xScale = 1f, float yScale = 1f, float zScale = 1f, float handleSize = 0.2f, bool autoSize = true, bool recordUndo = true) { - isExpanded = EditorGUILayout.Foldout(isExpanded, typeDescription + "s", true); + Handles.color = HandleColorSquare; - if (isExpanded) + if (autoSize) { - if (EditorGUILayout.DropdownButton(new GUIContent("Add " + typeDescription), FocusType.Keyboard)) - { - // create the menu and add items to it - GenericMenu menu = new GenericMenu(); + handleSize = Mathf.Lerp(handleSize, HandleUtility.GetHandleSize(position) * handleSize, 0.75f); + } - var type = typeof(T); - var types = AppDomain.CurrentDomain.GetAssemblies() - .SelectMany(s => s.GetLoadableTypes()) - .Where(p => type.IsAssignableFrom(p) && !p.IsAbstract); + // Multiply square handle to match other types + Vector3 newPosition = Handles.FreeMoveHandle(position, Quaternion.identity, handleSize * 0.8f, Vector3.zero, Handles.RectangleHandleCap); - foreach (var derivedType in types) + if (recordUndo && position != newPosition) + { + Undo.RegisterCompleteObjectUndo(target, target.name); + + position.x = Mathf.Lerp(position.x, newPosition.x, Mathf.Clamp01(xScale)); + position.y = Mathf.Lerp(position.z, newPosition.y, Mathf.Clamp01(yScale)); + position.z = Mathf.Lerp(position.y, newPosition.z, Mathf.Clamp01(zScale)); + } + + return position; + } + + /// + /// Draw a sphere move handle. + /// + /// Object that is undergoing the transformation. Also used for recording undo. + /// The position to draw the handle. + /// Scale the new value on the x axis by this amount. + /// Scale the new value on the x axis by this amount. + /// Scale the new value on the x axis by this amount. + /// Optional handle size. + /// Optional, auto sizes the handles based on position and handle size. + /// Optional, records undo state. + /// The new Vector3 value. + public static Vector3 SphereMoveHandle(Object target, Vector3 position, float xScale = 1f, float yScale = 1f, float zScale = 1f, float handleSize = 0.2f, bool autoSize = true, bool recordUndo = true) + { + Handles.color = HandleColorSphere; + + if (autoSize) + { + handleSize = Mathf.Lerp(handleSize, HandleUtility.GetHandleSize(position) * handleSize, 0.75f); + } + + // Multiply sphere handle size to match other types + Vector3 newPosition = Handles.FreeMoveHandle(position, Quaternion.identity, handleSize * 2, Vector3.zero, Handles.SphereHandleCap); + + if (recordUndo && position != newPosition) + { + Undo.RegisterCompleteObjectUndo(target, target.name); + + position.x = Mathf.Lerp(position.x, newPosition.x, Mathf.Clamp01(xScale)); + position.y = Mathf.Lerp(position.z, newPosition.y, Mathf.Clamp01(yScale)); + position.z = Mathf.Lerp(position.y, newPosition.z, Mathf.Clamp01(zScale)); + } + + return position; + } + + /// + /// Draw a vector handle. + /// + /// Object that is undergoing the transformation. Also used for recording undo. + /// Optional, Normalize the new vector value. + /// Optional, Clamp new vector's value based on the distance to the origin. + /// Optional, handle length. + /// Optional, handle size. + /// Optional, auto sizes the handles based on position and handle size. + /// Optional, records undo state. + /// The new Vector3 value. + public static Vector3 VectorHandle(Object target, Vector3 origin, Vector3 vector, bool normalize = true, bool clamp = true, float handleLength = 1f, float handleSize = 0.1f, bool recordUndo = true, bool autoSize = true) + { + Handles.color = HandleColorTangent; + + if (autoSize) + { + handleSize = Mathf.Lerp(handleSize, HandleUtility.GetHandleSize(origin) * handleSize, 0.75f); + } + + Vector3 handlePosition = origin + (vector * handleLength); + float distanceToOrigin = Vector3.Distance(origin, handlePosition) / handleLength; + + if (normalize) + { + vector.Normalize(); + } + else + { + // If the handle isn't normalized, brighten based on distance to origin + Handles.color = Color.Lerp(Color.gray, HandleColorTangent, distanceToOrigin * 0.85f); + + if (clamp) + { + // To indicate that we're at the clamped limit, make the handle 'pop' slightly larger + if (distanceToOrigin >= 0.98f) { - menu.AddItem(new GUIContent(derivedType.Name), false, t => gameObject.AddComponent((Type)t), derivedType); + Handles.color = Color.Lerp(HandleColorTangent, Color.white, 0.5f); + handleSize *= 1.5f; } - - menu.ShowAsContext(); } + } - var constraints = gameObject.GetComponents(); + // Draw a line from origin to origin + direction + Handles.DrawLine(origin, handlePosition); - foreach (var constraint in constraints) + Quaternion rotation = Quaternion.identity; + if (vector != Vector3.zero) + { + rotation = Quaternion.LookRotation(vector); + } + + Vector3 newPosition = Handles.FreeMoveHandle(handlePosition, rotation, handleSize, Vector3.zero, Handles.DotHandleCap); + + if (recordUndo && handlePosition != newPosition) + { + Undo.RegisterCompleteObjectUndo(target, target.name); + vector = (newPosition - origin).normalized; + + // If we normalize, we're done + // Otherwise, multiply the vector by the distance between origin and target + if (!normalize) { - EditorGUILayout.BeginHorizontal(); - string constraintName = constraint.GetType().Name; - EditorGUILayout.LabelField(constraintName); - if (GUILayout.Button("Go to component")) + distanceToOrigin = Vector3.Distance(origin, newPosition) / handleLength; + + if (clamp) { - Highlighter.Highlight("Inspector", $"{ObjectNames.NicifyVariableName(constraintName)} (Script)"); - EditorGUIUtility.ExitGUI(); + distanceToOrigin = Mathf.Clamp01(distanceToOrigin); } - EditorGUILayout.EndHorizontal(); + + vector *= distanceToOrigin; } } - return isExpanded; + return vector; } - - static private void DrawScriptableSubEditor(SerializedProperty scriptable) + /// + /// Draw a rotation handle. + /// + /// Object that is undergoing the transformation. Also used for recording undo. + /// The position to draw the handle. + /// The rotation to draw the handle. + /// Optional, handle size. + /// Optional, auto sizes the handles based on position and handle size. + /// Optional, records undo state. + /// The new Quaternion value. + public static Quaternion RotationHandle(Object target, Vector3 position, Quaternion rotation, float handleSize = 0.2f, bool autoSize = true, bool recordUndo = true) { - if (scriptable.objectReferenceValue != null) + Handles.color = HandleColorRotation; + + if (autoSize) { - UnityEditor.Editor configEditor = UnityEditor.Editor.CreateEditor(scriptable.objectReferenceValue); - EditorGUILayout.BeginVertical(EditorStyles.helpBox); - EditorGUILayout.Space(); - configEditor.OnInspectorGUI(); - EditorGUILayout.Space(); - EditorGUILayout.EndVertical(); + handleSize = Mathf.Lerp(handleSize, HandleUtility.GetHandleSize(position) * handleSize, 0.75f); + } + + // Make rotation handles larger so they can overlay movement handles + Quaternion newRotation = Handles.FreeRotateHandle(rotation, position, handleSize * 2); + + if (recordUndo) + { + Handles.color = Handles.zAxisColor; + Handles.ArrowHandleCap(0, position, Quaternion.LookRotation(newRotation * Vector3.forward), handleSize * 2, EventType.Repaint); + Handles.color = Handles.xAxisColor; + Handles.ArrowHandleCap(0, position, Quaternion.LookRotation(newRotation * Vector3.right), handleSize * 2, EventType.Repaint); + Handles.color = Handles.yAxisColor; + Handles.ArrowHandleCap(0, position, Quaternion.LookRotation(newRotation * Vector3.up), handleSize * 2, EventType.Repaint); + + if (rotation != newRotation) + { + Undo.RegisterCompleteObjectUndo(target, target.name); + rotation = newRotation; + } } + + return rotation; } - public static string GetBackingField(string propertyName) => $"<{propertyName}>k__BackingField"; + #endregion Handles } } diff --git a/com.microsoft.mrtk.core/Editor/Inspectors/Utilities/InspectorUIUtility.cs.meta b/com.microsoft.mrtk.core/Editor/Utilities/InspectorUIUtility.cs.meta similarity index 100% rename from com.microsoft.mrtk.core/Editor/Inspectors/Utilities/InspectorUIUtility.cs.meta rename to com.microsoft.mrtk.core/Editor/Utilities/InspectorUIUtility.cs.meta diff --git a/com.microsoft.mrtk.core/Editor/Utilities/MRTKEditorStyles.cs b/com.microsoft.mrtk.core/Editor/Utilities/MRTKEditorStyles.cs new file mode 100644 index 00000000000..434f91a0560 --- /dev/null +++ b/com.microsoft.mrtk.core/Editor/Utilities/MRTKEditorStyles.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +using UnityEditor; +using UnityEngine; + +namespace Microsoft.MixedReality.Toolkit.Editor +{ + public static class MRTKEditorStyles + { + /// + /// Default style for foldouts with bold title + /// + public static readonly GUIStyle BoldFoldoutStyle = new GUIStyle(EditorStyles.foldout) + { + fontStyle = FontStyle.Bold + }; + + /// + /// Default style for foldouts with bold large font size title + /// + public static readonly GUIStyle BoldTitleFoldoutStyle = new GUIStyle(EditorStyles.foldout) + { + fontStyle = FontStyle.Bold, + fontSize = InspectorUIUtility.TitleFontSize, + }; + + /// + /// Default style for foldouts with large font size title + /// + public static readonly GUIStyle TitleFoldoutStyle = new GUIStyle(EditorStyles.foldout) + { + fontSize = InspectorUIUtility.TitleFontSize, + }; + + /// + /// Default style for controller mapping buttons + /// + public static readonly GUIStyle ControllerButtonStyle = new GUIStyle("iconButton") + { + imagePosition = ImagePosition.ImageAbove, + fixedHeight = 128, + fontStyle = FontStyle.Bold, + stretchHeight = true, + stretchWidth = true, + wordWrap = true, + fontSize = 10, + alignment = TextAnchor.UpperCenter, + fixedWidth = 0, + margin = new RectOffset(0, 0, 0, 0) + }; + + /// + /// Default style for bold large font size title + /// + public static readonly GUIStyle BoldLargeTitleStyle = new GUIStyle(EditorStyles.boldLabel) + { + fontSize = InspectorUIUtility.TitleFontSize, + }; + + internal static readonly GUIStyle LicenseStyle = new GUIStyle(EditorStyles.label) + { + alignment = TextAnchor.MiddleCenter + }; + + /// + /// Reusable GUIStyle for drawing the MRTK product name label. + /// + public static readonly GUIStyle ProductNameStyle = new GUIStyle(EditorStyles.boldLabel) + { + fontSize = 26, + alignment = TextAnchor.UpperCenter, + fixedHeight = 32 + }; + + /// + /// Box style with left margin + /// + public static GUIStyle BoxStyle(int margin) + { + GUIStyle box = new GUIStyle(GUI.skin.box); + box.margin.left = margin; + return box; + } + + /// + /// Help box style with left margin + /// + /// amount of left margin + /// Configured helpbox GUIStyle + public static GUIStyle HelpBoxStyle(int margin) + { + GUIStyle box = new GUIStyle(EditorStyles.helpBox); + box.margin.left = margin; + return box; + } + + /// + /// Create a custom label style based on color and size + /// + public static GUIStyle LabelStyle(int size, Color color) + { + GUIStyle labelStyle = new GUIStyle(EditorStyles.boldLabel); + labelStyle.fontStyle = FontStyle.Bold; + labelStyle.fontSize = size; + labelStyle.fixedHeight = size * 2; + labelStyle.normal.textColor = color; + return labelStyle; + } + } +} diff --git a/com.microsoft.mrtk.core/Editor/Inspectors/Utilities/MixedRealityStylesUtility.cs.meta b/com.microsoft.mrtk.core/Editor/Utilities/MRTKEditorStyles.cs.meta similarity index 83% rename from com.microsoft.mrtk.core/Editor/Inspectors/Utilities/MixedRealityStylesUtility.cs.meta rename to com.microsoft.mrtk.core/Editor/Utilities/MRTKEditorStyles.cs.meta index 0552c650f3b..c9e713736cc 100644 --- a/com.microsoft.mrtk.core/Editor/Inspectors/Utilities/MixedRealityStylesUtility.cs.meta +++ b/com.microsoft.mrtk.core/Editor/Utilities/MRTKEditorStyles.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: f7e054a92532350499a6d5f06592da26 +guid: 1650069ded63dbc4fa5f154ae96ba565 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/com.microsoft.mrtk.core/Editor/Inspectors/Utilities/PropertyDrawerUtilities.cs b/com.microsoft.mrtk.core/Editor/Utilities/PropertyDrawerUtilities.cs similarity index 100% rename from com.microsoft.mrtk.core/Editor/Inspectors/Utilities/PropertyDrawerUtilities.cs rename to com.microsoft.mrtk.core/Editor/Utilities/PropertyDrawerUtilities.cs diff --git a/com.microsoft.mrtk.core/Editor/Inspectors/Utilities/PropertyDrawerUtilities.cs.meta b/com.microsoft.mrtk.core/Editor/Utilities/PropertyDrawerUtilities.cs.meta similarity index 100% rename from com.microsoft.mrtk.core/Editor/Inspectors/Utilities/PropertyDrawerUtilities.cs.meta rename to com.microsoft.mrtk.core/Editor/Utilities/PropertyDrawerUtilities.cs.meta diff --git a/com.microsoft.mrtk.core/Editor/ReserializeAssetsUtility.cs b/com.microsoft.mrtk.core/Editor/Utilities/ReserializeAssetsUtility.cs similarity index 100% rename from com.microsoft.mrtk.core/Editor/ReserializeAssetsUtility.cs rename to com.microsoft.mrtk.core/Editor/Utilities/ReserializeAssetsUtility.cs diff --git a/com.microsoft.mrtk.core/Editor/ReserializeAssetsUtility.cs.meta b/com.microsoft.mrtk.core/Editor/Utilities/ReserializeAssetsUtility.cs.meta similarity index 100% rename from com.microsoft.mrtk.core/Editor/ReserializeAssetsUtility.cs.meta rename to com.microsoft.mrtk.core/Editor/Utilities/ReserializeAssetsUtility.cs.meta diff --git a/com.microsoft.mrtk.core/Tests/Editor/SmokeTest.cs b/com.microsoft.mrtk.core/Tests/Editor/SmokeTest.cs index 53f4924cbbb..a911fbacbfb 100644 --- a/com.microsoft.mrtk.core/Tests/Editor/SmokeTest.cs +++ b/com.microsoft.mrtk.core/Tests/Editor/SmokeTest.cs @@ -1,18 +1,16 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -using System.Collections; -using UnityEngine.TestTools; +using NUnit.Framework; namespace Microsoft.MixedReality.Toolkit.Core.Tests.EditMode { - public class SmokeTest + internal class SmokeTest { - [UnityTest] - public IEnumerator CorePackageTest() + [Test] + public void CorePackageTest() { - yield return null; + Assert.IsTrue(true); } } } - diff --git a/com.microsoft.mrtk.core/Tests/Runtime/SmokeTest.cs b/com.microsoft.mrtk.core/Tests/Runtime/SmokeTest.cs index 1e7e8849ceb..f4fceda2ba2 100644 --- a/com.microsoft.mrtk.core/Tests/Runtime/SmokeTest.cs +++ b/com.microsoft.mrtk.core/Tests/Runtime/SmokeTest.cs @@ -6,7 +6,7 @@ namespace Microsoft.MixedReality.Toolkit.Core.Tests { - public class SmokeTest + internal class SmokeTest { [UnityTest] public IEnumerator CorePackageTest() @@ -15,4 +15,3 @@ public IEnumerator CorePackageTest() } } } - diff --git a/com.microsoft.mrtk.core/Utilities/ColorUtilities.cs b/com.microsoft.mrtk.core/Utilities/ColorUtilities.cs index 715d67f77cc..4c8418ff528 100644 --- a/com.microsoft.mrtk.core/Utilities/ColorUtilities.cs +++ b/com.microsoft.mrtk.core/Utilities/ColorUtilities.cs @@ -6,6 +6,9 @@ namespace Microsoft.MixedReality.Toolkit { + /// + /// Utilities for manipulating and interpolating between colors and gradients. + /// public static class ColorUtilities { /// @@ -18,11 +21,21 @@ public static Gradient GradientLerp(Gradient a, Gradient b, float t) return GradientLerp(a, b, t, false, false); } + /// + /// Linearly interpolate between two gradients, without interpolating alpha. + /// + /// Taken from https://forum.unity.com/threads/lerp-from-one-gradient-to-another.342561/ + /// The linearly interpolated gradient public static Gradient GradientLerpNoAlpha(Gradient a, Gradient b, float t) { return GradientLerp(a, b, t, true, false); } + /// + /// Linearly interpolate between two gradients using only the alpha channel. + /// + /// Taken from https://forum.unity.com/threads/lerp-from-one-gradient-to-another.342561/ + /// The linearly interpolated gradient public static Gradient GradientLerpNoColor(Gradient a, Gradient b, float t) { return GradientLerp(a, b, t, false, true); diff --git a/com.microsoft.mrtk.core/Utilities/DisplayType.cs b/com.microsoft.mrtk.core/Utilities/DisplayType.cs index 6ecb087401f..0db19f6783e 100644 --- a/com.microsoft.mrtk.core/Utilities/DisplayType.cs +++ b/com.microsoft.mrtk.core/Utilities/DisplayType.cs @@ -5,6 +5,8 @@ namespace Microsoft.MixedReality.Toolkit { /// /// Describes the type of display provided by the device. + /// Maps to the value returned by the when + /// querying displayOpaque. /// public enum DisplayType { diff --git a/com.microsoft.mrtk.core/Utilities/HandBounds.cs b/com.microsoft.mrtk.core/Utilities/HandBounds.cs index 69c4b4fc6f7..55b94937c18 100644 --- a/com.microsoft.mrtk.core/Utilities/HandBounds.cs +++ b/com.microsoft.mrtk.core/Utilities/HandBounds.cs @@ -13,7 +13,7 @@ namespace Microsoft.MixedReality.Toolkit /// (or the proxy visualizer of a motion controller). /// [AddComponentMenu("MRTK/Core/Hand Bounds")] - public class HandBounds : MonoBehaviour // todo, IMixedRealitySourceStateHandler, IMixedRealityHandJointHandler + public class HandBounds : MonoBehaviour { /// /// Accessor for the bounds associated with a handedness, calculated in global-axis-aligned space. diff --git a/com.microsoft.mrtk.core/Utilities/HandJointPose.cs b/com.microsoft.mrtk.core/Utilities/HandJointPose.cs index 44655a18231..0a34bfd1004 100644 --- a/com.microsoft.mrtk.core/Utilities/HandJointPose.cs +++ b/com.microsoft.mrtk.core/Utilities/HandJointPose.cs @@ -6,6 +6,11 @@ namespace Microsoft.MixedReality.Toolkit { + /// + /// The pose of an individual hand joint. Superset + /// of a , adding a + /// radius value. + /// public struct HandJointPose : IEqualityComparer { /// diff --git a/com.microsoft.mrtk.core/Utilities/MathUtilities.cs b/com.microsoft.mrtk.core/Utilities/MathUtilities.cs index bbf254752fa..ce353bd6efc 100644 --- a/com.microsoft.mrtk.core/Utilities/MathUtilities.cs +++ b/com.microsoft.mrtk.core/Utilities/MathUtilities.cs @@ -8,7 +8,8 @@ namespace Microsoft.MixedReality.Toolkit { /// - /// Math Utilities class. + /// Useful utilities for manipulating datatype sizes, conversion factors, + /// quaternions, matrices, and other mathematical tasks. /// public static class MathUtilities { diff --git a/com.microsoft.mrtk.core/Utilities/SystemType.cs b/com.microsoft.mrtk.core/Utilities/SystemType.cs index 401057992f2..7aef812459d 100644 --- a/com.microsoft.mrtk.core/Utilities/SystemType.cs +++ b/com.microsoft.mrtk.core/Utilities/SystemType.cs @@ -166,11 +166,7 @@ public override string ToString() // String values are broken into {namespace.classname, asmdef} private static Dictionary ReferenceMappings = new Dictionary() { - { "Microsoft.MixedReality.Toolkit.Input.InputSimulationService, Microsoft.MixedReality.Toolkit.Services.InputSimulation.Editor", - "Microsoft.MixedReality.Toolkit.Input.InputSimulationService, Microsoft.MixedReality.Toolkit.Services.InputSimulation" }, - - { "Microsoft.MixedReality.Toolkit.Input.InputPlaybackService, Microsoft.MixedReality.Toolkit.Services.InputSimulation.Editor", - "Microsoft.MixedReality.Toolkit.Input.InputPlaybackService, Microsoft.MixedReality.Toolkit.Services.InputSimulation" }, + // Empty for now. }; /// diff --git a/com.microsoft.mrtk.diagnostics/Tests/Editor/SmokeTest.cs b/com.microsoft.mrtk.diagnostics/Tests/Editor/SmokeTest.cs index 9ef84dd0a11..3a25e0bea4a 100644 --- a/com.microsoft.mrtk.diagnostics/Tests/Editor/SmokeTest.cs +++ b/com.microsoft.mrtk.diagnostics/Tests/Editor/SmokeTest.cs @@ -1,18 +1,16 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -using System.Collections; -using UnityEngine.TestTools; +using NUnit.Framework; namespace Microsoft.MixedReality.Toolkit.Performance.Tests.EditMode { - public class SmokeTest + internal class SmokeTest { - [UnityTest] - public IEnumerator PerformancePackageTest() + [Test] + public void PerformancePackageTest() { - yield return null; + Assert.IsTrue(true); } } } - diff --git a/com.microsoft.mrtk.diagnostics/Tests/Runtime/SmokeTest.cs b/com.microsoft.mrtk.diagnostics/Tests/Runtime/SmokeTest.cs index 6d3fed49c2a..342205a22bd 100644 --- a/com.microsoft.mrtk.diagnostics/Tests/Runtime/SmokeTest.cs +++ b/com.microsoft.mrtk.diagnostics/Tests/Runtime/SmokeTest.cs @@ -6,7 +6,7 @@ namespace Microsoft.MixedReality.Toolkit.Performance.Tests { - public class SmokeTest + internal class SmokeTest { [UnityTest] public IEnumerator PerformancePackageTest() @@ -15,4 +15,3 @@ public IEnumerator PerformancePackageTest() } } } - diff --git a/com.microsoft.mrtk.input/Assets/Prefabs/MRTK LeftHand Controller.prefab b/com.microsoft.mrtk.input/Assets/Prefabs/MRTK LeftHand Controller.prefab index 50cde87348f..1adaa767ad2 100644 --- a/com.microsoft.mrtk.input/Assets/Prefabs/MRTK LeftHand Controller.prefab +++ b/com.microsoft.mrtk.input/Assets/Prefabs/MRTK LeftHand Controller.prefab @@ -410,6 +410,7 @@ MonoBehaviour: m_Mode: 0 m_NumColorKeys: 2 m_NumAlphaKeys: 2 + maxGradientLength: 0.1 lineWidth: serializedVersion: 2 m_Curve: @@ -1101,7 +1102,7 @@ GameObject: - component: {fileID: 4299642553989019653} - component: {fileID: 6450185055475174866} - component: {fileID: 7678414244376504105} - m_Layer: 0 + m_Layer: 2 m_Name: NearInteractionModeDetector m_TagString: Untagged m_Icon: {fileID: 0} @@ -1456,7 +1457,7 @@ GameObject: m_Component: - component: {fileID: 1051247791254679178} - component: {fileID: 6800936895746535163} - m_Layer: 0 + m_Layer: 2 m_Name: AttachTransform m_TagString: Untagged m_Icon: {fileID: 0} diff --git a/com.microsoft.mrtk.input/Assets/Prefabs/MRTK XR Rig.prefab b/com.microsoft.mrtk.input/Assets/Prefabs/MRTK XR Rig.prefab index c8a51053c63..8e485a02fc0 100644 --- a/com.microsoft.mrtk.input/Assets/Prefabs/MRTK XR Rig.prefab +++ b/com.microsoft.mrtk.input/Assets/Prefabs/MRTK XR Rig.prefab @@ -91,7 +91,7 @@ MonoBehaviour: m_EditorClassIdentifier: m_EventMask: serializedVersion: 2 - m_Bits: 4294967295 + m_Bits: 4294967291 m_MaxRayIntersections: 0 --- !u!81 &2351505566771328560 AudioListener: diff --git a/com.microsoft.mrtk.input/Editor/Inspectors/CameraSimulationSettingsDrawer.cs b/com.microsoft.mrtk.input/Editor/Inspectors/CameraSimulationSettingsDrawer.cs index b451b788691..f1a67a2e855 100644 --- a/com.microsoft.mrtk.input/Editor/Inspectors/CameraSimulationSettingsDrawer.cs +++ b/com.microsoft.mrtk.input/Editor/Inspectors/CameraSimulationSettingsDrawer.cs @@ -8,7 +8,7 @@ namespace Microsoft.MixedReality.Toolkit.Input.Simulation.Editor { /// - /// Custom inspector drawing for the CameraSettings object. + /// Custom drawer for the CameraSettings object. /// [CustomPropertyDrawer(typeof(CameraSimulationSettings))] public class CameraSimulationSettingsDrawer : PropertyDrawer diff --git a/com.microsoft.mrtk.input/Editor/Inspectors/EyeGazeSimulationSettingsDrawer.cs b/com.microsoft.mrtk.input/Editor/Inspectors/EyeGazeSimulationSettingsDrawer.cs index 5d3b39b4f75..5c1a6cec401 100644 --- a/com.microsoft.mrtk.input/Editor/Inspectors/EyeGazeSimulationSettingsDrawer.cs +++ b/com.microsoft.mrtk.input/Editor/Inspectors/EyeGazeSimulationSettingsDrawer.cs @@ -8,7 +8,7 @@ namespace Microsoft.MixedReality.Toolkit.Input.Simulation.Editor { /// - /// Custom inspector drawing for the EyeGazeSimulationSettings object. + /// Custom drawer for the EyeGazeSimulationSettings object. /// [CustomPropertyDrawer(typeof(EyeGazeSimulationSettings))] public class EyeGazeSimulationSettingsDrawer : PropertyDrawer diff --git a/com.microsoft.mrtk.input/Editor/Inspectors/InteractionModeManagerEditor.cs b/com.microsoft.mrtk.input/Editor/Inspectors/InteractionModeManagerEditor.cs index 0541c1cd4df..dfc98957a71 100644 --- a/com.microsoft.mrtk.input/Editor/Inspectors/InteractionModeManagerEditor.cs +++ b/com.microsoft.mrtk.input/Editor/Inspectors/InteractionModeManagerEditor.cs @@ -27,7 +27,7 @@ public override void OnInspectorGUI() InspectorUIUtility.DrawError($"Duplicate interaction mode definitions detected in the interaction mode manager on {interactionModeManager.gameObject.name}. " + $"Please check the following interaction modes: {duplicatedNameString}"); - GUI.color = MixedRealityInspectorUtility.ErrorColor; + GUI.color = InspectorUIUtility.ErrorColor; } // Handle the rest of the UI diff --git a/com.microsoft.mrtk.input/Tests/Editor/MRTK.Input.EditorTests.asmdef b/com.microsoft.mrtk.input/Tests/Editor/MRTK.Input.EditorTests.asmdef index 39f78e4cca2..d0999d598b1 100644 --- a/com.microsoft.mrtk.input/Tests/Editor/MRTK.Input.EditorTests.asmdef +++ b/com.microsoft.mrtk.input/Tests/Editor/MRTK.Input.EditorTests.asmdef @@ -2,8 +2,7 @@ "name": "Microsoft.MixedReality.Toolkit.Input.Editor.Tests", "rootNamespace": "", "references": [ - "Microsoft.MixedReality.Toolkit.Core", - "Microsoft.MixedReality.Toolkit.Core.Editor", + "Microsoft.MixedReality.Toolkit.Input", "UnityEditor.TestRunner", "UnityEngine.TestRunner" ], diff --git a/com.microsoft.mrtk.input/Tests/Editor/SmokeTest.cs b/com.microsoft.mrtk.input/Tests/Editor/SmokeTest.cs index 3a2b1616cc4..0d0bc6bfa4e 100644 --- a/com.microsoft.mrtk.input/Tests/Editor/SmokeTest.cs +++ b/com.microsoft.mrtk.input/Tests/Editor/SmokeTest.cs @@ -1,18 +1,16 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -using System.Collections; -using UnityEngine.TestTools; +using NUnit.Framework; namespace Microsoft.MixedReality.Toolkit.Input.Tests.EditMode { - public class SmokeTest + internal class SmokeTest { - [UnityTest] - public IEnumerator InputPackageTest() + [Test] + public void InputPackageTest() { - yield return null; + Assert.IsTrue(true); } } } - diff --git a/com.microsoft.mrtk.input/Utilities/PlatformAwarePhysicsRaycaster.cs b/com.microsoft.mrtk.input/Utilities/PlatformAwarePhysicsRaycaster.cs index 1b1d3ea32b1..73ca95444dd 100644 --- a/com.microsoft.mrtk.input/Utilities/PlatformAwarePhysicsRaycaster.cs +++ b/com.microsoft.mrtk.input/Utilities/PlatformAwarePhysicsRaycaster.cs @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License -using System.Collections.Generic; -using UnityEngine; using UnityEngine.EventSystems; namespace Microsoft.MixedReality.Toolkit.Input @@ -31,4 +29,4 @@ protected override void Awake() } } } -} \ No newline at end of file +} diff --git a/com.microsoft.mrtk.input/Visualizers/RiggedHandVisualizer/RiggedHand-InvertedShell.mat b/com.microsoft.mrtk.input/Visualizers/RiggedHandVisualizer/RiggedHand-InvertedShell.mat index 7a7f5ffcfc0..9c7281e61b0 100644 --- a/com.microsoft.mrtk.input/Visualizers/RiggedHandVisualizer/RiggedHand-InvertedShell.mat +++ b/com.microsoft.mrtk.input/Visualizers/RiggedHandVisualizer/RiggedHand-InvertedShell.mat @@ -37,7 +37,7 @@ Material: - _Metallic: 0 - _OutlineExponent: 1 - _OutlineSmoothing: 0.05 - - _OutlineThickness: 0.0000119 + - _OutlineThickness: 0.00001337 - _OutlineThreshold: 0.474 - _PinchAmount: 0 - _Radius_: 0.09 @@ -46,6 +46,6 @@ Material: - _Center_: {r: 0.5, g: 0.5, b: 0, a: 0} - _Color_: {r: 1, g: 1, b: 1, a: 1} - _HandColor: {r: 0.14150941, g: 0.14150941, b: 0.14150941, a: 0.7137255} - - _OutlineColor: {r: 1, g: 1, b: 1, a: 0.2901961} + - _OutlineColor: {r: 1, g: 1, b: 1, a: 0.03529412} - _OutlineColorPinching: {r: 1, g: 1, b: 1, a: 1} m_BuildTextureStacks: [] diff --git a/com.microsoft.mrtk.input/Visualizers/RiggedHandVisualizer/RiggedHand-Main.mat b/com.microsoft.mrtk.input/Visualizers/RiggedHandVisualizer/RiggedHand-Main.mat index f26ebc9aeae..ef1d4e4fe0f 100644 --- a/com.microsoft.mrtk.input/Visualizers/RiggedHandVisualizer/RiggedHand-Main.mat +++ b/com.microsoft.mrtk.input/Visualizers/RiggedHandVisualizer/RiggedHand-Main.mat @@ -31,8 +31,8 @@ Material: - _Fade_In_End_: 0 - _Fade_In_Start_: 0 - _HandThickness: 0 - - _IlluminationAmount: 0.04 - - _IlluminationExponent: 1.78 + - _IlluminationAmount: 0.01 + - _IlluminationExponent: 0.56 - _Intensity_: 0.81 - _Metallic: 0 - _OutlineExponent: 1 @@ -45,7 +45,7 @@ Material: m_Colors: - _Center_: {r: 0.5, g: 0.5, b: 0, a: 0} - _Color_: {r: 1, g: 1, b: 1, a: 1} - - _HandColor: {r: 0.14150941, g: 0.14150941, b: 0.14150941, a: 0.7137255} + - _HandColor: {r: 0.01886791, g: 0.01886791, b: 0.01886791, a: 0.8} - _OutlineColor: {r: 1, g: 1, b: 1, a: 0.2901961} - _OutlineColorPinching: {r: 1, g: 1, b: 1, a: 1} m_BuildTextureStacks: [] diff --git a/com.microsoft.mrtk.spatialmanipulation/Editor/Constraints/ConstraintManagerInspector.cs b/com.microsoft.mrtk.spatialmanipulation/Editor/Constraints/ConstraintManagerEditor.cs similarity index 99% rename from com.microsoft.mrtk.spatialmanipulation/Editor/Constraints/ConstraintManagerInspector.cs rename to com.microsoft.mrtk.spatialmanipulation/Editor/Constraints/ConstraintManagerEditor.cs index af478eff435..1adbd2a5c00 100644 --- a/com.microsoft.mrtk.spatialmanipulation/Editor/Constraints/ConstraintManagerInspector.cs +++ b/com.microsoft.mrtk.spatialmanipulation/Editor/Constraints/ConstraintManagerEditor.cs @@ -11,7 +11,7 @@ namespace Microsoft.MixedReality.Toolkit.SpatialManipulation.Editor { /// - /// Custom inspector for constraint manager. + /// Custom editor for constraint manager. /// Offers two modes depending on if auto constraint selection is active or not. /// In auto constraint selection mode, all constraints attached to the current game object /// will be displayed with respective goto buttons as well as an add button that allows adding @@ -21,7 +21,7 @@ namespace Microsoft.MixedReality.Toolkit.SpatialManipulation.Editor /// [CustomEditor(typeof(ConstraintManager), true)] [CanEditMultipleObjects] - public class ConstraintManagerInspector : UnityEditor.Editor + public class ConstraintManagerEditor : UnityEditor.Editor { private SerializedProperty autoConstraintSelection; private SerializedProperty selectedConstraints; diff --git a/com.microsoft.mrtk.spatialmanipulation/Editor/Constraints/ConstraintManagerInspector.cs.meta b/com.microsoft.mrtk.spatialmanipulation/Editor/Constraints/ConstraintManagerEditor.cs.meta similarity index 100% rename from com.microsoft.mrtk.spatialmanipulation/Editor/Constraints/ConstraintManagerInspector.cs.meta rename to com.microsoft.mrtk.spatialmanipulation/Editor/Constraints/ConstraintManagerEditor.cs.meta diff --git a/com.microsoft.mrtk.spatialmanipulation/Editor/ObjectManipulator/ObjectManipulatorInspector.cs b/com.microsoft.mrtk.spatialmanipulation/Editor/ObjectManipulator/ObjectManipulatorEditor.cs similarity index 96% rename from com.microsoft.mrtk.spatialmanipulation/Editor/ObjectManipulator/ObjectManipulatorInspector.cs rename to com.microsoft.mrtk.spatialmanipulation/Editor/ObjectManipulator/ObjectManipulatorEditor.cs index bb5f664db92..0c6fd5ac506 100644 --- a/com.microsoft.mrtk.spatialmanipulation/Editor/ObjectManipulator/ObjectManipulatorInspector.cs +++ b/com.microsoft.mrtk.spatialmanipulation/Editor/ObjectManipulator/ObjectManipulatorEditor.cs @@ -8,12 +8,12 @@ namespace Microsoft.MixedReality.Toolkit.SpatialManipulation.Editor { /// - /// A custom inspector for ObjectManipulator used to separate + /// A custom editor for ObjectManipulator used to separate /// ObjectManipulator options into distinct foldout panels. /// [CustomEditor(typeof(ObjectManipulator))] [CanEditMultipleObjects] - public class ObjectManipulatorInspector : StatefulInteractableInspector + public class ObjectManipulatorEditor : StatefulInteractableEditor { private ObjectManipulator instance; private SerializedProperty hostTransform; @@ -118,7 +118,7 @@ protected override void DrawProperties() ObjectManipulator objectManipulator = (ObjectManipulator)target; Rigidbody rb = objectManipulator.HostTransform.GetComponent(); - constraintsFoldout = ConstraintManagerInspector.DrawConstraintManagerFoldout(objectManipulator.gameObject, + constraintsFoldout = ConstraintManagerEditor.DrawConstraintManagerFoldout(objectManipulator.gameObject, enableConstraints, constraintManager, constraintsFoldout); diff --git a/com.microsoft.mrtk.spatialmanipulation/Editor/ObjectManipulator/ObjectManipulatorInspector.cs.meta b/com.microsoft.mrtk.spatialmanipulation/Editor/ObjectManipulator/ObjectManipulatorEditor.cs.meta similarity index 100% rename from com.microsoft.mrtk.spatialmanipulation/Editor/ObjectManipulator/ObjectManipulatorInspector.cs.meta rename to com.microsoft.mrtk.spatialmanipulation/Editor/ObjectManipulator/ObjectManipulatorEditor.cs.meta diff --git a/com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/FollowInspector.cs b/com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/FollowEditor.cs similarity index 99% rename from com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/FollowInspector.cs rename to com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/FollowEditor.cs index b08795198ee..1ad895c17ed 100644 --- a/com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/FollowInspector.cs +++ b/com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/FollowEditor.cs @@ -8,7 +8,7 @@ namespace Microsoft.MixedReality.Toolkit.SpatialManipulation.Editor { [CustomEditor(typeof(Follow))] [CanEditMultipleObjects] - public class FollowEditor : SolverInspector + public class FollowEditor : SolverEditor { // Orientation private SerializedProperty orientationType; diff --git a/com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/FollowInspector.cs.meta b/com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/FollowEditor.cs.meta similarity index 100% rename from com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/FollowInspector.cs.meta rename to com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/FollowEditor.cs.meta diff --git a/com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/InBetweenInspector.cs b/com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/InBetweenEditor.cs similarity index 97% rename from com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/InBetweenInspector.cs rename to com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/InBetweenEditor.cs index cb9ad443fbf..12b1fc6bfb7 100644 --- a/com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/InBetweenInspector.cs +++ b/com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/InBetweenEditor.cs @@ -7,7 +7,7 @@ namespace Microsoft.MixedReality.Toolkit.SpatialManipulation.Editor { [CustomEditor(typeof(InBetween))] [CanEditMultipleObjects] - public class InBetweenEditor : SolverInspector + public class InBetweenEditor : SolverEditor { private SerializedProperty secondTrackedTargetTypeProperty; private SerializedProperty secondTrackedHandednessProperty; diff --git a/com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/InBetweenInspector.cs.meta b/com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/InBetweenEditor.cs.meta similarity index 100% rename from com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/InBetweenInspector.cs.meta rename to com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/InBetweenEditor.cs.meta diff --git a/com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/SolverInspector.cs b/com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/SolverEditor.cs similarity index 97% rename from com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/SolverInspector.cs rename to com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/SolverEditor.cs index d59caf43c95..edbb94e622a 100644 --- a/com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/SolverInspector.cs +++ b/com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/SolverEditor.cs @@ -7,7 +7,7 @@ namespace Microsoft.MixedReality.Toolkit.SpatialManipulation.Editor { [CustomEditor(typeof(Solver))] [CanEditMultipleObjects] - public class SolverInspector : UnityEditor.Editor + public class SolverEditor : UnityEditor.Editor { private SerializedProperty updateLinkedTransformProperty; private SerializedProperty moveLerpTimeProperty; diff --git a/com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/SolverInspector.cs.meta b/com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/SolverEditor.cs.meta similarity index 100% rename from com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/SolverInspector.cs.meta rename to com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/SolverEditor.cs.meta diff --git a/com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/SolverHandlerInspector.cs b/com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/SolverHandlerEditor.cs similarity index 98% rename from com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/SolverHandlerInspector.cs rename to com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/SolverHandlerEditor.cs index 17fdb1268de..651e5fbd44b 100644 --- a/com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/SolverHandlerInspector.cs +++ b/com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/SolverHandlerEditor.cs @@ -8,7 +8,7 @@ namespace Microsoft.MixedReality.Toolkit.SpatialManipulation.Editor { [CustomEditor(typeof(SolverHandler))] [CanEditMultipleObjects] - public class SolverHandlerInspector : UnityEditor.Editor + public class SolverHandlerEditor : UnityEditor.Editor { private SerializedProperty trackedTargetProperty; private SerializedProperty trackedHandednessProperty; diff --git a/com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/SolverHandlerInspector.cs.meta b/com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/SolverHandlerEditor.cs.meta similarity index 100% rename from com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/SolverHandlerInspector.cs.meta rename to com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/SolverHandlerEditor.cs.meta diff --git a/com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/SurfaceMagnetismInspector.cs b/com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/SurfaceMagnetismEditor.cs similarity index 99% rename from com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/SurfaceMagnetismInspector.cs rename to com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/SurfaceMagnetismEditor.cs index dc0b4e23108..7c4b0f2f876 100644 --- a/com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/SurfaceMagnetismInspector.cs +++ b/com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/SurfaceMagnetismEditor.cs @@ -10,7 +10,7 @@ namespace Microsoft.MixedReality.Toolkit.SpatialManipulation.Editor { [CustomEditor(typeof(SurfaceMagnetism))] [CanEditMultipleObjects] - public class SurfaceMagnetismInspector : SolverInspector + public class SurfaceMagnetismEditor : SolverEditor { private SerializedProperty magneticSurfacesProperty; private SerializedProperty maxDistanceProperty; diff --git a/com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/SurfaceMagnetismInspector.cs.meta b/com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/SurfaceMagnetismEditor.cs.meta similarity index 100% rename from com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/SurfaceMagnetismInspector.cs.meta rename to com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/SurfaceMagnetismEditor.cs.meta diff --git a/com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/TapToPlaceInspector.cs b/com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/TapToPlaceEditor.cs similarity index 97% rename from com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/TapToPlaceInspector.cs rename to com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/TapToPlaceEditor.cs index 8e69956ff51..13288e4e4ad 100644 --- a/com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/TapToPlaceInspector.cs +++ b/com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/TapToPlaceEditor.cs @@ -8,11 +8,11 @@ namespace Microsoft.MixedReality.Toolkit.SpatialManipulation.Editor { /// - /// Custom inspector for the Tap to Place component. + /// Custom editor for the Tap to Place component. /// [CustomEditor(typeof(TapToPlace))] [CanEditMultipleObjects] - public class TapToPlaceInspector : UnityEditor.Editor + public class TapToPlaceEditor : UnityEditor.Editor { private TapToPlace instance; @@ -111,7 +111,7 @@ private void RenderAdvancedProperties() { // Render Advanced Settings if (InspectorUIUtility.DrawSectionFoldoutWithKey("Advanced Properties", AdvancedPropertiesFoldoutKey, - MixedRealityStylesUtility.TitleFoldoutStyle, false)) + MRTKEditorStyles.TitleFoldoutStyle, false)) { using (new EditorGUI.IndentLevelScope()) { diff --git a/com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/TapToPlaceInspector.cs.meta b/com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/TapToPlaceEditor.cs.meta similarity index 100% rename from com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/TapToPlaceInspector.cs.meta rename to com.microsoft.mrtk.spatialmanipulation/Editor/Solvers/TapToPlaceEditor.cs.meta diff --git a/com.microsoft.mrtk.tools/SubsystemWizard/SubsystemWizardWindow.cs b/com.microsoft.mrtk.tools/SubsystemWizard/SubsystemWizardWindow.cs index 377e2ae9196..315317cb8e4 100644 --- a/com.microsoft.mrtk.tools/SubsystemWizard/SubsystemWizardWindow.cs +++ b/com.microsoft.mrtk.tools/SubsystemWizard/SubsystemWizardWindow.cs @@ -36,7 +36,7 @@ private static void Init() window.subsystemGenerator = new SubsystemGenerator(); window.titleContent = new GUIContent("MRTK3 Subsystem Wizard", EditorGUIUtility.IconContent("d_CustomTool").image); ; - if (MixedRealityInspectorUtility.IsMixedRealityToolkitLogoAssetPresent()) + if (InspectorUIUtility.IsMixedRealityToolkitLogoAssetPresent()) { window.minSize = WindowSizeWithLogo; } @@ -88,14 +88,14 @@ private void OnGUI() private void RenderCommonElements() { EditorGUILayout.Space(2); - if (!MixedRealityInspectorUtility.RenderMixedRealityToolkitLogo()) + if (!InspectorUIUtility.RenderMixedRealityToolkitLogo()) { // Only add additional space if the text fallback is used in RenderMixedRealityToolkitLogo(). EditorGUILayout.Space(3); } EditorGUILayout.LabelField( "MRTK3 Subsystem Wizard", - MixedRealityInspectorUtility.ProductNameStyle); + MRTKEditorStyles.ProductNameStyle); EditorGUILayout.Space(9); using (new EditorGUILayout.HorizontalScope()) { diff --git a/com.microsoft.mrtk.uxcomponents.noncanvas/Tests/Editor/SmokeTest.cs b/com.microsoft.mrtk.uxcomponents.noncanvas/Tests/Editor/SmokeTest.cs deleted file mode 100644 index 9205f3df0df..00000000000 --- a/com.microsoft.mrtk.uxcomponents.noncanvas/Tests/Editor/SmokeTest.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -using System.Collections; -using UnityEngine.TestTools; - -namespace Microsoft.MixedReality.Toolkit.Tests -{ - public class SmokeTest - { - [UnityTest] - public IEnumerator UXPackageTest() - { - yield return null; - } - } -} - diff --git a/com.microsoft.mrtk.uxcore/Editor/Inspectors/PressableButton/PressableButtonInspector.cs b/com.microsoft.mrtk.uxcore/Editor/Inspectors/PressableButton/PressableButtonInspector.cs index 0935227fc11..7d3e05b0c41 100644 --- a/com.microsoft.mrtk.uxcore/Editor/Inspectors/PressableButton/PressableButtonInspector.cs +++ b/com.microsoft.mrtk.uxcore/Editor/Inspectors/PressableButton/PressableButtonInspector.cs @@ -8,7 +8,7 @@ namespace Microsoft.MixedReality.Toolkit.Editor { [CustomEditor(typeof(PressableButton), true)] - public class PressableButtonEditor : StatefulInteractableInspector + public class PressableButtonEditor : StatefulInteractableEditor { // Struct used to store state of preview. // This lets us display accurate info while button is being pressed. diff --git a/com.microsoft.mrtk.uxcore/Editor/Inspectors/Slider/SliderInspector.cs b/com.microsoft.mrtk.uxcore/Editor/Inspectors/Slider/SliderInspector.cs index 24a6aad22ed..65d5e919fb0 100644 --- a/com.microsoft.mrtk.uxcore/Editor/Inspectors/Slider/SliderInspector.cs +++ b/com.microsoft.mrtk.uxcore/Editor/Inspectors/Slider/SliderInspector.cs @@ -8,7 +8,7 @@ namespace Microsoft.MixedReality.Toolkit.Editor { [CustomEditor(typeof(Slider), true)] - public class SliderInspector : StatefulInteractableInspector + public class SliderInspector : StatefulInteractableEditor { private static GUIStyle labelStyle; diff --git a/com.microsoft.mrtk.uxcore/Editor/Inspectors/StateVisualizer/StateVisualizerInspector.cs b/com.microsoft.mrtk.uxcore/Editor/Inspectors/StateVisualizer/StateVisualizerInspector.cs index a387ac02456..43781350cb3 100644 --- a/com.microsoft.mrtk.uxcore/Editor/Inspectors/StateVisualizer/StateVisualizerInspector.cs +++ b/com.microsoft.mrtk.uxcore/Editor/Inspectors/StateVisualizer/StateVisualizerInspector.cs @@ -104,7 +104,7 @@ private void RenderStates() string stateFoldoutID = stateName + "State" + "_" + target.name; - if (InspectorUIUtility.DrawSectionFoldoutWithKey(stateName, stateFoldoutID, MixedRealityStylesUtility.TitleFoldoutStyle, false)) + if (InspectorUIUtility.DrawSectionFoldoutWithKey(stateName, stateFoldoutID, MRTKEditorStyles.TitleFoldoutStyle, false)) { GUI.color = previousColor; using (new EditorGUI.IndentLevelScope()) diff --git a/com.microsoft.mrtk.uxcomponents.noncanvas/Tests/Editor.meta b/com.microsoft.mrtk.uxcore/Tests/Editor.meta similarity index 100% rename from com.microsoft.mrtk.uxcomponents.noncanvas/Tests/Editor.meta rename to com.microsoft.mrtk.uxcore/Tests/Editor.meta diff --git a/com.microsoft.mrtk.uxcomponents.noncanvas/Tests/Editor/AssemblyInfo.cs b/com.microsoft.mrtk.uxcore/Tests/Editor/AssemblyInfo.cs similarity index 96% rename from com.microsoft.mrtk.uxcomponents.noncanvas/Tests/Editor/AssemblyInfo.cs rename to com.microsoft.mrtk.uxcore/Tests/Editor/AssemblyInfo.cs index 78f3c47b9df..169b19ea17a 100644 --- a/com.microsoft.mrtk.uxcomponents.noncanvas/Tests/Editor/AssemblyInfo.cs +++ b/com.microsoft.mrtk.uxcore/Tests/Editor/AssemblyInfo.cs @@ -3,7 +3,7 @@ using System.Reflection; -[assembly: AssemblyProduct("Microsoft® Mixed Reality Toolkit UX Editor Tests")] +[assembly: AssemblyProduct("Microsoft® Mixed Reality Toolkit UXCore Editor Tests")] [assembly: AssemblyCopyright("Copyright © Microsoft Corporation")] // The AssemblyVersion attribute is checked-in and is recommended not to be changed often. diff --git a/com.microsoft.mrtk.uxcomponents.noncanvas/Tests/Editor/AssemblyInfo.cs.meta b/com.microsoft.mrtk.uxcore/Tests/Editor/AssemblyInfo.cs.meta similarity index 100% rename from com.microsoft.mrtk.uxcomponents.noncanvas/Tests/Editor/AssemblyInfo.cs.meta rename to com.microsoft.mrtk.uxcore/Tests/Editor/AssemblyInfo.cs.meta diff --git a/com.microsoft.mrtk.uxcomponents.noncanvas/Tests/Editor/MRTK.CoreUX.EditorTests.asmdef b/com.microsoft.mrtk.uxcore/Tests/Editor/MRTK.UXCore.EditorTests.asmdef similarity index 78% rename from com.microsoft.mrtk.uxcomponents.noncanvas/Tests/Editor/MRTK.CoreUX.EditorTests.asmdef rename to com.microsoft.mrtk.uxcore/Tests/Editor/MRTK.UXCore.EditorTests.asmdef index 7f5867783cb..8302bdb0b98 100644 --- a/com.microsoft.mrtk.uxcomponents.noncanvas/Tests/Editor/MRTK.CoreUX.EditorTests.asmdef +++ b/com.microsoft.mrtk.uxcore/Tests/Editor/MRTK.UXCore.EditorTests.asmdef @@ -1,8 +1,8 @@ { - "name": "Microsoft.MixedReality.Toolkit.UXComponents.Editor.Tests", + "name": "Microsoft.MixedReality.Toolkit.UXCore.Editor.Tests", "rootNamespace": "", "references": [ - "Microsoft.MixedReality.Toolkit.UXComponents", + "Microsoft.MixedReality.Toolkit.UXCore", "UnityEditor.TestRunner", "UnityEngine.TestRunner" ], diff --git a/com.microsoft.mrtk.uxcomponents.noncanvas/Tests/Editor/MRTK.CoreUX.EditorTests.asmdef.meta b/com.microsoft.mrtk.uxcore/Tests/Editor/MRTK.UXCore.EditorTests.asmdef.meta similarity index 100% rename from com.microsoft.mrtk.uxcomponents.noncanvas/Tests/Editor/MRTK.CoreUX.EditorTests.asmdef.meta rename to com.microsoft.mrtk.uxcore/Tests/Editor/MRTK.UXCore.EditorTests.asmdef.meta diff --git a/com.microsoft.mrtk.uxcore/Tests/Editor/SmokeTest.cs b/com.microsoft.mrtk.uxcore/Tests/Editor/SmokeTest.cs new file mode 100644 index 00000000000..a56a8bf578b --- /dev/null +++ b/com.microsoft.mrtk.uxcore/Tests/Editor/SmokeTest.cs @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +using NUnit.Framework; + +namespace Microsoft.MixedReality.Toolkit.UX.Tests.EditMode +{ + internal class SmokeTest + { + [Test] + public void UXPackageTest() + { + Assert.IsTrue(true); + } + } +} + diff --git a/com.microsoft.mrtk.uxcomponents.noncanvas/Tests/Editor/SmokeTest.cs.meta b/com.microsoft.mrtk.uxcore/Tests/Editor/SmokeTest.cs.meta similarity index 100% rename from com.microsoft.mrtk.uxcomponents.noncanvas/Tests/Editor/SmokeTest.cs.meta rename to com.microsoft.mrtk.uxcore/Tests/Editor/SmokeTest.cs.meta