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 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); }
public void BuildScene() { GameObject scene = Instantiate(this.gameObject); CaptureHeadbox[] headboxes = scene.GetComponentsInChildren <CaptureHeadbox>(); foreach (CaptureHeadbox box in headboxes) { box.BuildCapture(true, false); } SeuratAutomator auto = scene.GetComponent <SeuratAutomator>(); DestroyImmediate(auto); }
private void BuildScene() { SeuratAutomator automator = (SeuratAutomator)target; int numCaptures = automator.transform.childCount; CaptureHeadbox[] headboxes = new CaptureHeadbox[numCaptures]; for (int i = 0; i < numCaptures; i++) { headboxes[i] = automator.transform.GetChild(i).GetComponent <CaptureHeadbox>(); automator.OverrideSceneBuilder(headboxes[i]); UnityEditor.EditorUtility.SetDirty(headboxes[i]); } automator.BuildScene(); }
public void BuildMaterials() { SeuratAutomator automator = (SeuratAutomator)target; int numCaptures = automator.transform.childCount; CaptureHeadbox[] headboxes = new CaptureHeadbox[numCaptures]; automator.cur_mats_ = new Material[numCaptures]; for (int i = 0; i < numCaptures; i++) { headboxes[i] = automator.transform.GetChild(i).GetComponent <CaptureHeadbox>(); automator.OverrideSceneBuilder(headboxes[i]); automator.cur_mats_[i] = headboxes[i].CreateMaterial(); UnityEditor.EditorUtility.SetDirty(headboxes[i]); } UnityEditor.EditorUtility.SetDirty(automator); }
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_); }
public void ImportAll() { SeuratAutomator automator = (SeuratAutomator)target; string output_folder_ = automator.output_folder_; int numCaptures = automator.transform.childCount; CaptureHeadbox[] headboxes = new CaptureHeadbox[numCaptures]; automator.cur_meshes_ = new GameObject[numCaptures]; automator.cur_tex_ = new Texture2D[numCaptures]; Debug.Log("Setting up all headboxes..."); for (int i = 0; i < numCaptures; i++) { headboxes[i] = automator.transform.GetChild(i).GetComponent <CaptureHeadbox>(); headboxes[i].seurat_output_name_ = "capture_" + (i + 1); headboxes[i].seurat_output_folder_ = output_folder_; headboxes[i].asset_path_ = automator.asset_path_; UnityEditor.EditorUtility.SetDirty(headboxes[i]); } Debug.Log("Copying assets to project folder..."); for (int i = 0; i < numCaptures; i++) { headboxes[i].CopyFiles(); } Debug.Log("Beginning import..."); AssetDatabase.Refresh(); for (int i = 0; i < numCaptures; i++) { headboxes[i].CorrectTextureSettings(); } Debug.Log("Fetch imported assets..."); for (int i = 0; i < numCaptures; i++) { headboxes[i].FetchAssets(); automator.cur_meshes_[i] = headboxes[i].current_obj_; automator.cur_tex_[i] = headboxes[i].current_tex_; UnityEditor.EditorUtility.SetDirty(headboxes[i]); } UnityEditor.EditorUtility.SetDirty(automator); }