public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { // Set height for one control position.height = EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; // Put in a foldout for the property property.isExpanded = EditorGUI.Foldout(position, property.isExpanded, label); position.y += position.height; if (property.isExpanded) { // Increase indent EditorGUI.indentLevel++; // Get properties SerializedProperty enclosureScaffold = property.FindPropertyRelative(nameof(enclosureScaffold)); SerializedProperty masks = property.FindPropertyRelative(nameof(masks)); // Layout the enclosure scaffold and array fields NotebookEditorUtility.EnclosureScaffoldAndArrayField(position, enclosureScaffold, masks); // Restore indent EditorGUI.indentLevel--; } }
public override float GetPropertyHeight(SerializedProperty property, GUIContent label) { SerializedProperty scaffold = property.FindPropertyRelative(nameof(scaffold)); SerializedProperty initialTexts = property.FindPropertyRelative(nameof(initialTexts)); // Set height for one control float height = EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; if (property.isExpanded) { // Add in height for the scaffold and the foldout of the initial texts height += EditorGUI.GetPropertyHeight(scaffold); height += NotebookEditorUtility.GetSizeControlledArrayHeight(initialTexts); } return(height); }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { SerializedProperty scaffold = property.FindPropertyRelative(nameof(scaffold)); SerializedProperty initialTexts = property.FindPropertyRelative(nameof(initialTexts)); // Set height for only control position.height = EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; // Do a foldout property.isExpanded = EditorGUI.Foldout(position, property.isExpanded, label); position.y += position.height; if (property.isExpanded) { EditorGUI.indentLevel++; NotebookEditorUtility.EnclosureScaffoldAndArrayField(position, scaffold, initialTexts); EditorGUI.indentLevel--; } }