Skip to content

Commit 2971ab6

Browse files
Public API for URP DebugDisplaySettings
- Made the settings API public - Renamed properties to be more uniform with each other and use camelCase - Added new Material Albedo validation preset: AlbedoDebugValidationPreset.Custom
1 parent 73ef38f commit 2971ab6

File tree

8 files changed

+297
-163
lines changed

8 files changed

+297
-163
lines changed

com.unity.render-pipelines.universal/Runtime/2D/Renderer2D.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public override void Setup(ScriptableRenderContext context, ref RenderingData re
150150
if (DebugHandler != null)
151151
{
152152
#if UNITY_EDITOR
153-
UnityEditorInternal.SpriteMaskUtility.EnableDebugMode(DebugHandler.DebugDisplaySettings.MaterialSettings.DebugMaterialModeData == DebugMaterialMode.SpriteMask);
153+
UnityEditorInternal.SpriteMaskUtility.EnableDebugMode(DebugHandler.DebugDisplaySettings.MaterialSettings.materialDebugMode == DebugMaterialMode.SpriteMask);
154154
#endif
155155
if (DebugHandler.AreAnySettingsActive)
156156
{

com.unity.render-pipelines.universal/Runtime/Debug/DebugDisplaySettings.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@ public class DebugDisplaySettings : IDebugDisplaySettingsQuery
2020
/// <summary>
2121
/// Material-related Rendering Debugger settings.
2222
/// </summary>
23-
internal DebugDisplaySettingsMaterial MaterialSettings { get; private set; }
23+
public DebugDisplaySettingsMaterial MaterialSettings { get; private set; }
2424

2525
/// <summary>
2626
/// Rendering-related Rendering Debugger settings.
2727
/// </summary>
28-
internal DebugDisplaySettingsRendering RenderingSettings { get; private set; }
28+
public DebugDisplaySettingsRendering RenderingSettings { get; private set; }
2929

3030
/// <summary>
3131
/// Lighting-related Rendering Debugger settings.
3232
/// </summary>
33-
internal DebugDisplaySettingsLighting LightingSettings { get; private set; }
33+
public DebugDisplaySettingsLighting LightingSettings { get; private set; }
3434

3535
#region IDebugDisplaySettingsQuery
3636

@@ -62,7 +62,7 @@ public bool IsPostProcessingAllowed
6262
{
6363
get
6464
{
65-
DebugPostProcessingMode debugPostProcessingMode = RenderingSettings.debugPostProcessingMode;
65+
DebugPostProcessingMode debugPostProcessingMode = RenderingSettings.postProcessingDebugMode;
6666

6767
switch (debugPostProcessingMode)
6868
{
@@ -104,7 +104,10 @@ private TData Add<TData>(TData newData) where TData : IDebugDisplaySettingsData
104104
Reset();
105105
}
106106

107-
internal void Reset()
107+
/// <summary>
108+
/// Reset current debug data to default values.
109+
/// </summary>
110+
public void Reset()
108111
{
109112
m_Settings.Clear();
110113

com.unity.render-pipelines.universal/Runtime/Debug/DebugDisplaySettingsLighting.cs

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,20 @@
33

44
namespace UnityEngine.Rendering.Universal
55
{
6-
class DebugDisplaySettingsLighting : IDebugDisplaySettingsData
6+
/// <summary>
7+
/// Lighting-related Rendering Debugger settings.
8+
/// </summary>
9+
public class DebugDisplaySettingsLighting : IDebugDisplaySettingsData
710
{
8-
internal DebugLightingMode DebugLightingMode { get; private set; }
9-
internal DebugLightingFeatureFlags DebugLightingFeatureFlagsMask { get; private set; }
11+
/// <summary>
12+
/// Current debug lighting mode.
13+
/// </summary>
14+
public DebugLightingMode lightingDebugMode { get; set; }
15+
16+
/// <summary>
17+
/// Current debug lighting feature flags mask that allows selective disabling individual lighting components.
18+
/// </summary>
19+
public DebugLightingFeatureFlags lightingFeatureFlags { get; set; }
1020

1121
static class Strings
1222
{
@@ -20,17 +30,17 @@ internal static class WidgetFactory
2030
{
2131
nameAndTooltip = Strings.LightingDebugMode,
2232
autoEnum = typeof(DebugLightingMode),
23-
getter = () => (int)data.DebugLightingMode,
33+
getter = () => (int)data.lightingDebugMode,
2434
setter = (value) => { },
25-
getIndex = () => (int)data.DebugLightingMode,
26-
setIndex = (value) => data.DebugLightingMode = (DebugLightingMode)value
35+
getIndex = () => (int)data.lightingDebugMode,
36+
setIndex = (value) => data.lightingDebugMode = (DebugLightingMode)value
2737
};
2838

2939
internal static DebugUI.Widget CreateLightingFeatures(DebugDisplaySettingsLighting data) => new DebugUI.BitField
3040
{
3141
nameAndTooltip = Strings.LightingFeatures,
32-
getter = () => data.DebugLightingFeatureFlagsMask,
33-
setter = (value) => data.DebugLightingFeatureFlagsMask = (DebugLightingFeatureFlags)value,
42+
getter = () => data.lightingFeatureFlags,
43+
setter = (value) => data.lightingFeatureFlags = (DebugLightingFeatureFlags)value,
3444
enumType = typeof(DebugLightingFeatureFlags),
3545
};
3646
}
@@ -56,9 +66,9 @@ public SettingsPanel(DebugDisplaySettingsLighting data)
5666
}
5767

5868
#region IDebugDisplaySettingsData
59-
public bool AreAnySettingsActive => (DebugLightingMode != DebugLightingMode.None) || (DebugLightingFeatureFlagsMask != DebugLightingFeatureFlags.None);
69+
public bool AreAnySettingsActive => (lightingDebugMode != DebugLightingMode.None) || (lightingFeatureFlags != DebugLightingFeatureFlags.None);
6070

61-
public bool IsPostProcessingAllowed => (DebugLightingMode != DebugLightingMode.Reflections && DebugLightingMode != DebugLightingMode.ReflectionsWithSmoothness);
71+
public bool IsPostProcessingAllowed => (lightingDebugMode != DebugLightingMode.Reflections && lightingDebugMode != DebugLightingMode.ReflectionsWithSmoothness);
6272

6373
public bool IsLightingActive => true;
6474

@@ -67,7 +77,7 @@ public bool TryGetScreenClearColor(ref Color color)
6777
return false;
6878
}
6979

70-
public IDebugDisplaySettingsPanelDisposable CreatePanel()
80+
IDebugDisplaySettingsPanelDisposable IDebugDisplaySettingsData.CreatePanel()
7181
{
7282
return new SettingsPanel(this);
7383
}

0 commit comments

Comments
 (0)