public static void ShutdownApp() { CCActions.CancelCurrentTool(); CC.FileMonitor.Shutdown(); // will kill itself CC.MeshAnalysis.Shutdown(); CC.GCodeAnalysis.Shutdown(); CC.Slicer.PauseSlicing = true; CC.Slicer.InvalidateSlicing(); // should terminate background thread CC.Toolpather.PauseToolpathing = true; CC.Toolpather.InvalidateToolpaths(); // should terminate background thread }
public bool HandleShortcuts() { bool bShiftDown = Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift); bool bCtrlDown = Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl); // ESCAPE CLEARS ACTIVE TOOL OR SELECTION if (Input.GetKeyUp(KeyCode.Escape)) { if (CCActions.IsPreferencesVisible()) { CCActions.HidePreferencesDialog(); } else if (CCActions.InTool) { CCActions.CancelCurrentTool(); } else if (context.Scene.Selected.Count > 0) { context.Scene.ClearSelection(); } return(true); } else if (Input.GetKeyUp(KeyCode.Delete)) { if (CCActions.InTool == false) { CCActions.DeleteSelectedObjects(true); } return(true); // CENTER TARGET (??) } else if (Input.GetKeyUp(KeyCode.C)) { Ray3f cursorRay = context.MouseController.CurrentCursorWorldRay(); AnyRayHit hit = null; if (context.Scene.FindSceneRayIntersection(cursorRay, out hit)) { context.ActiveCamera.Animator().AnimatePanFocus(hit.hitPos, CoordSpace.WorldCoords, 0.3f); } return(true); // DROP A COPY } else if (Input.GetKeyUp(KeyCode.D)) { if (CCActions.InTool == false) { CCActions.DuplicateSelectedObjects(true); } return(true); // Mesh Editor } else if (Input.GetKeyUp(KeyCode.E)) { if (bCtrlDown) { CCActions.DoMeshExport(); } else { CCActions.BeginTool(MeshEditorTool.Identifier); } return(true); // TOGGLE FRAME TYPE } else if (Input.GetKeyUp(KeyCode.F)) { FrameType eCur = context.TransformManager.ActiveFrameType; context.TransformManager.ActiveFrameType = (eCur == FrameType.WorldFrame) ? FrameType.LocalFrame : FrameType.WorldFrame; return(true); // Fill Holes } else if (Input.GetKeyUp(KeyCode.H)) { CCActions.BeginTool(FillHolesTool.Identifier); return(true); // Autorepair } else if (Input.GetKeyUp(KeyCode.I)) { CCActions.BeginTool(MeshAutoRepairTool.Identifier); return(true); // CENTER AND ON BED } else if (Input.GetKeyUp(KeyCode.N)) { if (CCActions.InTool == false) { CCActions.AcceptAndExitCurrentTool(); CCActions.MoveCurrentToPrintBed(false); CCActions.CenterCurrent(true); } return(true); // Remesh or Simplify } else if (Input.GetKeyUp(KeyCode.R)) { if (bShiftDown) { CCActions.BeginTool(ReduceTool.Identifier); } else { CCActions.BeginTool(RemeshTool.Identifier); } return(true); // SET UNITS/SIZE } else if (Input.GetKeyUp(KeyCode.U)) { CCActions.BeginTool(SetDimensionsTool.Identifier); return(true); // VISIBILITY (V HIDES, SHIFT+V SHOWS) } else if (Input.GetKeyUp(KeyCode.V)) { // show/hide (should be abstracted somehow?? instead of directly accessing GOs?) if (bShiftDown) { foreach (SceneObject so in context.Scene.SceneObjects) { so.RootGameObject.Show(); } } else { foreach (SceneObject so in context.Scene.Selected) { so.RootGameObject.Hide(); } context.Scene.ClearSelection(); } return(true); // UNDO } else if (bCtrlDown && Input.GetKeyUp(KeyCode.Z)) { context.Scene.History.InteractiveStepBack(); return(true); } else if (Input.GetKeyUp(KeyCode.Backspace)) { context.Scene.History.InteractiveStepBack(); return(true); // REDO } else if (bCtrlDown && Input.GetKeyUp(KeyCode.Y)) { context.Scene.History.InteractiveStepForward(); return(true); // Toggle Y/Z Up } else if (bShiftDown && Input.GetKeyUp(KeyCode.Z)) { if (CCActions.InTool == false) { CCActions.AcceptAndExitCurrentTool(); CCActions.SwapCurrentUpDirections(true); } return(true); } else if (Input.GetKeyUp(KeyCode.UpArrow)) { int step = (bShiftDown) ? 10 : 1; CC.Objects.CurrentLayer = CC.Objects.CurrentLayer + step; return(true); } else if (Input.GetKeyUp(KeyCode.DownArrow)) { int step = (bShiftDown) ? 10 : 1; CC.Objects.CurrentLayer = CC.Objects.CurrentLayer - step; return(true); } else if (Input.GetKeyUp(KeyCode.A)) { CCActions.AcceptAndExitCurrentTool(); return(true); } else if (Input.GetKeyUp(KeyCode.Q) && bCtrlDown) { FPlatform.QuitApplication(); return(true); } else if (Input.GetKeyUp(KeyCode.S)) { if (bCtrlDown && bShiftDown) { CCActions.SaveCurrentSceneAs(); } else if (bCtrlDown) { CCActions.SaveCurrentSceneOrSaveAs(); } return(true); } else if (Input.GetKeyUp(KeyCode.X)) { if (FPlatform.InUnityEditor()) { //CC.ActiveContext.Scene.ClearHistory(); CC.ActiveContext.Scene.History.DebugPrint(); } return(true); } else if (bShiftDown && Input.GetKeyUp(KeyCode.Alpha1)) { if (FPlatform.InUnityEditor() == false && bCtrlDown == false) { return(true); } string lastFile = FPlatform.GetPrefsString("LastImportPath", ""); if (lastFile != "") { if (lastFile.EndsWith(".cota")) { CCActions.DoFileOpen(lastFile, false, (str) => { CC.ActiveScene.ClearHistory(); }); } else { CCActions.ClearScene(); CCActions.DoFileImport(lastFile, false, (str) => { CC.ActiveScene.ClearHistory(); }); } } return(true); } else if (Input.GetKeyUp(KeyCode.W)) { CCActions.WireframeEnabled = !CCActions.WireframeEnabled; return(true); } else if (Input.GetKeyUp(KeyCode.Alpha1)) { CCActions.SwitchToViewMode(AppViewMode.PrintView); return(true); } else if (Input.GetKeyUp(KeyCode.Alpha2)) { CCActions.SwitchToViewMode(AppViewMode.RepairView); return(true); } else if (Input.GetKeyUp(KeyCode.Alpha3)) { CCActions.SwitchToViewMode(AppViewMode.ModelView); return(true); } else { return(false); } }