Skip to content

Commit 4ee7fa3

Browse files
author
Unity Technologies
committed
Unity 2019.2.0a6 C# reference source code
1 parent 7091799 commit 4ee7fa3

File tree

302 files changed

+12017
-8498
lines changed

Some content is hidden

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

302 files changed

+12017
-8498
lines changed

Editor/Mono/Annotation/SceneViewCameraWindow.cs

Lines changed: 53 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -30,39 +30,44 @@ public static void Init()
3030
readonly SceneView m_SceneView;
3131

3232
GUIContent m_CameraSpeedSliderContent;
33-
GUIContent[] m_CameraSpeedMinMax;
33+
GUIContent m_CameraSpeedMin;
34+
GUIContent m_CameraSpeedMax;
3435
GUIContent m_FieldOfView;
3536
GUIContent m_DynamicClip;
3637
GUIContent m_OcclusionCulling;
38+
GUIContent m_EasingEnabled;
39+
GUIContent m_EasingDuration;
3740

38-
const int k_FieldCount = 10;
39-
const int k_WindowWidth = 300;
40-
const int k_WindowHeight = ((int)EditorGUI.kSingleLineHeight) * k_FieldCount + kFrameWidth * 2;
41+
const int kFieldCount = 12;
42+
const int kWindowWidth = 290;
43+
const int kWindowHeight = ((int)EditorGUI.kSingleLineHeight) * kFieldCount + kFrameWidth * 2;
4144
const int kFrameWidth = 10;
42-
const float k_PrefixLabelWidth = 120f;
43-
const float kMinMaxSpeedLabelWidth = 26f;
44-
const float k_NearClipMin = .01f;
45+
const float kPrefixLabelWidth = 120f;
46+
const float kMinSpeedLabelWidth = 25f;
47+
const float kMaxSpeedLabelWidth = 29f;
48+
const float kMinMaxSpeedFieldWidth = 50f;
49+
const float kMinMaxSpeedSpace = 8f;
50+
const float kNearClipMin = .01f;
4551

4652
float[] m_Vector2Floats = { 0, 0 };
4753

4854
public override Vector2 GetWindowSize()
4955
{
50-
return new Vector2(k_WindowWidth, k_WindowHeight);
56+
return new Vector2(kWindowWidth, kWindowHeight);
5157
}
5258

5359
public SceneViewCameraWindow(SceneView sceneView)
5460
{
5561
m_SceneView = sceneView;
5662

57-
m_CameraSpeedSliderContent = EditorGUIUtility.TrTextContent("Speed", "The current speed of the camera in the Scene view.");
58-
m_CameraSpeedMinMax = new GUIContent[]
59-
{
60-
EditorGUIUtility.TrTextContent("Min", "The minimum speed of the camera in the Scene view. Valid values are between [0.01, 98]."),
61-
EditorGUIUtility.TrTextContent("Max", "The maximum speed of the camera in the Scene view. Valid values are between [0.02, 99].")
62-
};
63-
m_FieldOfView = EditorGUIUtility.TrTextContent("Field of View", "The height of the Camera's view angle. Measured in degrees vertically, or along the local Y axis.");
63+
m_CameraSpeedSliderContent = EditorGUIUtility.TrTextContent("Camera Speed", "The current speed of the camera in the Scene view.");
64+
m_CameraSpeedMin = EditorGUIUtility.TrTextContent("Min", "The minimum speed of the camera in the Scene view. Valid values are between [0.01, 98].");
65+
m_CameraSpeedMax = EditorGUIUtility.TrTextContent("Max", "The maximum speed of the camera in the Scene view. Valid values are between [0.02, 99].");
66+
m_FieldOfView = EditorGUIUtility.TrTextContent("Field of View", "The height of the camera's view angle. Measured in degrees vertically, or along the local Y axis.");
6467
m_DynamicClip = EditorGUIUtility.TrTextContent("Dynamic Clipping", "Check this to enable camera's near and far clipping planes to be calculated relative to the viewport size of the Scene.");
65-
m_OcclusionCulling = EditorGUIUtility.TrTextContent("Occlusion Culling", "Check this to enable occlusion culling in the Scene view. Occlusion culling disables rendering of objects when they\'re not currently seen by the Camera because they\'re hidden (occluded) by other objects.");
68+
m_OcclusionCulling = EditorGUIUtility.TrTextContent("Occlusion Culling", "Check this to enable occlusion culling in the Scene view. Occlusion culling disables rendering of objects when they\'re not currently seen by the camera because they\'re hidden (occluded) by other objects.");
69+
m_EasingEnabled = EditorGUIUtility.TrTextContent("Camera Easing", "Check this to enable camera movement easing. This makes the camera ease in when it starts moving, and ease out when it stops.");
70+
m_EasingDuration = EditorGUIUtility.TrTextContent("Duration", "How long it takes for the speed of the camera to accelerate to its initial full speed. Measured in seconds.");
6671
}
6772

