示例#1
0
    // Draw beziers and handles
    private void DrawBeziers()
    {
        for (int i = 0; i < component.splineCount; i++)
        {
            //Draw beziers
            Color bezierColor = Color.cyan;
            float bezierWidth = 2f;
            if (i == activeSpline & tool != 1 && tool != 2)
            {
                bezierColor = Color.white;
                bezierWidth = 2f;
            }
            for (int j = 1; j < component.PointCount(i); j++)
            {
                Handles.DrawBezier(
                    component.GetPoint(i, j - 1),
                    component.GetPoint(i, j),
                    component.GetHandle(i, j - 1, 1),
                    component.GetHandle(i, j, 0),
                    bezierColor,
                    null,
                    bezierWidth);
            }

            //Draw handles for current tool
            for (int j = 0; j < component.PointCount(i); j++)
            {
                switch (tool)
                {
                case -1:
                    ShowControlPoint(i, j);
                    break;

                case 0:
                    ShowControlPoint(i, j);
                    break;

                case 1:
                    if (component.GetConnectedIndex(i, j) >= 0)
                    {
                        ShowSimplePoint(i, j);
                    }
                    break;

                case 2:
                    ShowSplinePoint(i);
                    break;
                }
            }
        }
    }