private void DrawSplineFlipAction() { if (GUILayout.Button(new GUIContent("Flip", "Flip spline direction."))) { Undo.RecordObject(_spline, "Flip spline"); _spline.Flip(); SplineUpdated?.Invoke(_spline); SceneView.RepaintAll(); } }
private void DrawInterpolationSteps() { using (var changeCheck = new EditorGUI.ChangeCheckScope()) { var steps = _spline.InterpolationStepsPerCurve; steps = EditorGUILayout.DelayedIntField("Interpolation Steps Per Curve", steps); if (changeCheck.changed) { Undo.RecordObject(_spline, "Set interpolation steps per curve"); _spline.SetStepsPerCurve(steps); SplineUpdated?.Invoke(_spline); } } }
private void DrawKnotAutoHandleValue(Knot knot) { // Auto-Handles Distance using (var changeCheck = new EditorGUI.ChangeCheckScope()) { knot.auto = EditorGUILayout.FloatField("Distance", knot.auto); if (changeCheck.changed) { Undo.RecordObject(_spline, "Edit Bezier Point"); _spline.SetKnot(CurveEditorState.SelectedKnotIndex, knot); SplineUpdated?.Invoke(_spline); SceneView.RepaintAll(); } } }
private void DrawKnotPosition(Knot knot) { // Draw Position using (var changeCheck = new EditorGUI.ChangeCheckScope()) { knot.position = EditorGUILayout.Vector3Field("Position", knot.position); if (changeCheck.changed) { Undo.RecordObject(_spline, "Edit Bezier Point"); _spline.SetKnot(CurveEditorState.SelectedKnotIndex, knot); SplineUpdated?.Invoke(_spline); SceneView.RepaintAll(); } } }
private void DrawClosedToggle() { using (var changeCheck = new EditorGUI.ChangeCheckScope()) { var closed = _spline.IsClosed; closed = EditorGUILayout.Toggle( new GUIContent("Closed", "Generate an extra curve, connecting the final point to the first point."), closed); if (changeCheck.changed) { Undo.RecordObject(_spline, "Set closed"); _spline.SetClosed(closed); SplineUpdated?.Invoke(_spline); SceneView.RepaintAll(); } } }
private void DrawKnotHandleValues(Knot knot) { // In-Handle using (var changeCheck = new EditorGUI.ChangeCheckScope()) { knot.handleIn = EditorGUILayout.Vector3Field("Handle in", knot.handleIn); if (changeCheck.changed) { Undo.RecordObject(_spline, "Edit Bezier Handle"); if (CurvePreferences.ShouldMirrorHandleMovement) { knot.handleOut = -knot.handleIn; } _spline.SetKnot(CurveEditorState.SelectedKnotIndex, knot); SplineUpdated?.Invoke(_spline); SceneView.RepaintAll(); } } // Out-Handle using (var changeCheck = new EditorGUI.ChangeCheckScope()) { knot.handleOut = EditorGUILayout.Vector3Field("Handle out", knot.handleOut); if (changeCheck.changed) { Undo.RecordObject(_spline, "Edit Bezier Handle"); if (CurvePreferences.ShouldMirrorHandleMovement) { knot.handleIn = -knot.handleOut; } _spline.SetKnot(CurveEditorState.SelectedKnotIndex, knot); SplineUpdated?.Invoke(_spline); SceneView.RepaintAll(); } } }
private void DrawKnotAutoHandleToggle(Knot knot) { using (var changeCheck = new EditorGUI.ChangeCheckScope()) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel(new GUIContent("Uses Auto Handles")); var isUsingAutoHandles = GUILayout.Toggle(knot.IsUsingAutoHandles, string.Empty); EditorGUILayout.EndHorizontal(); if (changeCheck.changed) { Undo.RecordObject(_spline, "Toggle Bezier Auto Handles"); knot.auto = isUsingAutoHandles ? 0.33f : 0f; _spline.SetKnot(CurveEditorState.SelectedKnotIndex, knot); SplineUpdated?.Invoke(_spline); SceneView.RepaintAll(); } } }
private void DrawKnotOrientationToggle(Knot knot) { using (var changeCheck = new EditorGUI.ChangeCheckScope()) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel(new GUIContent("Uses Orientation Anchor")); var isUsingOrientation = GUILayout.Toggle(knot.IsUsingRotation, string.Empty); EditorGUILayout.EndHorizontal(); if (changeCheck.changed) { Undo.RecordObject(_spline, "Toggle Bezier Orientation Anchor"); knot.rotation = !knot.IsUsingRotation ? (Quaternion?)Quaternion.identity : null; _spline.SetKnot(CurveEditorState.SelectedKnotIndex, knot); SplineUpdated?.Invoke(_spline); SceneView.RepaintAll(); } } }