GetPropertyHeight() public method

Override this method to specify how tall the GUI for this property is in pixels.

public GetPropertyHeight ( MaterialProperty prop, string label, MaterialEditor editor ) : float
prop MaterialProperty The MaterialProperty to make the custom GUI for.
label string The label of this property.
editor MaterialEditor Current material editor.
return float
コード例 #1
0
        public void OnGUI(ref Rect position, MaterialProperty prop, string label, MaterialEditor editor)
        {
            float height = position.height;

            position.height = 0.0f;
            if (this.m_DecoratorDrawers != null)
            {
                using (List <MaterialPropertyDrawer> .Enumerator enumerator = this.m_DecoratorDrawers.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        MaterialPropertyDrawer current = enumerator.Current;
                        position.height = current.GetPropertyHeight(prop, label, editor);
                        float labelWidth = EditorGUIUtility.labelWidth;
                        float fieldWidth = EditorGUIUtility.fieldWidth;
                        current.OnGUI(position, prop, label, editor);
                        EditorGUIUtility.labelWidth = labelWidth;
                        EditorGUIUtility.fieldWidth = fieldWidth;
                        position.y += position.height;
                        height     -= position.height;
                    }
                }
            }
            position.height = height;
            if (this.m_PropertyDrawer == null)
            {
                return;
            }
            float labelWidth1 = EditorGUIUtility.labelWidth;
            float fieldWidth1 = EditorGUIUtility.fieldWidth;

            this.m_PropertyDrawer.OnGUI(position, prop, label, editor);
            EditorGUIUtility.labelWidth = labelWidth1;
            EditorGUIUtility.fieldWidth = fieldWidth1;
        }
コード例 #2
0
        public float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor)
        {
            var height = 0f;

            if (m_DecoratorDrawers != null)
            {
                foreach (var drawer in m_DecoratorDrawers)
                {
                    height += drawer.GetPropertyHeight(prop, label, editor);
                }
            }
            if (m_PropertyDrawer != null)
            {
                height += m_PropertyDrawer.GetPropertyHeight(prop, label, editor);
            }
            return(height);
        }
コード例 #3
0
        public float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor)
        {
            float num = 0.0f;

            if (this.m_DecoratorDrawers != null)
            {
                using (List <MaterialPropertyDrawer> .Enumerator enumerator = this.m_DecoratorDrawers.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        MaterialPropertyDrawer current = enumerator.Current;
                        num += current.GetPropertyHeight(prop, label, editor);
                    }
                }
            }
            if (this.m_PropertyDrawer != null)
            {
                num += this.m_PropertyDrawer.GetPropertyHeight(prop, label, editor);
            }
            return(num);
        }