Skip to content

Commit f78f409

Browse files
author
Unity Technologies
committed
Unity 2020.1.0a9 C# reference source code
1 parent 86305f7 commit f78f409

File tree

154 files changed

+3292
-1239
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

+3292
-1239
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ void OnEnable()
194194
m_VariantScale = serializedObject.FindProperty("m_EditorData.variantMultiplier");
195195

196196
m_Packables = serializedObject.FindProperty("m_EditorData.packables");
197-
m_PackableList = new ReorderableList(serializedObject, m_Packables, true, true, true, true);
197+
m_PackableList = new ReorderableList(serializedObject, m_Packables, true, false, true, true);
198198
m_PackableList.onAddCallback = AddPackable;
199199
m_PackableList.onRemoveCallback = RemovePackable;
200200
m_PackableList.drawElementCallback = DrawPackableElement;

Editor/Mono/Animation/AnimationMode.bindings.cs

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
namespace UnityEditor
1515
{
16-
internal class AnimationModeDriver : ScriptableObject
16+
public class AnimationModeDriver : ScriptableObject
1717
{
1818
internal delegate bool IsKeyCallback(Object target, string propertyPath);
1919

@@ -65,11 +65,14 @@ static private AnimationModeDriver DummyDriver()
6565
// Stops animation mode, as used by the animation editor.
6666
public static void StopAnimationMode()
6767
{
68-
StopAnimationMode(DummyDriver());
68+
Internal_StopAnimationMode(DummyDriver());
6969
}
7070

7171
// Stops animation mode, as used by the animation editor.
72-
extern internal static void StopAnimationMode(Object driver);
72+
public static void StopAnimationMode(AnimationModeDriver driver)
73+
{
74+
Internal_StopAnimationMode(driver);
75+
}
7376

7477
// Returns true if the editor is currently in animation mode.
7578
public static bool InAnimationMode()
@@ -78,19 +81,22 @@ public static bool InAnimationMode()
7881
}
7982

8083
// Returns true if the editor is currently in animation mode.
81-
internal static bool InAnimationMode(Object driver)
84+
public static bool InAnimationMode(AnimationModeDriver driver)
8285
{
8386
return Internal_InAnimationMode(driver);
8487
}
8588

8689
// Starts animation mode, as used by the animation editor.
8790
public static void StartAnimationMode()
8891
{
89-
StartAnimationMode(DummyDriver());
92+
Internal_StartAnimationMode(DummyDriver());
9093
}
9194

9295
// Starts animation mode, as used by the animation editor.
93-
extern internal static void StartAnimationMode(Object driver);
96+
public static void StartAnimationMode(AnimationModeDriver driver)
97+
{
98+
Internal_StartAnimationMode(driver);
99+
}
94100

95101
// Stops animation playback mode, as used by the animation editor.
96102
internal static void StopAnimationPlaybackMode()
@@ -129,8 +135,10 @@ internal static void StartAnimationRecording()
129135
onAnimationRecordingStart?.Invoke();
130136
}
131137

132-
[NativeThrows]
133-
extern internal static void StartCandidateRecording(Object driver);
138+
internal static void StartCandidateRecording(AnimationModeDriver driver)
139+
{
140+
Internal_StartCandidateRecording(driver);
141+
}
134142

135143
[NativeThrows]
136144
extern internal static void AddCandidate(EditorCurveBinding binding, PropertyModification modification, bool keepPrefabOverride);
@@ -155,7 +163,7 @@ internal static void StartAnimationRecording()
155163
extern internal static void SampleCandidateClip([NotNull] GameObject gameObject, [NotNull] AnimationClip clip, float time);
156164

157165
[NativeThrows]
158-
extern internal static void SamplePlayableGraph([NotNull] GameObject gameObject, PlayableGraph graph, int index, float time);
166+
extern public static void SamplePlayableGraph(PlayableGraph graph, int index, float time);
159167

160168
[NativeThrows]
161169
extern public static void AddPropertyModification(EditorCurveBinding binding, PropertyModification modification, bool keepPrefabOverride);
@@ -190,8 +198,15 @@ internal static void StartAnimationRecording()
190198
// Return editor curve bindings for animator hierarhcy that need to be snapshot for animation mode.
191199
extern internal static EditorCurveBinding[] GetAnimatorBindings([NotNull] GameObject root);
192200

