private void DrawSelectedPointInspector() { GUILayout.Label("Selected Point"); EditorGUI.BeginChangeCheck(); Vector3 point = EditorGUILayout.Vector3Field("Position " + selectedIndex, spline.GetControlPoint(selectedIndex)); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(spline, "Move Point"); EditorUtility.SetDirty(spline); spline.SetControlPoint(selectedIndex, point); } }
private void OnSceneGUI() { spline = target as SplineLine; int length = spline.GetControlPointCount; Vector3[] points = new Vector3[length]; handleTransform = spline.transform; handleRotation = Tools.pivotRotation == PivotRotation.Local ? handleTransform.rotation : Quaternion.identity; for (int i = 0; i < length; i++) { points[i] = ShowPoint(i); if (i + 1 != length) { Handles.DrawLine(handleTransform.TransformPoint(spline.GetControlPoint(i)), handleTransform.TransformPoint(spline.GetControlPoint(i + 1))); } } Handles.color = Color.red; float size = HandleUtility.GetHandleSize(points[0]); Handles.Button(spline.GetPoint(spline.t), Quaternion.identity, size * handleSize, size * pickSize, Handles.DotHandleCap); // Debug.Log("Length :" + spline.GetLength(spline.t) + "Param : "+ spline.GetParametricLength(spline.GetLength(spline.t))); }