Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -78,34 +78,37 @@ public override void OnInspectorGUI()

if (!m_CascadeShadowSplitCount.value.hasMultipleDifferentValues)
{
EditorGUI.indentLevel++;
int cascadeCount = m_CascadeShadowSplitCount.value.intValue;
Debug.Assert(cascadeCount <= 4); // If we add support for more than 4 cascades, then we should add new entries in the next line
string[] cascadeOrder = { "first", "second", "third" };
int cascadeCount;

for (int i = 0; i < cascadeCount - 1; i++)
using (new HDEditorUtils.IndentScope())
{
string tooltipOverride = (unit == Unit.Metric) ?
$"Distance from the Camera (in meters) to the {cascadeOrder[i]} cascade split." :
$"Distance from the Camera (as a percentage of Max Distance) to the {cascadeOrder[i]} cascade split.";
PropertyField(m_CascadeShadowSplits[i], EditorGUIUtility.TrTextContent(string.Format("Split {0}", i + 1), tooltipOverride));
}
cascadeCount = m_CascadeShadowSplitCount.value.intValue;
Debug.Assert(cascadeCount <= 4); // If we add support for more than 4 cascades, then we should add new entries in the next line
string[] cascadeOrder = { "first", "second", "third" };

if (HDRenderPipeline.s_UseCascadeBorders)
{
EditorGUILayout.Space();
for (int i = 0; i < cascadeCount - 1; i++)
{
string tooltipOverride = (unit == Unit.Metric) ?
$"Distance from the Camera (in meters) to the {cascadeOrder[i]} cascade split." :
$"Distance from the Camera (as a percentage of Max Distance) to the {cascadeOrder[i]} cascade split.";
PropertyField(m_CascadeShadowSplits[i], EditorGUIUtility.TrTextContent(string.Format("Split {0}", i + 1), tooltipOverride));
}

for (int i = 0; i < cascadeCount; i++)
if (HDRenderPipeline.s_UseCascadeBorders)
{
PropertyField(m_CascadeShadowBorders[i], EditorGUIUtility.TrTextContent(string.Format("Border {0}", i + 1)));
EditorGUILayout.Space();

for (int i = 0; i < cascadeCount; i++)
{
PropertyField(m_CascadeShadowBorders[i], EditorGUIUtility.TrTextContent(string.Format("Border {0}", i + 1)));
}
}
}

EditorGUILayout.Space();

GUILayout.Label("Cascade splits");
ShadowCascadeGUI.DrawCascadeSplitGUI(m_CascadeShadowSplits, HDRenderPipeline.s_UseCascadeBorders ? m_CascadeShadowBorders : null, (uint)cascadeCount, blendLastCascade: true, useMetric: unit == Unit.Metric, baseMetric: m_MaxShadowDistance.value.floatValue);
EditorGUI.indentLevel--;
}

HDRenderPipeline hdrp = UnityEngine.Rendering.RenderPipelineManager.currentPipeline as HDRenderPipeline;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;

using UnityEditor.Rendering;

using UnityEditor.Rendering.HighDefinition;
using UnityEngine.Rendering;
using UnityEngine.Rendering.HighDefinition;

Expand Down Expand Up @@ -47,13 +47,14 @@ public override void OnInspectorGUI()

