Skip to content

Commit 234186e

Browse files
author
Unity Technologies
committed
Unity 2021.1.0a6 C# reference source code
1 parent 0b34d6c commit 234186e

File tree

154 files changed

+6272
-5808
lines changed

Some content is hidden

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

154 files changed

+6272
-5808
lines changed

Editor/Mono/2D/SpriteAtlas/EditorSpriteAtlas.bindings.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,14 @@ public struct SpriteAtlasPackingSettings
6767
private bool m_EnableRotation;
6868
[NativeName("enableTightPacking")]
6969
private bool m_EnableTightPacking;
70+
[NativeName("enableAlphaDilation")]
71+
private bool m_EnableAlphaDilation;
7072

7173
public int blockOffset { get { return m_BlockOffset; } set { m_BlockOffset = value; } }
7274
public int padding { get { return m_Padding; } set { m_Padding = value; } }
7375
public bool enableRotation { get { return m_EnableRotation; } set { m_EnableRotation = value; } }
7476
public bool enableTightPacking { get { return m_EnableTightPacking; } set { m_EnableTightPacking = value; } }
77+
public bool enableAlphaDilation { get { return m_EnableAlphaDilation; } set { m_EnableAlphaDilation = value; } }
7578
}
7679

7780
[NativeHeader("Editor/Src/AssetPipeline/TextureImporting/TextureImporterTypes.h")]

Editor/Mono/2D/SpriteAtlas/SpriteAtlasImporterInspector.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ class Styles
5252
public readonly GUIContent bindAsDefaultLabel = EditorGUIUtility.TrTextContent("Include in Build", "Packed textures will be included in the build by default.");
5353
public readonly GUIContent enableRotationLabel = EditorGUIUtility.TrTextContent("Allow Rotation", "Try rotating the sprite to fit better during packing.");
5454
public readonly GUIContent enableTightPackingLabel = EditorGUIUtility.TrTextContent("Tight Packing", "Use the mesh outline to fit instead of the whole texture rect during packing.");
55+
public readonly GUIContent enableAlphaDilationLabel = EditorGUIUtility.TrTextContent("Alpha Dilation", "Enable Alpha Dilation for SpriteAtlas padding pixels.");
5556
public readonly GUIContent paddingLabel = EditorGUIUtility.TrTextContent("Padding", "The amount of extra padding between packed sprites.");
5657

5758
public readonly GUIContent generateMipMapLabel = EditorGUIUtility.TrTextContent("Generate Mip Maps");
@@ -121,6 +122,7 @@ private enum AtlasType { Undefined = -1, Master = 0, Variant = 1 }
121122
private SerializedProperty m_Readable;
122123
private SerializedProperty m_UseSRGB;
123124
private SerializedProperty m_EnableTightPacking;
125+
private SerializedProperty m_EnableAlphaDilation;
124126
private SerializedProperty m_EnableRotation;
125127
private SerializedProperty m_Padding;
126128
private SerializedProperty m_BindAsDefault;
@@ -234,6 +236,7 @@ void OnEnable()
234236

235237
m_EnableTightPacking = serializedAssetObject.FindProperty("m_ImporterData.packingSettings.enableTightPacking");
236238
m_EnableRotation = serializedAssetObject.FindProperty("m_ImporterData.packingSettings.enableRotation");
239+
m_EnableAlphaDilation = serializedObject.FindProperty("m_EditorData.packingSettings.enableAlphaDilation");
237240
m_Padding = serializedAssetObject.FindProperty("m_ImporterData.packingSettings.padding");
238241

239242
m_MasterAtlas = serializedAssetObject.FindProperty("m_MasterAtlas");
@@ -541,6 +544,7 @@ private void HandleMasterSettingUI()
541544

542545
HandleBoolToIntPropertyField(m_EnableRotation, styles.enableRotationLabel);
543546
HandleBoolToIntPropertyField(m_EnableTightPacking, styles.enableTightPackingLabel);
547+
HandleBoolToIntPropertyField(m_EnableAlphaDilation, styles.enableAlphaDilationLabel);
544548
EditorGUILayout.IntPopup(m_Padding, styles.paddingOptions, styles.paddingValues, styles.paddingLabel);
545549

