static private DoPowerRangeProperty ( |
||
position | ||
prop | ||
label | string | |
power | float | |
Результат | float |
internal static float DoPowerRangeProperty(Rect position, MaterialProperty prop, string label, float power)
{
EditorGUI.BeginChangeCheck();
EditorGUI.showMixedValue = prop.hasMixedValue;
float labelWidth = EditorGUIUtility.labelWidth;
EditorGUIUtility.labelWidth = 0f;
float num2 = EditorGUI.PowerSlider(position, label, prop.floatValue, prop.rangeLimits.x, prop.rangeLimits.y, power);
EditorGUI.showMixedValue = false;
EditorGUIUtility.labelWidth = labelWidth;
if (EditorGUI.EndChangeCheck())
{
prop.floatValue = num2;
}
return prop.floatValue;
}
public override void OnGUI(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor) { if (prop.type != MaterialProperty.PropType.Range) { GUIContent label2 = EditorGUIUtility.TempContent("PowerSlider used on a non-range property: " + prop.name, EditorGUIUtility.GetHelpIcon(MessageType.Warning)); EditorGUI.LabelField(position, label2, EditorStyles.helpBox); return; } MaterialEditor.DoPowerRangeProperty(position, prop, label, this.power); }