Пример #1
0
    public override void OnInspectorGUI()
    {
        EditorGUILayout.HelpBox("Hold Shift and click to append and insert curve points. Backspace to delete points.", MessageType.Info);
        spline = target as SplineComponent;

        base.OnInspectorGUI();

        GUILayout.BeginVertical();

        GUILayout.BeginHorizontal();
        var closed = GUILayout.Toggle(spline.closed, "Closed", "button");

        if (spline.closed != closed)
        {
            spline.closed = closed;
            spline.ResetIndex();
        }
        if (GUILayout.Button("Flatten Y Axis"))
        {
            Undo.RecordObject(target, "Flatten Y Axis");
            TODO : Flatten(spline.points);
            spline.ResetIndex();
        }
        if (GUILayout.Button("Center around Origin"))
        {
            Undo.RecordObject(target, "Center around Origin");
            TODO : CenterAroundOrigin(spline.points);
            spline.ResetIndex();
        }

        GUILayout.EndHorizontal();

        spline.CurrentPointT = EditorGUILayout.Slider(spline.CurrentPointT, 0.0f, 1.0f);
        spline.CurrentPointT = Mathf.Clamp01(spline.CurrentPointT);

        GUILayout.EndVertical();
    }