546550
GUILayout.Space(EditorGUI.kSpacing);

Editor/Mono/2D/SpriteAtlas/SpriteAtlasInspector.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ class Styles
5353
public readonly GUIContent bindAsDefaultLabel = EditorGUIUtility.TrTextContent("Include in Build", "Packed textures will be included in the build by default.");
5454
public readonly GUIContent enableRotationLabel = EditorGUIUtility.TrTextContent("Allow Rotation", "Try rotating the sprite to fit better during packing.");
5555
public readonly GUIContent enableTightPackingLabel = EditorGUIUtility.TrTextContent("Tight Packing", "Use the mesh outline to fit instead of the whole texture rect during packing.");
56+
public readonly GUIContent enableAlphaDilationLabel = EditorGUIUtility.TrTextContent("Alpha Dilation", "Enable Alpha Dilation for SpriteAtlas padding pixels.");
5657
public readonly GUIContent paddingLabel = EditorGUIUtility.TrTextContent("Padding", "The amount of extra padding between packed sprites.");
5758

5859
public readonly GUIContent generateMipMapLabel = EditorGUIUtility.TrTextContent("Generate Mip Maps");
@@ -119,6 +120,7 @@ private enum AtlasType { Undefined = -1, Master = 0, Variant = 1 }
119120
private SerializedProperty m_Readable;
120121
private SerializedProperty m_UseSRGB;
121122
private SerializedProperty m_EnableTightPacking;
123+
private SerializedProperty m_EnableAlphaDilation;
122124
private SerializedProperty m_EnableRotation;
123125
private SerializedProperty m_Padding;
124126
private SerializedProperty m_BindAsDefault;
@@ -199,6 +201,7 @@ void OnEnable()
199201
m_UseSRGB = serializedObject.FindProperty("m_EditorData.textureSettings.sRGB");
200202

201203
m_EnableTightPacking = serializedObject.FindProperty("m_EditorData.packingSettings.enableTightPacking");
204+
m_EnableAlphaDilation = serializedObject.FindProperty("m_EditorData.packingSettings.enableAlphaDilation");
202205
m_EnableRotation = serializedObject.FindProperty("m_EditorData.packingSettings.enableRotation");
203206
m_Padding = serializedObject.FindProperty("m_EditorData.packingSettings.padding");
204207

@@ -463,6 +466,7 @@ private void HandleMasterSettingUI()
463466

464467
HandleBoolToIntPropertyField(m_EnableRotation, styles.enableRotationLabel);
465468
HandleBoolToIntPropertyField(m_EnableTightPacking, styles.enableTightPackingLabel);
469+
HandleBoolToIntPropertyField(m_EnableAlphaDilation, styles.enableAlphaDilationLabel);
466470
EditorGUILayout.IntPopup(m_Padding, styles.paddingOptions, styles.paddingValues, styles.paddingLabel);
467471

468472
GUILayout.Space(EditorGUI.kSpacing);

Editor/Mono/AssetPipeline/TextureGenerator.bindings.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,12 @@ public TextureGenerationSettings(TextureImporterType type)
204204
m_Settings.alphaIsTransparency = false;
205205
m_Settings.alphaSource = TextureImporterAlphaSource.None;
206206
break;
207+
case TextureImporterType.DirectionalLightmap:
208+
m_Settings.sRGBTexture = false;
209+
m_Settings.npotScale = TextureImporterNPOTScale.ToNearest;
210+
m_Settings.alphaIsTransparency = false;
211+
m_Settings.alphaSource = TextureImporterAlphaSource.None;
212+
break;
207213
case TextureImporterType.Shadowmask:
208214
m_Settings.sRGBTexture = false;
209215
m_Settings.npotScale = TextureImporterNPOTScale.ToNearest;

Editor/Mono/AssetPipeline/TextureImporterEnums.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@ public enum TextureImporterType
315315
Advanced = 5,
316316
SingleChannel = 10,
317317
Shadowmask = 11,
318+
DirectionalLightmap = 12,
318319
}
319320

