using Phantom.XRMOD.XRMODPackageTools.Editor; using UnityEditor; using UnityEngine; namespace Phantom.XRMOD.XRMODPackageTools.Editor { public class LightEstimationBlock : AbstractBlock { private bool lightEstimationBlockToggle = true; public LightEstimationBlock(Configures _property) : base(_property) { } public override Rect DrawBlock(Rect _area) { lightEstimationBlockToggle = EditorGUILayout.BeginFoldoutHeaderGroup(lightEstimationBlockToggle, "Light Estimation", null, ShowHeaderContextMenu); var tmp_BlockRect = GUILayoutUtility.GetLastRect(); if (property.SDKDeviceType == SDKDeviceType.VisionOS) { EditorGUILayout.HelpBox("This feature is not supported on current platform.", MessageType.Error); } else if (lightEstimationBlockToggle) { EditorGUILayout.BeginHorizontal(); GUILayout.Space(15f); EditorGUILayout.BeginVertical(); property.LightEstimation = EditorGUILayout.Toggle("Light Estimation", property.LightEstimation); if (property.LightEstimation) { property.LightShadowStrength = EditorGUILayout.Slider(new GUIContent("Shadow Strength"), property.LightShadowStrength, 0.1f, 1f); } property.LightEstimationHDR = EditorGUILayout.Toggle("Use HDR", property.LightEstimationHDR); if (property.LightEstimationHDR) { EditorGUILayout.HelpBox( "HDR mode only support android. If you are using it on iOS will be switch to face tracking algorithm automatic.", MessageType.Warning); } EditorGUILayout.EndVertical(); EditorGUILayout.EndHorizontal(); EditorGUILayout.Separator(); Utility.DrawHorizontalDivLine(); } EditorGUILayout.EndFoldoutHeaderGroup(); return tmp_BlockRect; } public override bool OnRemoved() { property.LightEstimation = false; return true; } public override bool OpenReference() { Application.OpenURL($"{CONST_HELP_BASE_URL}features#light-estimation"); return false; } void ShowHeaderContextMenu(Rect _position) { var tmp_Menu = new GenericMenu(); tmp_Menu.AddItem(new GUIContent("Reset"), false, () => OnRemoved()); tmp_Menu.AddItem(new GUIContent(CONST_HELP_BUTTON_TITLE), false, () => OpenReference()); tmp_Menu.DropDown(_position); } } }