예제 #1
0
    private void DrawPatternElement(Rect rect, int index, bool active, bool focus)
    {
        Rect  rect_content = VxlGUI.GetPaddedRect(rect, VxlGUI.MED_PAD);
        Rect  rect_row     = VxlGUI.GetAboveElement(rect_content, 0, VxlGUI.MED_BAR, VxlGUI.SM_SPACE, 0);
        float two          = rect_row.width / 2f;

        //plugs row
        GUI.Label(VxlGUI.GetLeftElement(rect_row, 0, two), "Plugs:", GUI.skin.GetStyle("LeftDarkLabel"));
        GUI.Label(VxlGUI.GetRightElement(rect_row, 1, two / 2f), _patterns[index].p0.ToString(), GUI.skin.GetStyle("LeftDarkLabel"));
        GUI.Label(VxlGUI.GetRightElement(rect_row, 0, two / 2f), _patterns[index].p1.ToString(), GUI.skin.GetStyle("LeftDarkLabel"));
        //above voxels
        rect_row = VxlGUI.GetAboveElement(rect_content, 1, VxlGUI.MED_BAR, VxlGUI.SM_SPACE, 0);
        GUI.Label(VxlGUI.GetLeftElement(rect_row, 0, two), "Above:", GUI.skin.GetStyle("LeftDarkLabel"));
        GUI.Label(VxlGUI.GetRightElement(rect_row, 1, two / 2f), _patterns[index].a0.ToString(), GUI.skin.GetStyle("LeftDarkLabel"));
        GUI.Label(VxlGUI.GetRightElement(rect_row, 0, two / 2f), _patterns[index].a1.ToString(), GUI.skin.GetStyle("LeftDarkLabel"));
        //below voxels
        rect_row = VxlGUI.GetAboveElement(rect_content, 2, VxlGUI.MED_BAR, VxlGUI.SM_SPACE, 0);
        GUI.Label(VxlGUI.GetLeftElement(rect_row, 0, two), "Below:", GUI.skin.GetStyle("LeftDarkLabel"));
        GUI.Label(VxlGUI.GetRightElement(rect_row, 1, two / 2f), _patterns[index].b0.ToString(), GUI.skin.GetStyle("LeftDarkLabel"));
        GUI.Label(VxlGUI.GetRightElement(rect_row, 0, two / 2f), _patterns[index].b1.ToString(), GUI.skin.GetStyle("LeftDarkLabel"));
        //flips
        rect_row = VxlGUI.GetAboveElement(rect_content, 3, VxlGUI.MED_BAR, VxlGUI.SM_SPACE, 0);
        GUI.Label(VxlGUI.GetLeftElement(rect_row, 0, two / 2f), "FlipX", GUI.skin.GetStyle("LeftDarkLabel"));
        GUI.Label(VxlGUI.GetLeftElement(rect_row, 1, two / 2f), _patterns[index].xflip.ToString(), GUI.skin.GetStyle("LeftDarkLabel"));
        GUI.Label(VxlGUI.GetLeftElement(rect_row, 2, two / 2f), "FlipY", GUI.skin.GetStyle("LeftDarkLabel"));
        GUI.Label(VxlGUI.GetLeftElement(rect_row, 3, two / 2f), _patterns[index].yflip.ToString(), GUI.skin.GetStyle("LeftDarkLabel"));
    }
예제 #2
0
    private void DrawPatternElement(Rect rect, int index, bool active, bool focus)
    {
        Rect rect_content = VxlGUI.GetPaddedRect(rect, VxlGUI.MED_PAD);

        float two = rect_content.width / 2f;
        //row 0 - a1 a0
        Rect rect_row = VxlGUI.GetAboveElement(rect_content, 0, VxlGUI.SM_BAR);

        GUI.Label(VxlGUI.GetLeftElement(rect_row, 0, two), "Above:", GUI.skin.GetStyle("LeftLightHeader"));
        GUI.Label(VxlGUI.GetRightElement(rect_row, 1, two / 2f), _patterns[index].a1_p.ToString(), GUI.skin.GetStyle("LeftDarkLabel"));
        GUI.Label(VxlGUI.GetRightElement(rect_row, 0, two / 2f), _patterns[index].a0_p.ToString(), GUI.skin.GetStyle("LeftDarkLabel"));
        //row 1 - b1 b0
        rect_row = VxlGUI.GetAboveElement(rect_content, 1, VxlGUI.SM_BAR);
        GUI.Label(VxlGUI.GetLeftElement(rect_row, 0, two), "Below:", GUI.skin.GetStyle("LeftLightHeader"));
        GUI.Label(VxlGUI.GetRightElement(rect_row, 1, two / 2f), _patterns[index].b1_p.ToString(), GUI.skin.GetStyle("LeftDarkLabel"));
        GUI.Label(VxlGUI.GetRightElement(rect_row, 0, two / 2f), _patterns[index].b0_p.ToString(), GUI.skin.GetStyle("LeftDarkLabel"));
        //row 2 - vin vout
        rect_row = VxlGUI.GetAboveElement(rect_content, 2, VxlGUI.SM_BAR);
        GUI.Label(VxlGUI.GetLeftElement(rect_row, 0, two), "Voxels:", GUI.skin.GetStyle("LeftDarkLabel"));
        GUI.Label(VxlGUI.GetRightElement(rect_row, 1, two / 2f), _patterns[index].vin.ToString(), GUI.skin.GetStyle("LeftDarkLabel"));
        GUI.Label(VxlGUI.GetRightElement(rect_row, 0, two / 2f), _patterns[index].vout.ToString(), GUI.skin.GetStyle("LeftDarkLabel"));
        //row 3 - flipx flipy
        rect_row = VxlGUI.GetAboveElement(rect_content, 3, VxlGUI.SM_BAR);
        GUI.Label(VxlGUI.GetLeftElement(rect_row, 0, two / 2f), "FlipX", GUI.skin.GetStyle("LeftDarkLabel"));
        GUI.Label(VxlGUI.GetLeftElement(rect_row, 1, two / 2f), _patterns[index].xflip.ToString(), GUI.skin.GetStyle("LeftDarkLabel"));
        GUI.Label(VxlGUI.GetLeftElement(rect_row, 2, two / 2f), "FlipY", GUI.skin.GetStyle("LeftDarkLabel"));
        GUI.Label(VxlGUI.GetLeftElement(rect_row, 3, two / 2f), _patterns[index].yflip.ToString(), GUI.skin.GetStyle("LeftDarkLabel"));
    }
