private void UpdateRects(Rect rect)
    {
        _rect_rename = VxlGUI.GetAboveElement(rect, 0, VxlGUI.MED_BAR + VxlGUI.LRG_SPACE - VxlGUI.MED_SPACE);
        Rect rect_bottom = VxlGUI.GetSandwichedRectY(rect, VxlGUI.MED_BAR + VxlGUI.LRG_SPACE, 0);
        Rect rect_left   = VxlGUI.GetLeftColumn(rect_bottom, VxlGUI.SM_SPACE, 0.5f);
        Rect rect_right  = VxlGUI.GetRightColumn(rect_bottom, VxlGUI.SM_SPACE, 0.5f);

        _rect_guidheader  = VxlGUI.GetAboveElement(rect_left, 0, VxlGUI.MED_BAR);
        _rect_guidfooter  = VxlGUI.GetBelowElement(rect_left, 0, VxlGUI.MED_BAR);
        _rect_guidscroll  = VxlGUI.GetSandwichedRectY(rect_left, VxlGUI.MED_BAR + VxlGUI.SM_SPACE, VxlGUI.MED_BAR + VxlGUI.SM_SPACE);
        _rect_guidcontent = VxlGUI.GetScrollViewRect(_guidlist, rect_left.width, _rect_guidscroll.height);

        _rect_unsavedheader  = VxlGUI.GetAboveElement(rect_right, 0, VxlGUI.MED_BAR);
        _rect_unsavedfooter  = VxlGUI.GetBelowElement(rect_right, 0, VxlGUI.MED_BAR);
        _rect_unsavedscroll  = VxlGUI.GetSandwichedRectY(rect_right, VxlGUI.MED_BAR + VxlGUI.SM_SPACE, VxlGUI.MED_BAR + VxlGUI.SM_SPACE);
        _rect_unsavedcontent = VxlGUI.GetScrollViewRect(_unsavedlist, rect_right.width, _rect_unsavedscroll.height);
    }
    private void UpdateLayoutRects(Rect rect)
    {
        Rect  rect_left       = VxlGUI.GetLeftColumn(rect, VxlGUI.MED_SPACE, 0.5f);
        float template_height = (2 * VxlGUI.SM_PAD) + (6 * VxlGUI.MED_BAR) + (5 * VxlGUI.MED_SPACE) + (3 * VxlGUI.LRG_SPACE);

        _rect_selectheader   = VxlGUI.GetAboveElement(rect_left, 0, VxlGUI.MED_BAR);
        _rect_selectscroll   = VxlGUI.GetSandwichedRectY(rect_left, VxlGUI.MED_BAR + VxlGUI.SM_SPACE, VxlGUI.SM_SPACE + template_height);
        _rect_select_content = VxlGUI.GetScrollViewRect(_cornerlist, _rect_selectscroll.width, _rect_selectscroll.height);

        Rect rect_right = VxlGUI.GetRightColumn(rect, VxlGUI.MED_SPACE, 0.5f);

        _rect_patheader  = VxlGUI.GetAboveElement(rect_right, 0, VxlGUI.MED_BAR);
        _rect_patscroll  = VxlGUI.GetSandwichedRectY(rect_right, VxlGUI.MED_BAR + VxlGUI.SM_SPACE, VxlGUI.SM_SPACE + VxlGUI.MED_BAR);
        _rect_patcontent = VxlGUI.GetScrollViewRect(_patternlist, _rect_patscroll.width, _rect_patscroll.height);
        _rect_patpanel   = VxlGUI.GetBelowElement(rect_right, 0, VxlGUI.MED_BAR);



        _rect_temparea = VxlGUI.GetBelowElement(rect_left, 0, template_height);
        Rect rect_content = VxlGUI.GetPaddedRect(_rect_temparea, VxlGUI.SM_PAD, VxlGUI.MED_PAD);

        _rect_tempheader = VxlGUI.GetAboveElement(rect_content, 0, VxlGUI.MED_BAR, VxlGUI.MED_SPACE, 0);
        Rect rect_row = VxlGUI.GetAboveElement(rect_content, 1, VxlGUI.MED_BAR, VxlGUI.MED_SPACE, VxlGUI.LRG_SPACE);

        _rect_voxelid  = VxlGUI.GetSandwichedRectX(rect_row, 0, (3 * VxlGUI.INTFIELD) + (2 * VxlGUI.SM_SPACE) + VxlGUI.MED_SPACE);
        _rect_d5       = VxlGUI.GetRightElement(rect_row, 2, VxlGUI.INTFIELD, VxlGUI.SM_SPACE, 0);
        _rect_d1       = VxlGUI.GetRightElement(rect_row, 1, VxlGUI.INTFIELD, VxlGUI.SM_SPACE, 0);
        _rect_d3       = VxlGUI.GetRightElement(rect_row, 0, VxlGUI.INTFIELD, VxlGUI.SM_SPACE, 0);
        rect_row       = VxlGUI.GetAboveElement(rect_content, 2, VxlGUI.MED_BAR, VxlGUI.MED_SPACE, VxlGUI.LRG_SPACE);
        _rect_above    = VxlGUI.GetSandwichedRectX(rect_row, 0, (3 * VxlGUI.INTFIELD) + (2 * VxlGUI.SM_SPACE) + VxlGUI.MED_SPACE);
        _rect_above_d5 = VxlGUI.GetRightElement(rect_row, 2, VxlGUI.INTFIELD, VxlGUI.SM_SPACE, 0);
        _rect_above_d1 = VxlGUI.GetRightElement(rect_row, 1, VxlGUI.INTFIELD, VxlGUI.SM_SPACE, 0);
        _rect_above_d3 = VxlGUI.GetRightElement(rect_row, 0, VxlGUI.INTFIELD, VxlGUI.SM_SPACE, 0);
        rect_row       = VxlGUI.GetAboveElement(rect_content, 3, VxlGUI.MED_BAR, VxlGUI.MED_SPACE, VxlGUI.LRG_SPACE);
        _rect_below    = VxlGUI.GetSandwichedRectX(rect_row, 0, (3 * VxlGUI.INTFIELD) + (2 * VxlGUI.SM_SPACE) + VxlGUI.MED_SPACE);
        _rect_below_d5 = VxlGUI.GetRightElement(rect_row, 2, VxlGUI.INTFIELD, VxlGUI.SM_SPACE, 0);
        _rect_below_d1 = VxlGUI.GetRightElement(rect_row, 1, VxlGUI.INTFIELD, VxlGUI.SM_SPACE, 0);
        _rect_below_d3 = VxlGUI.GetRightElement(rect_row, 0, VxlGUI.INTFIELD, VxlGUI.SM_SPACE, 0);
        rect_row       = VxlGUI.GetAboveElement(rect_content, 4, VxlGUI.MED_BAR, VxlGUI.MED_SPACE, 2 * VxlGUI.LRG_SPACE);
        float quarter = rect_row.width / 4f;

        _rect_flipx      = VxlGUI.GetSandwichedRectX(VxlGUI.GetLeftColumn(rect_row, 0, 0.5f), quarter - 20, 0);
        _rect_flipy      = VxlGUI.GetSandwichedRectX(VxlGUI.GetRightColumn(rect_row, 0, 0.5f), quarter - 20, 0);
        rect_row         = VxlGUI.GetAboveElement(rect_content, 5, VxlGUI.MED_BAR, VxlGUI.MED_SPACE, 3 * VxlGUI.LRG_SPACE);
        _rect_tempbutton = VxlGUI.GetRightElement(rect_row, 0, 80);
    }
