Skip to content

Commit e0297ce

Browse files
author
Unity Technologies
committed
Unity 2023.1.0a11 C# reference source code
1 parent 73c12b5 commit e0297ce

File tree

175 files changed

+3821
-4023
lines changed

Some content is hidden

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

175 files changed

+3821
-4023
lines changed

Editor/Mono/EditorSettings.bindings.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ public static bool enableCookiesInLightmapper
253253
#pragma warning restore 618
254254
}
255255

256+
[Obsolete("Bake with the Progressive Lightmapper.The backend that uses Enlighten to bake is obsolete.", true)]
256257
[StaticAccessor("GetEditorSettings()", StaticAccessorType.Dot)]
257258
public static extern bool enableEnlightenBakedGI { get; set; }
258259

Editor/Mono/EditorWindow.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ public VisualElement rootVisualElement
7171
}
7272

7373
internal virtual bool liveReloadPreferenceDefault => false;
74+
internal bool isUIToolkitWindow => m_UIRootElement != null && m_UIRootElement.childCount > 0;
7475

7576
[HideInInspector]
7677
[SerializeField]

Editor/Mono/GI/LightmapEditorSettings.bindings.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public enum Lightmapper
2222
[Obsolete("Use Lightmapper.ProgressiveCPU instead. (UnityUpgradable) -> UnityEditor.LightmapEditorSettings/Lightmapper.ProgressiveCPU", true)]
2323
Radiosity = 0,
2424
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
25-
[Obsolete("Use Lightmapper.ProgressiveCPU instead. (UnityUpgradable) -> UnityEditor.LightmapEditorSettings/Lightmapper.ProgressiveCPU", false)]
25+
[Obsolete("Use Lightmapper.ProgressiveCPU instead. (UnityUpgradable) -> UnityEditor.LightmapEditorSettings/Lightmapper.ProgressiveCPU", true)]
2626
Enlighten = 0,
2727
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
2828
[Obsolete("Use Lightmapper.ProgressiveCPU instead. (UnityUpgradable) -> UnityEditor.LightmapEditorSettings/Lightmapper.ProgressiveCPU", true)]
@@ -81,9 +81,6 @@ private static Lightmapper ConvertToOldLightmapperEnum(LightingSettings.Lightmap
8181
{
8282
switch (lightmapper)
8383
{
84-
case LightingSettings.Lightmapper.Enlighten:
85-
return Lightmapper.Enlighten;
86-
8784
case LightingSettings.Lightmapper.ProgressiveCPU:
8885
return Lightmapper.ProgressiveCPU;
8986

@@ -102,9 +99,6 @@ private static LightingSettings.Lightmapper ConvertToNewLightmapperEnum(Lightmap
10299
{
103100
switch (lightmapper)
104101
{
105-
case Lightmapper.Enlighten:
106-
return LightingSettings.Lightmapper.Enlighten;
107-
108102
case Lightmapper.ProgressiveCPU:
109103
return LightingSettings.Lightmapper.ProgressiveCPU;
110104

Editor/Mono/GameView/GameView.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,11 @@ private void DoToolbarGUI()
713713
{
714714
var typeNames = availableTypes.Values.ToList();
715715
var types = availableTypes.Keys.ToList();
716-
int viewIndex = EditorGUILayout.Popup(typeNames.IndexOf(titleContent.text), typeNames.ToArray(),
716+
var viewIndex = types.IndexOf(typeof(GameView));
717+
if (viewIndex == -1)
718+
viewIndex = 0;
719+
720+
viewIndex = EditorGUILayout.Popup(viewIndex, typeNames.ToArray(),
717721
EditorStyles.toolbarPopup,
718722
GUILayout.Width(90));
719723
EditorGUILayout.Space();

Editor/Mono/ImportSettings/TextureImporterInspector.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ internal class Styles
353353
};
354354
public readonly GUIContent spriteGenerateFallbackPhysicsShape = EditorGUIUtility.TrTextContent("Generate Physics Shape", "Generates a default physics shape from the outline of the Sprite/s when a physics shape has not been set in the Sprite Editor.");
355355

356-
public readonly GUIContent alphaIsTransparency = EditorGUIUtility.TrTextContent("Alpha Is Transparency", "If the provided alpha channel is transparency, enable this to pre-filter the color to avoid texture filtering artifacts. This is not supported for HDR textures.");
356+
public readonly GUIContent alphaIsTransparency = EditorGUIUtility.TrTextContent("Alpha Is Transparency", "If the alpha channel of your texture represents transparency, enable this property to dilate the color channels of visible texels into fully transparent areas. This effectively adds padding around transparent areas that prevents filtering artifacts from forming on their edges. Unity does not support this property for HDR textures. \n\nThis property makes the color data of invisible texels undefined. Disable this property to preserve invisible texels' original color data.");
357357

358358
public readonly GUIContent showAdvanced = EditorGUIUtility.TrTextContent("Advanced", "Show advanced settings.");
359359

Editor/Mono/Inspector/EditorSettingsInspector.cs

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ class Content
5454
public static GUIContent showLightmapResolutionOverlay = EditorGUIUtility.TrTextContent("Show Lightmap Resolution Overlay");
5555
public static GUIContent useLegacyProbeSampleCount = EditorGUIUtility.TrTextContent("Use legacy Light Probe sample counts", "Uses fixed Light Probe sample counts for baking with the Progressive Lightmapper. The sample counts are: 64 direct samples, 2048 indirect samples and 2048 environment samples.");
5656
public static GUIContent enableCookiesInLightmapper = EditorGUIUtility.TrTextContent("Enable baked cookies support", "Determines whether cookies should be evaluated by the Progressive Lightmapper during Global Illumination calculations. Introduced in version 2020.1. ");
57-
public static GUIContent enableEnlightenLightmapping = EditorGUIUtility.TrTextContent("Enable Enlighten for Baked GI (Legacy)", "Enable the Enlighten backend for Baked GI lightmaps. This is a deprecated feature that is no longer available in 2023.1 and later.");
5857

5958
public static GUIContent spritePacker = EditorGUIUtility.TrTextContent("Sprite Packer");
6059
public static readonly GUIContent spriteMaxCacheSize = EditorGUIUtility.TrTextContent("Max SpriteAtlas Cache Size (GB)", "The size of the Sprite Atlas Cache folder will be kept below this maximum value when possible. Change requires Editor restart.");
@@ -260,7 +259,6 @@ public PopupElement(string id, string content)
260259
SerializedProperty m_PrefabModeAllowAutoSave;
261260
SerializedProperty m_UseLegacyProbeSampleCount;
262261
SerializedProperty m_DisableCookiesInLightmapper;
263-
SerializedProperty m_EnableEnlightenBakedGI;
264262
SerializedProperty m_SpritePackerMode;
265263
SerializedProperty m_SpritePackerCacheSize;
266264
SerializedProperty m_Bc7TextureCompressor;
@@ -329,9 +327,6 @@ public void OnEnable()
329327
m_DisableCookiesInLightmapper = serializedObject.FindProperty("m_DisableCookiesInLightmapper");
330328
Assert.IsNotNull(m_DisableCookiesInLightmapper);
331329

332-
m_EnableEnlightenBakedGI = serializedObject.FindProperty("m_EnableEnlightenBakedGI");
333-
Assert.IsNotNull(m_EnableEnlightenBakedGI);
334-
335330
m_SpritePackerMode = serializedObject.FindProperty("m_SpritePackerMode");
336331
Assert.IsNotNull(m_SpritePackerMode);
337332

@@ -567,33 +562,6 @@ public override void OnInspectorGUI()
567562
}
568563
EditorGUI.EndProperty();
569564

570-
#pragma warning disable 618
571-
if (UnityEngine.Rendering.SupportedRenderingFeatures.active.enlightenLightmapper)
572-
{
573-
EditorGUI.BeginChangeCheck();
574-
EditorGUILayout.PropertyField(m_EnableEnlightenBakedGI, Content.enableEnlightenLightmapping);
575-
if (EditorGUI.EndChangeCheck())
576-
{
577-
if (!m_EnableEnlightenBakedGI.boolValue
578-
&& Lightmapping.lightingSettings.lightmapper == LightingSettings.Lightmapper.Enlighten)
579-
{
580-
bool isAppleSiliconEditor = SystemInfo.processorType.Contains("Apple") && !EditorUtility.IsRunningUnderCPUEmulation();
581-
582-
Lightmapping.lightingSettings.lightmapper = isAppleSiliconEditor ?
583-
LightingSettings.Lightmapper.ProgressiveGPU :
584-
LightingSettings.Lightmapper.ProgressiveCPU;
585-
}
586-
587-
if (m_IsGlobalSettings)
588-
{
589-
EditorSettings.enableEnlightenBakedGI = m_EnableEnlightenBakedGI.boolValue;
590-
}
591-
592-
EditorApplication.RequestRepaintAllViews();
593-
}
594-
}
595-
#pragma warning restore 618
596-
597565
GUILayout.Space(10);
598566

599567
GUI.enabled = true;

Editor/Mono/Inspector/Enlighten/LightmapParameters.cs

Lines changed: 14 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,12 @@ class LightmapParametersEditor : Editor
2222
SerializedProperty m_SystemTag;
2323
SerializedProperty m_IsTransparent;
2424

25-
SerializedProperty m_AOQuality;
26-
SerializedProperty m_AOAntiAliasingSamples;
27-
SerializedProperty m_BlurRadius;
2825
SerializedProperty m_Pushoff;
2926
SerializedProperty m_BakedLightmapTag;
3027
SerializedProperty m_LimitLightmapCount;
3128
SerializedProperty m_LightmapMaxCount;
3229

3330
SerializedProperty m_AntiAliasingSamples;
34-
SerializedProperty m_DirectLightQuality;
3531

3632
SavedBool m_RealtimeGISettings;
3733
SavedBool m_BakedGISettings;
@@ -48,11 +44,7 @@ public void OnEnable()
4844
m_EdgeStitching = serializedObject.FindProperty("edgeStitching");
4945
m_IsTransparent = serializedObject.FindProperty("isTransparent");
5046
m_SystemTag = serializedObject.FindProperty("systemTag");
51-
m_AOQuality = serializedObject.FindProperty("AOQuality");
52-
m_AOAntiAliasingSamples = serializedObject.FindProperty("AOAntiAliasingSamples");
53-
m_BlurRadius = serializedObject.FindProperty("blurRadius");
5447
m_AntiAliasingSamples = serializedObject.FindProperty("antiAliasingSamples");
55-
m_DirectLightQuality = serializedObject.FindProperty("directLightQuality");
5648
m_BakedLightmapTag = serializedObject.FindProperty("bakedLightmapTag");
5749
m_Pushoff = serializedObject.FindProperty("pushoff");
5850
m_LimitLightmapCount = serializedObject.FindProperty("limitLightmapCount");
@@ -99,86 +91,23 @@ public override void OnInspectorGUI()
9991
}
10092
}
10193

102-
// baked settings
103-
m_BakedGISettings.value = EditorGUILayout.FoldoutTitlebar(m_BakedGISettings.value, Styles.bakedGIContent, true);
104-
if (m_BakedGISettings.value)
105-
{
106-
#pragma warning disable 618
107-
bool usesPathTracerBakeBackend = Lightmapping.GetLightingSettingsOrDefaultsFallback().lightmapper != LightingSettings.Lightmapper.Enlighten;
108-
bool usesEnlightenBackend = Lightmapping.GetLightingSettingsOrDefaultsFallback().lightmapper == LightingSettings.Lightmapper.Enlighten;
109-
bool bakedEnlightenSupported = SupportedRenderingFeatures.IsLightmapperSupported((int)LightingSettings.Lightmapper.Enlighten) && EditorSettings.enableEnlightenBakedGI;
110-
#pragma warning restore 618
111-
112-
++EditorGUI.indentLevel;
113-
114-
// General
115-
EditorGUILayout.LabelField(Styles.generalLabel, EditorStyles.boldLabel);
116-
117-
++EditorGUI.indentLevel;
118-
119-
EditorGUILayout.PropertyField(m_AntiAliasingSamples, Styles.antiAliasingSamplesContent);
120-
const float minPushOff = 0.0001f; // Keep in sync with PLM_MIN_PUSHOFF
121-
EditorGUILayout.Slider(m_Pushoff, minPushOff, 1.0f, Styles.pushoffContent);
122-
EditorGUILayout.PropertyField(m_BakedLightmapTag, Styles.bakedLightmapTagContent);
123-
EditorGUILayout.Space();
124-
125-
--EditorGUI.indentLevel;
126-
127-
// Progressive Lightmapper
128-
using (new EditorGUI.DisabledScope(usesEnlightenBackend))
129-
{
130-
EditorGUILayout.LabelField(Styles.progressiveLabel, EditorStyles.boldLabel);
131-
132-
++EditorGUI.indentLevel;
133-
134-
m_LimitLightmapCount.boolValue = EditorGUILayout.Toggle(Styles.limitLightmapCount, m_LimitLightmapCount.boolValue);
135-
if (m_LimitLightmapCount.boolValue)
136-
{
137-
++EditorGUI.indentLevel;
138-
EditorGUILayout.PropertyField(m_LightmapMaxCount, Styles.lightmapMaxCount);
139-
--EditorGUI.indentLevel;
140-
}
141-
EditorGUILayout.Space();
142-
143-
--EditorGUI.indentLevel;
144-
}
145-
146-
// Enlighten
147-
if (bakedEnlightenSupported)
148-
{
149-
using (new EditorGUI.DisabledScope(usesPathTracerBakeBackend))
150-
{
151-
EditorGUILayout.LabelField(Styles.enlightenLabel, EditorStyles.boldLabel);
152-
153-
++EditorGUI.indentLevel;
154-
155-
EditorGUILayout.PropertyField(m_BlurRadius, Styles.blurRadiusContent);
156-
EditorGUILayout.PropertyField(m_DirectLightQuality, Styles.directLightQualityContent);
157-
158-
EditorGUILayout.LabelField(Styles.bakedAOContent);
159-
++EditorGUI.indentLevel;
160-
EditorGUILayout.PropertyField(m_AOQuality, Styles.aoQualityContent);
161-
EditorGUILayout.PropertyField(m_AOAntiAliasingSamples, Styles.aoAntiAliasingSamplesContent);
162-
--EditorGUI.indentLevel;
163-
164-
EditorGUILayout.Space();
94+
GUILayout.Label(Styles.bakedGIContent, EditorStyles.boldLabel);
16595

166-
--EditorGUI.indentLevel;
167-
}
168-
}
169-
170-
--EditorGUI.indentLevel;
171-
}
172-
173-
m_GeneralParametersSettings.value = EditorGUILayout.FoldoutTitlebar(m_GeneralParametersSettings.value, Styles.generalGIContent, true);
174-
if (m_GeneralParametersSettings.value)
96+
EditorGUILayout.PropertyField(m_AntiAliasingSamples, Styles.antiAliasingSamplesContent);
97+
const float minPushOff = 0.0001f; // Keep in sync with PLM_MIN_PUSHOFF
98+
EditorGUILayout.Slider(m_Pushoff, minPushOff, 1.0f, Styles.pushoffContent);
99+
EditorGUILayout.PropertyField(m_BakedLightmapTag, Styles.bakedLightmapTagContent);
100+
m_LimitLightmapCount.boolValue = EditorGUILayout.Toggle(Styles.limitLightmapCount, m_LimitLightmapCount.boolValue);
101+
if (m_LimitLightmapCount.boolValue)
175102
{
176-
++EditorGUI.indentLevel;
177-
178-
EditorGUILayout.Slider(m_BackFaceTolerance, 0.0f, 1.0f, Styles.backFaceToleranceContent);
179-
180-
--EditorGUI.indentLevel;
103+
EditorGUI.indentLevel++;
104+
EditorGUILayout.PropertyField(m_LightmapMaxCount, Styles.lightmapMaxCount);
105+
EditorGUI.indentLevel--;
181106
}
107+
EditorGUILayout.Space();
108+
109+
GUILayout.Label(Styles.generalGIContent, EditorStyles.boldLabel);
110+
EditorGUILayout.Slider(m_BackFaceTolerance, 0.0f, 1.0f, Styles.backFaceToleranceContent);
182111

183112
serializedObject.ApplyModifiedProperties();
184113
}
@@ -202,12 +131,7 @@ private class Styles
202131
public static readonly GUIContent edgeStitchingContent = EditorGUIUtility.TrTextContent("Edge Stitching", "If enabled, ensures that UV charts (aka UV islands) in the generated lightmaps blend together where they meet so there is no visible seam between them.");
203132
public static readonly GUIContent systemTagContent = EditorGUIUtility.TrTextContent("System Tag", "Systems are groups of objects whose lightmaps are in the same atlas. It is also the granularity at which dependencies are calculated. Multiple systems are created automatically if the scene is big enough, but it can be helpful to be able to split them up manually for e.g. streaming in sections of a level. The system tag lets you force an object into a different realtime system even though all the other parameters are the same.");
204133
public static readonly GUIContent bakedGIContent = EditorGUIUtility.TrTextContent("Baked Global Illumination", "Settings used in Baked Global Illumination where direct and indirect lighting for static objects is precalculated and saved (baked) into lightmaps for use at runtime. This is useful when lights are known to be static, for mobile, for low end devices and other situations where there is not enough processing power to use Precomputed Realtime GI. You can toggle on each light whether it should be included in the bake."); // Reuse the label from the Lighting window
205-
public static readonly GUIContent blurRadiusContent = EditorGUIUtility.TrTextContent("Blur Radius", "The radius (in texels) of the post-processing filter that blurs baked direct lighting. This reduces aliasing artefacts and produces softer shadows.");
206134
public static readonly GUIContent antiAliasingSamplesContent = EditorGUIUtility.TrTextContent("Anti-aliasing Samples", "The maximum number of times to supersample a texel to reduce aliasing. Progressive lightmapper supersamples the positions and normals buffers (part of the G-buffer) and hence the sample count is a multiplier on the amount of memory used for those buffers. Progressive lightmapper clamps the value to the [1;16] range.");
207-
public static readonly GUIContent directLightQualityContent = EditorGUIUtility.TrTextContent("Direct Light Quality", "The number of rays used for lights with an area. Allows for accurate soft shadowing.");
208-
public static readonly GUIContent bakedAOContent = EditorGUIUtility.TrTextContent("Ambient Occlusion", "Settings used in Baked Ambient Occlusion, where the information on dark corners and crevices in static geometry is baked. It is multiplied by indirect lighting when compositing the baked lightmap.");
209-
public static readonly GUIContent aoQualityContent = EditorGUIUtility.TrTextContent("Quality", "The number of rays to cast for computing ambient occlusion.");
210-
public static readonly GUIContent aoAntiAliasingSamplesContent = EditorGUIUtility.TrTextContent("Anti-aliasing Samples", "The maximum number of times to supersample a texel to reduce aliasing in ambient occlusion.");
211135
public static readonly GUIContent isTransparent = EditorGUIUtility.TrTextContent("Is Transparent", "If enabled, the object appears transparent during GlobalIllumination lighting calculations. Backfaces are not contributing to and light travels through the surface. This is useful for emissive invisible surfaces.");
212136
public static readonly GUIContent pushoffContent = EditorGUIUtility.TrTextContent("Pushoff", "The amount to push off geometry for ray tracing, in modelling units. It is applied to all baked light maps, so it will affect direct light, indirect light and AO. Useful for getting rid of unwanted AO or shadowing.");
213137
public static readonly GUIContent bakedLightmapTagContent = EditorGUIUtility.TrTextContent("Baked Tag", "An integer that lets you force an object into a different baked lightmap even though all the other parameters are the same. This can be useful e.g. when streaming in sections of a level.");

0 commit comments

Comments
 (0)