public float GetHeight(SerializedProperty property, GUIContent label, bool includeChildren)
        {
            if (_visibleDrawer == null)
            {
                this.Init();
            }

            property = property.Copy();
            if (label == null)
            {
                label = EditorHelper.TempContent(property.displayName);
            }

            if (_visibleDrawer is IArrayHandlingPropertyDrawer || !property.isArray)
            {
                return(_visibleDrawer.GetPropertyHeight(property, label));
            }
            else
            {
                float h = SPEditorGUI.GetSinglePropertyHeight(property, label);
                if (!includeChildren || !property.isExpanded)
                {
                    return(h);
                }

                h += EditorGUIUtility.singleLineHeight + 2f;

                for (int i = 0; i < property.arraySize; i++)
                {
                    var pchild = property.GetArrayElementAtIndex(i);
                    h += _visibleDrawer.GetPropertyHeight(pchild, EditorHelper.TempContent(pchild.displayName)) + 2f;
                }
                return(h);
            }
        }
Beispiel #2
0
            public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
            {
                if (label == null)
                {
                    label = EditorHelper.TempContent(property.displayName);
                }

                if (!property.isArray)
                {
                    if (_drawer != null)
                    {
                        return(_drawer.GetPropertyHeight(property, label));
                    }
                    else
                    {
                        return(SPEditorGUI.GetDefaultPropertyHeight(property));
                    }
                }
                else
                {
                    float h = SPEditorGUI.GetSinglePropertyHeight(property, label);
                    if (!property.isExpanded)
                    {
                        return(h);
                    }

                    h += EditorGUIUtility.singleLineHeight + 2f;

                    for (int i = 0; i < property.arraySize; i++)
                    {
                        var pchild = property.GetArrayElementAtIndex(i);
                        if (_drawer != null)
                        {
                            h += _drawer.GetPropertyHeight(pchild, EditorHelper.TempContent(pchild.displayName)) + 2f;
                        }
                        else
                        {
                            h += SPEditorGUI.GetPropertyHeight(pchild, EditorHelper.TempContent(pchild.displayName)) + 2f;
                        }
                    }
                    return(h);
                }
            }