Skip to content

Commit 08ad023

Browse files
svc-reach-platform-supportEvergreen
authored andcommitted
[Port] [6000.5] UUM-134685 Add documentation buttons to rendering debugger panel headers
1 parent 118b66d commit 08ad023

3 files changed

Lines changed: 72 additions & 3 deletions

File tree

Packages/com.unity.render-pipelines.core/Runtime/Debugging/DebugUI.Panel.cs

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44

55
using System;
66

7+
#if UNITY_EDITOR
8+
using UnityEditor;
9+
#endif
10+
711
#if ENABLE_RENDERING_DEBUGGER_UI
812
using UnityEngine.UIElements;
913
#endif
@@ -20,6 +24,8 @@ public partial class DebugUI
2024
public class Panel : IContainer, IComparable<Panel>
2125
{
2226
#if ENABLE_RENDERING_DEBUGGER_UI
27+
private VisualElement m_HelpButton;
28+
2329
/// <inheritdoc/>
2430
public VisualElement Create(DebugUI.Context context)
2531
{
@@ -29,9 +35,23 @@ public VisualElement Create(DebugUI.Context context)
2935
name = displayName + "_Content"
3036
};
3137

32-
var label = container.Q<Label>(className:"unity-group-box__label");
38+
var label = container.Q<Label>(className: "unity-group-box__label");
3339
label.AddToClassList("debug-window-header-title");
3440
label.AddToClassList("debug-window-search-filter-target");
41+
label.AddToClassList("debug-window-header-row");
42+
43+
#if UNITY_EDITOR
44+
if (EditorGUIUtility.isProSkin)
45+
{
46+
container.AddToClassList("dark");
47+
}
48+
49+
m_HelpButton = new UIElements.Button(() => Help.BrowseURL(documentationUrl));
50+
m_HelpButton.tooltip = $"Open Reference for {displayName} debugger panel.";
51+
m_HelpButton.SetEnabled(!string.IsNullOrEmpty(documentationUrl));
52+
m_HelpButton.AddToClassList("debug-window-help-button");
53+
label.Add(m_HelpButton);
54+
#endif
3555
container.AddToClassList("debug-window-tab-content");
3656
container.AddToClassList("unity-inspector-element");
3757

@@ -98,7 +118,21 @@ public VisualElement Create(DebugUI.Context context)
98118
public event Action<Panel> onSetDirty = delegate { };
99119

100120
#if UNITY_EDITOR
101-
public string documentationUrl { get; set; }
121+
private string m_DocumentationURL;
122+
123+
public string documentationUrl {
124+
get => m_DocumentationURL;
125+
set
126+
{
127+
if (m_DocumentationURL == value)
128+
return;
129+
130+
m_DocumentationURL = value;
131+
#if ENABLE_RENDERING_DEBUGGER_UI
132+
m_HelpButton?.SetEnabled(!string.IsNullOrEmpty(m_DocumentationURL));
133+
#endif
134+
}
135+
}
102136
#endif
103137

104138
/// <summary>

Packages/com.unity.render-pipelines.core/Runtime/Debugging/Runtime UI Resources/DebugWindowCommon.uss

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33

44
/* Common */
55

6+
.debug-window-header-row {
7+
flex-direction: row;
8+
align-items: center;
9+
justify-content: flex-end;
10+
min-height: 30px;
11+
width: 100%;
12+
}
13+
614
.debug-window-header-title {
715
font-size: 24px;
816
-unity-font-style: bold;
@@ -108,3 +116,30 @@
108116
.debug-window-colorfield.debug-window-table-cell>.unity-base-field__input {
109117
flex-grow: 0;
110118
}
119+
120+
.debug-window-help-button {
121+
width: 30px;
122+
height: 30px;
123+
padding: 0;
124+
margin-top: 0;
125+
margin-bottom: 0;
126+
border-width: 0;
127+
border-radius: 3px;
128+
background-color: transparent;
129+
background-size: 16px 16px;
130+
background-image: resource("Icons/_Help.png");
131+
align-self: flex-end;
132+
}
133+
134+
.debug-window-help-button:hover {
135+
background-color: var(--unity-colors-button-background-hover);
136+
}
137+
138+
.dark .debug-window-help-button {
139+
background-image: resource("Icons/d__Help.png");
140+
}
141+
142+
.debug-window-help-button:disabled
143+
{
144+
display: none;
145+
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ namespace UnityEngine.Rendering.Universal
99
/// <summary>
1010
/// Lighting-related Rendering Debugger settings.
1111
/// </summary>
12-
[URPHelpURL("features/rendering-debugger-reference", "lighting")]
1312
[Serializable]
1413
public class DebugDisplaySettingsLighting : IDebugDisplaySettingsData, ISerializedDebugDisplaySettings
1514
{
@@ -67,6 +66,7 @@ internal static class WidgetFactory
6766
}
6867

6968
[DisplayInfo(name = "Lighting", order = 3)]
69+
[URPHelpURL("features/rendering-debugger-reference", "lighting")]
7070
internal class SettingsPanel : DebugDisplaySettingsPanel<DebugDisplaySettingsLighting>
7171
{
7272
public SettingsPanel(DebugDisplaySettingsLighting data)

0 commit comments

Comments
 (0)