Skip to content

Commit 6a14d35

Browse files
author
Unity Technologies
committed
Unity 2020.2.0a15 C# reference source code
1 parent 61f92bd commit 6a14d35

File tree

442 files changed

+15258
-7669
lines changed

Some content is hidden

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

442 files changed

+15258
-7669
lines changed

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

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -80,31 +80,31 @@ public struct SpriteAtlasPackingSettings
8080
[NativeHeader("Runtime/2D/SpriteAtlas/SpriteAtlas.h")]
8181
public static class SpriteAtlasExtensions
8282
{
83-
extern public static void Add(this SpriteAtlas spriteAtlas, UnityEngine.Object[] objects);
84-
extern public static void Remove(this SpriteAtlas spriteAtlas, UnityEngine.Object[] objects);
85-
extern internal static void RemoveAt(this SpriteAtlas spriteAtlas, int index);
86-
extern public static UnityEngine.Object[] GetPackables(this SpriteAtlas spriteAtlas);
87-
extern public static SpriteAtlasTextureSettings GetTextureSettings(this SpriteAtlas spriteAtlas);
88-
extern public static void SetTextureSettings(this SpriteAtlas spriteAtlas, SpriteAtlasTextureSettings src);
89-
extern public static SpriteAtlasPackingSettings GetPackingSettings(this SpriteAtlas spriteAtlas);
90-
extern public static void SetPackingSettings(this SpriteAtlas spriteAtlas, SpriteAtlasPackingSettings src);
91-
extern public static TextureImporterPlatformSettings GetPlatformSettings(this SpriteAtlas spriteAtlas, string buildTarget);
92-
extern public static void SetPlatformSettings(this SpriteAtlas spriteAtlas, TextureImporterPlatformSettings src);
93-
extern public static void SetIncludeInBuild(this SpriteAtlas spriteAtlas, bool value);
94-
extern public static void SetIsVariant(this SpriteAtlas spriteAtlas, bool value);
95-
extern public static void SetMasterAtlas(this SpriteAtlas spriteAtlas, SpriteAtlas value);
96-
extern public static void SetVariantScale(this SpriteAtlas spriteAtlas, float value);
97-
extern internal static void CopyMasterAtlasSettings(this SpriteAtlas spriteAtlas);
98-
extern internal static string GetHash(this SpriteAtlas spriteAtlas);
99-
extern internal static Texture2D[] GetPreviewTextures(this SpriteAtlas spriteAtlas);
100-
extern internal static Texture2D[] GetPreviewAlphaTextures(this SpriteAtlas spriteAtlas);
101-
extern internal static TextureFormat GetTextureFormat(this SpriteAtlas spriteAtlas, BuildTarget target);
102-
extern internal static Sprite[] GetPackedSprites(this SpriteAtlas spriteAtlas);
103-
extern internal static Hash128 GetStoredHash(this SpriteAtlas spriteAtlas);
104-
extern internal static TextureImporterPlatformSettings GetSecondaryPlatformSettings(this SpriteAtlas spriteAtlas, string buildTarget, string secondaryTextureName);
105-
extern internal static void SetSecondaryPlatformSettings(this SpriteAtlas spriteAtlas, TextureImporterPlatformSettings src, string secondaryTextureName);
106-
extern internal static bool GetSecondaryColorSpace(this SpriteAtlas spriteAtlas, string secondaryTextureName);
107-
extern internal static void SetSecondaryColorSpace(this SpriteAtlas spriteAtlas, string secondaryTextureName, bool srGB);
108-
extern internal static void DeleteSecondaryPlatformSettings(this SpriteAtlas spriteAtlas, string secondaryTextureName);
83+
extern public static void Add([NotNull("NullExceptionObject")] this SpriteAtlas spriteAtlas, UnityEngine.Object[] objects);
84+
extern public static void Remove([NotNull("NullExceptionObject")] this SpriteAtlas spriteAtlas, UnityEngine.Object[] objects);
85+
extern internal static void RemoveAt([NotNull("NullExceptionObject")] this SpriteAtlas spriteAtlas, int index);
86+
extern public static UnityEngine.Object[] GetPackables([NotNull("NullExceptionObject")] this SpriteAtlas spriteAtlas);
87+
extern public static SpriteAtlasTextureSettings GetTextureSettings([NotNull("NullExceptionObject")] this SpriteAtlas spriteAtlas);
88+
extern public static void SetTextureSettings([NotNull("NullExceptionObject")] this SpriteAtlas spriteAtlas, SpriteAtlasTextureSettings src);
89+
extern public static SpriteAtlasPackingSettings GetPackingSettings([NotNull("NullExceptionObject")] this SpriteAtlas spriteAtlas);
90+
extern public static void SetPackingSettings([NotNull("NullExceptionObject")] this SpriteAtlas spriteAtlas, SpriteAtlasPackingSettings src);
91+
extern public static TextureImporterPlatformSettings GetPlatformSettings([NotNull("NullExceptionObject")] this SpriteAtlas spriteAtlas, string buildTarget);
92+
extern public static void SetPlatformSettings([NotNull("NullExceptionObject")] this SpriteAtlas spriteAtlas, TextureImporterPlatformSettings src);
93+
extern public static void SetIncludeInBuild([NotNull("NullExceptionObject")] this SpriteAtlas spriteAtlas, bool value);
94+
extern public static void SetIsVariant([NotNull("NullExceptionObject")] this SpriteAtlas spriteAtlas, bool value);
95+
extern public static void SetMasterAtlas([NotNull("NullExceptionObject")] this SpriteAtlas spriteAtlas, SpriteAtlas value);
96+
extern public static void SetVariantScale([NotNull("NullExceptionObject")] this SpriteAtlas spriteAtlas, float value);
97+
extern internal static void CopyMasterAtlasSettings([NotNull("NullExceptionObject")] this SpriteAtlas spriteAtlas);
98+
extern internal static string GetHash([NotNull("NullExceptionObject")] this SpriteAtlas spriteAtlas);
99+
extern internal static Texture2D[] GetPreviewTextures([NotNull("NullExceptionObject")] this SpriteAtlas spriteAtlas);
100+
extern internal static Texture2D[] GetPreviewAlphaTextures([NotNull("NullExceptionObject")] this SpriteAtlas spriteAtlas);
101+
extern internal static TextureFormat GetTextureFormat([NotNull("NullExceptionObject")] this SpriteAtlas spriteAtlas, BuildTarget target);
102+
extern internal static Sprite[] GetPackedSprites([NotNull("NullExceptionObject")] this SpriteAtlas spriteAtlas);
103+
extern internal static Hash128 GetStoredHash([NotNull("NullExceptionObject")] this SpriteAtlas spriteAtlas);
104+
extern internal static TextureImporterPlatformSettings GetSecondaryPlatformSettings([NotNull("NullExceptionObject")] this SpriteAtlas spriteAtlas, string buildTarget, string secondaryTextureName);
105+
extern internal static void SetSecondaryPlatformSettings([NotNull("NullExceptionObject")] this SpriteAtlas spriteAtlas, TextureImporterPlatformSettings src, string secondaryTextureName);
106+
extern internal static bool GetSecondaryColorSpace([NotNull("NullExceptionObject")] this SpriteAtlas spriteAtlas, string secondaryTextureName);
107+
extern internal static void SetSecondaryColorSpace([NotNull("NullExceptionObject")] this SpriteAtlas spriteAtlas, string secondaryTextureName, bool srGB);
108+
extern internal static void DeleteSecondaryPlatformSettings([NotNull("NullExceptionObject")] this SpriteAtlas spriteAtlas, string secondaryTextureName);
109109
}
110110
}

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,10 @@ private static Styles styles
108108
return s_Styles;
109109
}
110110
}
111-
private SpriteAtlasAsset spriteAtlasAsset { get { return m_TargetAsset as SpriteAtlasAsset; } }
112-
private SpriteAtlasImporter spriteAtlasImporter { get { return target as SpriteAtlasImporter; } }
111+
private SpriteAtlasAsset spriteAtlasAsset
112+
{
113+
get { return m_TargetAsset; }
114+
}
113115
private enum AtlasType { Undefined = -1, Master = 0, Variant = 1 }
114116

