private static void Remove() { GameObject selected = Selection.activeObject as GameObject; SplineControlPoint ctrlPoint = selected.GetComponent <SplineControlPoint>(); Spline spline = selected.GetComponentInParent <Spline>(); Selection.activeGameObject = spline.gameObject; Undo.RecordObject(spline, "Battlehub.Spline.Remove"); spline.Remove((ctrlPoint.Index - 1) / 3); EditorUtility.SetDirty(spline); }
public static void Remove(Spline spline, int controlPointIndex) { int curveIndex = Mathf.Min((controlPointIndex + 1) / 3, spline.CurveCount - 1); RecordHierarchy(spline.Root, "Battlehub.Spline.Remove"); if (!spline.Remove(curveIndex)) { EditorUtility.DisplayDialog("Action cancelled", "Unable to remove last curve in spline. If you want to remove whole spline or branch, please select it in hierarchy and press delete button", "OK"); } else { EditorUtility.SetDirty(spline); } }
private void Remove() { int curveIndex = (SelectedIndex - 1) / 3; Spline spline = m_spline; Undo.RecordObject(spline, "Battlehub.Spline.Remove"); if (!spline.Remove(curveIndex)) { EditorUtility.DisplayDialog("Action cancelled", "Unable to remove last curve", "OK"); } else { EditorUtility.SetDirty(spline); } }
public virtual void Remove() { if (SplineRuntimeEditor.Instance != null) { Spline spline = SplineRuntimeEditor.Instance.SelectedSpline as Spline; if (spline != null) { GameObject selection = RuntimeSelection.activeGameObject; if (selection != null) { SplineControlPoint ctrlPoint = selection.GetComponent <SplineControlPoint>(); if (ctrlPoint != null) { spline.Remove((ctrlPoint.Index - 1) / 3); } RuntimeSelection.activeGameObject = spline.gameObject; } } } }