예제 #1
0
    public override void DrawGUI(Rect rect)
    {
        float width = Mathf.Min(200, rect.width);

        if (!_expanded)
        {
            //calculate rect
            rect = VxlGUI.GetAboveElement(rect, 0, VxlGUI.MED_BAR);
            //draw background
            VxlGUI.DrawRect(rect, "DarkTransparentGrey");
            //draw foldout toggle label
            EditorGUI.BeginChangeCheck();
            _expanded = EditorGUI.Foldout(rect, _expanded, "Mesh", true, GUI.skin.GetStyle("LightBoldFoldout"));
            if (EditorGUI.EndChangeCheck())
            {
                _repaint_menu = true;
            }
        }
        else
        {
            float content_height = (2 * VxlGUI.MED_BAR) + VxlGUI.SM_SPACE;
            float panel_height   = Mathf.Min(rect.height, VxlGUI.SM_SPACE + VxlGUI.MED_BAR + content_height);
            float scroll_height  = Mathf.Max(0, panel_height - VxlGUI.SM_SPACE - VxlGUI.MED_BAR);
            Rect  panel_rect     = VxlGUI.GetAboveElement(rect, 0, panel_height);
            Rect  rect_scroll    = VxlGUI.GetSandwichedRectY(panel_rect, VxlGUI.MED_BAR + VxlGUI.SM_SPACE, 0);
            Rect  content_rect   = VxlGUI.GetVerticalScrollViewRect(rect_scroll.width, rect_scroll.height, content_height);

            VxlGUI.DrawRect(panel_rect, "DarkTransparentGrey");
            EditorGUI.BeginChangeCheck();
            Rect row_rect = VxlGUI.GetAboveElement(panel_rect, 0, VxlGUI.MED_BAR, VxlGUI.SM_SPACE, 0);
            _expanded = EditorGUI.Foldout(row_rect, _expanded, "Mesh", true, GUI.skin.GetStyle("LightBoldFoldout"));
            Rect rect_content = VxlGUI.GetBelowRightElement(content_rect, 0, content_rect.width - VxlGUI.MED_BAR, 0, content_rect.height);
            if (EditorGUI.EndChangeCheck())
            {
                _repaint_menu = true;
            }

            EditorGUI.BeginChangeCheck();
            _scroll = GUI.BeginScrollView(rect_scroll, _scroll, content_rect);

            //invert x
            int level = 0;
            row_rect = VxlGUI.GetAboveElement(rect_content, level, VxlGUI.MED_BAR, VxlGUI.SM_SPACE, 0);
            invertx  = EditorGUI.Foldout(row_rect, invertx, "Invert X", true, GUI.skin.GetStyle("LightFoldout"));
            level   += 1;
            //invert y
            row_rect = VxlGUI.GetAboveElement(rect_content, level, VxlGUI.MED_BAR, VxlGUI.SM_SPACE, 0);
            inverty  = EditorGUI.Foldout(row_rect, inverty, "Invert Y", true, GUI.skin.GetStyle("LightFoldout"));
            level   += 1;

            GUI.EndScrollView();
            if (EditorGUI.EndChangeCheck())
            {
                _repaint_menu = true;
                _render_mesh  = true;
                _update_mesh  = true;
            }
        }
    }
예제 #2
0
    public override void DrawGUI(Rect rect)
    {
        if (selected <= 0 || superselected < 0)
        {
            return;
        }
        //calculate rects and height
        float height       = (2 * VxlGUI.MED_BAR) + VxlGUI.SM_SPACE;
        Rect  superrect    = VxlGUI.GetBelowElement(rect, 1, VxlGUI.MED_BAR, VxlGUI.SM_SPACE, 0);
        Rect  selectrect   = VxlGUI.GetBelowElement(rect, 0, VxlGUI.MED_BAR);
        Rect  content_rect = VxlGUI.GetVerticalScrollViewRect(rect.width, rect.height, height);

        _scroll = GUI.BeginScrollView(VxlGUI.GetBelowElement(rect, 0, height), _scroll, content_rect);
        GUI.Label(VxlGUI.GetAboveElement(content_rect, 0, VxlGUI.MED_BAR, VxlGUI.SM_SPACE, 0), "Selected Vertex: " + superselected.ToString(), GUI.skin.GetStyle("SecondarySuperLabel"));
        GUI.Label(VxlGUI.GetAboveElement(content_rect, 1, VxlGUI.MED_BAR, VxlGUI.SM_SPACE, 0), "Selected: " + selected.ToString(), GUI.skin.GetStyle("SecondarySelectLabel"));
        GUI.EndScrollView();
    }
