Skip to content

Commit 95e0181

Browse files
authored
Merge pull request #8127 from Unity-Technologies/internal/master
Internal/master
2 parents f754346 + f7b8945 commit 95e0181

168 files changed

Lines changed: 27780 additions & 3318 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Packages/com.unity.render-pipelines.core/Editor/CoreEditorUtils.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,7 @@ static bool HandleEvent(bool state, Rect activationRect, Action<Vector2> context
863863
return state;
864864
}
865865

866-
static void ShowHelpButton(Rect contextMenuRect, string documentationURL, GUIContent title)
866+
internal static void ShowHelpButton(Rect contextMenuRect, string documentationURL, GUIContent title)
867867
{
868868
if (string.IsNullOrEmpty(documentationURL))
869869
return;

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

Lines changed: 17 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
using UnityEngine;
1212
using UnityEngine.Assertions;
1313
using UnityEngine.Rendering;
14-
using PackageInfo = UnityEditor.PackageManager.PackageInfo;
1514

1615
namespace UnityEditor.Rendering
1716
{
@@ -44,7 +43,8 @@ void OnEnable()
4443
hideFlags = HideFlags.HideAndDontSave;
4544
}
4645
}
47-
46+
47+
[CoreRPHelpURL("Rendering-Debugger")]
4848
sealed class DebugWindow : EditorWindowWithHelpButton, IHasCustomMenu
4949
{
5050
static Styles s_Styles;
@@ -76,37 +76,6 @@ public static bool open
7676
private set => DebugManager.instance.displayEditorUI = value;
7777
}
7878

