Skip to content

Commit 38adf82

Browse files
authored
Merge pull request #8137 from Unity-Technologies/internal/master
Internal/master
2 parents 274b2c0 + aa1ef11 commit 38adf82

File tree

325 files changed

+34283
-2462
lines changed

Some content is hidden

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

325 files changed

+34283
-2462
lines changed

Packages/com.unity.render-pipelines.core/Documentation~/Look-Dev-Environment-Library.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ An Environment Library is an Asset that contains a list of environments that you
44

55
<a name="Creation"></a>
66

7-
![](Images/LookDevEnvironmentLibrary1.png)
7+
![Environment Library asset.](Images/LookDevEnvironmentLibrary1.png)
88

99
## Creating an Environment Library
1010

@@ -26,13 +26,13 @@ To add, remove, or duplicate environments, use the toolbar at the bottom of the
2626

2727
| **Button** | **Function** | **Description** |
2828
| ------------------------------------------------------------ | ------------- | ------------------------------------------------------------ |
29-
| ![](Images/LookDevEnvironmentLibrary2.png) | **Add** | Click this button to add a new environment to the bottom of the list. |
30-
| ![](Images/LookDevEnvironmentLibrary3.png) | **Remove** | Click this button to remove the environment currently selected. Note that the environment that you have selected is the one with the blue frame. |
31-
| ![](Images/LookDevEnvironmentLibrary4.png) | **Duplicate** | Click this button to duplicate the currently selected environment and add it as a new environment to the bottom of the list. |
29+
| ![This button adds a new environment to the bottom of the list.](Images/LookDevEnvironmentLibrary2.png) | **Add** | Click this button to add a new environment to the bottom of the list. |
30+
| ![This button removes the currently selected environment.](Images/LookDevEnvironmentLibrary3.png) | **Remove** | Click this button to remove the environment currently selected. Note that the environment that you have selected is the one with the blue frame. |
31+
| ![This button duplicates the currently selected environment.](Images/LookDevEnvironmentLibrary4.png) | **Duplicate** | Click this button to duplicate the currently selected environment and add it as a new environment to the bottom of the list. |
3232

3333
## Properties
3434

35-
![](Images/LookDevEnvironmentLibrary5.png)
35+
![Environment Library properties](Images/LookDevEnvironmentLibrary5.png)
3636

3737
| **Property** | **Description** |
3838
| ------------------- | ------------------------------------------------------------ |

Packages/com.unity.render-pipelines.core/Documentation~/Look-Dev.md

+7-11
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@ Use the toolbar in the top-left of the window to change which viewing mode Look
4646

4747
### Single viewport
4848

49-
![](Images/LookDev1.png)
49+
![Buttons for switching between viewports 1 and 2.](Images/LookDev1.png)
5050

5151
By default, Look Dev displays a single viewport which contains the Prefab or GameObject you are working with. If you are in another viewing mode, you can click either the number **1** or number **2** button to go back to single view. Each button corresponds to a viewport in Look Dev. Select button **1** to use viewport 1, and button 2 to use viewport **2**.
5252

5353
<a name="MultiView"></a>
5454

5555
### Multi-viewport
5656

57-
![](Images/LookDev2.png)
57+
![Buttons for changing the multi-viewport mode.](Images/LookDev2.png)
5858

5959
Use multiple viewports to compare different environments and settings for the same Asset. You can arrange viewports:
6060

@@ -73,23 +73,21 @@ When using multiple viewports, it only makes sense to compare different Prefabs
7373

7474
Vertical and horizontal side-by-side viewports show an identical view of your Asset.
7575

76-
![](Images/LookDev3.png)
76+
![Vertical side-by-side viewport view.](Images/LookDev3.png)
7777

7878
##### Split-screen
7979

