示例#1
0
    void DrawVertices()
    {
        if (!plotter)
        {
            return;
        }

        if (plotter.VertexCount == 0)
        {
            return;
        }

        for (int i = 0; i < plotter.VertexCount; ++i)
        {
            Handles.color = Color.white;
            float size = 0.04f;

            if (plotter.IsSelected(i))
            {
                continue;
            }

            if (Handles.Button(plotter.GetVertex(i).Position, Quaternion.identity, size, size, Handles.CubeCap))
            {
                plotter.ToggleSelected(plotter.GetVertex(i));
                Repaint();
            }
        }

        for (int i = 0; i < plotter.VertexCount; ++i)
        {
            Handles.color = Color.white;
            float size = 0.04f;

            if (plotter.IsSelected(i))
            {
                if (plotter.UvEditVertex == plotter.GetVertex(i))
                {
                    Handles.color = UvEditedVertexColor;
                    size          = 0.02f;
                }
                else
                {
                    Handles.color = SelectedVertexColor;
                    size          = 0.02f;
                }
            }
            else
            {
                continue;
            }

            if (Handles.Button(plotter.GetVertex(i).Position, Quaternion.identity, size, size, Handles.CubeCap))
            {
                plotter.ToggleSelected(plotter.GetVertex(i));
                Repaint();
            }
        }
    }
    void DrawVertices()
    {
        if (!plotter)
        {
            return;
        }

        if (plotter.VertexCount == 0)
        {
            return;
        }

        Transform t = plotter.transform;         // this for position gizmo vertices and triangles according parent game object world coordinates

        for (int i = 0; i < plotter.VertexCount; ++i)
        {
            Handles.color = Color.white;

            if (plotter.IsSelected(i))
            {
                continue;
            }

            if (Handles.Button(t.TransformPoint(plotter.GetVertex(i).Position), Quaternion.identity, GizmoSize, GizmoSize, Handles.CubeCap))
            {
                plotter.ToggleSelected(plotter.GetVertex(i));
                Repaint();
            }
        }

        for (int i = 0; i < plotter.VertexCount; ++i)
        {
            Handles.color = Color.white;

            if (plotter.IsSelected(i))
            {
                if (plotter.UvEditVertex == plotter.GetVertex(i))
                {
                    Handles.color = UvEditedVertexColor;
                }
                else
                {
                    Handles.color = SelectedVertexColor;
                }
            }
            else
            {
                continue;
            }

            if (Handles.Button(t.TransformPoint(plotter.GetVertex(i).Position), Quaternion.identity, GizmoSize, GizmoSize, Handles.CubeCap))
            {
                plotter.ToggleSelected(plotter.GetVertex(i));
                Repaint();
            }
        }
    }