예제 #3
0
    private void DrawPatternElement(Rect rect, int index, bool active, bool focus)
    {
        Rect rect_content = VxlGUI.GetPaddedRect(rect, VxlGUI.MED_PAD);

        float two = rect_content.width / 2f;
        //row 0 - (4) (5) (0)
        Rect rect_row = VxlGUI.GetAboveElement(rect_content, 0, VxlGUI.SM_BAR);

        GUI.Label(VxlGUI.GetLeftElement(rect_row, 0, two), "Plugs:", GUI.skin.GetStyle("LeftLightHeader"));
        GUI.Label(VxlGUI.GetRightElement(rect_row, 2, two / 3f), _patterns[index].c4_p.ToString(), GUI.skin.GetStyle("LeftDarkLabel"));
        GUI.Label(VxlGUI.GetRightElement(rect_row, 1, two / 3f), _patterns[index].c5_p.ToString(), GUI.skin.GetStyle("LeftDarkLabel"));
        GUI.Label(VxlGUI.GetRightElement(rect_row, 0, two / 3f), _patterns[index].c0_p.ToString(), GUI.skin.GetStyle("LeftDarkLabel"));
        //row 1 - (3) (2) (1)
        rect_row = VxlGUI.GetAboveElement(rect_content, 1, VxlGUI.SM_BAR);
        GUI.Label(VxlGUI.GetRightElement(rect_row, 2, two / 3f), _patterns[index].c3_p.ToString(), GUI.skin.GetStyle("LeftDarkLabel"));
        GUI.Label(VxlGUI.GetRightElement(rect_row, 1, two / 3f), _patterns[index].c2_p.ToString(), GUI.skin.GetStyle("LeftDarkLabel"));
        GUI.Label(VxlGUI.GetRightElement(rect_row, 0, two / 3f), _patterns[index].c1_p.ToString(), GUI.skin.GetStyle("LeftDarkLabel"));
        //row 2 - above below
        rect_row = VxlGUI.GetAboveElement(rect_content, 2, VxlGUI.SM_BAR);
        GUI.Label(VxlGUI.GetLeftElement(rect_row, 0, two), "Voxels:", GUI.skin.GetStyle("LeftDarkLabel"));
        GUI.Label(VxlGUI.GetRightElement(rect_row, 1, two / 2f), _patterns[index].vb.ToString(), GUI.skin.GetStyle("LeftDarkLabel"));
        GUI.Label(VxlGUI.GetRightElement(rect_row, 0, two / 2f), _patterns[index].va.ToString(), GUI.skin.GetStyle("LeftDarkLabel"));
        //row 3 - flipx flipy
        rect_row = VxlGUI.GetAboveElement(rect_content, 3, VxlGUI.SM_BAR);
        GUI.Label(VxlGUI.GetLeftElement(rect_row, 0, two / 2f), "FlipX", GUI.skin.GetStyle("LeftDarkLabel"));
        GUI.Label(VxlGUI.GetLeftElement(rect_row, 1, two / 2f), _patterns[index].xflip.ToString(), GUI.skin.GetStyle("LeftDarkLabel"));
        GUI.Label(VxlGUI.GetLeftElement(rect_row, 2, two / 2f), "FlipY", GUI.skin.GetStyle("LeftDarkLabel"));
        GUI.Label(VxlGUI.GetLeftElement(rect_row, 3, two / 2f), _patterns[index].yflip.ToString(), GUI.skin.GetStyle("LeftDarkLabel"));
    }
예제 #4
0
    private void UpdateRects(Rect rect)
    {
        _rect_selected = VxlGUI.GetBelowElement(rect, 0, VxlGUI.MED_BAR);
        Rect rect_panel = VxlGUI.GetPaddedRect(VxlGUI.GetSandwichedRectY(rect, 0, VxlGUI.MED_BAR), VxlGUI.LRG_PAD);

        _rect_submodes = VxlGUI.GetAboveElement(VxlGUI.GetLeftElement(rect_panel, 0, VxlGUI.MED_BAR), 0, Mathf.Min(_modes.Length * 60, rect_panel.height));
        _rect_content  = VxlGUI.GetSandwichedRectX(rect_panel, VxlGUI.MED_BAR + (3 * VxlGUI.SM_SPACE), 0);
    }
예제 #5
0
    public override void DrawGUI(Rect rect)
    {
        //update lists
        UpdateVertexList();
        //update important layout elements
        UpdateRects(rect);
        //disable panel check
        EditorGUI.BeginDisabledGroup(target == null);
        //draw vertex build title
        VxlGUI.DrawRect(_rect_vertex_title, "DarkGradient");
        GUI.Label(_rect_vertex_title, "Vertex Builds", GUI.skin.GetStyle("LeftLightHeader"));
        //draw vertex build list
        VxlGUI.DrawRect(_rect_vertex_scrollview, "DarkWhite");
        _vertex_scroll = GUI.BeginScrollView(_rect_vertex_scrollview, _vertex_scroll, _rect_vertex_content);
        _vertexlist.DoList(_rect_vertex_content);
        GUI.EndScrollView();
        //draw vertex build button panel
        float button_width = Mathf.Min(60f, _rect_vertex_panel.width / 2f);

        VxlGUI.DrawRect(_rect_vertex_panel, "DarkGradient");
        //draw vertex add button
        if (GUI.Button(VxlGUI.GetRightElement(_rect_vertex_panel, 0, button_width), "Add", GUI.skin.GetStyle("LightButton")))
        {
            AddVertexElement();
        }
        //disable operation check
        EditorGUI.BeginDisabledGroup((_vertices.Count <= 0) || (selectlist.Count <= 0));
        //draw vertex delete button
        if (GUI.Button(VxlGUI.GetLeftElement(_rect_vertex_panel, 0, button_width), "Delete", GUI.skin.GetStyle("LightButton")))
        {
            DeleteSelectedVertex();
        }
        EditorGUI.EndDisabledGroup();

        //draw import panel
        VxlGUI.DrawRect(_rect_import, "DarkWhite");
        Rect importpad_rect = VxlGUI.GetPaddedRect(_rect_import, VxlGUI.MED_PAD);
        Rect importrow_rect = VxlGUI.GetAboveElement(importpad_rect, 0, VxlGUI.MED_BAR);

        GUI.Label(importrow_rect, "Import Obj Vertex and Triangles", GUI.skin.GetStyle("LeftLrgDarkLabel"));
        importrow_rect = VxlGUI.GetAboveElement(importpad_rect, 1, VxlGUI.MED_BAR);

        float import_width = Mathf.Min(100f, (importrow_rect.width - VxlGUI.SM_SPACE) / 2f);

        _importmesh = (Mesh)EditorGUI.ObjectField(
            VxlGUI.GetSandwichedRectX(importrow_rect, 0, import_width + VxlGUI.SM_SPACE),
            _importmesh,
            typeof(Mesh),
            false
            );
        EditorGUI.BeginDisabledGroup(_importmesh == null);
        if (GUI.Button(VxlGUI.GetRightElement(importrow_rect, 0, import_width), "Import", GUI.skin.GetStyle("DarkButton")))
        {
            ImportVertexAndTriangle();
        }
        EditorGUI.EndDisabledGroup();
        EditorGUI.EndDisabledGroup();
    }