79-
protected override void OnHelpButtonClicked()
80-
{
81-
//Deduce documentation url and open it in browser
82-
var url = GetSpecificURL() ?? GetDefaultURL();
83-
Application.OpenURL(url);
84-
}
85-
86-
string GetDefaultURL()
87-
{
88-
//Find package info of the current CoreRP package
89-
return $"https://docs.unity3d.com/Packages/com.unity.render-pipelines.core@{DocumentationInfo.version}/manual/Rendering-Debugger.html";
90-
}
91-
92-
string GetSpecificURL()
93-
{
94-
//Find package info of the current RenderPipeline
95-
var currentPipeline = GraphicsSettings.currentRenderPipeline;
96-
if (currentPipeline == null)
97-
return null;
98-
99-
if (!DocumentationUtils.TryGetPackageInfoForType(currentPipeline.GetType(), out var packageName, out var version))
100-
return null;
101-
102-
return packageName switch
103-
{
104-
"com.unity.render-pipelines.universal" => $"https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@{version}/manual/features/rendering-debugger.html",
105-
"com.unity.render-pipelines.high-definition" => $"https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@{version}/manual/Render-Pipeline-Debug-Window.html",
106-
_ => null
107-
};
108-
}
109-
11079
[DidReloadScripts]
11180
static void OnEditorReload()
11281
{
@@ -508,10 +477,23 @@ void OnGUI()
508477
{
509478
using (new EditorGUILayout.VerticalScope())
510479
{
511-
const float leftMargin = 4f;
512-
GUILayout.Space(leftMargin);
513480
var selectedPanel = panels[m_Settings.selectedPanel];
481+
482+
using (new EditorGUILayout.HorizontalScope())
483+
{
484+
var style = new GUIStyle(CoreEditorStyles.sectionHeaderStyle) { fontStyle = FontStyle.Bold };
485+
EditorGUILayout.LabelField(new GUIContent(selectedPanel.displayName), style);
486+
487+
// Context menu
488+
var rect = GUILayoutUtility.GetLastRect();
489+
var contextMenuRect = new Rect(rect.xMax, rect.y + 4f, 16f, 16f);
490+
491+
CoreEditorUtils.ShowHelpButton(contextMenuRect, selectedPanel.documentationUrl, new GUIContent($"{selectedPanel.displayName} panel."));
492+
}
514493

494+
const float leftMargin = 4f;
495+
GUILayout.Space(leftMargin);
496+
515497
using (var scrollScope = new EditorGUILayout.ScrollViewScope(m_ContentScroll))
516498
{
517499
TraverseContainerGUI(selectedPanel);

Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeVolumeEditor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ internal static void FrameSettingDisabledHelpBox()
123123
var k_EnsureFrameSetting = Type.GetType("UnityEditor.Rendering.HighDefinition.HDEditorUtils,Unity.RenderPipelines.HighDefinition.Editor")
124124
.GetMethod("EnsureFrameSetting", BindingFlags.Static | BindingFlags.NonPublic);
125125

126-
k_EnsureFrameSetting.Invoke(null, new object[] { k_APVFrameSetting, "Adaptive Probe Volumes" });
126+
k_EnsureFrameSetting.Invoke(null, new object[] { k_APVFrameSetting});
127127
}
128128
}
129129

Packages/com.unity.render-pipelines.core/Editor/LookDev/EnvironmentLibrary.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace UnityEditor.Rendering.LookDev
1212
/// <summary>
1313
/// Class containing a collection of Environment
1414
/// </summary>
15-
[CoreRPHelpURL("Environment-Library")]
15+
[CoreRPHelpURL("Look-Dev-Environment-Library")]
1616
public class EnvironmentLibrary : ScriptableObject
1717
{
1818
[field: SerializeField]

Packages/com.unity.render-pipelines.core/Editor/RenderGraph/RenderGraphViewer.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using UnityEditor.Rendering.Analytics;
44
using UnityEditor.UIElements;
55
using UnityEngine;
6+
using UnityEngine.Rendering;
67
using UnityEngine.Rendering.RenderGraphModule;
78
using UnityEngine.Scripting.APIUpdating;
89
using UnityEngine.UIElements;
@@ -13,7 +14,8 @@ namespace UnityEditor.Rendering
1314
/// Editor window class for the Render Graph Viewer
1415
/// </summary>
1516
[MovedFrom("")]
16-
public partial class RenderGraphViewer : EditorWindow
17+
[CoreRPHelpURL(packageName: "com.unity.render-pipelines.universal", pageName: "render-graph-view")]
18+
public partial class RenderGraphViewer : EditorWindowWithHelpButton
1719
{
1820
static partial class Names
1921
{

Packages/com.unity.render-pipelines.core/Runtime/Common/ObservableList.cs

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ public ListChangedEventArgs(int index, T item)
4545
/// <typeparam name="T">Type of the list.</typeparam>
4646
public class ObservableList<T> : IList<T>
4747
{
48-
IList<T> m_List;
48+
List<T> m_List;
49+
private readonly Comparison<T> m_Comparison;
4950

5051
/// <summary>
5152
/// Added item event.
@@ -98,18 +99,23 @@ public ObservableList()
9899
/// Constructor.
99100
/// </summary>
100101
/// <param name="capacity">Allocation size.</param>
101-
public ObservableList(int capacity)
102+
/// <param name="comparison">The comparision if you want the list to be sorted</param>
103+
public ObservableList(int capacity, Comparison<T> comparison = null)
102104
{
103105
m_List = new List<T>(capacity);
106+
m_Comparison = comparison;
104107
}
105108

106109
/// <summary>
107110
/// Constructor.
108111
/// </summary>
109112
/// <param name="collection">Input list.</param>
110-
public ObservableList(IEnumerable<T> collection)
113+
/// <param name="comparison">The comparision if you want the list to be sorted</param>
114+
public ObservableList(IEnumerable<T> collection, Comparison<T> comparison = null)
111115
{
112116
m_List = new List<T>(collection);
117+
m_Comparison = comparison;
118+
Sort(); // Make sure the given list is sorted
113119
}
114120

115121
void OnEvent(ListChangedEventHandler<T> e, int index, T item)
@@ -145,6 +151,7 @@ public int IndexOf(T item)
145151
public void Add(T item)
146152
{
147153
m_List.Add(item);
154+
Sort();
148155
OnEvent(ItemAdded, m_List.IndexOf(item), item);
149156
}
150157

@@ -166,6 +173,7 @@ public void Add(params T[] items)
166173
public void Insert(int index, T item)
167174
{
168175
m_List.Insert(index, item);
176+
Sort();
169177
OnEvent(ItemAdded, index, item);
170178
}
171179

@@ -248,5 +256,13 @@ IEnumerator IEnumerable.GetEnumerator()
248256
{
249257
return GetEnumerator();
250258
}
259+
260+
private void Sort()
261+
{
262+
if (m_Comparison != null)
263+
{
264+
m_List.Sort(m_Comparison);
265+
}
266+
}
251267
}
252268
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Reflection;
34
using UnityEngine.Rendering.RenderGraphModule;
45

56
namespace UnityEngine.Rendering
@@ -51,6 +52,9 @@ public void RegisterDebug(IDebugDisplaySettings settings)
5152
displayName: disposableSettingsPanel.PanelName,
5253
createIfNull: true,
5354
groupIndex: (disposableSettingsPanel is DebugDisplaySettingsPanel debugDisplaySettingsPanel) ? debugDisplaySettingsPanel.Order : 0);
55+
#if UNITY_EDITOR
56+
panel.documentationUrl = disposableSettingsPanel.GetType().GetCustomAttribute<HelpURLAttribute>()?.URL;
57+
#endif
5458

5559
ObservableList<DebugUI.Widget> panelChildren = panel.children;
5660

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,17 @@ public class Panel : IContainer, IComparable<Panel>
5353
/// Callback used when the panel is set dirty.
5454
/// </summary>
5555
public event Action<Panel> onSetDirty = delegate { };
56+
57+
#if UNITY_EDITOR
58+
public string documentationUrl { get; set; }
59+
#endif
5660

5761
/// <summary>
5862
/// Constructor.
5963
/// </summary>
6064
public Panel()
6165
{
62-
children = new ObservableList<Widget>();
66+
children = new ObservableList<Widget>(0, (widget, widget1) => widget.order.CompareTo(widget1.order));
6367
children.ItemAdded += OnItemAdded;
6468
children.ItemRemoved += OnItemRemoved;
6569
}

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace UnityEngine.Rendering
1818
/// state (e.g., whether it is in the editor or playing at runtime).
1919
/// - `DebugUI` also includes helper methods for widget initialization, such as compact initialization using the `NameAndTooltip` struct.
2020
///
21-
/// This API lets you do the following:
21+
/// This API lets you do the following:
2222
/// - Specify widget behavior such as "EditorOnly", "RuntimeOnly", "EditorForceUpdate", and "FrequentlyUsed".
2323
/// - Show dynamic data with optional formatting.
2424
/// - Specify delegate functions to show or hide widgets
@@ -53,10 +53,10 @@ namespace UnityEngine.Rendering
5353
/// {
5454
/// // Set the display label
5555
/// displayName = "Current Time",
56-
///
56+
///
5757
/// // Set the format for the time
5858
/// getter = () => System.DateTime.Now.ToString("HH:mm:ss"),
59-
///
59+
///
6060
/// // Set the value to refresh every second
6161
/// refreshRate = 1f
6262
/// };
@@ -103,6 +103,11 @@ public enum Flags
103103
/// </summary>
104104
public abstract class Widget
105105
{
106+
/// <summary>
107+
/// The order of the widget
108+
/// </summary>
109+
public int order { get; set; } = 0;
110+
106111
// Set to null until it's added to a panel, be careful
107112
/// <summary>
108113
/// Panels containing the widget.

0 commit comments

Comments
 (0)