6873
public override void OnGUI(Rect rect)
@@ -82,7 +87,7 @@ public override void OnGUI(Rect rect)
8287

8388
private void Draw(Rect rect)
8489
{
85-
var settings = m_SceneView.sceneViewCameraSettings;
90+
var settings = m_SceneView.cameraSettings;
8691
Styles.Init();
8792

8893
const int k_SettingsIconPad = 2;
@@ -96,7 +101,7 @@ private void Draw(Rect rect)
96101

97102
EditorGUI.BeginChangeCheck();
98103

99-
EditorGUIUtility.labelWidth = k_PrefixLabelWidth;
104+
EditorGUIUtility.labelWidth = kPrefixLabelWidth;
100105

101106
GUILayout.Label(EditorGUIUtility.TrTextContent("Scene Camera"), EditorStyles.boldLabel);
102107

@@ -111,12 +116,12 @@ private void Draw(Rect rect)
111116
using (new EditorGUI.DisabledScope(settings.dynamicClip))
112117
{
113118
float near = settings.nearClip, far = settings.farClip;
114-
ClipPlanesField(EditorGUI.s_ClipingPlanesLabel, ref near, ref far, EditorGUI.kNearFarLabelsWidth);
119+
DrawClipPlanesField(EditorGUI.s_ClipingPlanesLabel, ref near, ref far, EditorGUI.kNearFarLabelsWidth);
115120
settings.nearClip = near;
116121
settings.farClip = far;
117-
settings.nearClip = Mathf.Max(k_NearClipMin, settings.nearClip);
122+
settings.nearClip = Mathf.Max(kNearClipMin, settings.nearClip);
118123
if (settings.nearClip > settings.farClip)
119-
settings.farClip = settings.nearClip + k_NearClipMin;
124+
settings.farClip = settings.nearClip + kNearClipMin;
120125
}
121126

122127
settings.occlusionCulling = EditorGUILayout.Toggle(m_OcclusionCulling, settings.occlusionCulling);
@@ -126,18 +131,23 @@ private void Draw(Rect rect)
126131

127132
GUILayout.Label(EditorGUIUtility.TrTextContent("Navigation"), EditorStyles.boldLabel);
128133

134+
settings.easingEnabled = EditorGUILayout.Toggle(m_EasingEnabled, settings.easingEnabled);
135+
136+
using (new EditorGUI.DisabledScope(!settings.easingEnabled))
137+
{
138+
EditorGUI.indentLevel += 1;
139+
settings.easingDuration = EditorGUILayout.Slider(m_EasingDuration, settings.easingDuration, .1f, 2f);
140+
EditorGUI.indentLevel -= 1;
141+
}
142+
129143
settings.speed = EditorGUILayout.Slider(m_CameraSpeedSliderContent, settings.speed, settings.speedMin, settings.speedMax);
130144

131145
EditorGUI.BeginChangeCheck();
132146

133147
m_Vector2Floats[0] = settings.speedMin;
134148
m_Vector2Floats[1] = settings.speedMax;
135149

136-
GUILayout.BeginHorizontal();
137-
GUILayout.Space(EditorGUIUtility.labelWidth);
138-
Rect r = EditorGUILayout.GetControlRect(false, EditorGUI.kSingleLineHeight, EditorStyles.numberField);
139-
EditorGUI.MultiFloatField(r, m_CameraSpeedMinMax, m_Vector2Floats, kMinMaxSpeedLabelWidth);
140-
GUILayout.EndHorizontal();
150+
DrawSpeedMinMaxFields();
141151

142152
if (EditorGUI.EndChangeCheck())
143153
settings.SetSpeedMinMax(m_Vector2Floats);
@@ -147,7 +157,22 @@ private void Draw(Rect rect)
147157
GUILayout.EndArea();
148158
}
149159

