Add ultimate xr
This commit is contained in:
67
Assets/UltimateXR/Editor/Devices/UxrTrackingEditor.cs
Normal file
67
Assets/UltimateXR/Editor/Devices/UxrTrackingEditor.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="UxrTrackingEditor.cs" company="VRMADA">
|
||||
// Copyright (c) VRMADA, All rights reserved.
|
||||
// </copyright>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
using UltimateXR.Devices;
|
||||
using UltimateXR.Editor.Core;
|
||||
using UltimateXR.Editor.Sdks;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UltimateXR.Editor.Devices
|
||||
{
|
||||
/// <summary>
|
||||
/// Custom Unity editor for <see cref="UxrTrackingDevice" /> components. Checks for SDK availability.
|
||||
/// </summary>
|
||||
[CustomEditor(typeof(UxrTrackingDevice), true)]
|
||||
public class UxrTrackingEditor : UnityEditor.Editor
|
||||
{
|
||||
#region Public Types & Data
|
||||
|
||||
public const string PropertyHideAvatarInPassthrough = "_hideAvatarInPassthrough";
|
||||
|
||||
#endregion
|
||||
|
||||
#region Unity
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the given tracking component needs an SDK installed and available. Then draws the component itself.
|
||||
/// </summary>
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
serializedObject.Update();
|
||||
|
||||
UxrTrackingDevice tracking = serializedObject.targetObject as UxrTrackingDevice;
|
||||
|
||||
if (string.IsNullOrEmpty(tracking.SDKDependency) == false)
|
||||
{
|
||||
if (UxrSdkManager.IsAvailable(tracking.SDKDependency) == false)
|
||||
{
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.HelpBox($"In order to work properly this component needs the following SDK installed and active: {tracking.SDKDependency}", MessageType.Warning);
|
||||
|
||||
if (UxrEditorUtils.CenteredButton(new GUIContent("Check", "Go to the SDK Manager to check the SDK")))
|
||||
{
|
||||
UxrSdkManagerWindow.ShowWindow();
|
||||
}
|
||||
|
||||
EditorGUILayout.Space();
|
||||
}
|
||||
}
|
||||
|
||||
if (tracking.IsMixedRealityDevice)
|
||||
{
|
||||
DrawPropertiesExcluding(serializedObject, "m_Script");
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawPropertiesExcluding(serializedObject, "m_Script", PropertyHideAvatarInPassthrough);
|
||||
}
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user