public void RunSeurat()
        {
            CaptureHeadbox headbox = (CaptureHeadbox)target;
            string         seurat_output_folder = headbox.seurat_output_folder_;

            if (seurat_output_folder.Length <= 0)
            {
                seurat_output_folder          = FileUtil.GetUniqueTempPathInProject();
                headbox.seurat_output_folder_ = seurat_output_folder;
            }
            if (headbox.use_cache_)
            {
                string cache_folder_ = headbox.cache_folder_;
                if (cache_folder_.Length <= 0)
                {
                    cache_folder_ = FileUtil.GetUniqueTempPathInProject();
                }
                Directory.CreateDirectory(cache_folder_);
            }
            Directory.CreateDirectory(seurat_output_folder);
            string args = headbox.GetArgString();

            status_interface_ = new SeuratRunnerStatus();
            pipeline_runner_  = new SeuratPipelineRunner(
                args,
                headbox.seurat_exec_,
                status_interface_);

            runner_progress_window_ = (SeuratWindow)EditorWindow.GetWindow(typeof(SeuratWindow));
            runner_progress_window_.SetupStatus(status_interface_);

            runner_progress_window_.SetupRunnerProcess(headbox, pipeline_runner_);
        }
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            draw_capture_      = EditorUtility.DrawMethodGroup(draw_capture_, "Capture Settings", DrawCaptureSettings);
            draw_pipeline_     = EditorUtility.DrawMethodGroup(draw_pipeline_, "Pipeline Settings", DrawPipelineSettings);
            draw_import_       = EditorUtility.DrawMethodGroup(draw_import_, "Import Settings", DrawImportSettings);
            draw_scenebuilder_ = EditorUtility.DrawMethodGroup(draw_scenebuilder_, "Scene Builder Settings", DrawSceneBuilderSettings);

            DrawButtons();

            serializedObject.ApplyModifiedProperties();

            // Poll the bake status.
            if (bake_progress_window_ != null && bake_progress_window_.IsComplete())
            {
                bake_progress_window_.Close();
                bake_progress_window_ = null;
                capture_builder_      = null;
                capture_status_       = null;
            }
            if (runner_progress_window_ != null && runner_progress_window_.IsComplete())
            {
                runner_progress_window_.Close();
                runner_progress_window_ = null;
                pipeline_runner_        = null;
                status_interface_       = null;
            }
        }
        public void Update()
        {
            // Refresh the Editor GUI to finish the task.
            UnityEditor.EditorUtility.SetDirty(capture_notification_component_);

            if (bake_stage_ == BakeStage.kRunning)
            {
                if (!monitored_runner_.IsProcessRunning() && runner_status_.TaskContinuing())
                {
                    bake_stage_ = BakeStage.kWaitForDoneButton;
                }


                if (runner_status_ != null && !runner_status_.TaskContinuing())
                {
                    bake_stage_ = BakeStage.kComplete;
                    if (monitored_runner_ != null)
                    {
                        monitored_runner_.InterruptProcess();
                        monitored_runner_ = null;
                    }
                }
            }

            // Repaint with updated progress the GUI on each wall-clock time tick.
            Repaint();
        }
 public void SetupRunnerProcess(CaptureHeadbox capture_notification_component,
                                SeuratPipelineRunner runner)
 {
     bake_stage_ = BakeStage.kRunning;
     capture_notification_component_ = capture_notification_component;
     monitored_runner_ = runner;
     monitored_runner_.Run();
 }
        public void RunSeurat()
        {
            SeuratAutomator automator             = (SeuratAutomator)target;
            string          capture_output_folder = automator.output_folder_;
            string          exec_path             = automator.seurat_executable_path_;
            int             numCaptures           = automator.transform.childCount;

            runner_status_ = new SeuratCollectionRunnerStatus();

            CaptureHeadbox[]       headboxes = new CaptureHeadbox[numCaptures];
            SeuratPipelineRunner[] runners   = new SeuratPipelineRunner[numCaptures];

            for (int i = 0; i < numCaptures; i++)
            {
                headboxes[i] = automator.transform.GetChild(i).GetComponent <CaptureHeadbox>();
                if (headboxes[i].isActiveAndEnabled)
                {
                    headboxes[i].output_folder_        = Path.Combine(capture_output_folder, (i + 1).ToString());
                    headboxes[i].seurat_output_folder_ = capture_output_folder;
                    Directory.CreateDirectory(capture_output_folder);
                    headboxes[i].seurat_output_name_ = "capture_" + (i + 1);
                    if (automator.use_cache_)
                    {
                        headboxes[i].use_cache_ = true;
                        string cache_path = Path.Combine(capture_output_folder, "capture_" + (i + 1) + "_cache");
                        headboxes[i].cache_folder_ = cache_path;
                        Directory.CreateDirectory(cache_path);
                    }
                    automator.OverrideParams(headboxes[i]);
                    string arg = headboxes[i].GetArgString();
                    UnityEditor.EditorUtility.SetDirty(headboxes[i]);
                    runners[i] = new SeuratPipelineRunner(arg, exec_path, runner_status_);
                }
            }
            Debug.Log("All processes set up");
            Debug.Log("Beginning seurat captures...");
            collection_runner_ = new SeuratPipelineCollectionRunner(runners, runner_status_);

            runner_window_ = (SeuratRunnerWindow)EditorWindow.GetWindow(typeof(SeuratRunnerWindow));
            runner_window_.SetupStatus(runner_status_);

            runner_window_.SetupRunnerProcess(automator, collection_runner_);
        }