void OnGUI() { if (!playback) { if (GUILayout.Button("Play recording")) { string path = UnityEditor.EditorUtility.OpenFilePanel("Select dump", Constants.OutputDirectory, "csv"); if (path != null && path.Length > 0) { path = path.Replace("mocap", "***").Replace("neuron", "***").Replace("fused", "***"); Debug.Log("Loading recording from disk..."); mocapCaptureData = MocapSample.Import(path.Replace("***", "mocap")); fusedCaptureData = FusedSample.Import(path.Replace("***", "fused")); Debug.Log("Playing..."); playback = true; startTime = Time.time; } } } else if (playback) { if (GUILayout.Button("Stop playback")) { Debug.Log("Stopped."); playback = false; } pauseKeyFrame = GUILayout.Toggle(pauseKeyFrame, "Pause current key frame"); } if (playback) { float time; int keyFrame; keyFrame = GetCurrentKeyFrame(); time = mocapCaptureData[keyFrame].time - mocapCaptureData[0].time; GUILayout.Label("Time: " + Math.Round(time, 2) + " s"); GUILayout.Label("Key frame: " + keyFrame); } drawMarkers = GUILayout.Toggle(drawMarkers, "Draw markers"); if (!drawMarkers) { for (int i = 0; i < markerUI.marker_positions.GetLength(0); i++) { for (int j = 0; j < markerUI.marker_positions.GetLength(1); j++) { markerUI.marker_positions[i, j] = -1000; } } markerUI.RenderMarkers(); } jointPredictions = GUILayout.Toggle(jointPredictions, "Prediction mode"); if (!jointPredictions) { GUILayout.Label("Displaying raw dataset"); } else { GUILayout.Label("Displaying NN predictions"); } if (jointPredictions) { GUILayout.Label("Occlusion prediction:"); bool opt0 = predictionMode == 0; bool opt1 = predictionMode == 1; bool opt2 = predictionMode == 2; bool opt3 = predictionMode == 3; opt0 = GUILayout.Toggle(opt0, "None (last position)"); opt1 = GUILayout.Toggle(opt1, "Moving average"); opt2 = GUILayout.Toggle(opt2, "Affine combination"); opt3 = GUILayout.Toggle(opt3, "Neural network"); int newPredictionMode = 0; if (opt0 && predictionMode != 0) { newPredictionMode = 0; } else if (opt1 && predictionMode != 1) { newPredictionMode = 1; } else if (opt2 && predictionMode != 2) { newPredictionMode = 2; } else if (opt3 && predictionMode != 3) { newPredictionMode = 3; } else { newPredictionMode = predictionMode; } if (newPredictionMode != predictionMode) { occlusionManager.RemoveAllImplementations(); switch (newPredictionMode) { case 0: occlusionManager.AddImplementation(new NaiveOcclusionPredictor()); break; case 1: occlusionManager.AddImplementation(new MovingAverageOcclusionPredictor(20, handTemplate)); break; case 2: occlusionManager.AddImplementation(new LinearOcclusionPredictor()); break; case 3: occlusionManager.AddImplementation(new NeuralOcclusionPredictor("models/marker_model.bin", handTemplate, true, true)); break; } } predictionMode = newPredictionMode; if (predictionMode > 0) { GUILayout.Label(""); postProcessing = GUILayout.Toggle(postProcessing, "Post-processing"); } GUILayout.Label("Use keyboard [1-9]\nto simulate occlusions."); } }