Skip to content

Commit 5e328f0

Browse files
author
Unity Technologies
committed
Unity 6000.0.22f1 C# reference source code
1 parent a9c1652 commit 5e328f0

File tree

70 files changed

+2446
-192
lines changed

Some content is hidden

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

70 files changed

+2446
-192
lines changed

Editor/Mono/BuildProfile/BuildProfile.cs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ namespace UnityEditor.Build.Profile
2222
[HelpURL("build-profiles-reference")]
2323
public sealed partial class BuildProfile : ScriptableObject
2424
{
25+
/// <summary>
26+
/// Asset Schema Version
27+
/// </summary>
28+
[SerializeField]
29+
uint m_AssetVersion = 1;
30+
2531
/// <summary>
2632
/// Build Target used to fetch module and build profile extension.
2733
/// </summary>
@@ -78,6 +84,17 @@ internal BuildProfilePlatformSettingsBase platformBuildProfile
7884
set => m_PlatformBuildProfile = value;
7985
}
8086

87+
/// <summary>
88+
/// When set, this build profiles <see cref="scenes"/> used when building.
89+
/// </summary>
90+
/// <seealso cref="EditorBuildSettings"/>
91+
[SerializeField] private bool m_OverrideGlobalSceneList = false;
92+
internal bool overrideGlobalSceneList
93+
{
94+
get => m_OverrideGlobalSceneList;
95+
set => m_OverrideGlobalSceneList = value;
96+
}
97+
8198
/// <summary>
8299
/// List of scenes specified in the build profile.
83100
/// </summary>
@@ -97,7 +114,7 @@ public EditorBuildSettingsScene[] scenes
97114
m_Scenes = value;
98115
CheckSceneListConsistency();
99116

100-
if (this == BuildProfileContext.activeProfile)
117+
if (this == BuildProfileContext.activeProfile && m_OverrideGlobalSceneList)
101118
EditorBuildSettings.SceneListChanged();
102119
}
103120
}
@@ -202,7 +219,7 @@ void OnEnable()
202219