8080
In a split-screen view, there is a red/blue manipulation Gizmo that separates the two viewports. For information on how to use this Gizmo, see [Using the manipulation Gizmo](#ManipulationGizmo).
8181

82-
![](Images/LookDev4.png)
82+
![Split-screen viewport view.](Images/LookDev4.png)
8383

8484
#### Multi-viewport Camera
8585

8686
By default, Look Dev synchronizes the camera movement for both views. To decouple the Cameras from one another, and manipulate them independently, click the **Synchronized Cameras** button in-between the two numbered Camera buttons.
8787

88-
![](Images/LookDev5.png)
89-
9088
To align the cameras with each other, or reset them, click on the drop-down arrow next to the viewport **2** icon:
9189

92-
![](Images/LookDev6.png)
90+
![Drop-down options of multi-viewport cameras.](Images/LookDev6.png)
9391

9492
<a name="ManipulationGizmo"></a>
9593

@@ -101,13 +99,11 @@ The manipulation Gizmo represents the separation plane between the two viewports
10199

102100
To move the separator, click and drag the straight line of the Gizmo to the location you want.
103101

104-
![](Images/LookDev7.png)
105-
106102
#### Changing the orientation and length
107103

108104
To change the orientation and length of the manipulator Gizmo, click and drag the circle at either end of the manipulator. Changing the length of the Gizmo lets you set the orientation and [blending](#Blending) values more precisely.
109105

110-
![](Images/LookDev8.png))
106+
![Click and drag the circle at either end of the gizmo to change its orientation and length.](Images/LookDev8.png)
111107

112108
#### Changing the split in increments
113109

@@ -121,7 +117,7 @@ The central white circle on the separator allows you to blend between the two vi
121117

122118
The white circle automatically snaps back into the center when you drag it back. This helps you get back to the default blending value quickly.
123119

124-
![](Images/LookDev9.png)
120+
![The white circle on the separator lets you change the blending behavior.](Images/LookDev9.png)
125121

126122
### HDRI environments in Look Dev
127123

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

+73-50
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,21 @@ namespace UnityEditor.Rendering
99
public partial class HeaderFoldout : Foldout
1010
{
1111
const string k_StylesheetPathFormat = "Packages/com.unity.render-pipelines.core/Editor/StyleSheets/HeaderFoldout{0}.uss";
12-
const string k_Class = "header-foldout";
13-
const string k_IconName = "header-foldout__icon";
12+
const string k_MainClass = "header-foldout";
13+
const string k_EnableClass = k_MainClass + "__enable";
14+
const string k_IconClass = k_MainClass + "__icon";
15+
const string k_LabelClass = k_MainClass + "__label";
16+
const string k_HelpButtonClass = k_MainClass + "__help-button";
17+
const string k_ContextButtonClass = k_MainClass + "__context-button";
1418

1519
private string m_DocumentationURL;
1620
private Texture2D m_Icon;
1721
private Func<GenericMenu> m_ContextMenuGenerator;
1822
private VisualElement m_HelpButton;
1923
private VisualElement m_ContextMenuButton;
2024
private VisualElement m_IconElement;
25+
private Toggle m_Toggle;
26+
private Label m_Text;
2127

2228
/// <summary>URL to use on documentation icon. If null, button don't show.</summary>
2329
public string documentationURL
@@ -61,92 +67,109 @@ public Texture2D icon
6167
m_IconElement.style.display = m_Icon != null ? DisplayStyle.Flex : DisplayStyle.None;
6268
}
6369
}
70+
71+
/// <summary>Property to get the enablement state</summary>
72+
public bool enabled
73+
{
74+
get => m_Toggle.value;
75+
set => m_Toggle.value = value;
76+
}
77+
78+
/// <summary>Property to get the enablement visibility state</summary>
79+
public bool showEnableCheckbox
80+
{
81+
get => m_Toggle.style.display == DisplayStyle.Flex;
82+
set => m_Toggle.style.display = value ? DisplayStyle.Flex : DisplayStyle.None;
83+
}
84+
85+
/// <summary>Quick access to the enable toggle if one need to register events</summary>
86+
public Toggle enableToggle => m_Toggle;
87+
88+
/// <summary>Property to get the title</summary>
89+
public new string text
90+
{
91+
get => m_Text.text;
92+
set => m_Text.text = value;
93+
}
6494

