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 SetupCaptureProcess(CaptureHeadbox capture_notification_component,
                                 CaptureBuilder capture)
 {
     capture_timer_ = kTimerExpirationsPerCapture;
     bake_stage_    = BakeStage.kCapture;
     last_time_     = Time.realtimeSinceStartup;
     capture_notification_component_ = capture_notification_component;
     monitored_capture_ = capture;
 }
 void StopCapture()
 {
     Debug.Log("Capture stop", this);
     if (capture_ != null)
     {
         capture_.EndCapture();
     }
     capture_ = null;
     Time.captureFramerate = 0;
 }
        public void Capture()
        {
            SeuratAutomator automator = (SeuratAutomator)target;

            string capture_output_folder = automator.output_folder_;

            if (capture_output_folder.Length <= 0)
            {
                capture_output_folder = FileUtil.GetUniqueTempPathInProject();
            }
            Directory.CreateDirectory(capture_output_folder);

            int numCaptures = automator.transform.childCount;

            capture_status_  = new AutomatorStatus();
            capture_builder_ = new CaptureBuilder[numCaptures];
            CaptureHeadbox[] headboxes = new CaptureHeadbox[numCaptures];
            bake_progress_window_ = (AutomateWindow)EditorWindow.GetWindow(typeof(AutomateWindow));
            bake_progress_window_.SetupStatus(capture_status_);
            int num_not_null = 0;

            for (int i = 0; i < numCaptures; i++)
            {
                headboxes[i] = automator.transform.GetChild(i).GetComponent <CaptureHeadbox>();
                if (headboxes[i].isActiveAndEnabled)
                {
                    num_not_null++;
                    capture_builder_[i] = new CaptureBuilder();
                    automator.OverrideHeadbox(headboxes[i]);
                    string output = capture_output_folder + "\\" + (i + 1);
                    headboxes[i].output_folder_ = output;
                    UnityEditor.EditorUtility.SetDirty(headboxes[i]);
                    Directory.CreateDirectory(output);
                    capture_builder_[i].BeginCapture(headboxes[i], output, 1, capture_status_, "Capture " + (i + 1) + ": ");
                }
            }
            CaptureHeadbox[] total_headboxes        = new CaptureHeadbox[num_not_null];
            CaptureBuilder[] total_capture_builders = new CaptureBuilder[num_not_null];
            int j = 0;

            for (int i = 0; i < numCaptures; i++)
            {
                if (capture_builder_[i] != null)
                {
                    total_headboxes[j]        = headboxes[i];
                    total_capture_builders[j] = capture_builder_[i];
                    j++;
                }
            }

            bake_progress_window_.SetupCaptureProcess(total_headboxes, total_capture_builders);
        }
        void StartCapture()
        {
            Debug.Log("Capture start - temporarily setting fixed framerate.", this);
            capture_ = new CaptureBuilder();

            string capture_output_folder = output_folder_;

            if (capture_output_folder.Length <= 0)
            {
                capture_output_folder = FileUtil.GetUniqueTempPathInProject();
            }
            Directory.CreateDirectory(capture_output_folder);
            capture_.BeginCapture(this, capture_output_folder, 1, new CaptureStatus());

            // See Time.CaptureFramerate example, e.g. here:
            // https://docs.unity3d.com/ScriptReference/Time-captureFramerate.html
            Time.captureFramerate = 60;
        }
        public void Update()
        {
            if (capture_status_ != null && capture_status_.TaskContinuing() && !UpdateAndCheckUiTimerReady())
            {
                return;
            }

            // Refresh the Editor GUI to finish the task.
            UnityEditor.EditorUtility.SetDirty(capture_notification_component_);

            if (bake_stage_ == BakeStage.kCapture)
            {
                --capture_timer_;
                if (capture_timer_ == 0)
                {
                    capture_timer_ = kTimerExpirationsPerCapture;

                    monitored_capture_.RunCapture();

                    if (monitored_capture_.IsCaptureComplete() &&
                        capture_status_.TaskContinuing())
                    {
                        monitored_capture_.EndCapture();
                        monitored_capture_ = null;

                        bake_stage_ = BakeStage.kWaitForDoneButton;
                    }
                }

                if (capture_status_ != null && !capture_status_.TaskContinuing())
                {
                    bake_stage_ = BakeStage.kComplete;
                    if (monitored_capture_ != null)
                    {
                        monitored_capture_.EndCapture();
                        monitored_capture_ = null;
                    }
                }
            }

            // Repaint with updated progress the GUI on each wall-clock time tick.
            Repaint();
        }
        public void Capture()
        {
            CaptureHeadbox headbox = (CaptureHeadbox)target;

            string capture_output_folder = headbox.output_folder_;

            if (capture_output_folder.Length <= 0)
            {
                capture_output_folder = FileUtil.GetUniqueTempPathInProject();
            }
            headbox.last_output_dir_ = capture_output_folder;
            Directory.CreateDirectory(capture_output_folder);

            capture_status_  = new EditorBakeStatus();
            capture_builder_ = new CaptureBuilder();

            // Kick off the interactive Editor bake window.
            bake_progress_window_ = (CaptureWindow)EditorWindow.GetWindow(typeof(CaptureWindow));
            bake_progress_window_.SetupStatus(capture_status_);

            capture_builder_.BeginCapture(headbox, capture_output_folder, 1, capture_status_);
            bake_progress_window_.SetupCaptureProcess(headbox, capture_builder_);
        }