320321
public enum TextureImporterCompression

Editor/Mono/AssetPostprocessor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ static bool InvokeMethodIfAvailable<T>(object target, string methodName, object[
680680
returnedObject = method.Invoke(target, args) as T;
681681
}
682682

683-
return true;
683+
return returnedObject != null;
684684
}
685685
return false;
686686
}

Editor/Mono/Audio/WaveformPreview.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ public void Render(Rect rect)
158158
else if (m_ChannelMode == ChannelMode.SpecificChannel)
159159
mode = m_SpecificChannel;
160160

161-
s_Material.SetInt("_ChanDrawMode", mode);
161+
s_Material.SetFloat("_ChanDrawMode", (float)mode);
162162

163163
Graphics.DrawTexture(rect, m_Texture, s_Material);
164164
}

Editor/Mono/BuildPipeline/BuildUtils.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ private static void RunProgram(Program p, string exe, string args, string workin
114114
{
115115
var errorOutput = p.GetErrorOutput();
116116
var standardOutput = p.GetStandardOutput();
117-
messages.AddRange(parser.Parse(errorOutput, standardOutput, true, "n/a (il2cpp)"));
117+
messages.AddRange(parser.Parse(errorOutput, standardOutput, true));
118118
}
119119

120120
foreach (var message in NonerrorMessages(messages))

Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,11 @@ internal static string GetTundraFolder()
451451
return $"{GetIl2CppFolder()}/external/bee/tundra";
452452
}
453453