6595
/// <summary>Constructor</summary>
6696
public HeaderFoldout() : base()
6797
{
6898
styleSheets.Add(AssetDatabase.LoadAssetAtPath<StyleSheet>(string.Format(k_StylesheetPathFormat, "")));
6999
styleSheets.Add(AssetDatabase.LoadAssetAtPath<StyleSheet>(string.Format(k_StylesheetPathFormat, EditorGUIUtility.isProSkin ? "Dark" : "Light")));
70-
AddToClassList(k_Class);
100+
AddToClassList(k_MainClass);
71101

72102
RegisterCallback<AttachToPanelEvent>(DelayedInit);
73103

74104
var line = hierarchy[0][0]; //pass by herarchy to ignore content redirection
75105

106+
m_IconElement = new Image()
107+
{
108+
style =
109+
{
110+
display = DisplayStyle.None // hidden by default, will be enabled if icon is set
111+
}
112+
};
113+
m_IconElement.AddToClassList(k_IconClass);
114+
line.Add(m_IconElement);
115+
116+
m_Toggle = new Toggle()
117+
{
118+
value = true
119+
};
120+
m_Toggle.AddToClassList(k_EnableClass);
121+
m_Toggle.RegisterValueChangedCallback(HandleDisabling);
122+
m_Toggle.style.display = DisplayStyle.None; // hidden by default
123+
line.Add(m_Toggle);
124+
125+
m_Text = new Label();
126+
m_Text.AddToClassList(k_LabelClass);
127+
line.Add(m_Text);
128+
76129
m_HelpButton = new Button(Background.FromTexture2D(CoreEditorStyles.iconHelp), () => Help.BrowseURL(m_DocumentationURL));
130+
m_HelpButton.AddToClassList(k_HelpButtonClass);
77131
m_HelpButton.SetEnabled(!string.IsNullOrEmpty(m_DocumentationURL));
78132
line.Add(m_HelpButton);
79133

80-
m_ContextMenuButton =
81-
new Button(Background.FromTexture2D(CoreEditorStyles.paneOptionsIcon), () => ShowMenu())
82-
{
83-
style =
84-
{
85-
paddingRight = 2
86-
}
87-
};
88-
134+
m_ContextMenuButton = new Button(Background.FromTexture2D(CoreEditorStyles.paneOptionsIcon), () => ShowMenu());
135+
m_ContextMenuButton.AddToClassList(k_ContextButtonClass);
89136
m_ContextMenuButton.SetEnabled(m_ContextMenuGenerator != null);
90137
line.Add(m_ContextMenuButton);
91-
92-
m_IconElement = new Image();
93-
m_IconElement.name = k_IconName;
94-
m_IconElement.style.display = DisplayStyle.None; // Disable by default, will be enabled if icon is set
95-
// Delay insertion of icon to happen after foldout is constructed so we can put it in the right place
96-
RegisterCallbackOnce<AttachToPanelEvent>(evt => line.Insert(1, m_IconElement));
97138
}
98139

99140
void DelayedInit(AttachToPanelEvent evt)
100141
{
101142
//Only show top line if previous item is not a HeaderFoldout to avoid bolder border
102-
bool shouldShowTopLine = true;
103143
var parent = hierarchy.parent;
104144
int posInParent = parent.hierarchy.IndexOf(this);
105-
if (posInParent > 0 && parent[posInParent - 1].ClassListContains(k_Class))
106-
shouldShowTopLine = false;
145+
if (posInParent == 0 || !parent[posInParent - 1].ClassListContains(k_MainClass))
146+
AddToClassList("first-in-collection");
107147

108-
style.borderTopWidth = shouldShowTopLine ? 1 : 0;
148+
//fix to transfer label assigned in UXML from base label to new label
149+
if (!string.IsNullOrEmpty(base.text))
150+
{
151+
if (string.IsNullOrEmpty(m_Text.text))
152+
m_Text.text = base.text;
153+
base.text = null;
154+
}
109155
}
110156

111157
void ShowMenu()
112158
{
113159
var menu = m_ContextMenuGenerator.Invoke();
114160
menu.DropDown(new Rect(m_ContextMenuButton.worldBound.position + m_ContextMenuButton.worldBound.size.y * Vector2.up, Vector2.zero));
115161
}
162+
163+
void HandleDisabling(ChangeEvent<bool> evt)
164+
=> contentContainer.SetEnabled(evt.newValue);
116165
}
117166

