public OnGUI ( |
||
position | ||
prop | ||
label | ||
editor | ||
return | void |
public void OnGUI(ref Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) { float oldLabelWidth, oldFieldWidth; var propHeight = position.height; position.height = 0; if (m_DecoratorDrawers != null) { foreach (var decorator in m_DecoratorDrawers) { position.height = decorator.GetPropertyHeight(prop, label.text, editor); oldLabelWidth = EditorGUIUtility.labelWidth; oldFieldWidth = EditorGUIUtility.fieldWidth; decorator.OnGUI(position, prop, label, editor); EditorGUIUtility.labelWidth = oldLabelWidth; EditorGUIUtility.fieldWidth = oldFieldWidth; position.y += position.height; propHeight -= position.height; } } position.height = propHeight; if (m_PropertyDrawer != null) { oldLabelWidth = EditorGUIUtility.labelWidth; oldFieldWidth = EditorGUIUtility.fieldWidth; m_PropertyDrawer.OnGUI(position, prop, label, editor); EditorGUIUtility.labelWidth = oldLabelWidth; EditorGUIUtility.fieldWidth = oldFieldWidth; } }
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; }