Skip to content

Commit 1cf4122

Browse files
alex-vazquez-unity3dEvergreen
authored and
Evergreen
committed
[Port][22.3][Rendering Debbugger] Avoid reflection code and use directly the volume parameters of the Volume Component.
1 parent e164711 commit 1cf4122

File tree

6 files changed

+302
-206
lines changed

6 files changed

+302
-206
lines changed

Packages/com.unity.render-pipelines.core/Editor/Debugging/DebugUIDrawer.Builtins.cs

+7-4
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,10 @@ public override bool OnGUI(DebugUI.Widget widget, DebugState state)
801801

802802
rowRect.xMin += 2;
803803
rowRect.xMax -= 2;
804-
EditorGUI.LabelField(rowRect, GUIContent.none, EditorGUIUtility.TrTextContent(row.displayName), DebugWindow.Styles.centeredLeft);
804+
805+
bool isAlternate = r % 2 == 0;
806+
807+
EditorGUI.LabelField(rowRect, GUIContent.none, EditorGUIUtility.TrTextContent(row.displayName),isAlternate ? DebugWindow.Styles.centeredLeft : DebugWindow.Styles.centeredLeftAlternate);
805808
rowRect.xMin -= 2;
806809
rowRect.xMax += 2;
807810

@@ -812,7 +815,7 @@ public override bool OnGUI(DebugUI.Widget widget, DebugState state)
812815
rowRect.x += rowRect.width;
813816
rowRect.width = columns[visible[c]].width;
814817
if (!row.isHidden)
815-
DisplayChild(rowRect, row.children[visible[c] - 1]);
818+
DisplayChild(rowRect, row.children[visible[c] - 1], isAlternate);
816819
}
817820
rowRect.y += rowRect.height;
818821
}
@@ -855,7 +858,7 @@ internal Rect DrawOutline(Rect rect)
855858
return new Rect(rect.x + size, rect.y + size, rect.width - 2 * size, rect.height - 2 * size);
856859
}
857860

858-
internal void DisplayChild(Rect rect, DebugUI.Widget child)
861+
internal void DisplayChild(Rect rect, DebugUI.Widget child, bool isAlternate)
859862
{
860863
rect.xMin += 2;
861864
rect.xMax -= 2;
@@ -869,7 +872,7 @@ internal void DisplayChild(Rect rect, DebugUI.Widget child)
869872
if (child.GetType() == typeof(DebugUI.Value))
870873
{
871874
var widget = Cast<DebugUI.Value>(child);
872-
EditorGUI.LabelField(rect, GUIContent.none, EditorGUIUtility.TrTextContent(widget.GetValue().ToString()));
875+
EditorGUI.LabelField(rect, GUIContent.none, EditorGUIUtility.TrTextContent(widget.GetValue().ToString()), isAlternate ? DebugWindow.Styles.centeredLeft : DebugWindow.Styles.centeredLeftAlternate);
873876
}
874877
else if (child.GetType() == typeof(DebugUI.ColorField))
875878
{

Packages/com.unity.render-pipelines.core/Editor/Debugging/DebugWindow.cs

+17
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
using UnityEngine;
1111
using UnityEngine.Assertions;
1212
using UnityEngine.Rendering;
13+
using PackageInfo = UnityEditor.PackageManager.PackageInfo;
1314

1415
namespace UnityEditor.Rendering
1516
{
@@ -582,6 +583,7 @@ public class Styles
582583
public readonly Color skinBackgroundColor;
583584

584585
public static GUIStyle centeredLeft = new GUIStyle(EditorStyles.label) { alignment = TextAnchor.MiddleLeft };
586+
public static GUIStyle centeredLeftAlternate = new GUIStyle(EditorStyles.label) { alignment = TextAnchor.MiddleLeft };
585587
public static float singleRowHeight = EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
586588

587589
public static int foldoutColumnWidth = 70;
@@ -593,6 +595,12 @@ public Styles()
593595
Color backgroundColorDarkSkin = new Color32(38, 38, 38, 128);
594596
Color backgroundColorLightSkin = new Color32(128, 128, 128, 96);
595597

598+
centeredLeftAlternate.normal.background = CoreEditorUtils.CreateColoredTexture2D(
599+
EditorGUIUtility.isProSkin
600+
? new Color(63 / 255.0f, 63 / 255.0f, 63 / 255.0f, 255 / 255.0f)
601+
: new Color(202 / 255.0f, 202 / 255.0f, 202 / 255.0f, 255 / 255.0f),
602+
"centeredLeftAlternate Background");
603+
596604
sectionScrollView = new GUIStyle(sectionScrollView);
597605
sectionScrollView.overflow.bottom += 1;
598606

@@ -604,6 +612,15 @@ public Styles()
604612
sectionHeader.margin.left += 1;
605613
sectionHeader.normal.textColor = EditorGUIUtility.isProSkin ? textColorDarkSkin : textColorLightSkin;
606614
skinBackgroundColor = EditorGUIUtility.isProSkin ? backgroundColorDarkSkin : backgroundColorLightSkin;
615+
616+
// Make sure that textures are unloaded on domain reloads.
617+
void OnBeforeAssemblyReload()
618+
{
619+
UnityEngine.Object.DestroyImmediate(centeredLeftAlternate.normal.background);
620+
AssemblyReloadEvents.beforeAssemblyReload -= OnBeforeAssemblyReload;
621+
}
622+
623+
AssemblyReloadEvents.beforeAssemblyReload += OnBeforeAssemblyReload;
607624
}
608625
}
609626

0 commit comments

Comments
 (0)