void CheckForPreviewWidgetOverride(PathT pathT) { bool input = InputManager.m_Instance.GetCommand(InputManager.SketchCommands.Activate); m_ActiveKnot.knot.gameObject.SetActive(!input); PathT? pt = null; if (input) { pt = pathT; } InputManager.GetControllerGeometry(m_InteractingController).PreviewKnotHint.Activate(!input); SketchControlsScript.m_Instance.CameraPathCaptureRig.OverridePreviewWidgetPathT(pt); }
public void SetPathT(PathT pathT) { if (m_CurrentPathWidget != null) { m_PathT = pathT; m_PathT.Clamp(m_CurrentPathWidget.Path.PositionKnots.Count); } }
// Adds a path knot of type knotType to the path owned by widget at the // transform defined by spawnXf. public CreatePathKnotCommand(CameraPathWidget widget, CameraPathKnot.Type knotType, PathT pathT, TrTransform spawnXf, BaseCommand parent = null) : base(parent) { m_Widget = widget; m_KnotType = knotType; m_SpawnXf = spawnXf; m_PathT = pathT; }
public MoveConstrainedKnotCommand(CameraPath path, KnotDescriptor knotDesc, Quaternion rot_GS, bool mergesWithCreateCommand = false, bool final = false, BaseCommand parent = null) : base(knotDesc.knot, mergesWithCreateCommand, parent) { m_Path = path; m_EndRotation_CS = Quaternion.Inverse(App.Scene.Pose.rotation) * rot_GS; m_EndT = knotDesc.pathT.Value; m_Final = final; m_StartRotation_CS = Knot.transform.localRotation; m_StartT = Knot.PathT; }
public void AddPathConstrainedKnot(CameraPathKnot.Type type, Vector3 pos, Quaternion rot) { // Determine the position knot and path t for this new knot. Vector3 error = Vector3.zero; if (m_Path.ProjectPositionOnToPath(pos, out PathT pathT, out error)) { // For PositionKnots, validT is the position in the position list. if (type == CameraPathKnot.Type.Position) { pathT = new PathT(pathT.T + 1.0f); } SketchMemoryScript.m_Instance.PerformAndRecordCommand(new CreatePathKnotCommand( this, type, pathT, TrTransform.TR(pos, rot))); } }
public RemovePathKnotCommand(CameraPathWidget widget, CameraPathKnot knot, TrTransform removeXf, BaseCommand parent = null) : base(parent) { Knot = knot; m_Widget = widget; m_RemovedXf = removeXf; // If we're removing a position knot, remember its ordered index. This is necessary // because it's probable that the path will change after removal and Undo won't be able // to place the knot back on the path at the current position. if (Knot.KnotType == CameraPathKnot.Type.Position) { m_KnotIndex = m_Widget.Path.PositionKnots.IndexOf((CameraPathPositionKnot)Knot); m_PathT = new PathT(); } else { m_PathT = Knot.PathT; } }
override protected void OnUpdate() { base.OnUpdate(); CacheCurrentPathWidget(); ValidatePathT(); if (m_CurrentPathWidget != null && m_CurrentPathWidget.Path.NumPositionKnots > 1) { if (m_OverridePathT == null && !m_UserInteracting && WidgetManager.m_Instance.FollowingPath) { // It's possible for Path.GetSpeed() to return a value <= 0, which makes the // camera path stop advancing. To correct this, ensure the minimum speed is // the lowest speed available for a speed knot. float speed = Mathf.Max(m_CurrentPathWidget.Path.GetSpeed(m_PathT), CameraPathSpeedKnot.kMinSpeed); bool completed = m_CurrentPathWidget.Path.MoveAlongPath(speed * Time.deltaTime, m_PathT, out m_PathT); if (VideoRecorderUtils.ActiveVideoRecording != null && completed) { SketchControlsScript.m_Instance.CameraPathCaptureRig.StopRecordingPath(true); } } // Stay locked on the path. PathT t = m_OverridePathT != null ? m_OverridePathT.Value : m_PathT; transform.position = m_CurrentPathWidget.Path.GetPosition(t); if (m_CurrentPathWidget.Path.RotationKnots.Count > 0) { transform.rotation = m_CurrentPathWidget.Path.GetRotation(t); } float fov = m_CurrentPathWidget.Path.GetFov(t); SketchControlsScript.m_Instance.CameraPathCaptureRig.SetFov(fov); SketchControlsScript.m_Instance.CameraPathCaptureRig.UpdateCameraTransform(transform); } }
public override bool Merge(BaseCommand other) { if (base.Merge(other)) { return(true); } if (m_Final) { return(false); } MoveConstrainedKnotCommand move = other as MoveConstrainedKnotCommand; if (move != null && Knot == move.Knot) { m_EndRotation_CS = move.m_EndRotation_CS; m_EndT = move.m_EndT; m_Final = move.m_Final; return(true); } return(false); }