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); }
private void UpdateRects(Rect rect) { float import_height = (2 * VxlGUI.MED_BAR) + (2 * VxlGUI.MED_PAD); _rect_import = VxlGUI.GetBelowElement(rect, 0, import_height); Rect main_rect = VxlGUI.GetSandwichedRectY(rect, 0, import_height + VxlGUI.SM_SPACE); _rect_vertex_title = VxlGUI.GetAboveElement(main_rect, 0, VxlGUI.MED_BAR); _rect_vertex_scrollview = VxlGUI.GetSandwichedRectY(main_rect, VxlGUI.MED_BAR + VxlGUI.SM_SPACE, VxlGUI.SM_SPACE + VxlGUI.MED_BAR); _rect_vertex_content = VxlGUI.GetScrollViewRect(_vertexlist, main_rect.width, _rect_vertex_scrollview.height); _rect_vertex_panel = VxlGUI.GetBelowElement(main_rect, 0, VxlGUI.MED_BAR); }
private void UpdateLayoutRect(Rect rect) { _rect_header = VxlGUI.GetAboveElement(rect, 0, VxlGUI.MED_BAR); Rect rect_body = VxlGUI.GetSandwichedRectY(rect, VxlGUI.MED_BAR + VxlGUI.SM_SPACE, 0); float listheight = Mathf.Max(0, (rect_body.height - VxlGUI.MED_BAR - VxlGUI.SM_SPACE - VxlGUI.SM_SPACE) / 2f); _rect_guidscroll = VxlGUI.GetAboveElement(rect_body, 0, listheight); _rect_guidcontent = VxlGUI.GetScrollViewRect(_guidlist, _rect_guidscroll.width, _rect_guidscroll.height); _rect_panel = VxlGUI.GetMiddleY(rect_body, VxlGUI.MED_BAR); _rect_libscroll = VxlGUI.GetBelowElement(rect_body, 0, listheight); _rect_libcontent = VxlGUI.GetScrollViewRect(_libobjlist, _rect_libscroll.width, _rect_libscroll.height); }
private void DrawTriangleElement(Rect rect, int index, bool active, bool focus) { rect = VxlGUI.GetPaddedRect(rect, VxlGUI.SM_SPACE); //draw indexed label GUI.Label( VxlGUI.GetAboveElement(rect, 0, VxlGUI.MED_BAR, VxlGUI.SM_SPACE, 0), "Tri: " + index, GUI.skin.GetStyle("LeftListLabel") ); EditorGUI.BeginChangeCheck(); //draw triangle index 0 TriIndex index0 = DrawTriangleEditElement( VxlGUI.GetAboveElement(rect, 1, VxlGUI.MED_BAR, VxlGUI.SM_SPACE, 0), _triangles[index].type0, _triangles[index].vertex0 ); //draw triangle index 1 TriIndex index1 = DrawTriangleEditElement( VxlGUI.GetAboveElement(rect, 2, VxlGUI.MED_BAR, VxlGUI.SM_SPACE, 0), _triangles[index].type1, _triangles[index].vertex1 ); //draw triangle index 2 TriIndex index2 = DrawTriangleEditElement( VxlGUI.GetAboveElement(rect, 3, VxlGUI.MED_BAR, VxlGUI.SM_SPACE, 0), _triangles[index].type2, _triangles[index].vertex2 ); if (EditorGUI.EndChangeCheck()) { if (target != null) { if (target == null || target.triangles == null) { return; } if (index < 0 || index >= target.triangles.Count) { return; } Undo.RecordObject(target, "Update Triangle Build"); target.triangles[index] = new Triangle(index0, index1, index2); _update_mesh = true; _render_mesh = true; _repaint_menu = true; //dirty target object EditorUtility.SetDirty(target); } } }
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); }
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(); }
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); }
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; } }
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; } }
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")); }
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); }
private void UpdateRects(Rect rect) { _rect_title = VxlGUI.GetAboveElement(rect, 0, VxlGUI.MED_BAR); _rect_scroll = VxlGUI.GetSandwichedRectY(rect, VxlGUI.MED_BAR + VxlGUI.SM_SPACE, 0); _rect_content = VxlGUI.GetScrollViewRect(_pluglist, _rect_scroll.width, _rect_scroll.height); }
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; } } }
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(); }