Skip to content

Commit 044f335

Browse files
author
Unity Technologies
committed
Unity 2019.3.0b10 C# reference source code
1 parent d4fa90a commit 044f335

40 files changed

+238
-162
lines changed

Editor/Mono/AssetDatabase/AssetMoveInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace UnityEditor.Experimental
88
{
9-
internal struct AssetMoveInfo : IEquatable<AssetMoveInfo>
9+
public struct AssetMoveInfo : IEquatable<AssetMoveInfo>
1010
{
1111
public AssetMoveInfo(string sourceAssetPath, string destinationAssetPath)
1212
{

Editor/Mono/AssetDatabase/AssetsModifiedProcessor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88
namespace UnityEditor.Experimental
99
{
10-
internal abstract class AssetsModifiedProcessor
10+
public abstract class AssetsModifiedProcessor
1111
{
12-
internal HashSet<string> assetsReportedChanged { get; set; }
12+
public HashSet<string> assetsReportedChanged { get; set; }
1313

1414
protected void ReportAssetChanged(string assetChanged)
1515
{

Editor/Mono/AssetPipeline/TextureImporterTypes.bindings.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public struct SpriteMetaData
2424
[System.Serializable]
2525
[StructLayout(LayoutKind.Sequential)]
2626
[NativeAsStruct]
27+
[NativeType(CodegenOptions.Custom, "TextureImporterSettings")]
2728
[NativeHeader("Editor/Src/AssetPipeline/TextureImporting/TextureImporter.bindings.h")]
2829
[NativeHeader("Editor/Src/AssetPipeline/TextureImporting/TextureImporterTypes.h")]
2930
public sealed partial class TextureImporterSettings

Editor/Mono/BuildPipeline/DesktopStandalonePostProcessor.cs

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -385,8 +385,8 @@ private static void CreateApplicationData(BuildPostProcessArgs args)
385385

386386
protected bool CopyPlayerFilter(string path, BuildPostProcessArgs args)
387387
{
388-
// Don't copy UnityEngine mdb files
389-
return Path.GetExtension(path) != ".mdb" || !Path.GetFileName(path).StartsWith("UnityEngine.");
388+
// Don't copy UnityEngine mdb/pdb files
389+
return (Path.GetExtension(path) != ".mdb" && Path.GetExtension(path) != ".pdb") || !Path.GetFileName(path).StartsWith("UnityEngine.");
390390
}
391391

392392
private static uint StringToFourCC(string literal)
@@ -408,21 +408,6 @@ protected string GetVariationFolder(BuildPostProcessArgs args) =>
408408

409409
protected static void RecordCommonFiles(BuildPostProcessArgs args, string variationSourceFolder, string monoFolderRoot)
410410
{
411-
// Mark all the managed DLLs in Data/Managed as engine API assemblies
412-
// Data/Managed may already contain managed DLLs in the UnityEngine.*.dll naming scheme from the extensions
413-
// So we find the files in the source Variations directory and mark the corresponding files in the output
414-
var path = Path.Combine(variationSourceFolder, "Data/Managed");
415-
foreach (var file in Directory.GetFiles(path, "*.dll")
416-
.Concat(Directory.GetFiles(path, "*.pdb")))
417-
{
418-
var filename = Path.GetFileName(file);
419-
if (!filename.StartsWith("UnityEngine"))
420-
continue;
421-
422-
var targetFilePath = Path.Combine(args.stagingArea, "Data/Managed/" + filename);
423-
args.report.RecordFileAdded(targetFilePath, CommonRoles.managedEngineApi);
424-
}
425-
426411
// Mark the default resources file
427412
args.report.RecordFileAdded(Path.Combine(args.stagingArea, "Data/Resources/unity default resources"),
428413
CommonRoles.builtInResources);

Editor/Mono/EditorApplication.bindings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public static void OpenProject(string projectPath, params string[] args)
6363

6464
// Saves all serializable assets that have not yet been written to disk (eg. Materials)
6565
[System.Obsolete("Use AssetDatabase.SaveAssets instead (UnityUpgradable) -> AssetDatabase.SaveAssets()", true)]
66-
public static extern void SaveAssets();
66+
public static void SaveAssets() {}
6767

6868
// Is editor currently in play mode?
6969
public static extern bool isPlaying

Editor/Mono/GUIView.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ namespace UnityEditor
1717
[StructLayout(LayoutKind.Sequential)]
1818
internal partial class GUIView : View
1919
{
20+
// Case 1183719 - The delegate getEditorShader is being reset upon domain reload and InitializeOnLoad is not rerun
21+
// Hence a static constructor to Initialize the Delegate. EditorShaderLoader is still needed for Batch mode where GUIView may not be created
22+
static GUIView()
23+
{
24+
// TODO: Remove this once case 1148851 has been fixed.
25+
UnityEngine.UIElements.UIR.UIRenderDevice.getEditorShader = () => EditorShader;
26+
}
27+
2028
[InitializeOnLoad]
2129
static class EditorShaderLoader
2230
{

Editor/Mono/ImportSettings/TrueTypeFontImporterInspector.cs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,16 @@ protected override bool needsApplyRevert
6969

7070
protected override void Apply()
7171
{
72-
m_FallbackFontReferencesArraySize.intValue = m_FallbackFontReferences.Length;
73-
SerializedProperty fontReferenceProp = m_FallbackFontReferencesArraySize.Copy();
74-
75-
for (int i = 0; i < m_FallbackFontReferences.Length; i++)
72+
if (targets.Length == 1)
7673
{
77-
fontReferenceProp.Next(false);
78-
fontReferenceProp.objectReferenceValue = m_FallbackFontReferences[i];
74+
m_FallbackFontReferencesArraySize.intValue = m_FallbackFontReferences.Length;
75+
SerializedProperty fontReferenceProp = m_FallbackFontReferencesArraySize.Copy();
76+
77+
for (int i = 0; i < m_FallbackFontReferences.Length; i++)
78+
{
79+
fontReferenceProp.Next(false);
80+
fontReferenceProp.objectReferenceValue = m_FallbackFontReferences[i];
81+
}
7982
}
8083

8184
base.Apply();

Editor/Mono/Inspector/EditorElement.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ internal EditorElement(int editorIndex, InspectorWindow iw)
6767
{
6868
m_EditorIndex = editorIndex;
6969
inspectorWindow = iw;
70+
pickingMode = PickingMode.Ignore;
7071

7172
Init();
7273

Editor/Mono/Inspector/InspectorElement.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ public class InspectorElement : BindableElement
2929

3030
public new class UxmlFactory : UxmlFactory<InspectorElement, UxmlTraits> {}
3131

32+
public new class UxmlTraits : BindableElement.UxmlTraits
33+
{
34+
public UxmlTraits()
35+
{
36+
m_PickingMode.defaultValue = PickingMode.Ignore;
37+
}
38+
}
39+
3240
[Flags]
3341
internal enum Mode
3442
{
@@ -82,6 +90,7 @@ internal InspectorElement(Object obj, Mode mode)
8290
{
8391
m_IgnoreOnInspectorGUIErrors = false;
8492

93+
pickingMode = PickingMode.Ignore;
8594
AddToClassList(ussClassName);
8695

8796
this.mode = mode;
@@ -100,6 +109,7 @@ public InspectorElement(SerializedObject obj) : this(obj, Mode.Normal) {}
100109

101110
internal InspectorElement(SerializedObject obj, Mode mode)
102111
{
112+
pickingMode = PickingMode.Ignore;
103113
AddToClassList(ussClassName);
104114

105115
this.mode = mode;
@@ -118,6 +128,7 @@ public InspectorElement(Editor editor) : this(editor, Mode.Normal) {}
118128

119129
internal InspectorElement(Editor editor, Mode mode)
120130
{
131+
pickingMode = PickingMode.Ignore;
121132
AddToClassList(ussClassName);
122133

123134
this.mode = mode;

Editor/Mono/Inspector/LightProbeGroupInspector.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -749,8 +749,7 @@ private void InternalOnSceneView()
749749

750750
public void OnSceneGUI()
751751
{
752-
if (Event.current.type != EventType.Repaint)
753-
InternalOnSceneView();
752+
InternalOnSceneView();
754753
}
755754

756755
public bool HasFrameBounds()

Editor/Mono/Inspector/QualitySettingsEditor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ public override void OnInspectorGUI()
523523

524524
GUILayout.Label(EditorGUIUtility.TempContent("Rendering"), EditorStyles.boldLabel);
525525

526-
EditorGUILayout.PropertyField(customRenderPipeline);
526+
customRenderPipeline.objectReferenceValue = EditorGUILayout.ObjectField(customRenderPipeline.objectReferenceValue, typeof(RenderPipelineAsset), false);
527527

528528
if (!usingSRP)
529529
EditorGUILayout.PropertyField(pixelLightCountProperty);

Editor/Mono/Modules/DefaultPluginImporterExtension.cs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
// https://unity3d.com/legal/licenses/Unity_Reference_Only_License
44

55
using System;
6+
using System.Collections.Generic;
67
using System.ComponentModel;
8+
using System.IO;
9+
using System.Linq;
710
using System.Text;
11+
using UnityEditor.Compilation;
812
using UnityEngine;
9-
using System.Linq;
10-
using System.IO;
11-
using System.Collections.Generic;
1213

1314
namespace UnityEditor.Modules
1415
{
@@ -152,7 +153,14 @@ public virtual string CalculateFinalPluginPath(string platformName, PluginImport
152153

153154
protected Dictionary<string, List<PluginImporter>> GetCompatiblePlugins(string buildTargetName)
154155
{
155-
IEnumerable<PluginImporter> plugins = PluginImporter.GetAllImporters().Where(imp => imp.GetCompatibleWithPlatformOrAnyPlatformBuildTarget(buildTargetName));
156+
var assemblies = CompilationPipeline.GetAssemblies();
157+
var assemblyDefines = new Dictionary<string, string[]>(assemblies.Length);
158+
foreach (var assembly in assemblies)
159+
{
160+
assemblyDefines.Add(assembly.name, assembly.defines);
161+
}
162+
163+
IEnumerable<PluginImporter> plugins = PluginImporter.GetAllImporters().Where(imp => imp.GetCompatibleWithPlatformOrAnyPlatformBuildTarget(buildTargetName) && imp.IsCompatibleWithDefines(assemblyDefines.ContainsKey(imp.name) ? assemblyDefines[imp.name] : null));
156164
Dictionary<string, List<PluginImporter>> matchingPlugins = new Dictionary<string, List<PluginImporter>>();
157165

158166
foreach (var plugin in plugins)

Editor/Mono/Plugins/PluginsHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public static bool CheckFileCollisions(BuildTarget buildTarget)
1919
pluginImporterExtension = ModuleManager.GetPluginImporterExtension(buildTarget);
2020
if (pluginImporterExtension == null)
2121
{
22-
// Some platforms don't have platform specific settings for plugins, but we still wan't to check that plugins don't collide, use default path in this case
22+
// Some platforms don't have platform specific settings for plugins, but we still want to check that plugins don't collide, use default path in this case
2323
if (BuildPipeline.GetBuildTargetGroup(buildTarget) == BuildTargetGroup.Standalone)
2424
pluginImporterExtension = new DesktopPluginImporterExtension();
2525
else

Editor/Mono/SceneView/SceneView.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,7 @@ internal static class Styles
768768
public static GUIContent isolationModeOverlayContent = EditorGUIUtility.TrTextContent("Isolation View", "");
769769
public static GUIContent isolationModeExitButton = EditorGUIUtility.TrTextContent("Exit", "Exit isolation mode");
770770
public static GUIContent renderDocContent;
771-
public static GUIContent sceneVisToolbarButtonContent = EditorGUIUtility.TrIconContent("scenevis_hidden", "Number of hidden objects, click to toggle scene visibility");
771+
public static GUIContent sceneVisToolbarButtonContent = EditorGUIUtility.TrIconContent("SceneViewVisibility", "Number of hidden objects, click to toggle scene visibility");
772772
public static GUIStyle gizmoButtonStyle;
773773
public static GUIContent sceneViewCameraContent = EditorGUIUtility.TrIconContent("SceneViewCamera", "Settings for the Scene view camera.");
774774
public static GUIContent exposureIcon = EditorGUIUtility.TrIconContent("Exposure", "Controls the number of stops to over or under expose the precomputed and baked lighting debug views.");

Modules/AssetDatabase/Editor/ScriptBindings/AssetDatabaseExperimental.bindings.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,9 @@ static string[] OnSourceAssetsModified(string[] changedAssets, string[] addedAss
200200
public extern static bool IsAssetImportWorkerProcess();
201201

202202
[FreeFunction("AssetDatabaseExperimental::RemoveArtifacts_Internal")]
203-
internal extern static long RemoveArtifacts(string[] assets);
203+
public extern static long RemoveArtifacts(string[] assets);
204204

205205
[FreeFunction("AssetDatabaseExperimental::ReimportAssets_Internal")]
206-
internal extern static void ReimportAssets(string[] assets);
206+
public extern static void ReimportAssets(string[] assets);
207207
}
208208
}

Modules/GraphViewEditor/EdgeControl.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -904,13 +904,13 @@ void DrawEdge(MeshGenerationContext mgc)
904904
if ((i & 0x01) == 0)
905905
{
906906
md.SetNextIndex((UInt16)i);
907-
md.SetNextIndex((UInt16)(i + 1));
908907
md.SetNextIndex((UInt16)(i + 2));
908+
md.SetNextIndex((UInt16)(i + 1));
909909
}
910910
else
911911
{
912-
md.SetNextIndex((UInt16)(i + 1));
913912
md.SetNextIndex((UInt16)i);
913+
md.SetNextIndex((UInt16)(i + 1));
914914
md.SetNextIndex((UInt16)(i + 2));
915915
}
916916
}

Modules/PackageManagerUI/Editor/UI/PackageStatusBar.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ private void SetUpdateTimestamp(long lastUpdateTimestamp)
9595
private void SetUpdateTimeLabel(string lastUpdateTime)
9696
{
9797
if (!string.IsNullOrEmpty(lastUpdateTime))
98-
SetStatusMessage(StatusType.Normal, "Last update " + lastUpdateTime);
98+
SetStatusMessage(StatusType.Normal, lastUpdateTime);
9999
else
100100
SetStatusMessage(StatusType.Normal, string.Empty);
101101
}

Modules/ParticleSystemEditor/ParticleSystemModules/ModuleUIHelpers.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ partial class ModuleUI
2828
protected const float kReorderableListElementHeight = 16;
2929

3030
// Module rulers that are fixed
31-
static public float k_CompactFixedModuleWidth = 295f;
31+
static public float k_CompactFixedModuleWidth = 400f;
3232
static public float k_SpaceBetweenModules = 5;
3333

3434
public static readonly GUIStyle s_ControlRectStyle = new GUIStyle { margin = new RectOffset(0, 0, 2, 2) };

Modules/ProfilerEditor/MemoryProfiler/ArrayEntries.cs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ public class ArrayEntries<T>
1717
internal EntryType m_EntryType;
1818
GetItem<T> m_GetItemFunc;
1919

20+
internal ArrayEntries()
21+
{
22+
m_EntryType = unchecked((EntryType)0xffffffff);
23+
}
24+
2025
internal ArrayEntries(MemorySnapshotFileReader reader, EntryType entryType,
2126
GetItem<T> getItemFunc)
2227
{
@@ -27,11 +32,21 @@ internal ArrayEntries(MemorySnapshotFileReader reader, EntryType entryType,
2732

2833
public uint GetNumEntries()
2934
{
35+
if (m_Reader == null)
36+
return 0;
3037
return m_Reader.GetNumEntries(m_EntryType);
3138
}
3239

3340
public virtual void GetEntries(uint indexStart, uint numEntries, ref T[] dataOut)
3441
{
42+
if (GetNumEntries() == 0)
43+
{
44+
Debug.LogError("Unable to read, the array has 0 entries");
45+
return;
46+
}
47+
48+
if (m_Reader == null)
49+
throw new Exception("No reader present for array entries");
3550
m_Reader.GetDataArray(m_EntryType, indexStart, numEntries, ref dataOut, m_GetItemFunc);
3651
}
3752
}
@@ -108,8 +123,9 @@ public class NativeObjectEntries
108123
public ArrayEntries<ObjectFlags> flags { get; }
109124
public ArrayEntries<ulong> nativeObjectAddress { get; }
110125
public ArrayEntries<long> rootReferenceId { get; }
126+
public ArrayEntries<int> gcHandleIndex { get; }
111127

112-
internal NativeObjectEntries(MemorySnapshotFileReader reader)
128+
internal NativeObjectEntries(MemorySnapshotFileReader reader, bool hasGcHandleIndex)
113129
{
114130
objectName = new ArrayEntries<string>(reader, EntryType.NativeObjects_Name, ConversionFunctions.ToString);
115131
instanceId = new ArrayEntries<int>(reader, EntryType.NativeObjects_InstanceId, ConversionFunctions.ToInt32);
@@ -119,6 +135,10 @@ internal NativeObjectEntries(MemorySnapshotFileReader reader)
119135
flags = new ArrayEntries<ObjectFlags>(reader, EntryType.NativeObjects_Flags, ConversionFunctions.ToObjectFlags);
120136
nativeObjectAddress = new ArrayEntries<ulong>(reader, EntryType.NativeObjects_NativeObjectAddress, ConversionFunctions.ToUInt64);
121137
rootReferenceId = new ArrayEntries<long>(reader, EntryType.NativeObjects_RootReferenceId, ConversionFunctions.ToInt64);
138+
if (hasGcHandleIndex)
139+
gcHandleIndex = new ArrayEntries<int>(reader, EntryType.NativeObjects_GCHandleIndex, ConversionFunctions.ToInt32);
140+
else
141+
gcHandleIndex = new ArrayEntries<int>();
122142
}
123143

124144
public uint GetNumEntries()

Modules/ProfilerEditor/MemoryProfiler/MemorySnapshot.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ namespace UnityEditor.Profiling.Memory.Experimental
1414
// !!!!! NOTE: Keep in sync with Runtime\Profiler\MemorySnapshots.cpp
1515
public class PackedMemorySnapshot : IDisposable
1616
{
17-
static readonly UInt32 kMinSupportedVersion = 7;
18-
static readonly UInt32 kCurrentVersion = 9;
17+
static readonly UInt32 kMinSupportedVersion = 8;
18+
static readonly UInt32 kCurrentVersion = 10;
1919

2020
public static PackedMemorySnapshot Load(string path)
2121
{
@@ -217,7 +217,7 @@ internal void BuildEntries()
217217
nativeCallstackSymbols = new NativeCallstackSymbolEntries(m_Reader);
218218
nativeMemoryLabels = new NativeMemoryLabelEntries(m_Reader);
219219
nativeMemoryRegions = new NativeMemoryRegionEntries(m_Reader);
220-
nativeObjects = new NativeObjectEntries(m_Reader);
220+
nativeObjects = new NativeObjectEntries(m_Reader, version == kCurrentVersion);
221221
nativeRootReferences = new NativeRootReferenceEntries(m_Reader);
222222
nativeTypes = new NativeTypeEntries(m_Reader);
223223
typeDescriptions = new TypeDescriptionEntries(m_Reader);

Modules/ProfilerEditor/MemoryProfiler/MemorySnapshotFileReader.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
namespace UnityEditorInternal.Profiling.Memory.Experimental
1010
{
11-
// keep in sync with MemorySnapshot/FileFormat.h
11+
// keep in sync with MemorySnapshot/MemorySnapshotFileEntryNames.h
1212
namespace FileFormat
1313
{
1414
public enum EntryType : UInt16
@@ -70,7 +70,8 @@ public enum EntryType : UInt16
7070
NativeAllocationSites_MemoryLabelIndex,
7171
NativeAllocationSites_CallstackSymbols,
7272
NativeCallstackSymbol_Symbol,
73-
NativeCallstackSymbol_ReadableStackTrace
73+
NativeCallstackSymbol_ReadableStackTrace,
74+
NativeObjects_GCHandleIndex
7475
}
7576
}
7677

0 commit comments

Comments
 (0)