201+
extern private static void Internal_StartAnimationMode(Object driver);
202+
203+
extern private static void Internal_StopAnimationMode(Object driver);
204+
193205
extern private static bool Internal_InAnimationMode(Object driver);
194206

195207
extern private static bool Internal_InAnimationModeNoDriver();
208+
209+
[NativeThrows]
210+
extern private static void Internal_StartCandidateRecording(Object driver);
196211
}
197212
}

Editor/Mono/Animation/AnimationWindow/AnimEditor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ private void FrameRateInputFieldOnGUI()
575575

576576
using (new EditorGUI.DisabledScope(!selection.animationIsEditable))
577577
{
578-
GUILayout.Label(AnimationWindowStyles.samples, EditorStyles.miniLabel);
578+
GUILayout.Label(AnimationWindowStyles.samples, EditorStyles.toolbarLabel);
579579

580580
EditorGUI.BeginChangeCheck();
581581
int clipFrameRate = EditorGUILayout.DelayedIntField((int)m_State.clipFrameRate, EditorStyles.toolbarTextField, GUILayout.Width(kIntFieldWidth));

Editor/Mono/Animation/AnimationWindow/AnimationWindowControl.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@ private void ResampleAnimation(ResampleFlags flags)
676676

677677
m_ClipPlayable.SetSampleRate(playing ? -1 : state.activeAnimationClip.frameRate);
678678

679-
AnimationMode.SamplePlayableGraph(state.activeRootGameObject, m_Graph, 0, time.time);
679+
AnimationMode.SamplePlayableGraph(m_Graph, 0, time.time);
680680

681681
// This will cover euler/quaternion matching in basic playable graphs only (animation clip + candidate clip).
682682
AnimationUtility.SampleEulerHint(state.activeRootGameObject, state.activeAnimationClip, time.time, WrapMode.Clamp);

Editor/Mono/Annotation/SceneRenderModeWindow.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ private float windowHeight
167167
modes = Styles.sBuiltinCameraModes.Length + SceneView.userDefinedModes.Count(mode => m_SceneView.IsCameraDrawModeEnabled(mode));
168168
}
169169

170-
int separators = headers - 2;
170+
int separators = headers - 1;
171171
return ((headers + modes) * EditorGUI.kSingleLineHeight) + (kSeparatorHeight * separators) + kShowLightmapResolutionHeight;
172172
}
173173
}

Editor/Mono/AssetModificationProcessor.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,12 @@ static void FileModeChanged(string[] assets, UnityEditor.VersionControl.FileMode
127127
if (!Provider.enabled)
128128
return;
129129

130+
// if we happen to be disconnected or work offline, there's not much we can do;
131+
// just ignore the file mode and hope that VCS client/project is setup to handle
132+
// appropriate file types correctly
133+
if (!Provider.isActive)
134+
return;
135+
130136
// we'll want to re-serialize these assets in different (text vs binary) mode;
131137
// make sure they are editable first
132138
AssetDatabase.MakeEditable(assets);

Editor/Mono/EditorGUI.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1734,10 +1734,13 @@ internal static string ToolbarSearchField(int id, Rect position, string[] search
17341734
{
17351735
using (new DisabledScope(true))
17361736
{
1737-
var placeHolderTextRect = position;
1737+
var placeHolderTextRect = EditorStyles.toolbarSearchFieldPopup.padding.Remove(new Rect(position.x, position.y, position.width
1738+
, EditorStyles.toolbarSearchFieldPopup.fixedHeight > 0 ? EditorStyles.toolbarSearchFieldPopup.fixedHeight : position.height));
1739+
var oldFontSize = EditorStyles.label.fontSize;
17381740

1739-
placeHolderTextRect.xMin += EditorStyles.toolbarSearchFieldPopup.padding.right;
1741+
EditorStyles.label.fontSize = EditorStyles.toolbarSearchFieldPopup.fontSize;
17401742
EditorStyles.label.Draw(placeHolderTextRect, EditorGUIUtility.TempContent(searchModes[searchMode]), false, false, false, false);
1743+
EditorStyles.label.fontSize = oldFontSize;
17411744
}
17421745
}
17431746

@@ -5302,6 +5305,12 @@ internal static bool HelpIconButton(Rect position, Object[] objs)
53025305
bool hasHelp = Help.HasHelpForObject(obj, monoBehaviourFallback);
53035306
if (hasHelp || isDevBuild)
53045307
{
5308+
// Help button should not be disabled at any time. For example VCS system disables
5309+
// inspectors and it wouldn't make sense to prevent users from getting help because
5310+
// he didn't check out the file yet.
5311+
bool wasEditorDisabled = GUI.enabled;
5312+
GUI.enabled = true;
5313+
53055314
Color oldColor = GUI.color;
53065315
GUIContent content = new GUIContent(GUIContents.helpIcon);
53075316
string helpTopic = Help.GetNiceHelpNameForObject(obj, monoBehaviourFallback);
@@ -5328,6 +5337,8 @@ internal static bool HelpIconButton(Rect position, Object[] objs)
53285337
}
53295338

53305339
GUI.color = oldColor;
5340+
GUI.enabled = wasEditorDisabled;
5341+
53315342
return true;
53325343
}
53335344
return false;

Editor/Mono/EditorSceneManager.bindings.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,13 +197,14 @@ public extern static SceneAsset playModeStartScene
197197
[StaticAccessor("GetSceneManager()", StaticAccessorType.Dot)]
198198
extern public static ulong CalculateAvailableSceneCullingMask();
199199

200-
// Ensure in sync with kDefaultSceneCullingMask in C++ (it needs to match DefaultSceneCullingMask bits)
201-
public const ulong DefaultSceneCullingMask = SceneCullingMasks.GameViewObjects | SceneCullingMasks.MainStageSceneViewObjects;
200+
// Use SceneCullingMasks.DefaultSceneCullingMask
201+
public const ulong DefaultSceneCullingMask = SceneCullingMasks.DefaultSceneCullingMask;
202202
}
203203

