public bool HandleShortcuts() { bool bShiftDown = Input.GetKey(KeyCode.LeftShift); bool bCtrlDown = Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl); // ESCAPE CLEARS ACTIVE TOOL OR SELECTION if (Input.GetKeyUp(KeyCode.Escape)) { if (context.ToolManager.HasActiveTool(0) || context.ToolManager.HasActiveTool(1)) { context.ToolManager.DeactivateTool(0); context.ToolManager.DeactivateTool(1); } else if (context.Scene.Selected.Count > 0) { context.Scene.ClearSelection(); } 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); // 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); // DROP A COPY } else if (Input.GetKeyUp(KeyCode.D)) { foreach (SceneObject so in context.Scene.Selected) { SceneObject copy = so.Duplicate(); if (copy != null) { // [TODO] could have a lighter record here because we can just re-run Duplicate() ? context.Scene.History.PushChange( new AddSOChange() { scene = context.Scene, so = copy }); context.Scene.History.PushInteractionCheckpoint(); } } 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); // REDO } else if (bCtrlDown && Input.GetKeyUp(KeyCode.Y)) { context.Scene.History.InteractiveStepForward(); return(true); // APPLY CURRENT TOOL IF POSSIBLE } else if (Input.GetKeyUp(KeyCode.Return)) { if (((context.ActiveInputDevice & InputDevice.Mouse) != 0) && context.ToolManager.HasActiveTool(ToolSide.Right) && context.ToolManager.ActiveRightTool.CanApply) { context.ToolManager.ActiveRightTool.Apply(); } return(true); } else if (bCtrlDown && Input.GetKeyUp(KeyCode.M)) { List <SceneObject> selected = new List <SceneObject>(context.Scene.Selected); // combine two selected SOs into a GroupSO if (selected.Count == 2) { SceneUtil.CreateGroupSO(selected[0], selected[1]); } // [RMS] alternative, does deep-copy of internal GOs. This works OK except // that the frame of the combined object ends up at the origin... //if (selected.Count == 2) // SceneUtil.CombineAnySOs(selected[0], selected[1]); return(true); } else if (Input.GetKeyUp(KeyCode.M)) { // combine two DMeshSOs into a Dnew MeshSO List <SceneObject> selected = new List <SceneObject>(context.Scene.Selected); if (selected.Count == 2 && selected[0] is DMeshSO && selected[1] is DMeshSO) { SceneUtil.AppendMeshSO(selected[0] as DMeshSO, selected[1] as DMeshSO); } return(true); } else { return(false); } }