private void OnSceneGUI() { m_Spline = target as SplineBezier; m_HandleTransform = m_Spline.transform; m_HandleRotation = Tools.pivotRotation == PivotRotation.Local ? m_HandleTransform.rotation : Quaternion.identity; Vector3 point0 = ShowPoint(0); for (int i = 1; i < m_Spline.ControlPointCount; i += 3) { Vector3 point1 = ShowPoint(i); Vector3 point2 = ShowPoint(i + 1); Vector3 point3 = ShowPoint(i + 2); Handles.color = Color.gray; Handles.DrawLine(point0, point1); Handles.DrawLine(point2, point3); Handles.DrawBezier(point0, point3, point1, point2, Color.white, null, 2.0f); point0 = point3; } ShowDirections(); }
public override void OnInspectorGUI() { DrawDefaultInspector(); m_Spline = target as SplineBezier; EditorGUI.BeginChangeCheck(); bool loop = EditorGUILayout.Toggle("Loop", m_Spline.Loop); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(m_Spline, "Toggle Loop"); EditorUtility.SetDirty(m_Spline); m_Spline.Loop = loop; } if (m_SelectedIndex >= 0 && m_SelectedIndex < m_Spline.ControlPointCount) { DrawSelectedPointInspector(); } if (GUILayout.Button("Add Curve")) { Undo.RecordObject(m_Spline, "Add Curve"); m_Spline.AddCurve(); EditorUtility.SetDirty(m_Spline); } }