Skip to content

Commit

Permalink
Unity 2020.1.0a8 C# reference source code
Browse files Browse the repository at this point in the history
  • Loading branch information
Unity Technologies committed Oct 10, 2019
1 parent 806e5e6 commit 86305f7
Show file tree
Hide file tree
Showing 125 changed files with 1,458 additions and 565 deletions.
4 changes: 2 additions & 2 deletions Editor/Mono/Annotation/AnnotationWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ static public void IconChanged()
float GetTopSectionHeight()
{
const int numberOfControls = 3;
return EditorGUI.kSingleLineHeight * numberOfControls + EditorGUI.kControlVerticalSpacing * numberOfControls;
return EditorGUI.kSingleLineHeight * numberOfControls + EditorGUI.kControlVerticalSpacing * (numberOfControls - 1) + EditorStyles.inspectorBig.padding.bottom;
}

void OnEnable()
Expand Down Expand Up @@ -536,7 +536,7 @@ void DrawListHeader(string header, List<AInfo> elements, Rect rect, ref bool hea

// Column headers
Rect columnRect = rect;
columnRect.y -= gizmoTextSize.y - 3;
columnRect.y -= gizmoTextSize.y + 3;
columnRect.x = rect.width - gizmoTextRightAlign;
GUI.Label(columnRect, gizmoText, m_Styles.columnHeaderStyle);

Expand Down
1 change: 1 addition & 0 deletions Editor/Mono/AssetPipeline/TextureImporter.bindings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -425,5 +425,6 @@ public void SetTextureSettings(TextureImporterSettings src)
internal extern bool removeMatte { get; set; }

public extern bool ignorePngGamma { get; set; }
internal static readonly int MaxTextureSizeAllowedForReadable = 8192; //keep in sync with TextureImporter.h
}
}
15 changes: 8 additions & 7 deletions Editor/Mono/BuildPipeline.bindings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ public struct BuildPlayerOptions
public BuildTargetGroup targetGroup {get; set; }
public BuildTarget target {get; set; }
public BuildOptions options {get; set; }
public string[] extraScriptingDefines { get; set; }
}