예제 #6
0
    private void UpdateLayoutRects()
    {
        Rect window_rect = new Rect(Vector2.zero, position.size);

        _rect_mode = VxlGUI.GetAboveElement(window_rect, 0, VxlGUI.MODE);
        Rect  content_rect = VxlGUI.GetSandwichedRectY(window_rect, VxlGUI.MODE, 0);
        float pixels       = Mathf.Clamp(0.5f * content_rect.width, VxlGUI.MINWIDTH_WINDOW, VxlGUI.MAXWIDTH_WINDOW);

        _rect_menucontent = VxlGUI.GetLeftElement(content_rect, 0, pixels);
        _rect_preview     = VxlGUI.GetRightElement(content_rect, 0, content_rect.width - pixels);
    }
예제 #7
0
    public override void DrawGUI(Rect rect)
    {
        //update and populate lists
        UpdateLists();
        //update layout rects
        UpdateLayoutRect(rect);
        //draw header
        VxlGUI.DrawRect(_rect_header, "DarkGradient");
        GUI.Label(_rect_header, _title, GUI.skin.GetStyle("LeftLightHeader"));
        //GUID
        VxlGUI.DrawRect(_rect_guidscroll, "DarkWhite");
        _guidscroll = GUI.BeginScrollView(_rect_guidscroll, _guidscroll, _rect_guidcontent);
        _guidlist.DoList(_rect_guidcontent);
        GUI.EndScrollView();
        //transfer panel
        bool disable_guid = _guidlist.index < 0 || _guidlist.index >= _guidlist.count;
        bool disable_lib  = _libobjlist.index < 0 || _libobjlist.index >= _libobjlist.count;

        VxlGUI.DrawRect(_rect_panel, "DarkGradient");
        float boundwidth = Mathf.Min(60f, _rect_panel.width / 3f);
        //down button
        Rect rect_button = VxlGUI.GetMiddleX(VxlGUI.GetLeftElement(_rect_panel, 0, boundwidth), _rect_panel.height);

        EditorGUI.BeginDisabledGroup(disable_guid);
        if (GUI.Button(rect_button, "", GUI.skin.GetStyle("ArrowDown")))
        {
            AddSelected();
        }
        EditorGUI.EndDisabledGroup();
        //up button
        rect_button = VxlGUI.GetMiddleX(VxlGUI.GetMiddleX(_rect_panel, boundwidth), _rect_panel.height);
        EditorGUI.BeginDisabledGroup(disable_lib);
        if (GUI.Button(rect_button, "", GUI.skin.GetStyle("ArrowUp")))
        {
            RemoveSelected();
        }
        EditorGUI.EndDisabledGroup();
        //swap button
        rect_button = VxlGUI.GetMiddleX(VxlGUI.GetRightElement(_rect_panel, 0, boundwidth), _rect_panel.height);
        EditorGUI.BeginDisabledGroup(disable_guid || disable_lib);
        if (GUI.Button(rect_button, "", GUI.skin.GetStyle("ArrowSwap")))
        {
            SwapSelected();
        }
        EditorGUI.EndDisabledGroup();
        //library
        VxlGUI.DrawRect(_rect_libscroll, "DarkWhite");
        _libscroll = GUI.BeginScrollView(_rect_libscroll, _libscroll, _rect_libcontent);
        _libobjlist.DoList(_rect_libcontent);
        GUI.EndScrollView();
    }
예제 #8
0
    public override void DrawGUI(Rect rect)
    {
        RefreshOptionLabels();
        UpdateTriangleList();
        UpdateRects(rect);
        EditorGUI.BeginDisabledGroup(target == null);
        //draw title
        VxlGUI.DrawRect(_rect_title, "DarkGradient");
        GUI.Label(_rect_title, "Triangles", GUI.skin.GetStyle("LeftLightHeader"));
        //draw triangle list
        VxlGUI.DrawRect(_rect_tri_scroll, "DarkWhite");
        _scroll = GUI.BeginScrollView(_rect_tri_scroll, _scroll, _rect_tri_content);
        _trianglelist.DoList(_rect_tri_content);
        GUI.EndScrollView();
        //draw button panel
        VxlGUI.DrawRect(_rect_panel, "DarkGradient");
        float button_width = Mathf.Min(60, _rect_panel.width / 4f);

        //draw add button
        if (GUI.Button(VxlGUI.GetRightElement(_rect_panel, 0, button_width), "Add", GUI.skin.GetStyle("LightButton")))
        {
            AddTriangle();
        }
        //draw add triangle button
        EditorGUI.BeginDisabledGroup(_preview.secondaryCount != 3);
        if (GUI.Button(VxlGUI.GetRightElement(_rect_panel, 1, button_width), "S Add", GUI.skin.GetStyle("LightButton")))
        {
            AddSecondaryTriangle();
        }
        EditorGUI.EndDisabledGroup();
        //draw flip button
        EditorGUI.BeginDisabledGroup((_triangles.Count <= 0) || (selectlist.Count <= 0));
        if (GUI.Button(VxlGUI.GetRightElement(_rect_panel, 2, button_width), "Flip", GUI.skin.GetStyle("LightButton")))
        {
            FlipSelectedTriangles();
        }
        //draw delete button
        if (GUI.Button(VxlGUI.GetLeftElement(_rect_panel, 0, button_width), "Delete", GUI.skin.GetStyle("LightButton")))
        {
            DeleteSelectedTriangles();
        }
        EditorGUI.EndDisabledGroup();
        EditorGUI.EndDisabledGroup();
    }
