Example #1
0
        public bool GetCommandDown(SketchCommands rCommand)
        {
            // Here you can limit the given command to a specific scope, e.g. only allowing it on the Wand
            // or Brush, but the the controller info is responsible for how that command is mapped to the
            // hardware.

            KeyboardShortcut?shortcut = MapCommandToKeyboard(rCommand);

            switch (rCommand)
            {
            case SketchCommands.Activate:
                return(GetMouseButtonDown(0) || Brush.GetCommandDown(rCommand));

            case SketchCommands.RewindTimeline:
            case SketchCommands.AdvanceTimeline:
            case SketchCommands.TimelineHome:
            case SketchCommands.TimelineEnd:
            case SketchCommands.Reset:
            case SketchCommands.Undo:
            case SketchCommands.Redo:
                return(GetKeyboardShortcutDown(shortcut.Value) || Wand.GetCommandDown(rCommand));

            case SketchCommands.DuplicateSelection:
                return((SketchControlsScript.m_Instance.OneHandGrabController != ControllerName.None &&
                        Controllers[(int)SketchControlsScript.m_Instance.OneHandGrabController]
                        .GetCommandDown(rCommand)) ||
                       Brush.GetCommandDown(rCommand));

            // Keyboard only:
            case SketchCommands.Delete:
            case SketchCommands.Abort:
                return(GetKeyboardShortcutDown(shortcut.Value));

            // Brush only
            case SketchCommands.Teleport:
            case SketchCommands.ToggleDefaultTool:
            case SketchCommands.MenuContextClick:
            case SketchCommands.ToggleSelection:
                return(Brush.GetCommandDown(rCommand));

            // Misc
            case SketchCommands.SwapControls:
                return(HasSwapGestureCompleted());

            case SketchCommands.AltActivate:
                return(GetMouseButtonDown(1) || Wand.GetCommandDown(rCommand));

#if (UNITY_EDITOR || EXPERIMENTAL_ENABLED)
            case SketchCommands.ShowPinCushion:
                return(Brush.GetCommandDown(rCommand));
#endif
            }

            return(false);
        }