118167
/// <summary> UITK component to display header styled foldout. This variant have an enable checkbox.</summary>
168+
[Obsolete("Please directly use HeaderFoldout now #from(6000.2) (UnityUpgradable) -> HeaderFoldout", false)]
119169
public class HeaderToggleFoldout : HeaderFoldout
120170
{
121-
private Toggle m_Toggle;
122-
123-
/// <summary>Property to get the enablement state</summary>
124-
public bool enabled
125-
{
126-
get => m_Toggle.value;
127-
set => m_Toggle.value = value;
128-
}
129-
130-
/// <summary>Quick access to the enable toggle if one need to register events</summary>
131-
public Toggle enableToggle => m_Toggle;
132-
133171
/// <summary>Constructor</summary>
134172
public HeaderToggleFoldout() : base()
135-
{
136-
var line = hierarchy[0][0]; //pass by herarchy to ignore content redirection
137-
m_Toggle = new Toggle()
138-
{
139-
value = true,
140-
name = "enable-checkbox",
141-
};
142-
143-
//Need to delay insertion as foldout will be constructed after and we need to squeeze rigth after
144-
RegisterCallbackOnce<AttachToPanelEvent>(evt => line.Insert(1, m_Toggle));
145-
146-
m_Toggle.RegisterValueChangedCallback(HandleDisabling);
147-
}
148-
149-
void HandleDisabling(ChangeEvent<bool> evt)
150-
=> contentContainer.SetEnabled(evt.newValue);
173+
=> showEnableCheckbox = true;
151174
}
152175
}

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

+5-1
Original file line numberDiff line numberDiff line change
@@ -1070,7 +1070,11 @@ unsafe static void WriteBakingCells(BakingCell[] bakingCells)
10701070

10711071
AssetDatabase.ImportAsset(cellDataFilename);
10721072
AssetDatabase.ImportAsset(cellOptionalDataFilename);
1073-
AssetDatabase.ImportAsset(cellProbeOcclusionDataFilename);
1073+
// If we did not write a probe occlusion file (because it was zero bytes), don't try to load it (UUM-101480)
1074+
if (probeOcclusion.Length > 0)
1075+
{
1076+
AssetDatabase.ImportAsset(cellProbeOcclusionDataFilename);
1077+
}
10741078
AssetDatabase.ImportAsset(cellBricksDataFilename);
10751079
AssetDatabase.ImportAsset(cellSharedDataFilename);
10761080
AssetDatabase.ImportAsset(cellSupportDataFilename);

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

+3-1
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,8 @@ void BakingGUI()
372372
{
373373
if (newSet != null) { EditorUtility.SetDirty(newSet); newSet.singleSceneMode = false; }
374374
activeSet = newSet;
375+
376+
ProbeReferenceVolume.instance.Clear();
375377
ProbeReferenceVolume.instance.SetActiveBakingSet(activeSet);
376378
}
377379

@@ -525,7 +527,7 @@ void UseTemporaryBakingSet(string sceneGUID, ProbeVolumeBakingSet set = null)
525527
set = ScriptableObject.CreateInstance<ProbeVolumeBakingSet>();
526528
set.SetDefaults();
527529

528-
ProbeReferenceVolume.instance.AddPendingSceneRemoval(sceneGUID);
530+
ProbeReferenceVolume.instance.Clear();
529531
}
530532

531533
EditorUtility.SetDirty(set);

Packages/com.unity.render-pipelines.core/Editor/Properties/AdvancedProperties.cs

+4-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,10 @@ public static bool BeginGroup(AnimFloat animation = null)
120120

121121
animation ??= s_AnimFloat;
122122

123-
GUI.color = Color.Lerp(CoreEditorStyles.backgroundColor * oldColor, CoreEditorStyles.backgroundHighlightColor, animation.value);
123+
Color transparent = CoreEditorStyles.backgroundHighlightColor;
124+
transparent.a = 0f;
125+
126+
GUI.color = Color.Lerp(transparent, CoreEditorStyles.backgroundHighlightColor, animation.value);
124127
EditorGUILayout.BeginVertical(CoreEditorStyles.additionalPropertiesHighlightStyle);
125128
GUI.color = oldColor;
126129

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