예제 #9
0
    private void DrawAddPatternPanel()
    {
        EditorGUI.BeginChangeCheck();
        VxlGUI.DrawRect(_rect_pattemplateheader, "DarkGradient");
        GUI.Label(_rect_pattemplateheader, "Add Rect Pattern", GUI.skin.GetStyle("LeftLightHeader"));
        VxlGUI.DrawRect(_rect_pattemplate, "DarkWhite");
        Rect rect_content = VxlGUI.GetPaddedRect(_rect_pattemplate, VxlGUI.MED_PAD);

        float two = rect_content.width / 2f;
        //row 0 - a1 a0
        Rect rect_row = VxlGUI.GetAboveElement(rect_content, 0, VxlGUI.MED_BAR, VxlGUI.SM_SPACE, 0);

        GUI.Label(VxlGUI.GetLeftElement(rect_row, 0, two), "Above:", GUI.skin.GetStyle("LeftLightHeader"));
        int c4 = EditorGUI.IntField(VxlGUI.GetRightElement(rect_row, 2, Mathf.Min(two / 3f, 40)), _addpat.c4_p);
        int c5 = EditorGUI.IntField(VxlGUI.GetRightElement(rect_row, 1, Mathf.Min(two / 3f, 40)), _addpat.c5_p);
        int c0 = EditorGUI.IntField(VxlGUI.GetRightElement(rect_row, 0, Mathf.Min(two / 3f, 40)), _addpat.c0_p);

        //row 1 - b1 b0
        rect_row = VxlGUI.GetAboveElement(rect_content, 1, VxlGUI.MED_BAR, VxlGUI.SM_SPACE, 0);
        GUI.Label(VxlGUI.GetLeftElement(rect_row, 0, two), "Below:", GUI.skin.GetStyle("LeftLightHeader"));
        int c3 = EditorGUI.IntField(VxlGUI.GetRightElement(rect_row, 2, Mathf.Min(two / 3f, 40)), _addpat.c3_p);
        int c2 = EditorGUI.IntField(VxlGUI.GetRightElement(rect_row, 1, Mathf.Min(two / 3f, 40)), _addpat.c2_p);
        int c1 = EditorGUI.IntField(VxlGUI.GetRightElement(rect_row, 0, Mathf.Min(two / 3f, 40)), _addpat.c1_p);

        //row 2 - vin vout
        rect_row = VxlGUI.GetAboveElement(rect_content, 2, VxlGUI.MED_BAR, VxlGUI.SM_SPACE, 0);
        GUI.Label(VxlGUI.GetLeftElement(rect_row, 0, two), "Voxels:", GUI.skin.GetStyle("LeftLightHeader"));
        int vb = EditorGUI.IntField(VxlGUI.GetRightElement(rect_row, 1, Mathf.Min(two / 2f, 40)), _addpat.vb);
        int va = EditorGUI.IntField(VxlGUI.GetRightElement(rect_row, 0, Mathf.Min(two / 2f, 40)), _addpat.va);

        //row 3 - flipx flipy
        rect_row = VxlGUI.GetAboveElement(rect_content, 3, VxlGUI.MED_BAR, VxlGUI.SM_SPACE, 0);
        bool flipx = EditorGUI.Foldout(VxlGUI.GetLeftElement(rect_row, 0, two), _addpat.xflip, "FlipX", true, GUI.skin.GetStyle("LightFoldout"));
        bool flipy = EditorGUI.Foldout(VxlGUI.GetLeftElement(rect_row, 1, two), _addpat.yflip, "FlipY", true, GUI.skin.GetStyle("LightFoldout"));

        //apply change
        if (EditorGUI.EndChangeCheck())
        {
            _addpat       = new HexagonPattern(flipx, flipy, c0, c1, c2, c3, c4, c5, va, vb);
            _repaint_menu = false;
        }
    }
예제 #10
0
    private void DrawAddPatternPanel()
    {
        EditorGUI.BeginChangeCheck();
        VxlGUI.DrawRect(_rect_pattemplateheader, "DarkGradient");
        GUI.Label(_rect_pattemplateheader, "Add Rect Pattern", GUI.skin.GetStyle("LeftLightHeader"));
        VxlGUI.DrawRect(_rect_pattemplate, "DarkWhite");
        Rect rect_content = VxlGUI.GetPaddedRect(_rect_pattemplate, VxlGUI.MED_PAD);

        float two = rect_content.width / 2f;
        //row 0 - a1 a0
        Rect rect_row = VxlGUI.GetAboveElement(rect_content, 0, VxlGUI.MED_BAR, VxlGUI.SM_SPACE, 0);

        GUI.Label(VxlGUI.GetLeftElement(rect_row, 0, two), "Above:", GUI.skin.GetStyle("LeftLightHeader"));
        int a1 = EditorGUI.IntField(VxlGUI.GetRightElement(rect_row, 1, Mathf.Min(two / 2f, 40)), _addpat.a1_p);
        int a0 = EditorGUI.IntField(VxlGUI.GetRightElement(rect_row, 0, Mathf.Min(two / 2f, 40)), _addpat.a0_p);

        //row 1 - b1 b0
        rect_row = VxlGUI.GetAboveElement(rect_content, 1, VxlGUI.MED_BAR, VxlGUI.SM_SPACE, 0);
        GUI.Label(VxlGUI.GetLeftElement(rect_row, 0, two), "Below:", GUI.skin.GetStyle("LeftLightHeader"));
        int b1 = EditorGUI.IntField(VxlGUI.GetRightElement(rect_row, 1, Mathf.Min(two / 2f, 40)), _addpat.b1_p);
        int b0 = EditorGUI.IntField(VxlGUI.GetRightElement(rect_row, 0, Mathf.Min(two / 2f, 40)), _addpat.b0_p);

        //row 2 - vin vout
        rect_row = VxlGUI.GetAboveElement(rect_content, 2, VxlGUI.MED_BAR, VxlGUI.SM_SPACE, 0);
        GUI.Label(VxlGUI.GetLeftElement(rect_row, 0, two), "Voxels:", GUI.skin.GetStyle("LeftLightHeader"));
        int vin  = EditorGUI.IntField(VxlGUI.GetRightElement(rect_row, 1, Mathf.Min(two / 2f, 40)), _addpat.vin);
        int vout = EditorGUI.IntField(VxlGUI.GetRightElement(rect_row, 0, Mathf.Min(two / 2f, 40)), _addpat.vout);

        //row 3 - flipx flipy
        rect_row = VxlGUI.GetAboveElement(rect_content, 3, VxlGUI.MED_BAR, VxlGUI.SM_SPACE, 0);
        bool flipx = EditorGUI.Foldout(VxlGUI.GetLeftElement(rect_row, 0, two), _addpat.xflip, "FlipX", true, GUI.skin.GetStyle("LightFoldout"));
        bool flipy = EditorGUI.Foldout(VxlGUI.GetLeftElement(rect_row, 1, two), _addpat.yflip, "FlipY", true, GUI.skin.GetStyle("LightFoldout"));

        //apply change
        if (EditorGUI.EndChangeCheck())
        {
            _addpat       = new RectPattern(flipx, flipy, a0, b0, a1, b1, vin, vout);
            _repaint_menu = false;
        }
    }
