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), "Voxel In:", GUI.skin.GetStyle("LeftLrgDarkLabel")); int vin = EditorGUI.IntField(VxlGUI.GetRightElement(rect_row, 0, Mathf.Min(two / 2f, 40)), _addpat.in0); //below voxels rect_row = VxlGUI.GetAboveElement(rect_content, 2, VxlGUI.MED_BAR, VxlGUI.SM_SPACE, 0); GUI.Label(VxlGUI.GetLeftElement(rect_row, 0, two), "Voxel Out:", GUI.skin.GetStyle("LeftLrgDarkLabel")); int vout0 = EditorGUI.IntField(VxlGUI.GetRightElement(rect_row, 1, Mathf.Min(two / 2f, 40)), _addpat.out0); int vout1 = EditorGUI.IntField(VxlGUI.GetRightElement(rect_row, 0, Mathf.Min(two / 2f, 40)), _addpat.out1); //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 LongitudePattern(flipx, flipy, p0, p1, vin, vout0, vout1); _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.LongitudePatternExists(_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 Longitude Pattern"); target.AddLongitudePattern(_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 Longitude Pattern"); target.DeleteLongitudePattern(_edges[_edgelist.index], _patterns[_patternlist.index]); _repaint_menu = false; //dirty target EditorUtility.SetDirty(target); //update pattern list UpdatePatternList(); } } EditorGUI.EndDisabledGroup(); }