浏览代码

Fix dielectric specular control

It was resetting control values
/main
Matt Dean 7 年前
当前提交
8bf93fba
共有 1 个文件被更改,包括 6 次插入10 次删除
  1. 16
      com.unity.shadergraph/Editor/Drawing/Controls/DielectricSpecularControl.cs

16
com.unity.shadergraph/Editor/Drawing/Controls/DielectricSpecularControl.cs


m_RangePanel = new VisualElement { name = "sliderPanel" };
m_RangePanel.Add(new Label("Range"));
Action<float> changedRangeSlider = (s) => { OnChangeRangeSlider(s); };
m_RangeSlider = new Slider(0.01f, 1, changedRangeSlider);
m_RangeSlider.value = 0.5f;
m_RangeSlider = new Slider(0.01f, 1, changedRangeSlider) { value = m_DielectricMaterial.range };
m_RangePanel.SetEnabled(true);
m_RangePanel.SetEnabled(m_DielectricMaterial.type == DielectricMaterialType.Common);
m_IORSlider = new Slider(1, 5, changedIORSlider);
m_IORSlider.value = 1;
m_IORSlider = new Slider(1, 5, changedIORSlider) { value = m_DielectricMaterial.indexOfRefraction };
m_IORPanel.SetEnabled(false);
m_IORPanel.SetEnabled(m_DielectricMaterial.type == DielectricMaterialType.Custom);
Add(m_IORPanel);
}

value = Mathf.Max(Mathf.Min(value, 1), 0.01f);
m_RangePanel.Remove(m_RangeSlider);
Action<float> changedSlider = (s) => { OnChangeRangeSlider(s); };
m_RangeSlider = new Slider(0.01f, 1, changedSlider);
m_RangeSlider.value = value;
m_RangeSlider = new Slider(0.01f, 1, changedSlider) { value = value };
m_RangePanel.Add(m_RangeSlider);
m_RangePanel.Remove(m_RangeField);
m_RangeField.value = value;

value = Mathf.Max(Mathf.Min(value, 5), 1);
m_IORPanel.Remove(m_IORSlider);
Action<float> changedSlider = (s) => { OnChangeIORSlider(s); };
m_IORSlider = new Slider(1, 5, changedSlider);
m_IORSlider.value = value;
m_IORSlider = new Slider(1, 5, changedSlider) { value = value };
m_IORPanel.Add(m_IORSlider);
m_IORPanel.Remove(m_IORField);
m_IORField.value = value;

正在加载...
取消
保存