예제 #11
0
    private void DrawPatternElement(Rect rect, int index, bool active, bool focus)
    {
        Rect  rect_content = VxlGUI.GetPaddedRect(rect, VxlGUI.MED_PAD);
        Rect  rect_row     = VxlGUI.GetAboveElement(rect_content, 0, VxlGUI.SM_BAR);
        float width        = (rect_content.width / 3f) - (2 * VxlGUI.SM_SPACE);

        //row 0
        GUI.Label(rect_row, "Above IDs", GUI.skin.GetStyle("LeftDarkLabel"));
        //row 1
        rect_row = VxlGUI.GetAboveElement(rect_content, 1, VxlGUI.SM_BAR);
        GUI.Label(VxlGUI.GetLeftElement(rect_row, 0, width, VxlGUI.SM_SPACE, 0), _patterns[index].a0.ToString(), GUI.skin.GetStyle("RightDarkLabel"));
        GUI.Label(VxlGUI.GetLeftElement(rect_row, 1, width, VxlGUI.SM_SPACE, 0), _patterns[index].a1.ToString(), GUI.skin.GetStyle("RightDarkLabel"));
        GUI.Label(VxlGUI.GetLeftElement(rect_row, 2, width, VxlGUI.SM_SPACE, 0), _patterns[index].a2.ToString(), GUI.skin.GetStyle("RightDarkLabel"));
        //row 2
        rect_row = VxlGUI.GetAboveElement(rect_content, 2, VxlGUI.SM_BAR);
        GUI.Label(rect_row, "Below IDs", GUI.skin.GetStyle("LeftDarkLabel"));
        //row 3
        rect_row = VxlGUI.GetAboveElement(rect_content, 3, VxlGUI.SM_BAR);
        GUI.Label(VxlGUI.GetLeftElement(rect_row, 0, width, VxlGUI.SM_SPACE, 0), _patterns[index].b0.ToString(), GUI.skin.GetStyle("RightDarkLabel"));
        GUI.Label(VxlGUI.GetLeftElement(rect_row, 1, width, VxlGUI.SM_SPACE, 0), _patterns[index].b1.ToString(), GUI.skin.GetStyle("RightDarkLabel"));
        GUI.Label(VxlGUI.GetLeftElement(rect_row, 2, width, VxlGUI.SM_SPACE, 0), _patterns[index].b2.ToString(), GUI.skin.GetStyle("RightDarkLabel"));
    }
예제 #12
0
    private void DrawVertexElement(Rect rect, int index, bool active, bool focus)
    {
        EditorGUI.BeginChangeCheck();
        float width = Mathf.Min(rect.width / 4f);

        //draw label
        EditorGUI.LabelField(
            VxlGUI.GetLeftElement(rect, 0, width),
            "Vertex " + index,
            GUI.skin.GetStyle("LeftListLabel")
            );
        Vector3 vertex = EditorGUI.Vector3Field(VxlGUI.GetSandwichedRectX(rect, width, 0), "", _vertices[index]);

        if (EditorGUI.EndChangeCheck())
        {
            Undo.RecordObject(target, "Updated Vertex");
            target.vertices[index] = vertex;
            _repaint_menu          = true;
            _render_mesh           = true;
            _update_mesh           = true;
            EditorUtility.SetDirty(target);
        }
    }
예제 #13
0
    private void UpdateRects(Rect rect)
    {
        Rect rect_col = VxlGUI.GetLeftColumn(rect, VxlGUI.SM_SPACE, 0.5f);

        //calculate axi rects
        _rect_axititle   = VxlGUI.GetAboveElement(rect_col, 0, VxlGUI.MED_BAR);
        _rect_axiscroll  = VxlGUI.GetSandwichedRectY(rect_col, VxlGUI.MED_BAR + VxlGUI.SM_SPACE, 0);
        _rect_axicontent = VxlGUI.GetScrollViewRect(_axilist, _rect_axiscroll.width, _rect_axiscroll.height);

        rect_col = VxlGUI.GetRightColumn(rect, VxlGUI.SM_SPACE, 0.5f);
        //calculate socket rects
        _rect_sockethead        = VxlGUI.GetAboveElement(rect_col, 0, (2 * VxlGUI.MED_BAR) + VxlGUI.MED_SPACE);
        _rect_sockettitle       = VxlGUI.GetAboveElement(_rect_sockethead, 0, VxlGUI.MED_BAR);
        _rect_invx              = VxlGUI.GetBelowLeftElement(_rect_sockethead, 0, _rect_sockethead.width / 2f, 0, VxlGUI.MED_BAR);
        _rect_invy              = VxlGUI.GetBelowRightElement(_rect_sockethead, 0, _rect_sockethead.width / 2f, 0, VxlGUI.MED_BAR);
        _rect_socketscroll      = VxlGUI.GetSandwichedRectY(rect_col, _rect_sockethead.height + VxlGUI.SM_SPACE, VxlGUI.MED_BAR + VxlGUI.SM_SPACE);
        _rect_socketcontent     = VxlGUI.GetScrollViewRect(_socketlist, _rect_socketscroll.width, _rect_socketscroll.height);
        _rect_socketbuttonpanel = VxlGUI.GetBelowElement(rect_col, 0, VxlGUI.MED_BAR);
        float button_width = Mathf.Min(60, _rect_socketbuttonpanel.width / 3f);

        _rect_addsocket       = VxlGUI.GetRightElement(_rect_socketbuttonpanel, 0, button_width);
        _rect_delsocket       = VxlGUI.GetLeftElement(_rect_socketbuttonpanel, 0, button_width);
        _rect_secondaddsocket = VxlGUI.GetRightElement(_rect_socketbuttonpanel, 1, button_width);
    }