115117
private SerializedProperty m_FilterMode;

Editor/Mono/Animation/AnimationWindow/AnimationRecording.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ static private void ProcessAnimatorModifications(IAnimationRecordingState state,
632632

633633
if (isHumanBone)
634634
{
635-
Debug.LogWarning("Keyframing translation on humanoid rig is not supported!", target as Transform);
635+
Debug.LogWarning("Keyframing translation on humanoid rig is not supported!", target);
636636
discardListPos.Add(item.Key);
637637
}
638638
else if (isRootMotion)
@@ -691,7 +691,7 @@ static private void ProcessAnimatorModifications(IAnimationRecordingState state,
691691

692692
if (isHumanBone)
693693
{
694-
Debug.LogWarning("Keyframing rotation on humanoid rig is not supported!", target as Transform);
694+
Debug.LogWarning("Keyframing rotation on humanoid rig is not supported!", target);
695695
discardListRot.Add(item.Key);
696696
}
697697
else if (isRootMotion)
@@ -739,7 +739,7 @@ static private void ProcessAnimatorModifications(IAnimationRecordingState state,
739739
bool isHumanBone = isHuman && !isRootTransform && animator.IsBoneTransform(target);
740740
if (isHumanBone)
741741
{
742-
Debug.LogWarning("Keyframing scale on humanoid rig is not supported!", target as Transform);
742+
Debug.LogWarning("Keyframing scale on humanoid rig is not supported!", target);
743743
discardListScale.Add(item.Key);
744744
}
745745
}

Editor/Mono/Animation/AnimationWindow/AnimationWindowControl.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ public override bool StartPreview()
420420
CreateCandidateClip();
421421

422422
IAnimationWindowPreview[] previewComponents = FetchPostProcessComponents();
423-
m_UsesPostProcessComponents = previewComponents != null;
423+
m_UsesPostProcessComponents = previewComponents != null && previewComponents.Length > 0;
424424
if (previewComponents != null)
425425
{
426426
foreach (var component in previewComponents)

Editor/Mono/Animation/AnimationWindow/AnimationWindowUtility.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -780,7 +780,7 @@ public static string NicifyPropertyGroupName(Type animatableObjectType, string p
780780
string result = GetPropertyGroupName(GetPropertyDisplayName(propertyGroupName));
781781

782782
// Workaround for uGUI RectTransform which only animates position.z
783-
if (animatableObjectType == typeof(RectTransform) & result.Equals("Position"))
783+
if (animatableObjectType == typeof(RectTransform) && result.Equals("Position"))
784784
result = "Position (Z)";
785785

786786
return result;

Editor/Mono/AnimatorController.bindings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ static public StateMachineBehaviourContext[] FindStateMachineBehaviourContext(St
8787
extern internal MonoScript GetBehaviourMonoScript(AnimatorState state, int layerIndex, int behaviourIndex);
8888

8989
[FreeFunction]
90-
extern private static ScriptableObject ScriptingAddStateMachineBehaviourWithType(Type stateMachineBehaviourType, AnimatorController controller, AnimatorState state, int layerIndex);
90+
extern private static ScriptableObject ScriptingAddStateMachineBehaviourWithType(Type stateMachineBehaviourType, [NotNull("NullExceptionObject")] AnimatorController controller, [NotNull("NullExceptionObject")] AnimatorState state, int layerIndex);
9191

9292

9393
[TypeInferenceRule(TypeInferenceRules.TypeReferencedByFirstArgument)]

Editor/Mono/Annotation/AnnotationWindow.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -733,6 +733,7 @@ public Texture2D Thumb
733733
// Icon for builtin components
734734
else if (HasIcon())
735735
m_Thumb = AssetPreview.GetMiniTypeThumbnailFromClassID(m_ClassID);
736+
m_Thumb = EditorGUIUtility.GetSkinnedIcon(m_Thumb);
736737
}
737738
return m_Thumb;
738739
}

Editor/Mono/AssemblyInfo/AssemblyInfo.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@
115115
[assembly: InternalsVisibleTo("Unity.UIElements.Editor")]
116116
[assembly: InternalsVisibleTo("Unity.UIElements.Tests")]
117117
[assembly: InternalsVisibleTo("Unity.UIElements.EditorTests")]
118+
[assembly: InternalsVisibleTo("UnityEditor.UIElementsGameObjectsModule")]
119+
118120
[assembly: InternalsVisibleTo("Unity.SceneTemplate.Editor")]
119121
[assembly: InternalsVisibleTo("com.unity.purchasing.udp.Editor")]
120122

Editor/Mono/AssetDatabase/AssetDatabase.cs

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,17 @@ private static bool Internal_IsOpenForEdit(string assetOrMetaFilePath)
7474
return IsOpenForEdit(assetOrMetaFilePath);
7575
}
7676

77+
public static void CanOpenForEdit(string[] assetOrMetaFilePaths, List<string> outNotEditablePaths, [uei.DefaultValue("StatusQueryOptions.UseCachedIfPossible")] StatusQueryOptions statusQueryOptions = StatusQueryOptions.UseCachedIfPossible)
78+
{
79+
if (assetOrMetaFilePaths == null)
80+
throw new ArgumentNullException(nameof(assetOrMetaFilePaths));
81+
if (outNotEditablePaths == null)
82+
throw new ArgumentNullException(nameof(outNotEditablePaths));
83+
UnityEngine.Profiling.Profiler.BeginSample("AssetDatabase.CanOpenForEdit");
84+
AssetModificationProcessorInternal.CanOpenForEdit(assetOrMetaFilePaths, outNotEditablePaths, statusQueryOptions);
85+
UnityEngine.Profiling.Profiler.EndSample();
86+
}
87+
7788
public static void IsOpenForEdit(string[] assetOrMetaFilePaths, List<string> outNotEditablePaths, [uei.DefaultValue("StatusQueryOptions.UseCachedIfPossible")] StatusQueryOptions statusQueryOptions = StatusQueryOptions.UseCachedIfPossible)
7889
{
7990
if (assetOrMetaFilePaths == null)
@@ -108,12 +119,15 @@ public static bool MakeEditable(string[] paths, string prompt = null, List<strin
108119
{
109120
if (paths == null)
110121
throw new ArgumentNullException(nameof(paths));
111-
122+
UnityEngine.Profiling.Profiler.BeginSample("AssetDatabase.MakeEditable");
112123
ChangeSet changeSet = null;
113-
if (!Provider.HandlePreCheckoutCallback(ref paths, ref changeSet))
114-
return false;
115-
116-
return Provider.MakeEditableImpl(paths, prompt, changeSet, outNotEditablePaths);
124+
var result = Provider.HandlePreCheckoutCallback(ref paths, ref changeSet);
125+
if (result && !AssetModificationProcessorInternal.MakeEditable(paths, prompt, outNotEditablePaths))
126+
result = false;
127+
if (result && !Provider.MakeEditableImpl(paths, prompt, changeSet, outNotEditablePaths))
128+
result = false;
129+
UnityEngine.Profiling.Profiler.EndSample();
130+
return result;
117131
}
118132
}
119133
}

Editor/Mono/AssetDatabase/AssetPreview.bindings.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,9 @@ public static Texture2D GetMiniThumbnail(Object obj)
8989

9090
public static Texture2D GetMiniTypeThumbnail(Type type)
9191
{
92-
Texture2D tex;
9392
if (typeof(MonoBehaviour).IsAssignableFrom(type))
94-
tex = EditorGUIUtility.LoadIcon(type.FullName.Replace('.', '/') + " Icon");
95-
else
96-
tex = GetMiniTypeThumbnailFromType(type);
97-
return tex;
93+
return EditorGUIUtility.LoadIcon(type.FullName.Replace('.', '/') + " Icon");
94+
return GetMiniTypeThumbnailFromType(type);
9895
}
9996

10097
[FreeFunction("AssetPreviewBindings::GetMiniTypeThumbnailFromObject")]

0 commit comments

Comments
 (0)