204204
public static class SceneCullingMasks
205205
{
206-
// If updating the bits here ensure kDefaultSceneCullingMask (in C++) is in sync with EditorSceneManager.DefaultSceneCullingMask
206+
// If updating the bits here ensure kDefaultSceneCullingMask (in C++) is in sync. Also ensure EditorSceneManager.DefaultSceneCullingMask is in sync.
207+
public const ulong DefaultSceneCullingMask = GameViewObjects | MainStageSceneViewObjects;
207208
public const ulong GameViewObjects = 1UL << 63;
208209
public const ulong MainStageSceneViewObjects = MainStagePrefabInstanceObjectsOpenInPrefabMode | MainStageExcludingPrefabInstanceObjectsOpenInPrefabMode;
209210

Editor/Mono/EditorSettings.bindings.cs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,19 @@ public enum LineEndingsMode
4040
Windows = 2
4141
}
4242

43+
public enum AssetPipelineMode
44+
{
45+
Version1 = 0,
46+
Version2 = 1
47+
}
48+
49+
public enum CacheServerMode
50+
{
51+
AsPreferences = 0,
52+
Enabled = 1,
53+
Disabled = 2
54+
}
55+
4356
[Flags]
4457
public enum EnterPlayModeOptions
4558
{
@@ -237,5 +250,23 @@ internal static extern string Internal_ProjectGenerationUserExtensions
237250

238251
[StaticAccessor("GetEditorSettings()", StaticAccessorType.Dot)]
239252
public static extern EnterPlayModeOptions enterPlayModeOptions { get; set; }
253+
254+
[StaticAccessor("GetEditorSettings()", StaticAccessorType.Dot)]
255+
public static extern AssetPipelineMode assetPipelineMode { get; set; }
256+
257+
[StaticAccessor("GetEditorSettings()", StaticAccessorType.Dot)]
258+
public static extern CacheServerMode cacheServerMode { get; set; }
259+
260+
[StaticAccessor("GetEditorSettings()", StaticAccessorType.Dot)]
261+
public static extern string cacheServerEndpoint { get; set; }
262+
263+
[StaticAccessor("GetEditorSettings()", StaticAccessorType.Dot)]
264+
public static extern string cacheServerNamespacePrefix { get; set; }
265+
266+
[StaticAccessor("GetEditorSettings()", StaticAccessorType.Dot)]
267+
public static extern bool cacheServerEnableDownload { get; set; }
268+
269+
[StaticAccessor("GetEditorSettings()", StaticAccessorType.Dot)]
270+
public static extern bool cacheServerEnableUpload { get; set; }
240271
}
241272
}