454+
internal static string GetReapiCacheClientFolder()
455+
{
456+
return $"{GetIl2CppFolder()}/external/bee/reapi-cache-client";
457+
}
458+
454459
internal static string GetAdditionalArguments()
455460
{
456461
var arguments = new List<string>();
@@ -740,14 +745,13 @@ private void RunIl2CppWithArguments(List<string> arguments, Action<ProcessStartI
740745
{
741746
var args = arguments.Aggregate(String.Empty, (current, arg) => current + arg + " ");
742747

743-
BeeSettingsIl2Cpp il2cppSettings = new BeeSettingsIl2Cpp();
748+
BeeSettingsIl2Cpp beeSettings = new BeeSettingsIl2Cpp();
744749
var il2cppOutputParser = new Il2CppOutputParser(Path.Combine(generatedCppOutputDirectory, "Il2CppToEditorData.json"));
745750

746-
il2cppSettings.ToolPath = $"{EscapeSpacesInPath(GetIl2CppExe())}";
747-
il2cppSettings.Arguments.AddRange(arguments);
748-
il2cppSettings.Serialize(m_PlatformProvider.il2cppBuildCacheDirectory);
751+
beeSettings.ToolPath = $"{EscapeSpacesInPath(GetIl2CppExe())}";
752+
beeSettings.Arguments.AddRange(arguments);
753+
beeSettings.Serialize(m_PlatformProvider.il2cppBuildCacheDirectory);
749754

750-
FileUtil.CopyDirectoryRecursive(GetIl2CppBeeArtifactsDirectory(), $"{m_PlatformProvider.il2cppBuildCacheDirectory}/artifacts", true);
751755
void SetupTundraAndStartInfo(ProcessStartInfo startInfo)
752756
{
753757
if (setupStartInfo != null)
@@ -756,11 +760,13 @@ void SetupTundraAndStartInfo(ProcessStartInfo startInfo)
756760
// For some reason, TUNDRA_EXECUTABLE needs to be unescaped in order to be found on OSX,
757761
// but MONO_EXECUTABLE needs to be escaped in order to be found on OSX
758762
startInfo.EnvironmentVariables.Add("TUNDRA_EXECUTABLE", GetIl2CppTundraExe());
763+
startInfo.EnvironmentVariables.Add("REAPI_CACHE_CLIENT", GetIl2CppReapiCacheClientExe());
759764
startInfo.EnvironmentVariables.Add("MONO_EXECUTABLE", EscapeSpacesInPath(GetMonoBleedingEdgeExe()));
760765
}
761766

767+
var beeArgs = $"--no-colors --prebuiltbuildprogram={EscapeSpacesInPath(GetIl2CppBeeBuildProgramExe())}";
762768
Console.WriteLine("Invoking il2cpp (via bee.exe) with arguments: " + args);
763-
Runner.RunManagedProgram(GetIl2CppBeeExe(), "--useprebuiltbuildprogram --no-colors", m_PlatformProvider.il2cppBuildCacheDirectory, il2cppOutputParser, SetupTundraAndStartInfo);
769+
Runner.RunManagedProgram(GetIl2CppBeeExe(), beeArgs, m_PlatformProvider.il2cppBuildCacheDirectory, il2cppOutputParser, SetupTundraAndStartInfo);
764770

765771
// Copy IL2CPP outputs to StagingArea
766772
var nativeOutputDirectoryInBuildCache = GetNativeOutputDirectory(m_PlatformProvider.il2cppBuildCacheDirectory);
@@ -803,6 +809,11 @@ private string GetIl2CppBeeArtifactsDirectory()
803809
return $"{IL2CPPUtils.GetIl2CppBeeSettingsFolder()}/artifacts";
804810
}
805811

812+
private string GetIl2CppBeeBuildProgramExe()
813+
{
814+
return $"{GetIl2CppBeeArtifactsDirectory()}/buildprogram/buildprogram.exe";
815+
}
816+
806817
private string GetIl2CppTundraExe()
807818
{
808819
if (Application.platform == RuntimePlatform.OSXEditor)
@@ -813,6 +824,16 @@ private string GetIl2CppTundraExe()
813824
return $"{IL2CPPUtils.GetTundraFolder()}/tundra-win-x64/tundra2.exe";
814825
}
815826

827+
private string GetIl2CppReapiCacheClientExe()
828+
{
829+
if (Application.platform == RuntimePlatform.OSXEditor)
830+
return $"{IL2CPPUtils.GetReapiCacheClientFolder()}/tundra-mac-x64/tundra2";
831+
if (Application.platform == RuntimePlatform.LinuxEditor)
832+
return $"{IL2CPPUtils.GetReapiCacheClientFolder()}/tundra-linux-x64/tundra2";
833+
834+
return $"{IL2CPPUtils.GetReapiCacheClientFolder()}/tundra-win-x64/tundra2.exe";
835+
}
836+
816837
private string GetMonoBleedingEdgeExe()
817838
{
818839
var path = Path.Combine(MonoInstallationFinder.GetMonoInstallation("MonoBleedingEdge"), "bin");

Editor/Mono/BuildPlayerWindow.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public GUIContent GetDownloadErrorForTarget(BuildTarget target)
6767
public GUIContent buildWithDeepProfiler = EditorGUIUtility.TrTextContent("Deep Profiling Support", "Build Player with Deep Profiling Support. This might affect Player performance.");
6868
public GUIContent buildWithDeepProfilerDisabled = EditorGUIUtility.TrTextContent("Deep Profiling", "Profiling is only enabled in a Development Player.");
6969
public GUIContent allowDebugging = EditorGUIUtility.TrTextContent("Script Debugging", "Enable this setting to allow your script code to be debugged.");
70-
public GUIContent waitForManagedDebugger = EditorGUIUtility.TrTextContent("Wait For Managed Debugger", "Show a dialog where you can attach a managed debugger before any script execution.");
70+
public GUIContent waitForManagedDebugger = EditorGUIUtility.TrTextContent("Wait For Managed Debugger", "Show a dialog where you can attach a managed debugger before any script execution. Can also use volume Up or Down button to confirm on Android.");
7171
public GUIContent explicitNullChecks = EditorGUIUtility.TrTextContent("Explicit Null Checks");
7272
public GUIContent explicitDivideByZeroChecks = EditorGUIUtility.TrTextContent("Divide By Zero Checks");
7373
public GUIContent explicitArrayBoundsChecks = EditorGUIUtility.TrTextContent("Array Bounds Checks");

0 commit comments

Comments
 (0)