if (m_Enable.overrideState.boolValue && m_Enable.value.boolValue)
{
EditorGUI.indentLevel++;
PropertyField(m_LayerMask);
PropertyField(m_MaxSamples);
PropertyField(m_MinDepth);
PropertyField(m_MaxDepth);
PropertyField(m_MaxIntensity);
EditorGUI.indentLevel--;
using (new HDEditorUtils.IndentScope())
{
PropertyField(m_LayerMask);
PropertyField(m_MaxSamples);
PropertyField(m_MinDepth);
PropertyField(m_MaxDepth);
PropertyField(m_MaxIntensity);
}

// Make sure MaxDepth is always greater or equal than MinDepth
m_MaxDepth.value.intValue = Math.Max(m_MinDepth.value.intValue, m_MaxDepth.value.intValue);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using UnityEditor.Rendering;
using UnityEditor.Rendering.HighDefinition;
using UnityEngine.Rendering.HighDefinition;
using UnityEngine.Rendering;

Expand Down Expand Up @@ -42,12 +43,13 @@ public override void OnInspectorGUI()

if (m_Enable.overrideState.boolValue && m_Enable.value.boolValue)
{
EditorGUI.indentLevel++;
PropertyField(m_LayerMask);
PropertyField(m_MaxDepth);
PropertyField(m_RayLength);
PropertyField(m_MinSmoothness);
EditorGUI.indentLevel--;
using (new HDEditorUtils.IndentScope())
{
PropertyField(m_LayerMask);
PropertyField(m_MaxDepth);
PropertyField(m_RayLength);
PropertyField(m_MinSmoothness);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ public override void OnInspectorGUI()
PropertyField(m_RayTracing);
if (m_RayTracing.overrideState.boolValue && m_RayTracing.value.boolValue)
{
EditorGUI.indentLevel++;
PropertyField(m_SampleCount);
EditorGUI.indentLevel--;
using (new HDEditorUtils.IndentScope())
{
PropertyField(m_SampleCount);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,17 +118,19 @@ public override void OnInspectorGUI()
else
{
PropertyField(m_SphericalMode);
EditorGUI.indentLevel++;
bool isSpherical = !m_SphericalMode.overrideState.boolValue || m_SphericalMode.value.boolValue;
if (isSpherical)

using (new HDEditorUtils.IndentScope())
{
PropertyField(m_PlanetCenterPosition);
if (type == PhysicallyBasedSkyModel.Custom)
PropertyField(m_PlanetaryRadius);
bool isSpherical = !m_SphericalMode.overrideState.boolValue || m_SphericalMode.value.boolValue;
if (isSpherical)
{
PropertyField(m_PlanetCenterPosition);
if (type == PhysicallyBasedSkyModel.Custom)
PropertyField(m_PlanetaryRadius);
}
else
PropertyField(m_SeaLevel);
}
else
PropertyField(m_SeaLevel);
EditorGUI.indentLevel--;

PropertyField(m_PlanetRotation);
PropertyField(m_GroundColorTexture);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,23 +91,24 @@ protected void CommonSkySettingsGUI()
}
}

EditorGUI.indentLevel++;
if (m_IntensityMode.value.GetEnumValue<SkyIntensityMode>() == SkyIntensityMode.Exposure)
PropertyField(m_SkyExposure);
else if (m_IntensityMode.value.GetEnumValue<SkyIntensityMode>() == SkyIntensityMode.Multiplier)
PropertyField(m_SkyMultiplier);
else if (m_IntensityMode.value.GetEnumValue<SkyIntensityMode>() == SkyIntensityMode.Lux)
using (new HDEditorUtils.IndentScope())
{
PropertyField(m_DesiredLuxValue);
if (m_IntensityMode.value.GetEnumValue<SkyIntensityMode>() == SkyIntensityMode.Exposure)
PropertyField(m_SkyExposure);
else if (m_IntensityMode.value.GetEnumValue<SkyIntensityMode>() == SkyIntensityMode.Multiplier)
PropertyField(m_SkyMultiplier);
else if (m_IntensityMode.value.GetEnumValue<SkyIntensityMode>() == SkyIntensityMode.Lux)
{
PropertyField(m_DesiredLuxValue);

// Show the multiplier
EditorGUILayout.HelpBox(System.String.Format("Upper hemisphere lux value: {0}\nAbsolute multiplier: {1}",
m_UpperHemisphereLuxValue.value.floatValue,
(m_DesiredLuxValue.value.floatValue / m_UpperHemisphereLuxValue.value.floatValue)
), MessageType.Info);
// Show the multiplier
EditorGUILayout.HelpBox(System.String.Format(
"Upper hemisphere lux value: {0}\nAbsolute multiplier: {1}",
m_UpperHemisphereLuxValue.value.floatValue,
(m_DesiredLuxValue.value.floatValue / m_UpperHemisphereLuxValue.value.floatValue)
), MessageType.Info);
}
}

EditorGUI.indentLevel--;
}
if ((m_CommonUIElementsMask & (uint)SkySettingsUIElement.Rotation) != 0)
PropertyField(m_SkyRotation);
Expand All @@ -117,9 +118,10 @@ protected void CommonSkySettingsGUI()
PropertyField(m_EnvUpdateMode);
if (!m_EnvUpdateMode.value.hasMultipleDifferentValues && m_EnvUpdateMode.value.intValue == (int)EnvironmentUpdateMode.Realtime)
{
EditorGUI.indentLevel++;
PropertyField(m_EnvUpdatePeriod);
EditorGUI.indentLevel--;
using (new HDEditorUtils.IndentScope())
{
PropertyField(m_EnvUpdatePeriod);
}
}
}
if ((m_CommonUIElementsMask & (uint)SkySettingsUIElement.IncludeSunInBaking) != 0)
Expand Down