Skip to content

Commit 3e99c0d

Browse files
Merge pull request #8292 from Unity-Technologies/internal/master
Internal/master
2 parents 7ae5ef9 + 6fe86c9 commit 3e99c0d

286 files changed

Lines changed: 7779 additions & 2219 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/Debugging/DebugWindow.SearchFilter.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,13 @@ sealed partial class DebugWindow
2929
readonly Dictionary<DebugUI.Widget, WidgetSearchData> m_WidgetSearchElementCache = new();
3030
readonly List<TextElement> m_PanelHeaderTextElements = new();
3131
UIElementSearchFilter m_SearchFilter;
32+
Label m_NoResultsLabel;
3233

3334
void BuildSearchCache()
3435
{
3536
m_WidgetSearchElementCache.Clear();
3637
m_PanelHeaderTextElements.Clear();
38+
m_NoResultsLabel = rootVisualElement.Q<Label>(name: "debug-window-no-results-label");
3739

3840
foreach (var panelElement in m_RightPaneElement.Children())
3941
{
@@ -76,6 +78,9 @@ void InitializeSearchField()
7678
tab.style.display = shouldShow ? DisplayStyle.Flex : DisplayStyle.None;
7779
}
7880
}
81+
82+
bool noResults = !string.IsNullOrEmpty(searchString) && visiblePanels.Count == 0;
83+
m_NoResultsLabel.style.display = noResults ? DisplayStyle.Flex : DisplayStyle.None;
7984
}
8085
);
8186
m_SearchFilter.InitializeSearchField("search-field");

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

Lines changed: 51 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,41 @@
6363

6464
/* Header Foldout */
6565

66-
.debug-window-foldout > .unity-foldout__toggle {
67-
border-width: 1px 0px 1px 0px;
66+
.debug-window-foldout-header > .unity-foldout__toggle {
67+
padding-top: 1px !important;
68+
padding-bottom: 1px !important;
6869
margin-top: 0px !important;
6970
margin-bottom: 0px !important;
71+
margin-left: -2px;
72+
margin-right: -4px;
73+
border-top-width: 1px;
7074
border-top-color: var(--unity-colors-default-border);
71-
border-bottom-color: var(--unity-colors-inspector_titlebar-border_accent);
75+
border-bottom-width: 1px;
76+
border-bottom-color: var(--unity-colors-default-border);
7277
background-color: var(--unity-colors-inspector_titlebar-background);
7378
}
7479

80+
.debug-window-foldout-header > .unity-foldout__toggle:hover {
81+
background-color: var(--unity-colors-inspector_titlebar-background-hover);
82+
}
83+
84+
.debug-window-foldout-header > .unity-foldout__toggle > .unity-toggle__input > .unity-toggle__checkmark
85+
{
86+
margin-left: 4px;
87+
margin-right: 4px;
88+
}
89+
90+
.debug-window-foldout-header .unity-foldout__text {
91+
-unity-font-style: bold;
92+
}
93+
94+
.debug-window-foldout > .unity-foldout__toggle {
95+
padding-top: 1px !important;
96+
padding-bottom: 1px !important;
97+
margin-top: 0px !important;
98+
margin-bottom: 0px !important;
99+
}
100+
75101
.debug-window-foldout > .unity-foldout__toggle:hover {
76102
background-color: var(--unity-colors-inspector_titlebar-background-hover);
77103
}
@@ -82,29 +108,36 @@
82108
margin-right: 4px;
83109
}
84110

111+
.debug-window-foldout .unity-foldout__text {
112+
-unity-font-style: bold;
113+
}
114+
85115
.more-options-button {
86116
background-image: var(--unity-icons-pane_options);
87-
background-size: contain;
88-
background-repeat: no-repeat;
117+
}
118+
119+
.info-button,
120+
.more-options-button {
89121
background-color: transparent;
90-
border-color: transparent;
91-
width: 16px;
92-
margin: 0px 4px 0px 0px !important;
93-
padding: 0px 0px 0px 0px !important;
122+
margin: 2px 2px 1px 3px;
123+
padding: 0px 2px 0px 0px;
124+
border-width: 0px;
125+
border-radius: 2px 2px 2px 2px;
126+
width: 20px;
127+
height: 20px;
94128
}
95129

