コード例 #1
0
        override public Capture ForceEndCapture(InputState input, CaptureData data)
        {
            DrawSpaceCurveTool tool = context.ToolManager.GetActiveTool((int)data.which) as DrawSpaceCurveTool;

            tool.CancelDraw();
            return(Capture.End);
        }
コード例 #2
0
        override public Capture UpdateCapture(InputState input, CaptureData data)
        {
            Frame3f            worldFrame = (data.which == CaptureSide.Left) ? input.LeftHandFrame : input.RightHandFrame;
            DrawSpaceCurveTool tool       = context.ToolManager.GetActiveTool((int)data.which) as DrawSpaceCurveTool;

            // [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 == DrawSpaceCurveTool.DrawMode.OnClick)
            {
                if (bReleased)
                {
                    if (tool.UpdateDraw_Ray_MultiClick(worldFrame) == false)
                    {
                        tool.EndDraw();
                        return(Capture.End);
                    }
                }
                else
                {
                    tool.UpdateDrawPreview_Ray_MultiClick(worldFrame);
                }

                return(Capture.Continue);
            }
            else
            {
                tool.UpdateDraw_Ray_Continuous(worldFrame);
                if (bReleased)
                {
                    tool.EndDraw();
                    return(Capture.End);
                }
                else
                {
                    return(Capture.Continue);
                }
            }
        }
コード例 #3
0
        public DrawSpaceCurveTool_SpatialDeviceBehavior(DrawSpaceCurveTool tool, FContext s)
        {
            ownerTool = tool;
            context   = s;

            // have to cancel capture if we are in multi-click mode and tool exits
            s.ToolManager.OnToolActivationChanged += ToolManager_OnToolActivationChanged;
        }
コード例 #4
0
 override public CaptureRequest WantsCapture(InputState input)
 {
     if (input.bLeftTriggerPressed ^ input.bRightTriggerPressed)
     {
         CaptureSide eSide = (input.bLeftTriggerPressed) ? CaptureSide.Left : CaptureSide.Right;
         ITool       tool  = context.ToolManager.GetActiveTool((int)eSide);
         if (tool != null && tool is DrawSpaceCurveTool)
         {
             DrawSpaceCurveTool drawTool = tool as DrawSpaceCurveTool;
             return(CaptureRequest.Begin(this, eSide));
         }
     }
     return(CaptureRequest.Ignore);
 }
コード例 #5
0
        public virtual ITool Build(FScene scene, List <SceneObject> targets)
        {
            DrawSpaceCurveTool tool = new_tool(scene, targets[0]);

            tool.SamplingRateScene   = DefaultSamplingRateS;
            tool.MinSamplingRate     = Math.Min(tool.MinSamplingRate, DefaultSamplingRateS * 0.1f);
            tool.Closed              = Closed;
            tool.IsOverlayCurve      = IsOverlayCurve;
            tool.EmitNewCurveF       = EmitNewCurveF;
            tool.CurveMaterialF      = CurveMaterialF;
            tool.AttachCurveToTarget = AttachCurveToTarget;
            tool.InputMode           = InputMode;
            return(tool);
        }
コード例 #6
0
        override public Capture BeginCapture(InputState input, CaptureSide eSide)
        {
            Frame3f            worldFrame = (eSide == CaptureSide.Left) ? input.LeftHandFrame : input.RightHandFrame;
            DrawSpaceCurveTool tool       = context.ToolManager.GetActiveTool((int)eSide) as DrawSpaceCurveTool;

            if (tool.InputMode == DrawSpaceCurveTool.DrawMode.Continuous)
            {
                tool.BeginDraw_Ray_Continuous(worldFrame);
            }
            else
            {
                tool.BeginDraw_Ray_MultiClick();
            }

            return(Capture.Begin(this, eSide));
        }