Пример #1
0
    void TriangleToolbox()
    {
        if (plotter.CurrentAction != HairyPlotterActions.VertexUvEdit)
        {
            EditorGUILayout.LabelField("Triangle Toolbox", EditorStyles.boldLabel);
            EditorGUILayout.BeginHorizontal();

            if (plotter.CurrentAction == HairyPlotterActions.TriangleAdd)
            {
                GUI.color = ActiveUvEditorColor;

                if (plotter.VertexSelectionCount == 3)
                {
                    CreateTriangleFromSelection();
                }
            }
            else
            {
                GUI.color = TriangleToolbarColor;
            }

            if (GUILayout.Button("Create", EditorStyles.miniButton))
            {
                if (plotter.VertexSelectionCount == 3)
                {
                    CreateTriangleFromSelection();
                }
                else
                {
                    if (plotter.CurrentAction == HairyPlotterActions.TriangleAdd)
                    {
                        plotter.CurrentAction = HairyPlotterActions.None;
                        plotter.ClearVertexSelection();
                    }
                    else
                    {
                        plotter.CurrentAction = HairyPlotterActions.TriangleAdd;
                    }
                }
            }

            if (GUILayout.Button("Pop", EditorStyles.miniButton))
            {
                plotter.DestroyTriangle(plotter.LastTriangle);
            }

            if (plotter.CurrentAction == HairyPlotterActions.TriangleClear)
            {
                if (GUILayout.Button("Yes!", EditorStyles.miniButton))
                {
                    plotter.ClearTriangles();
                    plotter.CurrentAction = HairyPlotterActions.None;
                }

                if (GUILayout.Button("No!", EditorStyles.miniButton))
                {
                    plotter.CurrentAction = HairyPlotterActions.None;
                }
            }
            else
            {
                if (GUILayout.Button("Delete All", EditorStyles.miniButton))
                {
                    plotter.CurrentAction = HairyPlotterActions.TriangleClear;
                }
            }

            EditorGUILayout.EndHorizontal();
        }
    }