150-
internal static void ClipPlanesField(GUIContent label, ref float near, ref float far, float propertyLabelsWidth, params GUILayoutOption[] options)
160+
void DrawSpeedMinMaxFields()
161+
{
162+
GUILayout.BeginHorizontal();
163+
GUILayout.Space(EditorGUIUtility.labelWidth);
164+
Rect r = EditorGUILayout.GetControlRect(false, EditorGUI.kSingleLineHeight, EditorStyles.numberField);
165+
r.width = kMinSpeedLabelWidth + kMinMaxSpeedFieldWidth;
166+
EditorGUIUtility.labelWidth = kMinSpeedLabelWidth;
167+
m_Vector2Floats[0] = EditorGUI.FloatField(r, m_CameraSpeedMin, m_Vector2Floats[0]);
168+
r.x += r.width + kMinMaxSpeedSpace;
169+
r.width = kMaxSpeedLabelWidth + kMinMaxSpeedFieldWidth;
170+
EditorGUIUtility.labelWidth = kMaxSpeedLabelWidth;
171+
m_Vector2Floats[1] = EditorGUI.FloatField(r, m_CameraSpeedMax, m_Vector2Floats[1]);
172+
GUILayout.EndHorizontal();
173+
}
174+
175+
void DrawClipPlanesField(GUIContent label, ref float near, ref float far, float propertyLabelsWidth, params GUILayoutOption[] options)
151176
{
152177
bool hasLabel = EditorGUI.LabelHasContent(label);
153178
const float height = EditorGUI.kSingleLineHeight * 2 + EditorGUI.kVerticalSpacingMultiField;
@@ -179,7 +204,7 @@ void ShowContextMenu()
179204

180205
void Reset()
181206
{
182-
m_SceneView.ResetSceneViewCameraSettings();
207+
m_SceneView.ResetCameraSettings();
183208
m_SceneView.Repaint();
184209
}
185210
}

Editor/Mono/Annotation/SceneViewSettingsProvider.cs

Lines changed: 0 additions & 74 deletions
This file was deleted.

Editor/Mono/AssemblyHelper.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,6 @@ public static string[] GetDefaultAssemblySearchPaths()
263263
foreach (var asm in precompiledAssemblies)
264264
searchPaths.Add(Path.GetDirectoryName(asm.Path));
265265

266-
searchPaths.Add("Library/ScriptAssemblies");
267266
return searchPaths.ToArray();
268267
}
269268

@@ -515,8 +514,7 @@ public static bool IsManagedAssembly(string file)
515514

516515
public static bool IsInternalAssembly(string file)
517516
{
518-
return UnityEditor.Modules.ModuleManager.IsRegisteredModule(file) ||
519-
ModuleUtils.GetAdditionalReferencesForUserScripts().Any(p => p.Equals(file));
517+
return ModuleUtils.GetAdditionalReferencesForUserScripts().Any(p => p.Equals(file));
520518
}
521519

522520
const int kDefaultDepth = 10;

Editor/Mono/AssemblyInfo/AssemblyInfo.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using UnityEngine;
77