예제 #14
0
    public override void DrawGUI(Rect rect)
    {
        UpdateRects(rect);

        //rename - do later
        EditorGUI.BeginDisabledGroup(selected == null);
        VxlGUI.DrawRect(_rect_rename, "LightBlack");
        EditorGUI.BeginChangeCheck();
        GUI.Label(VxlGUI.GetLeftColumn(_rect_rename, 0, 0.5f), "Rename:", GUI.skin.GetStyle("RightLightLabel"));
        string name = "";

        if (selected != null)
        {
            name = selected.objname;
        }
        name = EditorGUI.DelayedTextField(
            VxlGUI.GetPaddedRect(VxlGUI.GetRightColumn(_rect_rename, 0, 0.5f), VxlGUI.SM_PAD),
            name,
            GUI.skin.GetStyle("RightLightText")
            );
        if (EditorGUI.EndChangeCheck())
        {
            if (RenameSelectedUnsaved(name) || RenameSelectedAsset(name))
            {
                if (!_unsaved_selected)
                {
                    SetSelectedFromGUIDList();
                }
                RefreshAssets();
            }
        }
        EditorGUI.EndDisabledGroup();

        //guid list
        VxlGUI.DrawRect(_rect_guidheader, "DarkGradient");
        VxlGUI.DrawRect(_rect_guidfooter, "DarkGradient");
        VxlGUI.DrawRect(_rect_guidscroll, "DarkWhite");
        GUI.Label(_rect_guidheader, "Project Assets", GUI.skin.GetStyle("LeftLightHeader"));
        _scroll_guid = GUI.BeginScrollView(_rect_guidscroll, _scroll_guid, _rect_guidcontent);
        _guidlist.DoList(_rect_guidcontent);
        GUI.EndScrollView();
        float width = Mathf.Min(60f, _rect_guidfooter.width);

        if (GUI.Button(VxlGUI.GetRightElement(_rect_guidfooter, 0, width), "Refresh", GUI.skin.GetStyle("LightButton")))
        {
            RefreshAssets();
        }

        //unsaved list
        VxlGUI.DrawRect(_rect_unsavedheader, "DarkGradient");
        VxlGUI.DrawRect(_rect_unsavedfooter, "DarkGradient");
        VxlGUI.DrawRect(_rect_unsavedscroll, "DarkWhite");
        GUI.Label(_rect_unsavedheader, "Unsaved Objects", GUI.skin.GetStyle("LeftLightHeader"));
        _scroll_unsaved = GUI.BeginScrollView(_rect_unsavedscroll, _scroll_unsaved, _rect_unsavedcontent);
        if (_unsavedlist != null)
        {
            _unsavedlist.DoList(_rect_unsavedcontent);
        }
        GUI.EndScrollView();
        width = Mathf.Min(60f, _rect_unsavedfooter.width / 3f);
        if (GUI.Button(VxlGUI.GetRightElement(_rect_unsavedfooter, 0, width), "Add", GUI.skin.GetStyle("LightButton")))
        {
            AddUnsaved();
        }
        EditorGUI.BeginDisabledGroup(!_unsaved_selected || _index < 0 || _index >= _unsaveds.Count);
        if (GUI.Button(VxlGUI.GetRightElement(_rect_unsavedfooter, 1, width), "Save", GUI.skin.GetStyle("LightButton")))
        {
            SaveAsset();
            RefreshAssets();
            SetSelectedFromGUIDList();
        }
        if (GUI.Button(VxlGUI.GetLeftElement(_rect_unsavedfooter, 0, width), "Delete", GUI.skin.GetStyle("LightButton")))
        {
            DeleteUnsaved();
        }
        EditorGUI.EndDisabledGroup();
    }
