private void DrawElement(int index) { var element = List.GetArrayElementAtIndex(index); var content = GetElementContent(element, index); ToolboxEditorGui.DrawToolboxProperty(element, content); }
/// <inheritdoc/> public override void DrawStandardElement(Rect rect, int index, bool selected, bool focused, bool draggable) { var element = List.GetArrayElementAtIndex(index); var label = HasLabels ? new GUIContent(GetElementDisplayName(element, index)) : new GUIContent(); ToolboxEditorGui.DrawToolboxProperty(element, label); }
private void DrawElementsBody(SerializedProperty property, ScrollableItemsAttribute attribute, int size, Vector2 indexRange) { if (size == 0 || indexRange.x - indexRange.y == 0) { return; } var minRange = (int)indexRange.x; var maxRange = (int)indexRange.y; //draw all visible (in the range) properties for (var i = minRange; i < maxRange; i++) { ToolboxEditorGui.DrawToolboxProperty(property.GetArrayElementAtIndex(i)); } }
/// <inheritdoc/> public override void DrawStandardElement(Rect rect, int index, bool selected, bool focused, bool draggable) { var element = List.GetArrayElementAtIndex(index); ToolboxEditorGui.DrawToolboxProperty(element, GetElementContent(element, index)); }
protected override void OnGuiSafe(SerializedProperty property, GUIContent label, ScrollableItemsAttribute attribute) { if (!EditorGUILayout.PropertyField(property, label, false)) { return; } EditorGUI.indentLevel++; EditorGUILayout.PropertyField(property.GetSize()); var size = property.arraySize; //get or initialize current ranges var indexRange = storage.ReturnItem(property, attribute); //create a min-max slider to determine the range of visible properties { var enabled = GUI.enabled; GUI.enabled = true; EditorGUILayout.MinMaxSlider(Style.rangeContent, ref indexRange.x, ref indexRange.y, 0, size); GUI.enabled = enabled; } //fix values to the integral part indexRange.x = Mathf.Max(Mathf.RoundToInt(indexRange.x), 0); indexRange.y = Mathf.Min(Mathf.RoundToInt(indexRange.y), size); storage.ApplyItem(property, indexRange); EditorGUI.indentLevel--; if (size == 0 || indexRange.x - indexRange.y == 0) { return; } EditorGUILayout.BeginHorizontal(); //NOTE1: we have to handle indentation for group //NOTE2: 15.0f - internal 'indentPerLevel' value GUILayout.Space(15.0f * EditorGUI.indentLevel); EditorGUILayout.BeginVertical(Style.backgroundStyle); var space = EditorGUIUtility.standardVerticalSpacing; GUILayout.Space(space); GUILayout.Space(space); var minRange = (int)indexRange.x; var maxRange = (int)indexRange.y; if (minRange > 0) { EditorGUILayout.LabelField(Style.spaceContent, Style.spaceLabelStyle); } //draw all visible (in the range) properties for (var i = minRange; i < maxRange; i++) { ToolboxEditorGui.DrawToolboxProperty(property.GetArrayElementAtIndex(i)); } if (maxRange < size) { EditorGUILayout.LabelField(Style.spaceContent, Style.spaceLabelStyle); } GUILayout.Space(space); EditorGUILayout.EndVertical(); EditorGUILayout.EndHorizontal(); }