Exemplo n.º 1
0
        void HandleBeginDrag(VrEventArgs args)
        {
            _frameGfx.Visible = false;

            var hitInstruction = args.HitResult as HitResult <RsMoveInstruction>;
            var hitSegment     = args.HitResult as HitResult <PathSegment>;

            if (hitInstruction != null)
            {
                _dragOffset = args.Frame.InverseRigid() * hitInstruction.HitObject.GetToTarget().Transform.GlobalMatrix;
                WithUndo("VR Drag", () => PathEditingHelper.MoveInstructionToFrame(hitInstruction.HitObject, args.Frame * _dragOffset));
                _newHighlightTarget = hitInstruction?.HitObject?.GetToTarget();
            }
            else if (hitSegment != null)
            {
                WithUndo("VR Drag", () => _newInstruction = PathEditingHelper.InsertMoveInstruction(hitSegment.HitObject, args.Frame));
            }
            else if (args.HitResult != null)
            {
                throw new InvalidOperationException("unrecognized HitResult");
            }
            else
            {
                WithUndo("VR Create Instruction", () => _newInstruction = PathEditingHelper.CreateNewInstructionInActivePath(args.Frame));
                _dragOffset        = Matrix4.Identity;
                args.CreatedObject = () => new HitResult <RsMoveInstruction>(_newInstruction, 0, args.Frame.Translation);
            }
        }
Exemplo n.º 2
0
 void CreateMoveInstruction(Matrix4 tf, string name)
 {
     var moveInstr = PathEditingHelper.CreateNewInstructionInActivePath(tf);
 }