浏览代码

Merge pull request #699 from Unity-Technologies/hdlighteditor-tweaks

Tweaked the hd light editor (artists feedback)
/feature-ReflectionProbeFit
GitHub 7 年前
当前提交
a3dae81f
共有 2 个文件被更改,包括 6 次插入41 次删除
  1. 43
      ScriptableRenderPipeline/HDRenderPipeline/Editor/Lighting/HDLightEditor.cs
  2. 4
      ScriptableRenderPipeline/HDRenderPipeline/Lighting/HDAdditionalLightData.cs

43
ScriptableRenderPipeline/HDRenderPipeline/Editor/Lighting/HDLightEditor.cs


if (settings.cookie != null && m_LightShape == LightShape.Directional)
{
EditorGUI.indentLevel++;
EditorGUILayout.Slider(m_AdditionalLightData.shapeWidth, 0.01f, 10f, s_Styles.cookieSizeX);
EditorGUILayout.Slider(m_AdditionalLightData.shapeHeight, 0.01f, 10f, s_Styles.cookieSizeY);
EditorGUILayout.PropertyField(m_AdditionalLightData.shapeWidth, s_Styles.cookieSizeX);
EditorGUILayout.PropertyField(m_AdditionalLightData.shapeHeight, s_Styles.cookieSizeY);
EditorGUI.indentLevel--;
}
}

}
EditorGUI.indentLevel++;
using (var scope = new EditorGUI.ChangeCheckScope())
{
// Draw each field first...
int arraySize = m_AdditionalShadowData.cascadeRatios.arraySize;
for (int i = 0; i < arraySize; i++)
EditorGUILayout.Slider(m_AdditionalShadowData.cascadeRatios.GetArrayElementAtIndex(i), 0f, 1f, s_Styles.shadowCascadeRatios[i]);
if (scope.changed)
{
// ...then clamp values to avoid out of bounds cascade ratios
for (int i = 0; i < arraySize; i++)
{
var ratios = m_AdditionalShadowData.cascadeRatios;
var ratioProp = ratios.GetArrayElementAtIndex(i);
float val = ratioProp.floatValue;
if (i > 0)
{
var prevRatioProp = ratios.GetArrayElementAtIndex(i - 1);
float prevVal = prevRatioProp.floatValue;
val = Mathf.Max(val, prevVal);
}
if (i < arraySize - 1)
{
var nextRatioProp = ratios.GetArrayElementAtIndex(i + 1);
float nextVal = nextRatioProp.floatValue;
val = Mathf.Min(val, nextVal);
}
ratioProp.floatValue = val;
}
}
}
int arraySize = m_AdditionalShadowData.cascadeRatios.arraySize;
for (int i = 0; i < arraySize; i++)
EditorGUILayout.Slider(m_AdditionalShadowData.cascadeRatios.GetArrayElementAtIndex(i), 0f, 1f, s_Styles.shadowCascadeRatios[i]);
EditorGUI.indentLevel--;
}

4
ScriptableRenderPipeline/HDRenderPipeline/Lighting/HDAdditionalLightData.cs


public SpotLightShape spotLightShape = SpotLightShape.Cone;
// Only for Rectangle/Line/box projector lights
[Range(0.0f, 20.0f)]
[Range(0.0f, 20.0f)]
[FormerlySerializedAs("lightHeight")]
public float shapeHeight = 0.5f;

// This is specific for the LightEditor GUI and not use at runtime
public bool useOldInspector = false;
public bool featuresFoldout = true;
public bool showAdditionalSettings = true; // TODO: Maybe we can remove if if we decide to always show additional settings
public bool showAdditionalSettings = false;
#if UNITY_EDITOR

正在加载...
取消
保存