+5-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,11 @@ void InitializeSidePanel()
6666
rootVisualElement.RegisterCallback<GeometryChangedEvent>(_ =>
6767
{
6868
SaveSplitViewFixedPaneHeight(); // Window resized - save the current pane height
69-
UpdatePanelHeights();
69+
70+
// TwoPaneSplitView also updates draglineanchor offset using the same event, conflicting with what we
71+
// do here. Deferring our panel height update to next frame solves a bug with dragline "jumping" when
72+
// window is resized down vertically and the lower panel is already at minimum height.
73+
rootVisualElement.schedule.Execute(UpdatePanelHeights);
7074
});
7175

7276
var contentSplitView = rootVisualElement.Q<TwoPaneSplitView>(Names.kContentContainer);

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

+29-3
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ static partial class Names
3535
public const string kGridlineContainer = "grid-line-container";
3636
public const string kHoverOverlay = "hover-overlay";
3737
public const string kEmptyStateMessage = "empty-state-message";
38+
public const string kPassListCornerOccluder = "pass-list-corner-occluder";
3839
}
3940

4041
static partial class Classes
@@ -191,6 +192,7 @@ static void Init()
191192
{
192193
var window = GetWindow<RenderGraphViewer>();
193194
window.titleContent = new GUIContent("Render Graph Viewer");
195+
window.minSize = new Vector2(880f, 300f);
194196
}
195197

196198
[Flags]
@@ -1817,6 +1819,27 @@ void RebuildUI()
18171819
RebuildGraphViewerUI();
18181820
}
18191821

1822+
void RerouteWheelEvent(VisualElement source, VisualElement target)
1823+
{
1824+
source.RegisterCallback<WheelEvent>(evt =>
1825+
{
1826+
evt.StopImmediatePropagation();
1827+
1828+
// Need to create an intermediate Event to be able to call WheelEvent.GetPooled()
1829+
var imguiEvt = new Event {
1830+
type = EventType.ScrollWheel,
1831+
delta = new Vector2(evt.delta.x, evt.delta.y),
1832+
mousePosition = evt.mousePosition,
1833+
modifiers = evt.modifiers
1834+
};
1835+
using (var newEvt = WheelEvent.GetPooled(imguiEvt))
1836+
{
1837+
newEvt.target = target;
1838+
target.SendEvent(newEvt);
1839+
}
1840+
}, TrickleDown.TrickleDown);
1841+
}
1842+
18201843
// Initialize, register callbacks & manipulators etc. once
18211844
void InitializePersistentElements()
18221845
{
@@ -1881,9 +1904,12 @@ void InitializePersistentElements()
18811904
resourceGridScrollView.horizontalScroller.valueChanged += value =>
18821905
passListScrollView.scrollOffset = new Vector2(value, passListScrollView.scrollOffset.y);
18831906

1884-
// Disable mouse wheel on the scroll views that are synced to the resource grid
1885-
resourceListScrollView.RegisterCallback<WheelEvent>(evt => evt.StopImmediatePropagation(), TrickleDown.TrickleDown);
1886-
passListScrollView.RegisterCallback<WheelEvent>(evt => evt.StopImmediatePropagation(), TrickleDown.TrickleDown);
1907+
// Scroll views are synced to the resource grid, so we don't want them to scroll independently. To have
1908+
// consistent behavior, redirect the wheel events to the resource grid and let it handle them.
1909+
RerouteWheelEvent(resourceListScrollView, resourceGridScrollView);
1910+
RerouteWheelEvent(passListScrollView, resourceGridScrollView);
1911+
var passListCornerOccluder = rootVisualElement.Q<VisualElement>(Names.kPassListCornerOccluder);
1912+
RerouteWheelEvent(passListCornerOccluder, resourceGridScrollView);
18871913

18881914
InitializeSidePanel();
18891915
}

0 commit comments

Comments
 (0)