예제 #15
0
    public override void DrawGUI(Rect rect)
    {
        //update both visual lists
        UpdateEdgeList();
        UpdatePatternList();
        //update layout rects
        UpdateLayoutRects(rect);

        //draw key selection header
        VxlGUI.DrawRect(_rect_selectheader, "DarkGradient");
        GUI.Label(_rect_selectheader, _title, GUI.skin.GetStyle("LeftLightHeader"));
        //draw key selection list
        VxlGUI.DrawRect(_rect_selectscroll, "DarkWhite");
        _selectscroll = GUI.BeginScrollView(_rect_selectscroll, _selectscroll, _rect_select_content);
        _edgelist.DoList(_rect_select_content);
        GUI.EndScrollView();
        //draw add pattern template
        VxlGUI.DrawRect(_rect_pattemplateheader, "DarkGradient");
        GUI.Label(_rect_pattemplateheader, "Add Lateral Edge", GUI.skin.GetStyle("LeftLightHeader"));
        VxlGUI.DrawRect(_rect_pattemplate, "DarkWhite");
        Rect rect_content = VxlGUI.GetPaddedRect(_rect_pattemplate, VxlGUI.MED_PAD);

        EditorGUI.BeginChangeCheck();
        Rect rect_row = VxlGUI.GetAboveElement(rect_content, 0, VxlGUI.MED_BAR, VxlGUI.SM_SPACE, 0);

        float two = rect_row.width / 2f;

        //plugs row
        GUI.Label(VxlGUI.GetLeftElement(rect_row, 0, two), "Plugs:", GUI.skin.GetStyle("LeftLrgDarkLabel"));
        int p0 = EditorGUI.IntField(VxlGUI.GetRightElement(rect_row, 1, Mathf.Min(two / 2f, 40)), _addpat.p0);
        int p1 = EditorGUI.IntField(VxlGUI.GetRightElement(rect_row, 0, Mathf.Min(two / 2f, 40)), _addpat.p1);

        //above voxels
        rect_row = VxlGUI.GetAboveElement(rect_content, 1, VxlGUI.MED_BAR, VxlGUI.SM_SPACE, 0);
        GUI.Label(VxlGUI.GetLeftElement(rect_row, 0, two), "Above:", GUI.skin.GetStyle("LeftLrgDarkLabel"));
        int a0 = EditorGUI.IntField(VxlGUI.GetRightElement(rect_row, 1, Mathf.Min(two / 2f, 40)), _addpat.a0);
        int a1 = EditorGUI.IntField(VxlGUI.GetRightElement(rect_row, 0, Mathf.Min(two / 2f, 40)), _addpat.a1);

        //below voxels
        rect_row = VxlGUI.GetAboveElement(rect_content, 2, VxlGUI.MED_BAR, VxlGUI.SM_SPACE, 0);
        GUI.Label(VxlGUI.GetLeftElement(rect_row, 0, two), "Below:", GUI.skin.GetStyle("LeftLrgDarkLabel"));
        int b0 = EditorGUI.IntField(VxlGUI.GetRightElement(rect_row, 1, Mathf.Min(two / 2f, 40)), _addpat.b0);
        int b1 = EditorGUI.IntField(VxlGUI.GetRightElement(rect_row, 0, Mathf.Min(two / 2f, 40)), _addpat.b1);

        //flips
        rect_row = VxlGUI.GetAboveElement(rect_content, 3, VxlGUI.MED_BAR, VxlGUI.SM_SPACE, 0);
        bool flipx = EditorGUI.Foldout(VxlGUI.GetLeftElement(rect_row, 0, two), _addpat.xflip, "FlipX", true, GUI.skin.GetStyle("LightFoldout"));
        bool flipy = EditorGUI.Foldout(VxlGUI.GetLeftElement(rect_row, 1, two), _addpat.yflip, "FlipY", true, GUI.skin.GetStyle("LightFoldout"));

        //apply change
        if (EditorGUI.EndChangeCheck())
        {
            _addpat       = new LateralPattern(flipx, flipy, p0, p1, a0, b0, a1, b1);
            _repaint_menu = false;
        }
        //draw pattern header
        VxlGUI.DrawRect(_rect_patheader, "DarkGradient");
        GUI.Label(_rect_patheader, "Patterns", GUI.skin.GetStyle("LeftLightHeader"));
        //draw pattern list
        VxlGUI.DrawRect(_rect_patscroll, "DarkWhite");
        _patscroll = GUI.BeginScrollView(_rect_patscroll, _patscroll, _rect_patcontent);
        _patternlist.DoList(_rect_patcontent);
        GUI.EndScrollView();
        //draw pattern panel
        VxlGUI.DrawRect(_rect_patpanel, "DarkGradient");
        float button_width = Mathf.Min(60f, _rect_patpanel.width / 2f);

        bool invalid_addpat    = !_addpat.IsValid() || _addpat.IsEmpty();
        bool invalid_edgeindex = _edgelist.count <= 0 || _edgelist.index < 0 || _edgelist.index >= _edgelist.count;
        bool invalid_exists    = target != null && target.LateralPatternExists(_addpat);

        EditorGUI.BeginDisabledGroup(target == null || invalid_addpat || invalid_edgeindex || invalid_exists);
        if (GUI.Button(VxlGUI.GetRightElement(_rect_patpanel, 0, button_width), "Add", GUI.skin.GetStyle("LightButton")))
        {
            if (target != null)
            {
                Undo.RecordObject(target, "Add Lateral Pattern");
                target.AddLateralPattern(_edges[_edgelist.index], _addpat);
                _repaint_menu = false;
                //dirty target
                EditorUtility.SetDirty(target);
                //update pattern list
                UpdatePatternList();
            }
        }
        EditorGUI.EndDisabledGroup();

        bool invalid_patternindex = _patternlist.count <= 0 || _patternlist.index < 0 || _patternlist.index >= _patternlist.count;

        EditorGUI.BeginDisabledGroup(target == null || invalid_edgeindex || invalid_patternindex);
        if (GUI.Button(VxlGUI.GetLeftElement(_rect_patpanel, 0, button_width), "Delete", GUI.skin.GetStyle("LightButton")))
        {
            if (target != null)
            {
                Undo.RecordObject(target, "Delete Lateral Pattern");
                target.DeleteLateralPattern(_edges[_edgelist.index], _patterns[_patternlist.index]);
                _repaint_menu = false;
                //dirty target
                EditorUtility.SetDirty(target);
                //update pattern list
                UpdatePatternList();
            }
        }
        EditorGUI.EndDisabledGroup();
    }
예제 #16
0
    public override void DrawGUI(Rect rect)
    {
        //update both visual lists
        UpdateFaceList();
        UpdatePatternList();
        //update layout rects
        UpdateLayoutRects(rect);

        //draw key selection header
        VxlGUI.DrawRect(_rect_selectheader, "DarkGradient");
        GUI.Label(_rect_selectheader, _title, GUI.skin.GetStyle("LeftLightHeader"));
        //draw key selection list
        VxlGUI.DrawRect(_rect_selectscroll, "DarkWhite");
        _selectscroll = GUI.BeginScrollView(_rect_selectscroll, _selectscroll, _rect_select_content);
        _facelist.DoList(_rect_select_content);
        GUI.EndScrollView();
        //draw add pattern template
        DrawAddPatternPanel();

        //draw pattern header
        VxlGUI.DrawRect(_rect_patheader, "DarkGradient");
        GUI.Label(_rect_patheader, "Patterns", GUI.skin.GetStyle("LeftLightHeader"));
        //draw pattern list
        VxlGUI.DrawRect(_rect_patscroll, "DarkWhite");
        _patscroll = GUI.BeginScrollView(_rect_patscroll, _patscroll, _rect_patcontent);
        _patternlist.DoList(_rect_patcontent);
        GUI.EndScrollView();
        //draw pattern panel
        VxlGUI.DrawRect(_rect_patpanel, "DarkGradient");
        float button_width = Mathf.Min(60f, _rect_patpanel.width / 2f);

        bool invalid_addpat    = _addpat.IsEmpty() || !_addpat.IsValid();
        bool invalid_faceindex = _facelist.count <= 0 || _facelist.index < 0 || _facelist.index >= _facelist.count;
        bool invalid_exists    = target == null || target.HexagonPatternExists(_addpat);

        EditorGUI.BeginDisabledGroup(target == null || invalid_addpat || invalid_faceindex || invalid_exists);
        if (GUI.Button(VxlGUI.GetRightElement(_rect_patpanel, 0, button_width), "Add", GUI.skin.GetStyle("LightButton")))
        {
            if (target != null)
            {
                Undo.RecordObject(target, "Add Hexagon Pattern");
                target.AddHexagonPattern(_faces[_facelist.index], _addpat);
                _repaint_menu = false;
                //set target dirty
                EditorUtility.SetDirty(target);
                //update pattern list
                UpdatePatternList();
            }
        }
        EditorGUI.EndDisabledGroup();

        bool invalid_patindex = _patternlist.count <= 0 || _patternlist.index < 0 || _patternlist.index >= _patternlist.count;

        EditorGUI.BeginDisabledGroup(target == null || invalid_faceindex || invalid_patindex);
        if (GUI.Button(VxlGUI.GetLeftElement(_rect_patpanel, 0, button_width), "Delete", GUI.skin.GetStyle("LightButton")))
        {
            if (target != null)
            {
                Undo.RecordObject(target, "Delete Hexagon Pattern");
                target.DeleteHexagonPattern(_faces[_facelist.index], _patterns[_patternlist.index]);
                _repaint_menu = false;
                //set target dirty
                EditorUtility.SetDirty(target);
                //update pattern list
                UpdatePatternList();
            }
        }
        EditorGUI.EndDisabledGroup();
    }
