/// <summary> /// Enables the user to launch dense 3D reconstruction and meshing via COLMAP. /// </summary> /// <param name="workspace"></param> The workspace from which to perform this method. private void SubsectionDenseReconstruction() { EditorGUILayout.Space(); string workspace = dataHandler.dataDirectory; string label = "Reconstruct 3D mesh (.PLY) from sparse camera setup."; string tooltip = "Processed geometry will be stored at: \"" + COLMAPConnector.GetDelaunayFile(workspace) + "\"."; // Check if this option is available. bool isGUIEnabled = GUI.enabled; GUI.enabled = isGUIEnabled && (cameraSetup != null && cameraSetup.cameraModels != null) && workspace.Contains(COLMAPConnector.dense0DirName) && Application.isPlaying; GeneralToolkit.EditorRequirePlayMode(ref tooltip); // Display a button to launch the helper method. bool hasPressed = GeneralToolkit.EditorWordWrapLeftButton(new GUIContent("Run", tooltip), new GUIContent(label, tooltip)); // If the button is pressed, display a dialog to confirm. if (hasPressed) { label = "Existing data will be erased. Are you ready to proceed?"; tooltip = "Launching this process will erase data in the folder: \"" + workspace + "\". Are you ready to proceed?"; // If the user confirms, update the workspace directory and launch the method. if (EditorUtility.DisplayDialog(label, tooltip, "Yes", "No")) { StartCoroutine(COLMAPConnector.RunDenseReconstructionCoroutine(this, workspace)); } } // Reset the GUI. GUI.enabled = isGUIEnabled; EditorGUILayout.Space(); }
/// <summary> /// Enables the user to launch dense 3D reconstruction and meshing via COLMAP. /// </summary> /// <param name="workspace"></param> The workspace from which to perform this method. private void SubsectionDenseReconstruction() { EditorGUILayout.Space(); string workspace = dataHandler.dataDirectory; string label = "Reconstruct 3D mesh (.PLY) from sparse camera setup."; string tooltip = "Processed geometry will be stored at: \"" + COLMAPConnector.GetDelaunayFile(workspace) + "\"."; // Check if this option is available. bool isGUIEnabled = GUI.enabled; GUI.enabled = isGUIEnabled && (cameraSetup != null && cameraSetup.cameraModels != null && cameraSetup.cameraModels.Length > 0) && (dataHandler != null && dataHandler.imagePointCorrespondencesExist) && Application.isPlaying; GeneralToolkit.EditorRequirePlayMode(ref tooltip); // Display a button to launch the helper method. bool hasPressed = GeneralToolkit.EditorWordWrapLeftButton(new GUIContent("Run", tooltip), new GUIContent(label, tooltip)); // If the button is pressed, display a dialog to confirm. if (hasPressed) { label = "Existing data will be erased. Are you ready to proceed?"; tooltip = "WARNING: Before launching this step, please check that you are using a CUDA-capable GPU. Your current GPU is a " + SystemInfo.graphicsDeviceName + "."; tooltip += "\n\nLaunching this process will erase data in the folder: \"" + workspace + "\". Are you ready to proceed?"; // If the user confirms, update the workspace directory and launch the method. int chosenButton = EditorUtility.DisplayDialogComplex(label, tooltip, "Yes", "No", "Check whether my GPU is CUDA-capable"); if (chosenButton == 0) { StartCoroutine(COLMAPConnector.RunDenseReconstructionCoroutine(this, workspace, cameraSetup.cameraModels.Length)); } else if (chosenButton == 2) { Application.OpenURL("https://developer.nvidia.com/cuda-gpus"); } } // Reset the GUI. GUI.enabled = isGUIEnabled; EditorGUILayout.Space(); }