Example #3
0
    private void UpdateLayoutRects(Rect rect)
    {
        Rect  rect_left       = VxlGUI.GetLeftColumn(rect, VxlGUI.MED_SPACE, 0.5f);
        float template_height = (2 * VxlGUI.MED_PAD) + (4 * VxlGUI.MED_BAR) + (3 * VxlGUI.SM_SPACE);

        _rect_selectheader      = VxlGUI.GetAboveElement(rect_left, 0, VxlGUI.MED_BAR);
        _rect_selectscroll      = VxlGUI.GetSandwichedRectY(rect_left, VxlGUI.MED_BAR + VxlGUI.SM_SPACE, VxlGUI.MED_SPACE + VxlGUI.MED_BAR + VxlGUI.SM_SPACE + template_height);
        _rect_select_content    = VxlGUI.GetScrollViewRect(_facelist, _rect_selectscroll.width, _rect_selectscroll.height);
        _rect_pattemplateheader = VxlGUI.GetBelowElement(rect_left, 0, VxlGUI.MED_BAR, VxlGUI.SM_SPACE + template_height);
        _rect_pattemplate       = VxlGUI.GetBelowElement(rect_left, 0, template_height);

        Rect rect_right = VxlGUI.GetRightColumn(rect, VxlGUI.MED_SPACE, 0.5f);

        _rect_patheader  = VxlGUI.GetAboveElement(rect_right, 0, VxlGUI.MED_BAR);
        _rect_patscroll  = VxlGUI.GetSandwichedRectY(rect_right, VxlGUI.MED_BAR + VxlGUI.SM_SPACE, VxlGUI.SM_SPACE + VxlGUI.MED_BAR);
        _rect_patcontent = VxlGUI.GetScrollViewRect(_patternlist, _rect_patscroll.width, _rect_patscroll.height);
        _rect_patpanel   = VxlGUI.GetBelowElement(rect_right, 0, VxlGUI.MED_BAR);
    }
