Skip to content

Commit 8f0516b

Browse files
author
Unity Technologies
committed
Unity 2023.3.0b2 C# reference source code
1 parent 2d9918c commit 8f0516b

File tree

182 files changed

+1188
-306
lines changed

Some content is hidden

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

182 files changed

+1188
-306
lines changed

Editor/Mono/AssetDatabase/AssetDatabaseSearching.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using System.Collections.Generic;
88
using UnityEditor.Utils;
99
using UnityEngine;
10+
using UnityEngine.Bindings;
1011
using Object = UnityEngine.Object;
1112

1213
namespace UnityEditor
@@ -36,6 +37,7 @@ internal static string[] FindAssets(SearchFilter searchFilter)
3637
return FindAllAssets(searchFilter).Select(property => property.guid).Distinct().ToArray();
3738
}
3839

40+
[VisibleToOtherModules("UnityEditor.UIBuilderModule")]
3941
internal static IEnumerable<HierarchyProperty> FindAllAssets(SearchFilter searchFilter)
4042
{
4143
var enumerator = EnumerateAllAssets(searchFilter);

Editor/Mono/ContainerWindow.bindings.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
namespace UnityEditor
99
{
1010
// How ContainerWindows are visualized. Used with ContainerWindow.Show
11+
[VisibleToOtherModules("UnityEditor.UIBuilderModule")]
1112
internal enum ShowMode
1213
{
1314
// Show as a normal window with max, min & close buttons.

Editor/Mono/ContainerWindow.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@
1111
using UnityEngine.Pool;
1212
using UnityEngine.Scripting;
1313
using UnityEditorInternal;
14+
using UnityEngine.Bindings;
1415

1516
namespace UnityEditor
1617
{
1718
[StructLayout(LayoutKind.Sequential)]
19+
[VisibleToOtherModules("UnityEditor.UIBuilderModule")]
1820
internal partial class ContainerWindow : ScriptableObject
1921
{
2022
[SerializeField] MonoReloadableIntPtr m_WindowPtr;

Editor/Mono/EditorApplication.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
using UnityEditor.Profiling;
1717
using UnityEditor.SceneManagement;
1818
using UnityEditor.VersionControl;
19+
using UnityEngine.Bindings;
1920
using UnityEngine.Profiling;
2021

2122
namespace UnityEditor
@@ -245,6 +246,7 @@ public static event Action projectChanged
245246

246247
internal static CallbackFunction assetBundleNameChanged;
247248

249+
[VisibleToOtherModules("UnityEditor.UIBuilderModule")]
248250
internal static CallbackFunction fileMenuSaved;
249251

250252
// Delegate for changed keyboard modifier keys.
@@ -353,7 +355,7 @@ internal static ApplicationTitleDescriptor GetApplicationTitleDescriptor()
353355
activeSceneName,
354356
BuildPipeline.GetBuildTargetGroupDisplayName(BuildPipeline.GetBuildTargetGroup(EditorUserBuildSettings.activeBuildTarget)),
355357
Coverage.enabled
356-
);
358+
);
357359
}
358360
else
359361
{

Editor/Mono/EditorGUI.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
using Unity.Profiling;
2626
using UnityEngine.Experimental.Rendering;
2727
using UnityEngine.UIElements;
28+
using UnityEditor.UIElements;
29+
using UnityEngine.Bindings;
2830

2931
namespace UnityEditor
3032
{
@@ -4501,6 +4503,7 @@ private static bool ValidateObjectReferenceValue(SerializedProperty property, Ob
45014503
return property.ValidateObjectReferenceValue(obj);
45024504
}
45034505

4506+
[VisibleToOtherModules("UnityEditor.UIBuilderModule")]
45044507
internal static Object ValidateObjectFieldAssignment(Object[] references, Type objType, SerializedProperty property, ObjectFieldValidatorOptions options)
45054508
{
45064509
if (references.Length > 0)

Editor/Mono/EditorGUIUtility.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
using UnityEditor.StyleSheets;
1919
using UnityEditor.Experimental;
2020
using UnityEditor.SceneManagement;
21+
using UnityEngine.Bindings;
2122
using UnityEngine.Pool;
2223
using UnityEngine.UIElements;
2324
using UnityObject = UnityEngine.Object;
@@ -783,6 +784,7 @@ internal static Texture2D LoadIconRequired(string name)
783784

784785
// Automatically loads version of icon that matches current skin.
785786
// Equivalent to Texture2DNamed in ObjectImages.cpp
787+
[VisibleToOtherModules("UnityEditor.UIBuilderModule")]
786788
internal static Texture2D LoadIcon(string name)
787789
{
788790
return LoadIconForSkin(name, skinIndex);

Editor/Mono/EditorWindow.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
using SerializableJsonDictionary = UnityEditor.UIElements.SerializableJsonDictionary;
1414
using UnityEngine.UIElements;
1515
using UnityEditor.UIElements;
16+
using UnityEngine.Bindings;
1617

1718
namespace UnityEditor
1819
{
@@ -52,7 +53,11 @@ internal DataModeController GetDataModeController_Internal() // For HostView to
5253

5354
private VisualElement m_UIRootElement;
5455

55-
internal VisualElement baseRootVisualElement => m_UIRootElement ??= CreateRoot();
56+
internal VisualElement baseRootVisualElement
57+
{
58+
[VisibleToOtherModules("UnityEditor.UIBuilderModule")]
59+
get => m_UIRootElement ??= CreateRoot();
60+
}
5661

5762
public VisualElement rootVisualElement
5863
{
@@ -140,6 +145,7 @@ internal void DisableViewDataPersistence()
140145
m_EnableViewDataPersistence = false;
141146
}
142147

148+
[VisibleToOtherModules("UnityEditor.UIBuilderModule")]
143149
internal void ClearPersistentViewData()
144150
{
145151
string editorPrefFileName = this.GetType().ToString();
@@ -158,6 +164,7 @@ internal void ClearPersistentViewData()
158164
bool m_DisableInputEvents;
159165

160166
// Dockarea we're inside.
167+
[VisibleToOtherModules("UnityEditor.UIBuilderModule")]
161168
[NonSerialized]
162169
internal HostView m_Parent;
163170

@@ -181,6 +188,7 @@ public void EndWindows()
181188
GUI.EndWindows();
182189
}
183190

191+
[VisibleToOtherModules("UnityEditor.UIBuilderModule")]
184192
internal virtual void OnResized() {}
185193

186194
internal virtual void OnBackgroundViewResized(Rect pos) {}
@@ -242,6 +250,7 @@ internal void CheckForWindowRepaint()
242250

243251
internal CustomYieldInstruction WaitUntilPresented() => new WaitUntil(() => m_IsPresented);
244252

253+
[VisibleToOtherModules("UnityEditor.UIBuilderModule")]
245254
internal GUIContent GetLocalizedTitleContent()
246255
{
247256
return GetLocalizedTitleContentFromType(GetType());
@@ -635,6 +644,7 @@ internal void ShowAsDropDown(Rect buttonRect, Vector2 windowSize, PopupLocation[
635644
// 'windowSize' is used for setting up initial size
636645
// 'locationPriorityOrder' is for manual popup direction, if null it uses default order: down, up, left or right
637646
// 'giveFocus' is for whether the window should immediately be given focus (default true)
647+
[VisibleToOtherModules("UnityEditor.UIBuilderModule")]
638648
internal void ShowAsDropDown(Rect buttonRect, Vector2 windowSize, PopupLocation[] locationPriorityOrder, ShowMode mode, bool giveFocus)
639649
{
640650
// Setup position before bringing window live (otherwise the dropshadow on Windows will be placed in 0,0 first frame)
@@ -1069,6 +1079,7 @@ public void Repaint()
10691079
}
10701080
}
10711081

1082+
[VisibleToOtherModules("UnityEditor.UIBuilderModule")]
10721083
internal void RepaintImmediately()
10731084
{
10741085
if (m_Parent && m_Parent.actualView == this)

Editor/Mono/FileUtil.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using System.IO;
99
using System.Text.RegularExpressions;
1010
using UnityEngine;
11+
using UnityEngine.Bindings;
1112
using UnityEngine.Scripting;
1213

1314
namespace UnityEditor
@@ -384,6 +385,7 @@ internal static bool WriteTextFileToDisk(string path, string content)
384385
return WriteTextFileToDisk(path, content, out string message);
385386
}
386387

388+
[VisibleToOtherModules("UnityEditor.UIBuilderModule")]
387389
internal static bool WriteTextFileToDisk(string path, string content, out string message)
388390
{
389391
if (AssetDatabase.IsOpenForEdit(path, out message) || AssetDatabase.MakeEditable(path))

Editor/Mono/GUI/ObjectField.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using UnityEditor.SceneManagement;
77
using UnityEditorInternal;
88
using UnityEngine;
9+
using UnityEngine.Bindings;
910
using Object = UnityEngine.Object;
1011

1112
namespace UnityEditor
@@ -17,12 +18,14 @@ public sealed partial class EditorGUI
1718
static private GUIContent s_Select = EditorGUIUtility.TrTextContent("Select");
1819

1920
[Flags]
21+
[VisibleToOtherModules("UnityEditor.UIBuilderModule")]
2022
internal enum ObjectFieldValidatorOptions
2123
{
2224
None = 0,
2325
ExactObjectTypeValidation = (1 << 0)
2426
}
2527

28+
[VisibleToOtherModules("UnityEditor.UIBuilderModule")]
2629
internal delegate Object ObjectFieldValidator(Object[] references, System.Type objType, SerializedProperty property, ObjectFieldValidatorOptions options);
2730

2831
// Takes object directly, no SerializedProperty.

Editor/Mono/GUI/PopupLocation.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22
// Copyright (c) Unity Technologies. For terms of use, see
33
// https://unity3d.com/legal/licenses/Unity_Reference_Only_License
44

5+
using UnityEngine.Bindings;
6+
57
namespace UnityEditor
68
{
9+
[VisibleToOtherModules("UnityEditor.UIBuilderModule")]
710
internal enum PopupLocation
811
{
912
Below,

Editor/Mono/GameView/GameView.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ Floating GameView in separate window
3838
namespace UnityEditor
3939
{
4040
[EditorWindowTitle(title = "Game", useTypeNameAsIconName = true)]
41+
[VisibleToOtherModules("UnityEditor.UIBuilderModule")]
4142
internal class GameView : PlayModeView, IHasCustomMenu, IGameViewSizeMenuUser
4243
{
4344
const int kScaleSliderMinWidth = 30;
@@ -350,6 +351,7 @@ public void OnDisable()
350351
}
351352

352353
[UsedImplicitly] // This is here because NGUI uses it via reflection (noted in https://confluence.hq.unity3d.com/display/DEV/Game+View+Bucket)
354+
[VisibleToOtherModules("UnityEditor.UIBuilderModule")]
353355
internal static Vector2 GetSizeOfMainGameView()
354356
{
355357
return GetMainPlayModeViewTargetSize();

Editor/Mono/Handles/HandleUtility.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
using System.Linq;
1616
using Unity.Collections;
1717
using Unity.Collections.LowLevel.Unsafe;
18+
using UnityEngine.Bindings;
1819

1920
namespace UnityEditor
2021
{
@@ -1565,6 +1566,7 @@ internal static void ApplyWireMaterial([DefaultValue("UnityEngine.Rendering.Comp
15651566
}
15661567

15671568
[ExcludeFromDocs]
1569+
[VisibleToOtherModules("UnityEditor.UIBuilderModule")]
15681570
internal static void ApplyWireMaterial()
15691571
{
15701572
CompareFunction zTest = CompareFunction.Always;

Editor/Mono/HostView.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
namespace UnityEditor
2020
{
21+
[UnityEngine.Bindings.VisibleToOtherModules("UnityEditor.UIBuilderModule")]
2122
internal class HostView : GUIView, IEditorWindowModel
2223
{
2324
static class Styles
@@ -110,6 +111,7 @@ static Styles()
110111

111112
internal EditorWindow actualView
112113
{
114+
[UnityEngine.Bindings.VisibleToOtherModules("UnityEditor.UIBuilderModule")]
113115
get { return m_ActualView; }
114116
set { SetActualViewInternal(value, sendEvents: true); }
115117
}
@@ -903,6 +905,7 @@ private void Inspect(object userData)
903905
Selection.activeObject = (Object)userData;
904906
}
905907

908+
[UnityEngine.Bindings.VisibleToOtherModules("UnityEditor.UIBuilderModule")]
906909
internal void Reload(object userData)
907910
{
908911
EditorWindow window = userData as EditorWindow;

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@
88
using System.Reflection;
99
using UnityEngine;
1010
using UnityEditorInternal;
11+
using UnityEngine.Bindings;
1112

1213
namespace UnityEditor
1314
{
15+
[VisibleToOtherModules("UnityEditor.UIBuilderModule")]
1416
internal class PropertyHandler : IDisposable
1517
{
1618
List<PropertyDrawer> m_PropertyDrawers;

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@
88
using System.Text.RegularExpressions;
99
using Unity.Collections;
1010
using UnityEngine;
11+
using UnityEngine.Bindings;
1112
using UnityEngine.Rendering;
1213
using Object = UnityEngine.Object;
1314

1415
namespace UnityEditor
1516
{
17+
[VisibleToOtherModules("UnityEditor.UIBuilderModule")]
1618
internal class ScriptAttributeUtility
1719
{
1820
readonly struct CustomPropertyDrawerContainer
@@ -625,6 +627,7 @@ private static FieldInfo GetFieldInfoFromPropertyPath(Type host, string path, ou
625627
return fieldInfo;
626628
}
627629

630+
[VisibleToOtherModules("UnityEditor.UIBuilderModule")]
628631
internal static PropertyHandler GetHandler(SerializedProperty property)
629632
{
630633
if (property == null)

Editor/Mono/Inspector/LightingSettingsEditor.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ internal class SharedLightingSettingsEditor
102102
// internal
103103
SerializedProperty m_BounceScale;
104104
SerializedProperty m_ExportTrainingData;
105-
SerializedProperty m_DisableWorkerProcessBaking;
105+
SerializedProperty m_EnableWorkerProcessBaking;
106106
SerializedProperty m_TrainingDataDestination;
107107
SerializedProperty m_ForceWhiteAlbedo;
108108
SerializedProperty m_ForceUpdates;
@@ -215,7 +215,7 @@ static class Styles
215215
public static readonly GUIContent padding = EditorGUIUtility.TrTextContent("Lightmap Padding", "Sets the separation in texels between shapes in the baked lightmap.");
216216
public static readonly GUIContent lightmapMaxSize = EditorGUIUtility.TrTextContent("Max Lightmap Size", "Sets the max size of the full lightmap Texture in pixels. Values are squared, so a setting of 1024 can produce a 1024x1024 pixel sized lightmap.");
217217
public static readonly GUIContent lightmapSizeFixed = EditorGUIUtility.TrTextContent("Fixed Lightmap Size", "Forces all lightmap textures to use the same size. These can be no larger than Max Lightmap Size.");
218-
public static readonly GUIContent disableWorkerProcessBaking = EditorGUIUtility.TrTextContent("Disable worker process baking", "Forces bakes that would otherwise be run in a worker process to be run in-process and blocking.");
218+
public static readonly GUIContent enableWorkerProcessBaking = EditorGUIUtility.TrTextContent("Enable worker process baking", "Leaving this unchecked will force bakes that would otherwise be run in a worker process to be run in-process and blocking.");
219219
public static readonly GUIContent useMipmapLimits = EditorGUIUtility.TrTextContent("Use Mipmap Limits", "Whether lightmap textures use the Global Mipmap limit defined in Quality Settings. Disable this to ensure lightmaps are available at the full mipmap resolution.");
220220
public static readonly GUIContent lightmapCompression = EditorGUIUtility.TrTextContent("Lightmap Compression", "Compresses baked lightmaps created using this Lighting Settings Asset. Lower quality compression reduces memory and storage requirements, at the cost of more visual artifacts. Higher quality compression requires more memory and storage, but provides better visual results.");
221221
public static readonly GUIContent ambientOcclusion = EditorGUIUtility.TrTextContent("Ambient Occlusion", "Specifies whether to include ambient occlusion or not in the baked lightmap result. Enabling this results in simulating the soft shadows that occur in cracks and crevices of objects when light is reflected onto them.");
@@ -336,7 +336,7 @@ public void UpdateSettings(SerializedObject lightingSettingsObject)
336336

337337
//dev debug properties
338338
m_ExportTrainingData = lightingSettingsObject.FindProperty("m_ExportTrainingData");
339-
m_DisableWorkerProcessBaking = lightingSettingsObject.FindProperty("m_DisableWorkerProcessBaking");
339+
m_EnableWorkerProcessBaking = lightingSettingsObject.FindProperty("m_EnableWorkerProcessBaking");
340340
m_TrainingDataDestination = lightingSettingsObject.FindProperty("m_TrainingDataDestination");
341341
m_ForceWhiteAlbedo = lightingSettingsObject.FindProperty("m_ForceWhiteAlbedo");
342342
m_ForceUpdates = lightingSettingsObject.FindProperty("m_ForceUpdates");
@@ -697,7 +697,7 @@ void InternalSettingsGUI(bool compact)
697697
EditorGUILayout.PropertyField(m_ForceUpdates, Styles.forceUpdates);
698698
}
699699

700-
EditorGUILayout.PropertyField(m_DisableWorkerProcessBaking, Styles.disableWorkerProcessBaking);
700+
EditorGUILayout.PropertyField(m_EnableWorkerProcessBaking, Styles.enableWorkerProcessBaking);
701701

702702
EditorGUILayout.PropertyField(m_ExportTrainingData, Styles.exportTrainingData);
703703

Editor/Mono/Inspector/RenderPipelineEditorUtility.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public static Type FetchFirstCompatibleTypeUsingScriptableRenderPipelineExtensio
3939

4040
private static Dictionary<Type, Type> s_RenderPipelineAssetToRenderPipelineType = new ();
4141

42-
internal static Type GetPipelineTypeFromPipelineAssetType(Type pipelineAssetType)
42+
public static Type GetPipelineTypeFromPipelineAssetType(Type pipelineAssetType)
4343
{
4444
if (!typeof(RenderPipelineAsset).IsAssignableFrom(pipelineAssetType))
4545
return null;

Editor/Mono/Inspector/ShaderVariantCollectionInspector.cs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using UnityEngine;
66
using System.Collections.Generic;
77
using System.Linq;
8-
using UnityEngine.UIElements;
98

109
namespace UnityEditor
1110
{
@@ -27,24 +26,6 @@ public virtual void OnEnable()
2726
m_Shaders = serializedObject.FindProperty("m_Shaders");
2827
}
2928

30-
public override VisualElement CreateInspectorGUI()
31-
{
32-
if (serializedObject == null)
33-
return null;
34-
var root = new VisualElement();
35-
var monoBehaviour = target as MonoBehaviour;
36-
var scriptableObject = target as ScriptableObject;
37-
if ((monoBehaviour != null || scriptableObject != null) && SerializationUtility.HasManagedReferencesWithMissingTypes(target))
38-
{
39-
string missingSerializeMessage = L10n.Tr("This object contains SerializeReference types which are missing.\nFor more information see SerializationUtility.HasManagedReferencesWithMissingTypes.");
40-
root.Add(new HelpBox(missingSerializeMessage, HelpBoxMessageType.Warning));
41-
}
42-
43-
UIElements.InspectorElement.FillDefaultInspector(root, serializedObject, this);
44-
45-
return root;
46-
}
47-
4829
static Rect GetAddRemoveButtonRect(Rect r)
4930
{
5031
var buttonSize = Styles.invisibleButton.CalcSize(Styles.iconRemove);

Editor/Mono/Inspector/VisualElements/ObjectFieldWithPrompt.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ public ObjectFieldWithPrompt(string label) : base(label, null)
112112
value = evt.newValue;
113113
else
114114
m_ObjectField.SetValueWithoutNotify(value);
115+
116+
if (EditorWindow.HasOpenInstances<ObjectSelector>())
117+
ObjectSelector.get.Cancel();
115118
});
116119
Add(m_ObjectField);
117120
}

0 commit comments

Comments
 (0)