96-
.more-options-button:hover {
130+
.info-button:hover,
131+
.more-options-button:hover{
97132
background-color: var(--unity-colors-button-background-hover);
98133
}
99134

100-
.info-button {
101-
background-color: transparent;
102-
border-color: transparent;
103-
width: 24px;
104-
margin: 0px 4px 0px 0px !important;
105-
padding: 0px 0px 0px 0px !important;
135+
.info-button:disabled
136+
.info-button:disabled,
137+
.more-options-button:disabled {
106138
}
107139

108-
.info-button:hover {
109-
background-color: var(--unity-colors-button-background-hover);
140+
#debug-window-no-results-label {
141+
display: none;
142+
-unity-text-align: middle-center;
110143
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<ui:VisualElement name="debug-window-tab-container" class="">
1616
<ui:ScrollView horizontal-scroller-visibility="Hidden" view-data-key="debug-window-tab-container-scrollview">
1717
<ui:VisualElement name="panels-inspector-insertion-element" />
18+
<ui:Label name="debug-window-no-results-label" text="No results match your search." />
1819
<ui:VisualElement name="scroll-buffer" />
1920
</ui:ScrollView>
2021
</ui:VisualElement>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -892,6 +892,7 @@ static internal void Init()
892892
Lightmapping.bakeStarted += OnBakeStarted;
893893
Lightmapping.bakeCancelled += OnBakeCancelled;
894894
Lightmapping.inputExtraction += OnInputExtraction;
895+
AssemblyReloadEvents.beforeAssemblyReload += CleanUp;
895896
}
896897
}
897898

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

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
using NUnit.Framework;
22
using System;
33
using System.Collections.Generic;
4+
using UnityEngine;
5+
using UnityEngine.Rendering;
46
using UnityEngine.Rendering.RenderGraphModule;
57

6-
#if UNITY_EDITOR
7-
using UnityEditor.Rendering;
8-
#endif
9-
10-
namespace UnityEngine.Rendering.Tests
8+
namespace UnityEditor.Rendering.Tests
119
{
1210
// TODO: Move this class to the Tests/Editor folder once the "IsolatedPackagesVerified" CI test correctly resolves all dependencies.
1311
// Currently, the URP package fails to locate the RenderGraphTestsCore class when it's placed under Tests/Editor,
@@ -130,9 +128,8 @@ public void Setup()
130128
{
131129
// Setting default global settings to the custom RG render pipeline type, no quality settings so we can rely on the default RP
132130
m_RenderGraphTestGlobalSettings = ScriptableObject.CreateInstance<RenderGraphTestGlobalSettings>();
133-
#if UNITY_EDITOR
134131
EditorGraphicsSettings.SetRenderPipelineGlobalSettingsAsset<RenderGraphTestPipelineInstance>(m_RenderGraphTestGlobalSettings);
135-
#endif
132+
136133
// Saving old render pipelines to set them back after testing
137134
m_OldDefaultRenderPipeline = GraphicsSettings.defaultRenderPipeline;
138135
m_OldQualityRenderPipeline = QualitySettings.renderPipeline;
@@ -166,14 +163,20 @@ public void Cleanup()
166163
QualitySettings.renderPipeline = m_OldQualityRenderPipeline;
167164
m_OldQualityRenderPipeline = null;
168165

169-
m_RenderGraph.Cleanup();
166+
try
167+
{
168+
m_RenderGraph.Cleanup();
169+
}
170+
catch (Exception e)
171+
{
172+
Debug.Log($"Tried to clean RenderGraph but exception was thrown: {e.Message}");
173+
}
170174

171-
Object.DestroyImmediate(m_RenderGraphTestPipeline);
172175

173-
#if UNITY_EDITOR
176+
UnityEngine.Object.DestroyImmediate(m_RenderGraphTestPipeline);
174177
EditorGraphicsSettings.SetRenderPipelineGlobalSettingsAsset<RenderGraphTestPipelineInstance>(null);
175-
#endif
176-
Object.DestroyImmediate(m_RenderGraphTestGlobalSettings);
178+
179+
UnityEngine.Object.DestroyImmediate(m_RenderGraphTestGlobalSettings);
177180

178181
GameObject.DestroyImmediate(m_GameObject);
179182
m_GameObject = null;

Packages/com.unity.render-pipelines.core/Editor/SampleDependencyImportSystem/SampleDependencyImporter.cs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using System;
21
using System.Collections.Generic;
32
using System.IO;
43
using UnityEditor;
@@ -40,7 +39,6 @@ static SampleDependencyImporter()
4039

4140
PackageInfo m_PackageInfo;
4241
SampleList m_SampleList;
43-
List<Sample> m_Samples;
4442

4543
VisualElement injectingElement;
4644
VisualElement _panelRoot;
@@ -100,6 +98,7 @@ internal void RefreshSampleButtons()
10098

10199
var bound = Mathf.Min(sampleContainers.Count, m_SampleList.samples.Length);
102100

101+
// Foreach sample
103102
for (int i=0; i<bound; i++)
104103
{
105104
// Check if the sample has dependencies, if not just skip the injection.
@@ -155,16 +154,20 @@ internal void RefreshSampleButtons()
155154

156155
// Need to copy i for the lambda.
157156
var index = i;
158-
// On click of the imported button, import the dependencies first then call the original button logic.
157+
// On click of the imported button, import the dependencies first then use the package manager API to trigger the regular sample import logic.
159158
injectedButton.clicked += () =>
160159
{
161160
ImportSampleDependencies(index);
162161

163-
using (var ev = NavigationSubmitEvent.GetPooled())
162+
// After importing the dependencies, we can call the package manager API import logic.
163+
foreach (Sample sample in Sample.FindByPackage(m_PackageInfo.name, m_PackageInfo.version))
164164
{
165-
ev.target = importButton;
166-
importButton.SendEvent(ev);
165+
if (sample.displayName == m_SampleList.samples[index].displayName)
166+
{
167+
sample.Import(Sample.ImportOptions.HideImportWindow | Sample.ImportOptions.OverridePreviousImports);
168+
}
167169
}
170+
168171
};
169172
}
170173
else // We may need to update the button text after the sample import here.

Packages/com.unity.render-pipelines.core/Editor/Tools/MaterialUpgrader/MaterialUpgrader.Utils.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ namespace UnityEditor.Rendering
1212
/// </summary>
1313
public partial class MaterialUpgrader
1414
{
15+
internal static readonly string k_DialogKey = $"{nameof(UnityEditor)}.{nameof(Rendering)}.{nameof(MaterialUpgrader)}.ConfirmMaterialConversion";
16+
1517
#region Internal API
1618
/// <summary>
1719
/// Represents an entry describing material properties
@@ -344,15 +346,15 @@ static void PerformUpgrade(List<MaterialUpgradeEntry> materialUpgrades, List<Mat
344346

345347
bool CanPerformUpgrade()
346348
{
347-
const string title = "Material Upgrader";
348-
const string message = "This operation will overwrite existing materials in your project.\n\nPlease ensure you have a backup before proceeding.";
349+
const string title = "Confirm Material Conversion";
350+
const string message = "This action will modify materials and cannot be easily undone. It is strongly recommended to have a backup or use version control before continuing.";
349351
const string proceed = "Proceed";
350352
const string cancel = "Cancel";
351353

352354
if (Application.isBatchMode)
353355
return true;
354356

355-
return EditorUtility.DisplayDialog(title, message, proceed, cancel);
357+
return EditorUtility.DisplayDialog(title, message, proceed, cancel, DialogOptOutDecisionType.ForThisMachine, k_DialogKey);
356358
}
357359

358360
if (CanPerformUpgrade())
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
using System.Collections.Generic;
2+
using UnityEngine;
3+
using UnityEngine.Rendering;
4+
5+
namespace UnityEditor.Rendering
6+
{
7+
class MaterialUpgraderEditMenus
8+
{
9+
private static readonly List<MaterialUpgrader> s_Empty = new List<MaterialUpgrader>();
10+
11+
public static List<MaterialUpgrader> GetCurrentSRPUpgraders()
12+
{
13+
if (!GraphicsSettings.isScriptableRenderPipelineEnabled)
14+
return s_Empty;
15+
16+
return MaterialUpgrader.FetchAllUpgradersForPipeline(GraphicsSettings.currentRenderPipelineAssetType);
17+
}
18+
19+
[MenuItem("Edit/Rendering/Materials/Convert All Built-In Materials to Current SRP", true)]
20+
internal static bool UpgradeMaterialsProjectValidate()
21+
{
22+
return GraphicsSettings.isScriptableRenderPipelineEnabled;
23+
}
24+
25+
[MenuItem("Edit/Rendering/Materials/Convert All Built-In Materials to Current SRP", priority = CoreUtils.Priorities.editMenuPriority + 1)]
26+
internal static void UpgradeMaterialsProject()
27+
{
28+
MaterialUpgrader.UpgradeProjectFolder(GetCurrentSRPUpgraders(), "Upgrade to SRP Material");
29+
}
30+
31+
[MenuItem("Edit/Rendering/Materials/Convert Selected Built-In Materials to Current SRP", true)]
32+
internal static bool UpgradeMaterialsSelectionValidate()
33+
{
34+
if (Selection.objects.Length == 0 || !GraphicsSettings.isScriptableRenderPipelineEnabled)
35+
return false;
36+
37+
foreach (var obj in Selection.objects)
38+
{
39+
if (obj is not Material)
40+
return false;
41+
}
42+
43+
return true;
44+
}
45+
46+
[MenuItem("Edit/Rendering/Materials/Convert Selected Built-In Materials to Current SRP", priority = CoreUtils.Priorities.editMenuPriority + 2)]
47+
internal static void UpgradeMaterialsSelection()
48+
{
49+
MaterialUpgrader.UpgradeSelection(GetCurrentSRPUpgraders(), "Upgrade to SRP Material");
50+
}
51+
}
52+
}

Packages/com.unity.render-pipelines.core/Editor/Tools/MaterialUpgrader/MaterialUpgraderEditMenus.cs.meta

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Packages/com.unity.render-pipelines.core/Editor/Utilities/UIElementSearchFilter.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class UIElementSearchFilter
1111
{
1212
internal const string k_SelectionColorBeginTag = "<mark=#3169ACAB>";
1313
internal const string k_SelectionColorEndTag = "</mark>";
14-
const int k_SearchStringLimit = 15;
14+
const int k_SearchStringLimit = 32;
1515

1616
IVisualElementScheduledItem m_PreviousSearch;
1717
string m_PendingSearchString;
@@ -28,6 +28,7 @@ public void InitializeSearchField(string searchFieldName)
2828
{
2929
var searchField = m_RootElement.Q<ToolbarSearchField>(searchFieldName);
3030
searchField.placeholderText = L10n.Tr("Search");
31+
searchField.Q<TextField>().maxLength = k_SearchStringLimit;
3132
searchField.RegisterValueChangedCallback(evt => OnSearchFilterChanged(evt.newValue));
3233

3334
// Apply empty search once in case the entire window was reloaded with a non-empty search. Search
@@ -37,13 +38,6 @@ public void InitializeSearchField(string searchFieldName)
3738

3839
void OnSearchFilterChanged(string searchString)
3940
{
40-
// Ensure the search string is within the allowed length limit
41-
if (searchString.Length > k_SearchStringLimit)
42-
{
43-
searchString = searchString[..k_SearchStringLimit];
44-
Debug.LogWarning($"Search string limit exceeded: {k_SearchStringLimit}");
45-
}
46-
4741
// Sanitize to not match rich text tags
4842
searchString = searchString.Replace("<", string.Empty).Replace(">", string.Empty);
4943

0 commit comments

Comments
 (0)