mixedreality/com.microsoft.mixedreality..../Providers/UnityAR/Editor/UnityARCameraSettingsProfil...

60 lines
2.3 KiB
C#
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// 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);
}
}
}