void Start() { // print ("Start of pupil gaze tracker"); Settings = PupilSettings.Instance; string str = PupilConversions.ReadStringFromFile("camera_intrinsics"); PupilConversions.ReadCalibrationData(str, ref PupilData.CalibrationData); Settings.framePublishing.StreamCameraImages = false; if (Settings.framePublishing.StreamCameraImages) { Settings.framePublishing.InitializeFramePublishing(); } if (PupilGazeTracker._Instance == null) { PupilGazeTracker._Instance = this; } PupilData.calculateMovingAverage = true; //make sure that if the toggles are on it functions as the toggle requires it if (isOperatorMonitor && OnOperatorMonitor == null) { OperatorMonitor.Instantiate(); } //OnOperatorMonitor += DrawOperatorMonitor; if (Settings.debugView.active) { debugInstance.StartCalibrationDebugView(); } PupilGazeTracker.Instance.ProjectName = Application.productName; Settings.connection.isConnected = false; Settings.DataProcessState = PupilSettings.EStatus.Idle; var relativeRightEyePosition = UnityEngine.XR.InputTracking.GetLocalPosition(UnityEngine.XR.XRNode.RightEye) - UnityEngine.XR.InputTracking.GetLocalPosition(UnityEngine.XR.XRNode.CenterEye); Settings.calibration.rightEyeTranslation = new float[] { relativeRightEyePosition.z *PupilSettings.PupilUnitScalingFactor, 0, 0 }; var relativeLeftEyePosition = UnityEngine.XR.InputTracking.GetLocalPosition(UnityEngine.XR.XRNode.LeftEye) - UnityEngine.XR.InputTracking.GetLocalPosition(UnityEngine.XR.XRNode.CenterEye); Settings.calibration.leftEyeTranslation = new float[] { relativeLeftEyePosition.z *PupilSettings.PupilUnitScalingFactor, 0, 0 }; #if !UNITY_WSA if (Settings.connection.isAutorun) { RunConnect(); } #else RunConnect(); #endif }
void Start() { // print ("Start of pupil gaze tracker"); Settings = PupilTools.Settings; string str = PupilConversions.ReadStringFromFile("camera_intrinsics"); PupilConversions.ReadCalibrationData(str, ref PupilData.CalibrationData); Settings.framePublishing.StreamCameraImages = false; if (Settings.framePublishing.StreamCameraImages) { Settings.framePublishing.InitializeFramePublishing(); } if (PupilGazeTracker._Instance == null) { PupilGazeTracker._Instance = this; } PupilData.calculateMovingAverage = true; //make sure that if the toggles are on it functions as the toggle requires it if (isOperatorMonitor && OnOperatorMonitor == null) { OperatorMonitor.Instantiate(); } //OnOperatorMonitor += DrawOperatorMonitor; if (Settings.debugView.active) { debugInstance.StartCalibrationDebugView(); } PupilGazeTracker.Instance.ProjectName = Application.productName; Settings.connection.isConnected = false; Settings.dataProcess.state = PupilSettings.EStatus.Idle; if (Settings.connection.isAutorun) { RunConnect(); } }
private void DrawMainMenu() { Event e = Event.current; GUILayout.Space(10); ////////////////////////////CALIBRATE BUTTON//////////////////////////// if (isConnected) { if (!isCalibrating) { if (GUILayout.Button("Calibrate", GUILayout.Height(50))) { if (Application.isPlaying) { pupilTracker.StartCalibration(); EditorApplication.update += CheckCalibration; } else { EditorUtility.DisplayDialog("Pupil service message", "You can only use calibration in playmode", "Understood"); } } } else { if (GUILayout.Button("Stop Calibration", GUILayout.Height(50))) { pupilTracker.StopCalibration(); } } } else { GUI.enabled = false; GUILayout.Button("Calibrate (Not Connected !)", GUILayout.Height(50)); } GUI.enabled = true; ////////////////////////////CALIBRATE BUTTON//////////////////////////// GUILayout.Space(5); ////////////////////////////RECORDING BUTTON//////////////////////////// EditorGUI.BeginChangeCheck(); if (Recorder.isProcessing) { GUI.enabled = false; Recorder.isRecording = GUILayout.Toggle(Recorder.isRecording, "Processing ... ", "Button", GUILayout.Height(50)); } else { Recorder.isRecording = GUILayout.Toggle(Recorder.isRecording, "Recording", "Button", GUILayout.Height(50)); } GUI.enabled = true; GUI.backgroundColor = Color.white; if (EditorGUI.EndChangeCheck()) { if (Recorder.isRecording) { Recorder.Start(); EditorApplication.update += CheckRecording; EditorUtility.SetDirty(target); } else { Recorder.Stop(); } } ////////////////////////////RECORDING BUTTON//////////////////////////// /// GUILayout.Space(5); ////////////////////////////OPERATOR MONITOR BUTTON//////////////////////////// EditorGUI.BeginChangeCheck(); pupilTracker.isOperatorMonitor = GUILayout.Toggle(pupilTracker.isOperatorMonitor, "Operator Monitor", "Button", GUILayout.MinWidth(100), GUILayout.Height(50)); if (EditorGUI.EndChangeCheck()) { if (pupilTracker.isOperatorMonitor) { pupilTracker.CloseCalibrationDebugView(); // Debug.Log("instantiate operator monitor"); OperatorMonitor.Instantiate(); } else { if (pupilTracker.OperatorMonitorProperties[0].OperatorCamera != null) { OperatorMonitor.Instance.ExitOperatorMonitor(); } } } ////////////////////////////OPERATOR MONITOR BUTTON//////////////////////////// GUILayout.Space(10); GUI.skin = default(GUISkin); GUILayout.Space(100); GUI.depth = 0; GUI.color = Color.white; GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1)); //Separator Line GUI.depth = 1; GUI.color = Color.white; if (cInspector.AdvancedSettings) { if (GUILayout.Button("IsConnected")) { isConnected = true; } pupilTracker.DebugVariables.packetsOnMainThread = GUILayout.Toggle(pupilTracker.DebugVariables.packetsOnMainThread, "Process Packets on Main Thread", "Button", GUILayout.MinWidth(100)); GUI.backgroundColor = Color.white; GUILayout.Space(10); pupilTracker.DebugVariables.printSampling = GUILayout.Toggle(pupilTracker.DebugVariables.printSampling, "Print Sampling", "Button"); pupilTracker.DebugVariables.printMessage = GUILayout.Toggle(pupilTracker.DebugVariables.printMessage, "Print Msg", "Button"); pupilTracker.DebugVariables.printMessageType = GUILayout.Toggle(pupilTracker.DebugVariables.printMessageType, "Print Msg Types", "Button"); pupilTracker.DebugVariables.subscribeAll = GUILayout.Toggle(pupilTracker.DebugVariables.subscribeAll, "Subscribe to all", "Button"); pupilTracker.DebugVariables.subscribeFrame = GUILayout.Toggle(pupilTracker.DebugVariables.subscribeFrame, "Subscribe to frame.", "Button"); pupilTracker.DebugVariables.subscribeGaze = GUILayout.Toggle(pupilTracker.DebugVariables.subscribeGaze, "Subscribe to gaze.", "Button"); pupilTracker.DebugVariables.subscribeNotify = GUILayout.Toggle(pupilTracker.DebugVariables.subscribeNotify, "Subscribe to notifications.", "Button"); } }