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 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();

            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_window_ != null && runner_window_.IsComplete())
            {
                runner_window_.Close();
                runner_window_     = null;
                collection_runner_ = null;
                runner_status_     = null;
            }
        }
 public void SetupRunnerProcess(SeuratAutomator capture_notification_component,
                                SeuratPipelineCollectionRunner 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_);
        }