Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
            }
        }
Ejemplo n.º 3
0
        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);
            }
        }
Ejemplo n.º 4
0
 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;
             }
         }
     }
 }