203220
void OnDisable()
204221
{
205-
if (IsActiveBuildProfileOrPlatform())
222+
if (BuildProfileContext.activeProfile == this)
206223
EditorUserBuildSettings.SetActiveProfileScriptingDefines(m_ScriptingDefines);
207224

208225
var playerSettingsDirty = EditorUtility.IsDirty(m_PlayerSettings);

Editor/Mono/BuildTargetDiscovery.bindings.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,6 @@ internal static bool DoesBuildTargetSupportSinglePassStereoRendering(BuildTarget
349349
s_platform_43,
350350
s_platform_45,
351351
s_platform_46,
352-
s_platform_47,
353352
s_platform_48,
354353
};
355354

Editor/Mono/EditorBuildSettings.bindings.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ public static EditorBuildSettingsScene[] scenes
8686
{
8787
get
8888
{
89-
if (BuildProfileContext.activeProfile is not null)
89+
if (BuildProfileContext.activeProfile is not null
90+
&& BuildProfileContext.activeProfile.overrideGlobalSceneList)
9091
{
9192
return BuildProfileContext.activeProfile.scenes;
9293
}
@@ -95,7 +96,8 @@ public static EditorBuildSettingsScene[] scenes
9596
}
9697
set
9798
{
98-
if (BuildProfileContext.activeProfile is not null)
99+
if (BuildProfileContext.activeProfile is not null
100+
&& BuildProfileContext.activeProfile.overrideGlobalSceneList)
99101
{
100102
BuildProfileContext.activeProfile.scenes = value;
101103
}
@@ -109,7 +111,9 @@ public static EditorBuildSettingsScene[] scenes
109111
[RequiredByNativeCode]
110112
static EditorBuildSettingsScene[] GetActiveBuildProfileSceneList()
111113
{
112-
if (!EditorUserBuildSettings.isBuildProfileAvailable || BuildProfileContext.activeProfile is null)
114+
if (!EditorUserBuildSettings.isBuildProfileAvailable
115+
|| BuildProfileContext.activeProfile is null
116+
|| !BuildProfileContext.activeProfile.overrideGlobalSceneList)
113117
return null;
114118

115119
return BuildProfileContext.activeProfile.scenes;

Editor/Mono/EditorWindow.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,6 +1081,12 @@ public void Close()
10811081
if (WindowLayout.IsMaximized(this))
10821082
WindowLayout.Unmaximize(this);
10831083

1084+
// [UUM-58449] If the focused window got closed, reset the IME composition mode to the default value. The normal codepaths may not run since this object is immediately destroyed.
1085+
if (focusedWindow == this)
1086+
{
1087+
GUIUtility.imeCompositionMode = IMECompositionMode.Auto;
1088+
}
1089+
10841090
DockArea da = m_Parent as DockArea;
10851091
if (da)
10861092
{

Editor/Mono/GI/Lightmapping.bindings.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,13 @@ public enum GIWorkflowMode
100100
Legacy = 2
101101
}
102102

103+
[NativeHeader("Runtime/Graphics/LightmapSettings.h")]
104+
public enum BakeOnSceneLoadMode
105+
{
106+
Never = 0,
107+
IfMissingLightingData = 1,
108+
};
109+
103110
// Obsolete, please use Actions instead
104111
public delegate void OnStartedFunction();
105112
public delegate void OnCompletedFunction();
@@ -447,6 +454,9 @@ public static void Tetrahedralize(Vector3[] positions, out int[] outIndices, out
447454
[FreeFunction]
448455
public static extern void GetTerrainGIChunks([NotNull] Terrain terrain, ref int numChunksX, ref int numChunksY);
449456

457+
[StaticAccessor("GetLightmapSettings()")]
458+
public static extern BakeOnSceneLoadMode bakeOnSceneLoad { get; set; }
459+
450460
[StaticAccessor("GetLightmapSettings()")]
451461
public static extern LightingDataAsset lightingDataAsset { get; set; }
452462

Editor/Mono/GUI/EditorStyles.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,9 @@ public sealed class EditorStyles
257257
public static GUIStyle inspectorDefaultMargins { get { return s_Current.m_InspectorDefaultMargins; } }
258258
private GUIStyle m_InspectorDefaultMargins;
259259

260+
internal static GUIStyle inspectorHorizontalDefaultMargins => s_Current.m_InspectorHorizontalDefaultMargins;
261+
private GUIStyle m_InspectorHorizontalDefaultMargins;
262+
260263
public static GUIStyle inspectorFullWidthMargins { get { return s_Current.m_InspectorFullWidthMargins; } }
261264
private GUIStyle m_InspectorFullWidthMargins;
262265

@@ -564,6 +567,11 @@ private void InitSharedStyles()
564567
padding = new RectOffset(kInspectorPaddingLeft, kInspectorPaddingRight, kInspectorPaddingTop, 0)
565568
};
566569

570+
m_InspectorHorizontalDefaultMargins = new GUIStyle
571+
{
572+
padding = new RectOffset(kInspectorPaddingLeft, kInspectorPaddingRight, 0, 0)
573+
};
574+
567575
// For the full width margins, use padding from right side in both sides,
568576
// though adjust for overdraw by adding one in left side to get even margins.
569577
m_InspectorFullWidthMargins = new GUIStyle

Editor/Mono/Inspector/Core/ScriptAttributeGUI/PropertyHandler.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -300,11 +300,7 @@ internal bool OnGUI(Rect position, SerializedProperty property, GUIContent label
300300
if (childrenAreExpanded)
301301
{
302302
SerializedProperty endProperty = prop.GetEndProperty();
303-
// Children need to be indented
304-
int prevIndent = EditorGUI.indentLevel;
305-
EditorGUI.indentLevel++;
306-
position = EditorGUI.IndentedRect(position);
307-
EditorGUI.indentLevel = prevIndent;
303+
308304
while (prop.NextVisible(childrenAreExpanded) && !SerializedProperty.EqualContents(prop, endProperty))
309305
{
310306
if (GUI.isInsideList && prop.depth <= EditorGUI.GetInsideListDepth())

Editor/Mono/Overlays/Overlay.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -766,6 +766,11 @@ internal void ToggleCollapsedPopup()
766766
m_ModalPopup.Focus();
767767
}
768768

769+
public void RefreshPopup()
770+
{
771+
m_ModalPopup?.Refresh();
772+
}
773+
769774
void ClosePopup()
770775
{
771776
m_ModalPopup?.RemoveFromHierarchy();

Editor/Mono/Overlays/OverlayPopup.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,26 @@ class OverlayPopup : VisualElement
3333
AddToClassList(Overlay.ussClassName);
3434
style.position = Position.Absolute;
3535

36+
Refresh();
37+
38+
RegisterCallback<MouseEnterEvent>(evt => m_CursorIsOverPopup = true);
39+
RegisterCallback<MouseLeaveEvent>(evt => m_CursorIsOverPopup = false);
40+
}
41+
42+
public void Refresh()
43+
{
3644
var root = this.Q("overlay-content");
45+
46+
root.Clear();
47+
3748
root.renderHints = RenderHints.ClipWithScissors;
49+
style.maxHeight = StyleKeyword.Initial;
50+
style.maxWidth = StyleKeyword.Initial;
51+
3852
root.Add(overlay.GetSimpleHeader());
3953
root.Add(overlay.CreatePanelContent());
4054

41-
RegisterCallback<MouseEnterEvent>(evt => m_CursorIsOverPopup = true);
42-
RegisterCallback<MouseLeaveEvent>(evt => m_CursorIsOverPopup = false);
55+
root.Focus();
4356
}
4457

4558
public static OverlayPopup CreateUnderOverlay(Overlay overlay)

Editor/Mono/PlayerSettingsVulkan.bindings.cs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,27 @@ namespace UnityEditor
1010
public partial class PlayerSettings : UnityEngine.Object
1111
{
1212
public static extern bool vulkanEnableSetSRGBWrite { get; set; }
13-
public static extern UInt32 vulkanNumSwapchainBuffers { get; set; }
13+
14+
private static extern UInt32 GetVulkanNumSwapchainBuffersImpl();
15+
private static extern void SetVulkanNumSwapchainBuffersImpl(UInt32 value);
16+
17+
// NOTE: While in the editor, changing this value can be destructive so we force 3 swapchain buffers while running in the editor.
18+
public static UInt32 vulkanNumSwapchainBuffers
19+
{
20+
get
21+
{
22+
// Must match the value PlayerSettings::kFixedEditorVulkanSwapchainBufferCount in native code,
23+
// explicitly report the current value being used.
24+
const UInt32 kFixedEditorVulkanSwapchainBufferCount = 3;
25+
if (EditorApplication.isPlaying)
26+
return kFixedEditorVulkanSwapchainBufferCount;
27+
else
28+
return GetVulkanNumSwapchainBuffersImpl();
29+
}
30+
31+
set => SetVulkanNumSwapchainBuffersImpl(value);
32+
}
33+
1434
public static extern bool vulkanEnableLateAcquireNextImage { get; set; }
1535

1636
[Obsolete("Vulkan SW command buffers are deprecated, vulkanUseSWCommandBuffers will be ignored.")]

Editor/Mono/SceneModeWindows/LightingWindow.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ static class Styles
3939
public static readonly GUIContent progressiveGPUChangeWarning = EditorGUIUtility.TrTextContent("Changing the compute device used by the Progressive GPU Lightmapper requires the editor to be relaunched. Do you want to change device and restart?");
4040
public static readonly GUIContent gpuBakingProfile = EditorGUIUtility.TrTextContent("GPU Baking Profile", "The profile chosen for trading off between performance and memory usage when baking using the GPU.");
4141

42+
public static readonly GUIContent bakeOnSceneLoad = EditorGUIUtility.TrTextContent("Bake On Scene Load", "Whether to automatically generate lighting for Scenes that do not have valid lighting data when first opened.");
43+
4244
public static readonly GUIContent invalidEnvironmentLabel = EditorGUIUtility.TrTextContentWithIcon("Baked environment lighting does not match the current Scene state. Generate Lighting to update this.", MessageType.Warning);
4345
public static readonly GUIContent unsupportedDenoisersLabel = EditorGUIUtility.TrTextContentWithIcon("Unsupported denoiser selected", MessageType.Error);
4446

@@ -539,6 +541,16 @@ void DrawBakingProfileSelector()
539541
}
540542
}
541543

544+
void DrawBakeOnLoadSelector()
545+
{
546+
var selected = (Lightmapping.BakeOnSceneLoadMode)EditorGUILayout.EnumPopup(Styles.bakeOnSceneLoad, Lightmapping.bakeOnSceneLoad);
547+
if (selected != Lightmapping.bakeOnSceneLoad)
548+
{
549+
Undo.RecordObject(LightmapEditorSettings.GetLightmapSettings(), "Change Bake On Load Setting");
550+
Lightmapping.bakeOnSceneLoad = selected;
551+
}
552+
}
553+
542554
void DrawBottomBarGUI(Mode selectedMode)
543555
{
544556
using (new EditorGUI.DisabledScope(EditorApplication.isPlayingOrWillChangePlaymode))
@@ -552,6 +564,7 @@ void DrawBottomBarGUI(Mode selectedMode)
552564
// Bake settings.
553565
DrawGPUDeviceSelector();
554566
DrawBakingProfileSelector();
567+
DrawBakeOnLoadSelector();
555568

556569
{
557570
// Bake button if we are not currently baking

Editor/Mono/SceneView/SceneView.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2459,6 +2459,10 @@ void HandleViewToolCursor(Rect cameraRect)
24592459
{
24602460
if (!Tools.viewToolActive || Event.current.type != EventType.Repaint)
24612461
return;
2462+
// In case multiple scene views are opened, we only want to set the cursor for the one being hovered
2463+
// Skip if the mouse is over an overlay or an area that should not use a custom cursor
2464+
if (mouseOverWindow is SceneView view && (mouseOverWindow != this || !view.sceneViewMotion.viewportsUnderMouse))
2465+
return;
24622466

24632467
var cursor = MouseCursor.Arrow;
24642468
switch (Tools.viewTool)
@@ -3012,13 +3016,6 @@ void HandleMouseCursor()
30123016
bool repaintView = false;
30133017
MouseCursor cursor = MouseCursor.Arrow;
30143018

3015-
//Reset the cursor if the mouse is over an overlay or an area that should not use a custom cursor
3016-
if (mouseOverWindow is SceneView view && !view.sceneViewMotion.viewportsUnderMouse)
3017-
{
3018-
InternalEditorUtility.ResetCursor();
3019-
return;
3020-
}
3021-
30223019
foreach (CursorRect r in s_MouseRects)
30233020
{
30243021
if (r.rect.Contains(evt.mousePosition))

0 commit comments

Comments
 (0)