60 lines
2.3 KiB
C#
60 lines
2.3 KiB
C#
// Copyright (c) Microsoft Corporation.
|
||
// Licensed under the MIT License.
|
||
|
||
using Microsoft.MixedReality.Toolkit.Editor;
|
||
using System.Linq;
|
||
using UnityEditor;
|
||
|
||
namespace Microsoft.MixedReality.Toolkit.Experimental.UnityAR
|
||
{
|
||
[CustomEditor(typeof(UnityARCameraSettingsProfile))]
|
||
public class UnityARCameraSettingsProfileInspector : BaseMixedRealityToolkitConfigurationProfileInspector
|
||
{
|
||
private const string ProfileTitle = "Unity AR Foundation Camera Settings";
|
||
private const string ProfileDescription = "";
|
||
|
||
// Tracking settings
|
||
private SerializedProperty poseSource;
|
||
private SerializedProperty trackingType;
|
||
private SerializedProperty updateType;
|
||
|
||
protected override void OnEnable()
|
||
{
|
||
base.OnEnable();
|
||
|
||
// Tracking settings
|
||
poseSource = serializedObject.FindProperty("poseSource");
|
||
trackingType = serializedObject.FindProperty("trackingType");
|
||
updateType = serializedObject.FindProperty("updateType");
|
||
}
|
||
|
||
public override void OnInspectorGUI()
|
||
{
|
||
RenderProfileHeader(ProfileTitle, ProfileDescription, target);
|
||
|
||
using (new EditorGUI.DisabledGroupScope(IsProfileLock((BaseMixedRealityProfile)target)))
|
||
{
|
||
serializedObject.Update();
|
||
|
||
EditorGUILayout.Space();
|
||
EditorGUILayout.LabelField("Tracking Settings", EditorStyles.boldLabel);
|
||
EditorGUILayout.PropertyField(poseSource);
|
||
EditorGUILayout.PropertyField(trackingType);
|
||
EditorGUILayout.PropertyField(updateType);
|
||
|
||
serializedObject.ApplyModifiedProperties();
|
||
}
|
||
}
|
||
|
||
protected override bool IsProfileInActiveInstance()
|
||
{
|
||
var profile = target as BaseMixedRealityProfile;
|
||
|
||
return MixedRealityToolkit.IsInitialized && profile != null &&
|
||
MixedRealityToolkit.Instance.HasActiveProfile &&
|
||
MixedRealityToolkit.Instance.ActiveProfile.CameraProfile != null &&
|
||
MixedRealityToolkit.Instance.ActiveProfile.CameraProfile.SettingsConfigurations != null &&
|
||
MixedRealityToolkit.Instance.ActiveProfile.CameraProfile.SettingsConfigurations.Any(s => s.SettingsProfile == profile);
|
||
}
|
||
}
|
||
} |