88
// ADD_NEW_PLATFORM_HERE
9+
[assembly: InternalsVisibleTo("Unity.LiveNotes")]
910
[assembly: InternalsVisibleTo("Unity.Burst")]
1011
[assembly: InternalsVisibleTo("Unity.Burst.Editor")]
1112
[assembly: InternalsVisibleTo("Unity.CollabProxy.Editor")]
@@ -41,12 +42,14 @@
4142
[assembly: InternalsVisibleTo("UnityEditor.WindowsStandalone.Extensions")]
4243
[assembly: InternalsVisibleTo("UnityEditor.OSXStandalone.Extensions")]
4344
[assembly: InternalsVisibleTo("UnityEditor.Lumin.Extensions")]
45+
[assembly: InternalsVisibleTo("UnityEditor.BJM.Extensions")]
4446
[assembly: InternalsVisibleTo("UnityEditor.Networking")]
4547
[assembly: InternalsVisibleTo("UnityEngine.Networking")]
4648
[assembly: InternalsVisibleTo("Unity.Analytics.Editor")]
4749
[assembly: InternalsVisibleTo("UnityEditor.Analytics")]
4850
[assembly: InternalsVisibleTo("UnityEditor.Purchasing")]
4951
[assembly: InternalsVisibleTo("UnityEditor.Lumin")]
52+
[assembly: InternalsVisibleTo("UnityEditor.BJM")]
5053
[assembly: InternalsVisibleTo("UnityEditor.Switch.Extensions")]
5154
[assembly: InternalsVisibleTo("UnityEditor.EditorTestsRunner")]
5255
[assembly: InternalsVisibleTo("UnityEditor.TestRunner")]

Editor/Mono/AssetDatabase/AssetDatabaseSearching.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,23 +56,27 @@ private static IEnumerator<T> FindInFolders<T>(SearchFilter searchFilter, Func<H
5656
folders.AddRange(searchFilter.folders);
5757
if (folders.Remove(PackageManager.Folders.GetPackagesPath()))
5858
{
59-
var packages = PackageManagerUtilityInternal.GetAllVisiblePackages();
59+
var packages = PackageManagerUtilityInternal.GetAllVisiblePackages(searchFilter.skipHidden);
6060
foreach (var package in packages)
6161
{
6262
if (!folders.Contains(package.assetPath))
6363
folders.Add(package.assetPath);
6464
}
6565
}
6666

67-
foreach (string folderPath in folders)
67+
foreach (var folderPath in folders)
6868
{
6969
var folderInstanceID = AssetDatabase.GetMainAssetOrInProgressProxyInstanceID(folderPath);
7070
var rootPath = "Assets";
7171

7272
// Find the right rootPath if folderPath is part of a package
73-
var packageInfo = PackageManager.Packages.GetForAssetPath(folderPath);
73+
var packageInfo = PackageManager.PackageInfo.FindForAssetPath(folderPath);
7474
if (packageInfo != null)
75+
{
7576
rootPath = packageInfo.assetPath;
77+
if (searchFilter.skipHidden && !PackageManagerUtilityInternal.IsPathInVisiblePackage(rootPath))
78+
continue;
79+
}
7680

7781
// Set empty filter to ensure we search all assets to find folder
7882
var property = new HierarchyProperty(rootPath);
@@ -106,7 +110,7 @@ private static IEnumerator<T> FindEverywhere<T>(SearchFilter searchFilter, Func<
106110
if (searchFilter.searchArea == SearchFilter.SearchArea.AllAssets ||
107111
searchFilter.searchArea == SearchFilter.SearchArea.InPackagesOnly)
108112
{
109-
var packages = PackageManagerUtilityInternal.GetAllVisiblePackages();
113+
var packages = PackageManagerUtilityInternal.GetAllVisiblePackages(searchFilter.skipHidden);
110114
foreach (var package in packages)
111115
{
112116
rootPaths.Add(package.assetPath);
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Unity C# reference source
2+
// Copyright (c) Unity Technologies. For terms of use, see
3+
// https://unity3d.com/legal/licenses/Unity_Reference_Only_License
4+
5+
using UnityEditor;
6+
using UnityEngine;
7+
8+
namespace UnityEditorInternal
9+
{
10+
public sealed partial class AssemblyDefinitionReferenceImporter : AssetImporter
11+
{
12+
}
13+
14+
public sealed partial class AssemblyDefinitionReferenceAsset : TextAsset
15+
{
16+
private AssemblyDefinitionReferenceAsset() {}
17+
18+
private AssemblyDefinitionReferenceAsset(string text) {}
19+
}
20+
}

0 commit comments

Comments
 (0)