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

            spline = target as SplinePath;

            if (selectedIndex >= 0 && selectedIndex < spline.ControlPointCount)
            {
                DrawSelectedPointInspector();
                Tools.hidden = true;
            }
            else
            {
                Tools.hidden = false;
            }

            if (GUILayout.Button("Add Curve"))
            {
                Undo.RecordObject(spline, "Add Curve");
                spline.AddCurve();
                EditorUtility.SetDirty(spline);
            }

            if (spline.CurveCount > 1 && GUILayout.Button("Remove Curve"))
            {
                Undo.RecordObject(spline, "Remove Curve");
                spline.RemoveCurve();
                EditorUtility.SetDirty(spline);
            }

            if (GUI.changed)
            {
                spline.OnPathChanged(spline);
            }
        }
예제 #2
0
        private void OnEnable()
        {
            Undo.undoRedoPerformed += UndoRedoPerformed;

            spline = target as SplinePath;

            if (!Application.IsPlaying(spline))
            {
                spline.OnPathChanged(spline);
            }
        }
예제 #3
0
        private void UndoRedoPerformed()
        {
            spline = target as SplinePath;

            if (spline != null)
            {
                spline.OnPathChanged(spline);
            }
            else
            {
                Undo.undoRedoPerformed -= UndoRedoPerformed;
            }
        }