예제 #17
0
    public override void DrawGUI(Rect rect)
    {
        //update both visual lists
        UpdateCornerList();
        UpdatePatternList();
        //update layout rects
        UpdateLayoutRects(rect);

        //draw key selection header
        VxlGUI.DrawRect(_rect_selectheader, "DarkGradient");
        GUI.Label(_rect_selectheader, _title, GUI.skin.GetStyle("LeftLightHeader"));
        //draw key selection list
        VxlGUI.DrawRect(_rect_selectscroll, "DarkWhite");
        _selectscroll = GUI.BeginScrollView(_rect_selectscroll, _selectscroll, _rect_select_content);
        _cornerlist.DoList(_rect_select_content);
        GUI.EndScrollView();
        //draw add pattern template
        EditorGUI.BeginChangeCheck();
        VxlGUI.DrawRect(_rect_temparea, "DarkGrey");
        GUI.Label(_rect_tempheader, "Corner Pattern", "PatHeader");
        GUI.Label(_rect_voxelid, "Voxel IDs:", "LeftMedPatLabel");
        GUI.Label(_rect_above, "Above", "RightMedPatLabel");
        GUI.Label(_rect_below, "Below", "RightMedPatLabel");
        GUI.Label(_rect_d5, "D5", "MidMedPatLabel");
        GUI.Label(_rect_d1, "D1", "MidMedPatLabel");
        GUI.Label(_rect_d3, "D3", "MidMedPatLabel");
        int  a0    = EditorGUI.IntField(_rect_above_d5, _addpat.a0, "MidPatIntField");
        int  a1    = EditorGUI.IntField(_rect_above_d1, _addpat.a1, "MidPatIntField");
        int  a2    = EditorGUI.IntField(_rect_above_d3, _addpat.a2, "MidPatIntField");
        int  b0    = EditorGUI.IntField(_rect_below_d5, _addpat.b0, "MidPatIntField");
        int  b1    = EditorGUI.IntField(_rect_below_d1, _addpat.b1, "MidPatIntField");
        int  b2    = EditorGUI.IntField(_rect_below_d3, _addpat.b2, "MidPatIntField");
        bool xflip = EditorGUI.Foldout(_rect_flipx, _addpat.xflip, "FlipX", true, "LightFoldout");
        bool yflip = EditorGUI.Foldout(_rect_flipy, _addpat.yflip, "FlipY", true, "LightFoldout");

        //apply change
        if (EditorGUI.EndChangeCheck())
        {
            _addpat       = new CornerPattern(xflip, yflip, a0, a1, a2, b0, b1, b2);
            _repaint_menu = true;
        }



        bool invalid_corner = _cornerlist.count <= 0 || _cornerlist.index < 0 || _cornerlist.index >= _cornerlist.count;
        bool invalid_exists = target != null && target.CornerPatternExists(_addpat);

        EditorGUI.BeginDisabledGroup(target == null || _addpat.IsEmpty() || invalid_corner || invalid_exists);
        if (GUI.Button(_rect_tempbutton, "Add", GUI.skin.GetStyle("PatButton")))
        {
            if (target != null)
            {
                Undo.RecordObject(target, "Add Corner Pattern");
                target.AddCornerPattern(_corners[_cornerlist.index], _addpat);
                _repaint_menu = false;
                //dirty target object
                EditorUtility.SetDirty(target);
                //update pattern list
                UpdatePatternList();
            }
        }
        EditorGUI.EndDisabledGroup();

        //draw pattern header
        VxlGUI.DrawRect(_rect_patheader, "DarkGradient");
        GUI.Label(_rect_patheader, "Patterns", GUI.skin.GetStyle("LeftLightHeader"));
        //draw pattern list
        VxlGUI.DrawRect(_rect_patscroll, "DarkWhite");
        _patscroll = GUI.BeginScrollView(_rect_patscroll, _patscroll, _rect_patcontent);
        _patternlist.DoList(_rect_patcontent);
        GUI.EndScrollView();
        //draw pattern panel
        VxlGUI.DrawRect(_rect_patpanel, "DarkGradient");
        float button_width    = Mathf.Min(60f, _rect_patpanel.width / 2f);
        bool  invalid_pattern = _patternlist.count <= 0 || _patternlist.index < 0 || _patternlist.index >= _patternlist.count;

        EditorGUI.BeginDisabledGroup(target == null || invalid_pattern || invalid_corner);
        if (GUI.Button(VxlGUI.GetLeftElement(_rect_patpanel, 0, button_width), "Delete", GUI.skin.GetStyle("LightButton")))
        {
            if (target != null)
            {
                Undo.RecordObject(target, "Delete Corner Pattern");
                target.DeleteCornerPattern(_corners[_cornerlist.index], _patterns[_patternlist.index]);
                _repaint_menu = false;
                //dirty target object
                EditorUtility.SetDirty(target);
                //update pattern list
                UpdatePatternList();
            }
        }
        EditorGUI.EndDisabledGroup();
    }