浏览代码

Fix/change slider property view UI

/main
Matt Dean 7 年前
当前提交
81985612
共有 1 个文件被更改,包括 12 次插入4 次删除
  1. 16
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/ShaderPropertyView.cs

16
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/ShaderPropertyView.cs


{
var fProp = (SliderShaderProperty)property;
var value = fProp.value;
GUILayoutOption[] sliderOptions = { GUILayout.ExpandWidth(true) };
GUILayoutOption[] options = { GUILayout.MaxWidth(30.0f) };
value.x = EditorGUILayout.Slider(fProp.value.x, fProp.value.y, fProp.value.z, sliderOptions);
GUILayoutOption[] options = { GUILayout.MaxWidth(48.0f) };
value.x = EditorGUILayout.Slider(fProp.value.x, fProp.value.y, fProp.value.z);
value.y = EditorGUILayout.FloatField(fProp.value.y, options);
value.z = EditorGUILayout.FloatField(fProp.value.z, options);
float previousLabelWidth = EditorGUIUtility.labelWidth;
EditorGUIUtility.labelWidth = 30f;
Rect minMaxRect = EditorGUILayout.GetControlRect(new GUILayoutOption[]{ GUILayout.ExpandWidth(true) } );
Rect minRect = new Rect(minMaxRect.x, minMaxRect.y, minMaxRect.width / 2, minMaxRect.height);
Rect maxRect = new Rect(minMaxRect.x + minMaxRect.width / 2, minMaxRect.y, minMaxRect.width / 2, minMaxRect.height);
value.y = EditorGUI.FloatField(minRect, "Min", fProp.value.y);
value.z = EditorGUI.FloatField(maxRect, "Max", fProp.value.z);
EditorGUIUtility.labelWidth = previousLabelWidth;
EditorGUILayout.EndHorizontal();
fProp.value = value;
}
正在加载...
取消
保存