public override Capture UpdateCapture(InputState input, CaptureData data) { GrabInfo gi = data.custom_data as GrabInfo; if (data.which == CaptureSide.Left && (input.bLeftShoulderReleased || input.bLeftTriggerReleased)) { gi.complete(); return(end_transform(data)); } else if (data.which == CaptureSide.Right && (input.bRightShoulderReleased || input.bRightTriggerReleased)) { gi.complete(); return(end_transform(data)); } Frame3f handF = (data.which == CaptureSide.Left) ? input.LeftHandFrame : input.RightHandFrame; gi.stickDelta += (data.which == CaptureSide.Left) ? input.vLeftStickDelta2D : input.vRightStickDelta2D; gi.update(handF); // drop-a-copy on X/A button release if ((data.which == CaptureSide.Left && input.bXButtonReleased) || (data.which == CaptureSide.Right && input.bAButtonReleased)) { SceneObject copy = gi.so.Duplicate(); // save an undo-point for the current xform, and start a new one. That way we can // step between drop-a-copy stages end_transform(data); gi.change = new TransformGizmoChange() { parentSO = new WeakReference(gi.so), parentBefore = gi.so.GetLocalFrame(CoordSpace.SceneCoords), parentScaleBefore = gi.so.GetLocalScale() }; // if we do this afterwards, and don't push an interaction state, then when // we undo/redo we don't end up sitting on top of a duplicate. cockpit.Scene.History.PushChange( new AddSOChange() { scene = cockpit.Scene, so = copy, bKeepWorldPosition = false }); } return(Capture.Continue); }
public override Capture ForceEndCapture(InputState input, CaptureData data) { GrabInfo gi = data.custom_data as GrabInfo; gi.complete(); return(end_transform(data)); }