Example #4
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);
    }
    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();
    }
Example #6
0
    private TriIndex DrawTriangleEditElement(Rect rect, TriIndexType type, ushort vertexcode)
    {
        rect = VxlGUI.GetRightColumn(rect, 0, 0.95f);
        float element_factor = 0.6f;
        float segment_width  = (rect.width - (2 * VxlGUI.SM_SPACE)) / 3;
        float unit_width     = (rect.width - (5 * VxlGUI.SM_SPACE)) / 6f;
        //Type Options
        Rect segrect = VxlGUI.GetRightElement(rect, 2, segment_width, VxlGUI.SM_SPACE, 0);

        EditorGUI.LabelField(
            VxlGUI.GetLeftColumn(segrect, 0, 1 - element_factor),
            "Type:",
            GUI.skin.GetStyle("RightDarkText")
            );
        int type_index = EditorGUI.Popup(
            VxlGUI.GetRightColumn(segrect, 0, element_factor),
            OptionIndex(type),
            _optionstrs,
            GUI.skin.GetStyle("DarkDropdown")
            );

        if (type_index >= 0 && type_index < _options.Length)
        {
            type = _options[type_index];
        }
        if (type == TriIndexType.CornerPlug || type == TriIndexType.EdgePlug)
        {
            //Axis Options
            segrect = VxlGUI.GetRightElement(rect, 1, segment_width, VxlGUI.SM_SPACE, 0);
            EditorGUI.LabelField(
                VxlGUI.GetLeftColumn(segrect, 0, 1 - element_factor),
                "Axis:",
                GUI.skin.GetStyle("RightDarkText")
                );
            string[] labels;
            if (type == TriIndexType.CornerPlug)
            {
                labels = _cornerplug_labels;
            }
            else
            {
                labels = _edgeplug_labels;
            }
            int axis_index = EditorGUI.Popup(
                VxlGUI.GetRightColumn(segrect, 0, element_factor),
                TriIndex.DecodeAxiIndex(vertexcode),
                labels,
                GUI.skin.GetStyle("DarkDropdown")
                );
            //Socket Options
            segrect = VxlGUI.GetRightElement(rect, 0, segment_width, VxlGUI.SM_SPACE, 0);
            EditorGUI.LabelField(
                VxlGUI.GetLeftColumn(segrect, 0, 1 - element_factor),
                "Socket:",
                GUI.skin.GetStyle("RightDarkText")
                );
            int socket_index = EditorGUI.IntField(
                VxlGUI.GetRightColumn(segrect, 0, element_factor),
                TriIndex.DecodeIndex(vertexcode),
                GUI.skin.GetStyle("DarkNumberField")
                );
            vertexcode = TriIndex.EncodeIndex((byte)axis_index, (byte)socket_index);
        }
        else
        {
            //Vertex Index Options
            segrect = VxlGUI.GetRightElement(rect, 0, segment_width, VxlGUI.SM_SPACE, 0);
            EditorGUI.LabelField(
                VxlGUI.GetLeftColumn(segrect, 0, 1 - element_factor),
                "Index:",
                GUI.skin.GetStyle("RightDarkText")
                );
            vertexcode = (ushort)EditorGUI.IntField(
                VxlGUI.GetRightColumn(segrect, 0, element_factor),
                vertexcode,
                GUI.skin.GetStyle("DarkNumberField")
                );
        }
        return(new TriIndex(type, vertexcode));
    }