Beispiel #1
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            var targetSpline = target as Spline;

            if (GUILayout.Button("Add point (extend)"))
            {
                var newPoint = SplinePointEditor.AddSplinePointAfter(targetSpline.transform);

                Undo.RegisterCreatedObjectUndo(newPoint, "Add Crest Spline Point");
            }

            GUILayout.BeginHorizontal();
            var pointCount = targetSpline.transform.childCount;

            GUI.enabled = pointCount > 0;
            if (GUILayout.Button("Select first point"))
            {
                Selection.activeGameObject = targetSpline.transform.GetChild(0).gameObject;
            }
            if (GUILayout.Button("Select last point"))
            {
                Selection.activeGameObject = targetSpline.transform.GetChild(pointCount - 1).gameObject;
            }
            GUI.enabled = true;
            GUILayout.EndHorizontal();

            if (GUILayout.Button("Reverse"))
            {
                for (int i = 1; i < targetSpline.transform.childCount; i++)
                {
                    targetSpline.transform.GetChild(i).SetSiblingIndex(0);
                }
            }
        }
Beispiel #2
0
        public static void ExtendSpline(Spline spline)
        {
            var newPoint = SplinePointEditor.AddSplinePointAfter(spline.transform);

            Undo.RegisterCreatedObjectUndo(newPoint, "Add Crest Spline Point");
        }