/** * Helper function for calibration setup. * This will perform the following procedures * * 1) Initialize eye tracking calibration * 2) Ensure Vive Tracker for Headset and Vive Controllers are connected * 3) Prompt to calibrate FOVE headset to Vive space (Press H) * 4) Load initial scene (Scene_000) if everything is completed */ private void RunCalibrationSetup() { if (eyeTrackerCalibrationStarted == false) { FoveInterface.EnsureEyeTrackingCalibration(); eyeTrackerCalibrationStarted = true; } if (RenderSettings.skybox != defaultSkyboxMaterial) { RenderSettings.skybox = defaultSkyboxMaterial; } bool eyeTrackerCalibrated = (!FoveInterface.IsEyeTrackingCalibrating() && FoveInterface.IsEyeTrackingCalibrated()); bool headsetCalibrated = headsetLocalizationInstance.IsHeadsetCalibrated(); bool viveTrackerHeadsetConnected = headsetLocalizationInstance.IsHeadsetPositionTracked(); bool controllersConnected = headsetLocalizationInstance.IsControllersConnected(); string uiPromptMessage = ""; if (viveTrackerHeadsetConnected == false) { uiPromptMessage += "Please turn on Vive Tracker for headset.\n"; } if (controllersConnected == false) { uiPromptMessage += "Please connect both Vive controllers.\n"; } if (eyeTrackerCalibrated == false) { uiPromptMessage += "Please calibrate eye tracking.\n"; } if (headsetCalibrated == false) { uiPromptMessage += "Please calibrate headset and vive to world space [H]\n"; } uiPrompt.SetUiPromptMessage(uiPromptMessage); uiPrompt.TurnOnUiPrompt(); if (eyeTrackerCalibrated && headsetCalibrated) { systemCalibrated = true; uiPrompt.TurnOffUiPrompt(); // Initialize a new scene headsetLocalizationInstance.ReCenterUser(); eyeTrackerInstance.CreateNewScene(GenerateSceneName(currentSceneNumber)); SceneManager.LoadSceneAsync(GenerateSceneName(currentSceneNumber), LoadSceneMode.Additive); ChangeSkybox(currentSceneNumber); currentSceneState = SCENE_CHANGE_STATE.Changing; } }
// Currently does not support editing of multiple objects at once. // I do not anticipate any problems with this since you should only // ever really have one per scene anyway. public sealed override void OnInspectorGUI() { // A decent style. Light grey text inside a border. helpStyle = new GUIStyle(GUI.skin.box); helpStyle.wordWrap = true; helpStyle.alignment = TextAnchor.UpperLeft; helpStyle.normal.textColor = Color.red; // Update the serializedobject serializedObject.Update(); EditorGUILayout.PropertyField(_worldScale); // Cache the editor's playing state so we can prevent editing fields that shouldn't update during // a live play session. bool isPlaying = EditorApplication.isPlaying; EditorGUILayout.Space(); EditorGUILayout.LabelField("Client uses...", EditorStyles.boldLabel); EditorGUI.BeginChangeCheck(); { EditorGUI.indentLevel++; EditorGUILayout.PropertyField(_gaze); EditorGUILayout.PropertyField(_orientation); EditorGUILayout.PropertyField(_position); EditorGUI.indentLevel--; } if (EditorGUI.EndChangeCheck()) { FoveInterfaceBase xface = target as FoveInterfaceBase; if (xface != null) { xface.ReloadFoveClient(); } } EditorGUILayout.Space(); EditorGUILayout.PropertyField(_skipAutoCalibrationCheck); EditorGUILayout.PropertyField(_oversamplingRatio); GUI.enabled = true; _showOverrides = EditorGUILayout.Foldout(_showOverrides, "Headset Overrides"); if (_showOverrides) { EditorGUI.indentLevel++; EditorGUILayout.PropertyField(_useCustomPositionScaling); GUI.enabled = _useCustomPositionScaling.boolValue; { EditorGUI.indentLevel++; EditorGUILayout.PropertyField(_posScales); EditorGUI.indentLevel--; } GUI.enabled = true; EditorGUILayout.PropertyField(_usesCustomPlacement); GUI.enabled = _usesCustomPlacement.boolValue; // & !isPlaying; // not modifiable in play mode { EditorGUI.indentLevel++; EditorGUILayout.PropertyField(_IOD); EditorGUILayout.PropertyField(_eyeHeight); EditorGUILayout.PropertyField(_eyeForward); EditorGUI.indentLevel--; } GUI.enabled = true; EditorGUILayout.PropertyField(_suppressProjectionUpdates); EditorGUI.indentLevel--; } GUI.enabled = true; _showCompositorAttribs = EditorGUILayout.Foldout(_showCompositorAttribs, "Compositor options"); if (_showCompositorAttribs) { GUI.enabled = !isPlaying; EditorGUI.indentLevel++; EditorGUILayout.PropertyField(_compositorLayerType); EditorGUILayout.PropertyField(_compositorDisableTimewarp); EditorGUILayout.PropertyField(_compositorDisableDistortion); EditorGUI.indentLevel--; } GUI.enabled = true; if (isPlaying && GUILayout.Button("Ensure calibration")) { Debug.Log("Manually triggering eye tracking calibration check from inspector..."); FoveInterface.EnsureEyeTrackingCalibration(); } if (Application.targetFrameRate != -1) { GUILayout.Label( "WARNING: Your target framerate is set to " + Application.targetFrameRate + ". Having a target framerate can artificially slow down FOVE frame submission. We recommend disabling this." , helpStyle , GUILayout.ExpandWidth(true)); } DrawLocalGUIEditor(); serializedObject.ApplyModifiedProperties(); // Tell a live FoveInterfaceBase object to try to update itself if (isPlaying && GUI.changed) { FoveInterfaceBase xface = target as FoveInterfaceBase; if (xface != null) { xface.RefreshSetup(); } } }