void CheckAndSave() { bool allowSave = ViveSR_RigidReconstruction.IsScanning && !ViveSR_RigidReconstruction.IsExportingMesh && !StaticMeshScript.SemanticMeshIsExporting; if (!allowSave) { return; } SetColor(Color_Dark, ScanText, StopText, SaveText, PlayText); StaticMeshScript.SetSegmentation(false); StaticMeshScript.ExportSemanticMesh(CheckAndSave_UpdatePercentage, ExportSemanticMesh_done); }
void Save() { bool allowSave = ViveSR_RigidReconstruction.IsScanning && !ViveSR_RigidReconstruction.IsExportingMesh && !StaticMeshScript.SemanticMeshIsExporting; if (!allowSave) { return; } LoadText.color = OriginalColor; ScanText.color = OriginalColor; StopText.color = OriginalColor; SaveText.color = OriginalColor; StaticMeshScript.SetSegmentation(false); ViveSR_SceneUnderstanding.SetAllCustomSceneUnderstandingConfig(10, true); StaticMeshScript.ExportSemanticMesh(Save_UpdatePercentage, Save_done); }
private void HandleTouchpad_MeshOperation(ButtonStage buttonStage, Vector2 axis) { if (!isTriggerDown) { switch (buttonStage) { case ButtonStage.PressDown: TouchpadDirection touchpadDirection = ViveSR_Experience_ControllerDelegate.GetTouchpadDirection(axis, false); if (touchpadDirection == TouchpadDirection.Up) //[Scan] { if (!ViveSR_RigidReconstruction.IsScanning && !StaticMeshScript.ModelIsLoading && !StaticMeshScript.SemanticMeshIsLoading) { //SemanticDrawer.DestroyAllObjects(); if (StaticMeshScript.CheckModelLoaded()) { StaticMeshScript.LoadMesh(false); } StaticMeshScript.ActivateSemanticMesh(false); DartText.text = ""; HintText.text = ""; GripText.text = ""; //ViveSR_Experience_ControllerDelegate.gripDelegate -= HandleGrip_SwitchMode; StaticMeshScript.SetScanning(true); StaticMeshScript.SetSegmentation(true); LoadText.color = Color.gray; ScanText.color = Color.gray; SaveText.color = Color.white; StopText.color = Color.white; } } else if (touchpadDirection == TouchpadDirection.Left) //[Stop] { if (ViveSR_RigidReconstruction.IsScanning) { StaticMeshScript.SetScanning(false); StaticMeshScript.SetSegmentation(false); if (StaticMeshScript.CheckModelLoaded()) { StaticMeshScript.LoadMesh(true); } if (StaticMeshScript.SemanticMeshIsLoaded) { StaticMeshScript.ActivateSemanticMesh(true); } SetStaticMeshUI(); //ViveSR_Experience_ControllerDelegate.gripDelegate += HandleGrip_SwitchMode; } } else if (touchpadDirection == TouchpadDirection.Right) // [Save] { if (ViveSR_RigidReconstruction.IsScanning) { StaticMeshScript.UnloadSemanticMesh(); LoadText.color = Color.grey; ScanText.color = Color.grey; StopText.color = Color.grey; SaveText.color = Color.grey; ViveSR_Experience_ControllerDelegate.touchpadDelegate -= HandleTouchpad_MeshOperation; ViveSR_SceneUnderstanding.SetAllCustomSceneUnderstandingConfig(10, true); StaticMeshScript.SetSegmentation(false); StaticMeshScript.ExportSemanticMesh(UpdateSegmentationPercentage, () => { StaticMeshScript.ExportModel(UpdateModelPercentage, () => { DartText.text = ""; HintText.text = "Mesh Saved!"; ScanText.color = Color.white; LoadText.color = Color.white; ViveSR_Experience_ControllerDelegate.touchpadDelegate += HandleTouchpad_MeshOperation; } ); } ); } } else if (touchpadDirection == TouchpadDirection.Down) //[Load] { if (!ViveSR_RigidReconstruction.IsScanning && StaticMeshScript.CheckModelExist() && !StaticMeshScript.CheckModelLoaded()) { //ViveSR_Experience_ControllerDelegate.gripDelegate -= HandleGrip_SwitchMode; StaticMeshScript.LoadMesh( true, () => { // step 1 ScanText.color = Color.grey; LoadText.color = Color.grey; HintText.text = "Loading Scene..."; DartText.text = ""; }, () => { // step 2 if (StaticMeshScript.CheckSemanticMeshDirExist()) { LoadSemanticMesh(); StaticMeshScript.collisionMesh.SetActive(false); } else { ScanText.color = Color.white; HintText.text = "No Object is Found.\nPlease Rescan!"; } } ); } } break; } } }