Editor/Mono/EditorUserBuildSettings.bindings.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,8 @@ public static extern AndroidETC2Fallback androidETC2Fallback
409409
[Obsolete("androidUseLegacySdkTools has been deprecated. It does not have any effect.")]
410410
public static extern bool androidUseLegacySdkTools { get; set; }
411411

412+
public static extern bool androidCreateSymbolsZip { get; set; }
413+
412414
// *undocumented*
413415
// NOTE: This setting should probably not be a part of the public API as is. Atm it is used by playmode tests
414416
// and applied during build post-processing. We will however move towards separating building and launching

Editor/Mono/GI/LightProbeVisualization.bindings.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ internal enum LightProbeVisualizationMode
2929
[StaticAccessor("GetLightProbeVisualizationSettings()")]
3030
public extern static bool showOcclusions { get; set; }
3131

32+
[StaticAccessor("GetLightProbeVisualizationSettings()")]
33+
public extern static bool highlightInvalidCells { get; set; }
34+
3235
[StaticAccessor("GetLightProbeVisualizationSettings()")]
3336
public extern static bool dynamicUpdateLightProbes { get; set; }
3437

Editor/Mono/GI/Lightmapping.bindings.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,9 @@ public enum GIWorkflowMode
182182
[StaticAccessor("ProgressiveRuntimeManager::Get()", StaticAccessorType.Arrow)]
183183
internal static extern ulong GetVisibleTexelCount(int lightmapIndex);
184184

185+
[StaticAccessor("ProgressiveRuntimeManager::Get()", StaticAccessorType.Arrow)]
186+
internal static extern int atlasCount { [NativeName("GetAtlasCount")] get; }
187+
185188
[StaticAccessor("ProgressiveRuntimeManager::Get()", StaticAccessorType.Arrow)]
186189
internal static extern LightmapConvergence GetLightmapConvergence(int lightmapIndex);
187190

Editor/Mono/GUI/AboutWindow.cs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using System;
77
using System.Collections;
88
using System.Collections.Generic;
9+
using System.Diagnostics;
910
using UnityEditor;
1011
using UnityEditor.VisualStudioIntegration;
1112
using UnityEditorInternal;
@@ -16,15 +17,22 @@ internal class AboutWindow : EditorWindow
1617
{
1718
static void ShowAboutWindow()
1819
{
19-
AboutWindow w = EditorWindow.GetWindowWithRect<AboutWindow>(new Rect(100, 100, 570, 340), true, "About Unity");
20-
w.position = new Rect(100, 100, 570, 340);
20+
AboutWindow w = EditorWindow.GetWindowWithRect<AboutWindow>(new Rect(100, 100, 570, 360), true, "About Unity");
21+
w.position = new Rect(100, 100, 570, 360);
2122
w.m_Parent.window.m_DontSaveToLayout = true;
2223
}
2324

2425
private static GUIContent s_MonoLogo, s_AgeiaLogo, s_Header;
2526

2627
private const string kSpecialThanksNames = "Thanks to Forest 'Yoggy' Johnson, Graham McAllister, David Janik-Jones, Raimund Schumacher, Alan J. Dickins and Emil 'Humus' Persson";
2728

29+
static class Styles
30+
{
31+
public static GUIContent thanksContent = new GUIContent("Special thanks to our beta users");
32+
public static GUIStyle thanksStyle = EditorStyles.FromUSS("About-Thanks-Label");
33+
public static Uri thanksUri = new Uri("https://unity.com/releases/2020-1/thanks");
34+
}
35+
2836
private static void LoadLogos()
2937
{
3038
if (s_MonoLogo != null)
@@ -150,6 +158,14 @@ public void OnGUI()
150158
GUILayout.BeginVertical();
151159
GUILayout.FlexibleSpace();
152160

161+
var specialThanksRect = GUILayoutUtility.GetRect(Styles.thanksContent, Styles.thanksStyle);
162+
if (GUI.Button(specialThanksRect, Styles.thanksContent, Styles.thanksStyle))
163+
{
164+
Process.Start(Styles.thanksUri.AbsoluteUri);
165+
}
166+
167+
EditorGUIUtility.AddCursorRect(specialThanksRect, MouseCursor.Link);
168+
153169
var VSTUlabel = UnityVSSupport.GetAboutWindowLabel();
154170
if (VSTUlabel.Length > 0)
155171
GUILayout.Label(VSTUlabel, "MiniLabel");

0 commit comments

Comments
 (0)