// Lets you programmatically build players or AssetBundles which can be loaded from the web.
Expand Down Expand Up @@ -262,10 +263,10 @@ public static BuildReport BuildPlayer(string[] levels, string locationPathName,

public static BuildReport BuildPlayer(BuildPlayerOptions buildPlayerOptions)
{
return BuildPlayer(buildPlayerOptions.scenes, buildPlayerOptions.locationPathName, buildPlayerOptions.assetBundleManifestPath, buildPlayerOptions.targetGroup, buildPlayerOptions.target, buildPlayerOptions.options);
return BuildPlayer(buildPlayerOptions.scenes, buildPlayerOptions.locationPathName, buildPlayerOptions.assetBundleManifestPath, buildPlayerOptions.targetGroup, buildPlayerOptions.target, buildPlayerOptions.options, buildPlayerOptions.extraScriptingDefines);
}

private static BuildReport BuildPlayer(string[] scenes, string locationPathName, string assetBundleManifestPath, BuildTargetGroup buildTargetGroup, BuildTarget target, BuildOptions options)
private static BuildReport BuildPlayer(string[] scenes, string locationPathName, string assetBundleManifestPath, BuildTargetGroup buildTargetGroup, BuildTarget target, BuildOptions options, string[] extraScriptingDefines)
{
if (isBuildingPlayer)
throw new InvalidOperationException("Cannot start a new build because there is already a build in progress.");
Expand All @@ -279,7 +280,7 @@ private static BuildReport BuildPlayer(string[] scenes, string locationPathName,

try
{
return BuildPlayerInternal(scenes, locationPathName, assetBundleManifestPath, buildTargetGroup, target, options);
return BuildPlayerInternal(scenes, locationPathName, assetBundleManifestPath, buildTargetGroup, target, options, extraScriptingDefines);
}
catch (System.Exception exception)
{
Expand Down Expand Up @@ -353,7 +354,7 @@ internal static string BuildStreamedSceneAssetBundle(string[] levels, string loc
crc = 0;
try
{
var report = BuildPlayerInternal(levels, locationPath, null, buildTargetGroup, target, options | BuildOptions.BuildAdditionalStreamedScenes | BuildOptions.ComputeCRC);
var report = BuildPlayerInternal(levels, locationPath, null, buildTargetGroup, target, options | BuildOptions.BuildAdditionalStreamedScenes | BuildOptions.ComputeCRC, new string[] {});
crc = report.summary.crc;

var summary = report.SummarizeErrors();
Expand All @@ -375,19 +376,19 @@ public static string BuildStreamedSceneAssetBundle(string[] levels, string locat
return BuildStreamedSceneAssetBundle(levels, locationPath, target, out crc, 0);
}

private static BuildReport BuildPlayerInternal(string[] levels, string locationPathName, string assetBundleManifestPath, BuildTargetGroup buildTargetGroup, BuildTarget target, BuildOptions options)
private static BuildReport BuildPlayerInternal(string[] levels, string locationPathName, string assetBundleManifestPath, BuildTargetGroup buildTargetGroup, BuildTarget target, BuildOptions options, string[] extraScriptingDefines)
{
if (!BuildPlayerWindow.DefaultBuildMethods.IsBuildPathValid(locationPathName))
throw new Exception("Invalid Build Path: " + locationPathName);

return BuildPlayerInternalNoCheck(levels, locationPathName, assetBundleManifestPath, buildTargetGroup, target, options, false);
return BuildPlayerInternalNoCheck(levels, locationPathName, assetBundleManifestPath, buildTargetGroup, target, options, extraScriptingDefines, false);
}

// Is a player currently building?
public static extern bool isBuildingPlayer {[FreeFunction("IsBuildingPlayer")] get; }

// Just like BuildPlayer, but does not check for Pro license. Used from build player dialog.
internal static extern BuildReport BuildPlayerInternalNoCheck(string[] levels, string locationPathName, string assetBundleManifestPath, BuildTargetGroup buildTargetGroup, BuildTarget target, BuildOptions options, bool delayToAfterScriptReload);
internal static extern BuildReport BuildPlayerInternalNoCheck(string[] levels, string locationPathName, string assetBundleManifestPath, BuildTargetGroup buildTargetGroup, BuildTarget target, BuildOptions options, string[] extraScriptingDefines, bool delayToAfterScriptReload);

#pragma warning disable 618

Expand Down
2 changes: 1 addition & 1 deletion Editor/Mono/BuildPlayerWindowBuildMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public static void BuildPlayer(BuildPlayerOptions options)
bool locationPathExistedBeforeBuild = System.IO.Directory.Exists(options.locationPathName);
// Trigger build.
// Note: report will be null, if delayToAfterScriptReload = true
var report = BuildPipeline.BuildPlayerInternalNoCheck(options.scenes, options.locationPathName, null, options.targetGroup, options.target, options.options, delayToAfterScriptReload);
var report = BuildPipeline.BuildPlayerInternalNoCheck(options.scenes, options.locationPathName, null, options.targetGroup, options.target, options.options, options.extraScriptingDefines, delayToAfterScriptReload);


if (report != null)
Expand Down
12 changes: 6 additions & 6 deletions Editor/Mono/Callbacks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ internal sealed partial class RegisterPluginsAttribute : CallbackOrderAttribute
public RegisterPluginsAttribute(int callbackOrder) { m_CallbackOrder = callbackOrder; }

[RequiredSignature]
extern static IEnumerable<PluginDesc> Signature(BuildTarget target);
static IEnumerable<PluginDesc> Signature(BuildTarget target) { throw new InvalidOperationException(); }
}

[RequiredByNativeCode]
Expand All @@ -46,7 +46,7 @@ public sealed partial class PostProcessBuildAttribute : CallbackOrderAttribute
public PostProcessBuildAttribute(int callbackOrder) { m_CallbackOrder = callbackOrder; }

[RequiredSignature]
extern static void Signature(BuildTarget target, string pathToBuiltProject);
static void Signature(BuildTarget target, string pathToBuiltProject) { throw new InvalidOperationException(); }
}

[RequiredByNativeCode]
Expand All @@ -62,7 +62,7 @@ public sealed partial class PostProcessSceneAttribute : CallbackOrderAttribute
public PostProcessSceneAttribute(int callbackOrder, int version) { m_CallbackOrder = callbackOrder; m_version = version; }

[RequiredSignature]
extern static void Signature();
static void Signature() { throw new InvalidOperationException(); }
}

[RequiredByNativeCode]
Expand All @@ -73,7 +73,7 @@ public sealed partial class DidReloadScripts : CallbackOrderAttribute
public DidReloadScripts(int callbackOrder) { m_CallbackOrder = callbackOrder; }

[RequiredSignature]
extern static void Signature();
static void Signature() { throw new InvalidOperationException(); }
}

// Add this attribute to a static method to get a callback for opening an asset inside Unity before trying to open it with an external tool
Expand All @@ -84,10 +84,10 @@ public sealed partial class OnOpenAssetAttribute : CallbackOrderAttribute
public OnOpenAssetAttribute(int callbackOrder) { m_CallbackOrder = callbackOrder; }

[RequiredSignature]
extern static bool SignatureLine(int instanceID, int line);
static bool SignatureLine(int instanceID, int line) { throw new InvalidOperationException(); }

[RequiredSignature]
extern static bool SignatureLineColumn(int instanceID, int line, int column);
static bool SignatureLineColumn(int instanceID, int line, int column) { throw new InvalidOperationException(); }
}
}
}
2 changes: 1 addition & 1 deletion Editor/Mono/CollectImportedDependenciesAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public CollectImportedDependenciesAttribute(Type importerType, uint version)
public uint version { get { return m_Version; } }

