Exemple #1
0
        override public Capture UpdateCapture(InputState input, CaptureData data)
        {
            DrawSurfaceCurveTool tool = context.ToolManager.GetActiveTool((int)data.which) as DrawSurfaceCurveTool;
            Ray3f worldRay            = (data.which == CaptureSide.Left) ? input.vLeftSpatialWorldRay : input.vRightSpatialWorldRay;

            // [RMS] this is a hack for trigger+shoulder grab gesture...really need some way
            //   to interrupt captures!!
            if ((data.which == CaptureSide.Left && input.bLeftShoulderPressed) ||
                (data.which == CaptureSide.Right && input.bRightShoulderPressed))
            {
                tool.CancelDraw();
                return(Capture.End);
            }


            // this happens if we exit tool while in draw (cts or multi-click). We need to fail gracefully in those cases.
            if (tool == null)
            {
                return(Capture.End);
            }
            // this can happen if we called tool.EndDraw() somewhere else
            if (tool.InDraw == false)
            {
                return(Capture.End);
            }

            bool bReleased = (data.which == CaptureSide.Left) ? input.bLeftTriggerReleased : input.bRightTriggerReleased;

            if (tool.InputMode == DrawSurfaceCurveTool.DrawMode.OnClick)
            {
                if (bReleased)
                {
                    if (tool.UpdateDraw_Ray_MultiClick(worldRay) == false)
                    {
                        tool.EndDraw();
                        return(Capture.End);
                    }
                }
                else
                {
                    tool.UpdateDrawPreview_Ray_MultiClick(worldRay);
                }

                return(Capture.Continue);
            }
            else
            {
                tool.UpdateDraw_Ray_Continuous(worldRay);
                if (bReleased)
                {
                    tool.EndDraw();
                    return(Capture.End);
                }
                else
                {
                    return(Capture.Continue);
                }
            }
        }
Exemple #2
0
        override public Capture UpdateCapture(InputState input, CaptureData data)
        {
            DrawSurfaceCurveTool tool = context.ToolManager.GetActiveTool((int)data.which) as DrawSurfaceCurveTool;
            Ray3f sideRay             = (data.which == CaptureSide.Left) ? input.vLeftSpatialWorldRay : input.vRightSpatialWorldRay;

            // [RMS] this is a hack for trigger+shoulder grab gesture...really need some way
            //   to interrupt captures!!
            if ((data.which == CaptureSide.Left && input.bLeftShoulderPressed) ||
                (data.which == CaptureSide.Right && input.bRightShoulderPressed))
            {
                tool.CancelDraw();
                return(Capture.End);
            }

            tool.UpdateDraw_Ray(sideRay);

            bool bReleased = (data.which == CaptureSide.Left) ? input.bLeftTriggerReleased : input.bRightTriggerReleased;

            if (bReleased)
            {
                tool.EndDraw();
                return(Capture.End);
            }
            else
            {
                return(Capture.Continue);
            }
        }
Exemple #3
0
 private void ToolManager_OnToolActivationChanged(ITool tool, ToolSide eSide, bool bActivated)
 {
     if (bActivated == false && tool == ownerTool)
     {
         ownerTool.EndDraw();
     }
 }
Exemple #4
0
        override public Capture UpdateCapture(InputState input, CaptureData data)
        {
            DrawSurfaceCurveTool tool =
                (context.ToolManager.ActiveRightTool as DrawSurfaceCurveTool);

            // this happens if we exit tool while in draw (cts or multi-click). We need to fail gracefully in those cases.
            if (tool == null)
            {
                return(Capture.End);
            }
            // this can happen if we called tool.EndDraw() somewhere else
            if (tool.InDraw == false)
            {
                return(Capture.End);
            }

            if (tool.InputMode == DrawSurfaceCurveTool.DrawMode.OnClick)
            {
                if (Released(input))
                {
                    if (tool.UpdateDraw_Ray_MultiClick(WorldRay(input)) == false)
                    {
                        tool.EndDraw();
                        return(Capture.End);
                    }
                }
                else
                {
                    tool.UpdateDrawPreview_Ray_MultiClick(WorldRay(input));
                }

                return(Capture.Continue);
            }
            else
            {
                tool.UpdateDraw_Ray_Continuous(WorldRay(input));
                if (Released(input))
                {
                    tool.EndDraw();
                    return(Capture.End);
                }
                else
                {
                    return(Capture.Continue);
                }
            }
        }
Exemple #5
0
        override public Capture UpdateCapture(InputState input, CaptureData data)
        {
            DrawSurfaceCurveTool tool =
                (context.ToolManager.ActiveRightTool as DrawSurfaceCurveTool);

            tool.UpdateDraw_Ray(WorldRay(input));

            if (Released(input))
            {
                tool.EndDraw();
                return(Capture.End);
            }
            else
            {
                return(Capture.Continue);
            }
        }