public override void OnInspectorGUI()
    {
        serializedObject.Update();

        EditorGUILayout.PropertyField(output_folder_, new GUIContent(
                                          "Output Folder"));
        if (GUILayout.Button("Choose Output Folder"))
        {
            string path = EditorUtility.SaveFolderPanel(
                "Choose Capture Output Folder", output_folder_.stringValue, "");
            if (path.Length != 0)
            {
                output_folder_.stringValue = path;
            }
        }

        EditorGUILayout.PropertyField(size_, new GUIContent("Headbox Size"));
        EditorGUILayout.PropertyField(samples_, new GUIContent("Sample Count"));
        EditorGUILayout.PropertyField(center_resolution_, new GUIContent(
                                          "Center Capture Resolution"));
        EditorGUILayout.PropertyField(resolution_, new GUIContent(
                                          "Default Resolution"));
        EditorGUILayout.PropertyField(dynamic_range_, new GUIContent(
                                          "Dynamic Range"));

        EditorGUILayout.PropertyField(last_output_dir_, new GUIContent(
                                          "Last Output Folder"));

        if (capture_status_ != null)
        {
            GUI.enabled = false;
        }
        if (GUILayout.Button("Capture"))
        {
            Capture();
        }
        GUI.enabled = true;

        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;
        }
    }
    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_);
    }
 public void SetupStatus(EditorBakeStatus capture_status)
 {
     capture_status_ = capture_status;
     capture_status_.SetGUI(this);
 }