Пример #1
0
    public override void OnInspectorGUI()
    {
        spline = target as Edge;

        GUILayout.Label("N1: " + spline.Nodes[0] + " , N2: " + spline.Nodes[1]);

        EditorGUI.BeginChangeCheck();
        bool loop = EditorGUILayout.Toggle("Loop", spline.Loop);

        if (EditorGUI.EndChangeCheck())
        {
            Undo.RecordObject(spline, "Toggle Loop");
            EditorUtility.SetDirty(spline);
            spline.Loop = loop;
        }

        EditorGUI.BeginChangeCheck();
        GUILayout.Label("Line Steps");
        int lineSteps = EditorGUILayout.IntSlider(spline.LineSteps, 10, 20);

        if (EditorGUI.EndChangeCheck())
        {
            Undo.RecordObject(spline, "Set Line Steps");
            EditorUtility.SetDirty(spline);
            spline.LineSteps = lineSteps;
        }

        EditorGUI.BeginChangeCheck();
        GUILayout.Label("Direction Vector Scale");
        float directionScale = EditorGUILayout.Slider(spline.DirectionScale, 0.5f, 5.0f);

        if (EditorGUI.EndChangeCheck())
        {
            Undo.RecordObject(spline, "Set Direction Scale");
            EditorUtility.SetDirty(spline);
            spline.DirectionScale = directionScale;
        }

        if (selectedIndex >= 0 && selectedIndex < spline.ControlPointCount)
        {
            DrawSelectedPointInspector();
        }

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