[RequiredSignature]
static extern string[] CollectImportedDependenciesSignature(string assetPath);
static string[] CollectImportedDependenciesSignature(string assetPath) { throw new InvalidOperationException(); }
}

static class ImportedDependenciesApi
Expand Down
37 changes: 31 additions & 6 deletions Editor/Mono/EditorGUIUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ internal static Material GUITextureBlitSceneGUIMaterial
internal static int s_LastControlID = 0;
private static float s_LabelWidth = 0f;

private static Texture2D s_InfoIcon;
private static Texture2D s_WarningIcon;
private static Texture2D s_ErrorIcon;
private static ScalableGUIContent s_InfoIcon;
private static ScalableGUIContent s_WarningIcon;
private static ScalableGUIContent s_ErrorIcon;

private static GUIStyle s_WhiteTextureStyle;
private static GUIStyle s_BasicTextureStyle;
Expand Down Expand Up @@ -855,9 +855,34 @@ public static Vector2 GetIconSize()
return Internal_GetIconSize();
}

internal static Texture2D infoIcon => s_InfoIcon ?? (s_InfoIcon = LoadIcon("console.infoicon"));
internal static Texture2D warningIcon => s_WarningIcon ?? (s_WarningIcon = LoadIcon("console.warnicon"));
internal static Texture2D errorIcon => s_ErrorIcon ?? (s_ErrorIcon = LoadIcon("console.erroricon"));
internal static Texture2D infoIcon
{
get
{
if (s_InfoIcon == null)
s_InfoIcon = new ScalableGUIContent("console.infoicon");
return s_InfoIcon.image as Texture2D;
}
}
internal static Texture2D warningIcon
{
get
{
if (s_WarningIcon == null)
s_WarningIcon = new ScalableGUIContent("console.warnicon");
return s_WarningIcon.image as Texture2D;
}
}

internal static Texture2D errorIcon
{
get
{
if (s_ErrorIcon == null)
s_ErrorIcon = new ScalableGUIContent("console.erroricon");
return s_ErrorIcon.image as Texture2D;
}
}

internal static Texture2D GetHelpIcon(MessageType type)
{
Expand Down
2 changes: 1 addition & 1 deletion Editor/Mono/EditorHeaderItemAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ public EditorHeaderItemAttribute(Type targetType, int priority = 1)
public Type TargetType;

[RequiredSignature]
static extern bool SignatureBool(Rect rectangle, UnityEngine.Object[] targetObjets);
static bool SignatureBool(Rect rectangle, UnityEngine.Object[] targetObjets) { throw new InvalidOperationException(); }
}
}
6 changes: 3 additions & 3 deletions Editor/Mono/EditorResources.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
using System.Linq;
using JetBrains.Annotations;
using UnityEditor.StyleSheets;
using UnityEditor.Profiling;
using UnityEngine;
using UnityEngine.Internal;
using UnityEngine.Scripting;

namespace UnityEditor.Experimental
{
Expand Down Expand Up @@ -229,7 +229,7 @@ private static List<string> GetDefaultStyleCatalogPaths()

internal static void BuildCatalog()
{
using (new PerformanceTracker(nameof(BuildCatalog)))
using (new EditorPerformanceTracker(nameof(BuildCatalog)))
{
s_StyleCatalog = new StyleCatalog();
s_RefreshGlobalStyleCatalog = false;
Expand All @@ -245,7 +245,7 @@ internal static void BuildCatalog()

internal static void RefreshSkin()
{
using (new PerformanceTracker(nameof(RefreshSkin)))
using (new EditorPerformanceTracker(nameof(RefreshSkin)))
{
if (!CanEnableExtendedStyles())
return;
Expand Down
6 changes: 6 additions & 0 deletions Editor/Mono/EditorWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1023,6 +1023,12 @@ internal void SetPlayModeViewSize(Vector2 targetSize)
m_Parent.SetInternalGameViewDimensions(m_GameViewRect, m_GameViewClippedRect, m_GameViewTargetSize);
}

internal void SetMainPlayModeViewSize(Vector2 targetSize)
{
if (m_Parent != null)
m_Parent.SetMainPlayModeViewSize(targetSize);
}

internal void SetPlayModeView(bool value)
{
m_IsPlayModeView = value;
Expand Down
Loading

0 comments on commit 86305f7

Please sign in to comment.