예제 #3
0
    public override void DrawGUI(Rect rect)
    {
        float width = Mathf.Min(200, rect.width);

        rect = new Rect(rect.x, rect.y, width, rect.height);
        if (!expanded)
        {
            //calculate rect
            rect = VxlGUI.GetAboveElement(rect, 0, VxlGUI.MED_BAR);
            //draw background
            VxlGUI.DrawRect(rect, "DarkTransparentGrey");
            //draw foldout toggle label
            EditorGUI.BeginChangeCheck();
            expanded = EditorGUI.Foldout(rect, expanded, "Display", true, GUI.skin.GetStyle("LightBoldFoldout"));
            if (EditorGUI.EndChangeCheck())
            {
                _repaint_menu = true;
            }
        }
        else
        {
            float content_height = GetPanelHeight();
            float panel_height   = Mathf.Min(rect.height, VxlGUI.SM_SPACE + VxlGUI.MED_BAR + content_height);
            float scroll_height  = Mathf.Max(0, panel_height - VxlGUI.SM_SPACE - VxlGUI.MED_BAR);
            Rect  panel_rect     = VxlGUI.GetAboveElement(rect, 0, panel_height);
            Rect  rect_scroll    = VxlGUI.GetSandwichedRectY(panel_rect, VxlGUI.MED_BAR + VxlGUI.SM_SPACE, 0);
            Rect  content_rect   = VxlGUI.GetVerticalScrollViewRect(rect_scroll.width, rect_scroll.height, content_height);

            VxlGUI.DrawRect(panel_rect, "DarkTransparentGrey");

            EditorGUI.BeginChangeCheck();
            Rect row_rect = VxlGUI.GetAboveElement(panel_rect, 0, VxlGUI.MED_BAR, VxlGUI.SM_SPACE, 0);
            expanded = EditorGUI.Foldout(row_rect, expanded, "Display", true, GUI.skin.GetStyle("LightBoldFoldout"));
            Rect rect_content = VxlGUI.GetBelowRightElement(content_rect, 0, content_rect.width - VxlGUI.MED_BAR, 0, content_rect.height);
            if (EditorGUI.EndChangeCheck())
            {
                _repaint_menu = true;
            }

            EditorGUI.BeginChangeCheck();
            _scroll = GUI.BeginScrollView(rect_scroll, _scroll, content_rect);
            //origin
            int level = 0;
            row_rect       = VxlGUI.GetAboveElement(rect_content, level, VxlGUI.MED_BAR, VxlGUI.SM_SPACE, 0);
            origin_enabled = EditorGUI.Foldout(row_rect, origin_enabled, "Origin", true, GUI.skin.GetStyle("LightFoldout"));
            level         += 1;
            //global axis
            row_rect       = VxlGUI.GetAboveElement(rect_content, level, VxlGUI.MED_BAR, VxlGUI.SM_SPACE, 0);
            global_enabled = EditorGUI.Foldout(row_rect, global_enabled, "Global Axis", true, GUI.skin.GetStyle("LightFoldout"));
            level         += 1;
            //axi
            row_rect         = VxlGUI.GetAboveElement(rect_content, level, VxlGUI.MED_BAR, VxlGUI.SM_SPACE, 0);
            voxelaxi_enabled = EditorGUI.Foldout(row_rect, voxelaxi_enabled, "Voxel Axi", true, GUI.skin.GetStyle("LightFoldout"));
            level           += 1;
            //frame
            if (enable_voxelframe)
            {
                row_rect           = VxlGUI.GetAboveElement(rect_content, level, VxlGUI.MED_BAR, VxlGUI.SM_SPACE, 0);
                voxelframe_enabled = EditorGUI.Foldout(row_rect, voxelframe_enabled, "Voxel Frame", true, GUI.skin.GetStyle("LightFoldout"));
                level += 1;
                if (enable_voxelflip && voxelframe_enabled)
                {
                    float y          = (level * VxlGUI.MED_BAR) + ((Mathf.Max(0, level - 1) * VxlGUI.SM_SPACE));
                    Rect  frame_rect = VxlGUI.GetSandwichedRectX(VxlGUI.GetSandwichedRectY(rect_content, y, 0), VxlGUI.MED_BAR, 0);
                    row_rect        = VxlGUI.GetAboveElement(frame_rect, 0, VxlGUI.MED_BAR, VxlGUI.SM_SPACE, 0);
                    voxelframe_flip = EditorGUI.Foldout(row_rect, voxelframe_flip, "Flip Voxel", true, GUI.skin.GetStyle("LightFoldout"));
                    level          += 1;
                }
            }
            GUI.EndScrollView();
            if (EditorGUI.EndChangeCheck())
            {
                _repaint_menu = true;
                _render_mesh  = true;
            }
        }
    }