Skip to content

Commit 11aeafb

Browse files
author
Unity Technologies
committed
Unity 2019.3.0a6 C# reference source code
1 parent 2ea5a24 commit 11aeafb

File tree

172 files changed

+3459
-1659
lines changed

Some content is hidden

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

172 files changed

+3459
-1659
lines changed

Editor/Mono/Animation/AnimationWindow/AnimationWindowHierarchyGUI.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ private bool DoTreeViewButton(int id, Rect position, GUIContent content, GUIStyl
411411
switch (type)
412412
{
413413
case EventType.Repaint:
414-
style.Draw(position, content, id, false);
414+
style.Draw(position, content, id, false, position.Contains(evt.mousePosition));
415415
break;
416416
case EventType.MouseDown:
417417
if (position.Contains(evt.mousePosition) && evt.button == 0)

Editor/Mono/Annotation/SceneRenderModeWindow.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ private float windowHeight
154154
int modes;
155155

156156
// TODO: This needs to be fixed and we need to find a way to dif. between disabled and unsupported
157-
if (GraphicsSettings.renderPipelineAsset != null)
157+
if (GraphicsSettings.currentRenderPipeline != null)
158158
{
159159
// When using SRP, we completely hide disabled builtin modes, including headers
160160
headers = Styles.sBuiltinCameraModes.Where(mode => m_SceneView.IsCameraDrawModeEnabled(mode)).Select(mode => mode.section).Distinct().Count() +
@@ -242,7 +242,7 @@ private void DrawHeader(ref Rect rect, GUIContent label)
242242
private void Draw(float listElementWidth)
243243
{
244244
var drawPos = new Rect(0, 0, listElementWidth, EditorGUI.kSingleLineHeight);
245-
bool usingScriptableRenderPipeline = (GraphicsSettings.renderPipelineAsset != null);
245+
bool usingScriptableRenderPipeline = (GraphicsSettings.currentRenderPipeline != null);
246246
string lastSection = null;
247247

248248
foreach (SceneView.CameraMode mode in SceneView.userDefinedModes.OrderBy(mode => mode.section).Concat(Styles.sBuiltinCameraModes))

Editor/Mono/AssetDatabase/AssetPreview.bindings.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ internal static Texture2D GetAssetPreview(int instanceID)
3030
[FreeFunction("AssetPreviewBindings::GetAssetPreview")]
3131
internal static extern Texture2D GetAssetPreview(int instanceID, int clientID);
3232

33+
[FreeFunction("AssetPreviewBindings::HasAssetPreview")]
34+
internal static extern bool HasAssetPreview(int instanceID, int clientID);
35+
3336
public static bool IsLoadingAssetPreview(int instanceID)
3437
{
3538
return IsLoadingAssetPreview(instanceID, kSharedClientID);

Editor/Mono/AssetModificationProcessor.cs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using UnityEditor.VersionControl;
99
using UnityEditorInternal;
1010
using UnityEditorInternal.VersionControl;
11+
using System.Linq;
1112
using System.Reflection;
1213

1314
namespace UnityEditor
@@ -176,13 +177,14 @@ static void OnWillSaveAssets(string[] assets, out string[] assetsThatShouldBeSav
176177
var editableAssets = new string[assets.Length];
177178
if (assets.Length != 0 && !Provider.MakeEditable(assets, editableAssets))
178179
{
179-
// TODO: fix this behaviour to make save asset honour version control result
180-
// keep previous behaviour which is save all assets even if checkout fails
181-
// TODO: this needs to consider and handle saving assets which have not been
182-
// added to version control. They have to be added to version control before
183-
// calling MakeEditable.
184-
//assetsThatShouldBeSaved = editableAssets;
185-
return;
180+
// only save assets that can be made editable (not locked by someone else, etc.),
181+
// unless we are in the behavior mode that just overwrites everything anyway
182+
if (!EditorUserSettings.overwriteFailedCheckoutAssets)
183+
{
184+
editableAssets = editableAssets.Where(a => a != null).ToArray();
185+
assetsThatShouldBeReverted = assets.Except(editableAssets).ToArray();
186+
assetsThatShouldBeSaved = assetsThatShouldBeSaved.Except(assetsThatShouldBeReverted).ToArray();
187+
}
186188
}
187189
}
188190

Editor/Mono/BuildPipeline/CodeStrippingUtils.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ private static HashSet<string> CollectManagedTypeReferencesFromRoots(string dire
549549
// UnityEngine.UI references UnityEngine.Collider, which causes the inclusion of Physics and Physics2D modules if
550550
// UnityEngine.UI is referenced. UnityEngine.UI code is designed to only actually access Colliders if these modules
551551
// are used, so don't include references from UnityEngine.UI here.
552-
if (fileNames[i] == "Unity.ugui.dll")
552+
if (fileNames[i] == "UnityEngine.UI.dll")
553553
unityEngineUIAssemblyDefinition = assemblies[i];
554554
}
555555

Editor/Mono/BuildPipeline/MonoAssemblyStripping.cs

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -118,29 +118,6 @@ public static void RunMonoProcess(Process process, string name, string resulting
118118
}
119119
}
120120

121-
public static Process PrepareMonoProcess(string workDir)
122-
{
123-
var process = new Process();
124-
125-
var executableName = Application.platform == RuntimePlatform.WindowsEditor ? "mono.exe" : "mono";
126-
process.StartInfo.FileName = Paths.Combine(MonoInstallationFinder.GetMonoInstallation(), "bin", executableName);
127-
128-
// ;; TODO fix this hack for strange process handle duplication problem inside mono
129-
process.StartInfo.EnvironmentVariables["_WAPI_PROCESS_HANDLE_OFFSET"] = "5";
130-
131-
// We run the linker on .NET 2.0 profile
132-
var monoProfile = BuildPipeline.CompatibilityProfileToClassLibFolder(ApiCompatibilityLevel.NET_2_0);
133-
process.StartInfo.EnvironmentVariables["MONO_PATH"] = MonoInstallationFinder.GetProfileDirectory(monoProfile);
134-
process.StartInfo.UseShellExecute = false;
135-
process.StartInfo.RedirectStandardOutput = true;
136-
process.StartInfo.RedirectStandardError = true;
137-
process.StartInfo.CreateNoWindow = true;
138-
139-
process.StartInfo.WorkingDirectory = workDir;
140-
141-
return process;
142-
}
143-
144121
public static Process PrepareMonoProcessBleedingEdge(string workDir)
145122
{
146123
var process = new Process();

Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,49 @@ internal static class PostprocessBuildPlayer
4646
{
4747
internal const string StreamingAssets = "Assets/StreamingAssets";
4848

49+
internal static void AddProjectBootConfigKey(string key)
50+
{
51+
AddProjectBootConfigKeyValue(key, null);
52+
}
53+
54+
internal static void AddProjectBootConfigKeyValue(string key, string value)
55+
{
56+
if (projectBootConfigEntries.ContainsKey(key))
57+
{
58+
projectBootConfigEntries[key] = value;
59+
}
60+
else
61+
{
62+
projectBootConfigEntries.Add(key, value);
63+
}
64+
}
65+
66+
internal static bool RemoveProjectBootConfigKey(string key)
67+
{
68+
return projectBootConfigEntries.Remove(key);
69+
}
70+
71+
internal static bool GetProjectBootConfigKeyValue(string key, out string value)
72+
{
73+
if (projectBootConfigEntries.ContainsKey(key))
74+
{
75+
value = projectBootConfigEntries[key];
76+
return true;
77+
}
78+
else
79+
{
80+
value = null;
81+
return false;
82+
}
83+
}
84+
85+
internal static void ClearProjectBootConfigEntries()
86+
{
87+
projectBootConfigEntries.Clear();
88+
}
89+
90+
private static Dictionary<string, string> projectBootConfigEntries = new Dictionary<string, string>();
91+
4992
// Seems to be used only by PlatformDependent\AndroidPlayer\Editor\Managed\PostProcessAndroidPlayer.cs
5093
internal static bool InstallPluginsByExtension(string pluginSourceFolder, string extension, string debugExtension, string destPluginFolder, bool copyDirectories)
5194
{
@@ -246,6 +289,14 @@ static public void UpdateBootConfig(BuildTargetGroup targetGroup, BuildTarget ta
246289
IBuildPostprocessor postprocessor = ModuleManager.GetBuildPostProcessor(targetGroup, target);
247290
if (postprocessor != null)
248291
postprocessor.UpdateBootConfig(target, config, options);
292+
293+
foreach (var keyValue in projectBootConfigEntries)
294+
{
295+
if ((keyValue.Value == null) || keyValue.Value.All(char.IsWhiteSpace))
296+
config.AddKey(keyValue.Key);
297+
else
298+
config.Set(keyValue.Key, keyValue.Value);
299+
}
249300
}
250301

251302
static public void Postprocess(BuildTargetGroup targetGroup, BuildTarget target, string installPath, string companyName, string productName,

Editor/Mono/ConsoleWindow.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -487,8 +487,6 @@ internal void OnGUI()
487487
}
488488
}
489489

490-
EditorGUILayout.Space();
491-
492490
bool wasCollapsed = HasFlag(ConsoleFlags.Collapse);
493491
SetFlag(ConsoleFlags.Collapse, GUILayout.Toggle(wasCollapsed, Constants.CollapseLabel, Constants.MiniButton));
494492

Editor/Mono/CustomEditorAttributes.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ internal static Type FindCustomEditorTypeByType(Type type, bool multiEdit)
7272

7373
// we have a render pipeline...
7474
// we need to select the one with the correct RP asset
75-
if (GraphicsSettings.renderPipelineAsset != null)
75+
if (GraphicsSettings.currentRenderPipeline != null)
7676
{
77-
var rpType = GraphicsSettings.renderPipelineAsset.GetType();
77+
var rpType = GraphicsSettings.currentRenderPipeline.GetType();
7878
foreach (var editor in s_SearchCache)
7979
{
8080
if (editor.m_RenderPipelineType == rpType)

Editor/Mono/CustomInspectorStubs.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,25 @@ private InputManager() {}
6767
internal static SettingsProvider CreateProjectSettingsProvider()
6868
{
6969
var provider = AssetSettingsProvider.CreateProviderFromAssetPath(
70-
"Project/Input", "ProjectSettings/InputManager.asset",
70+
"Project/Input Manager", "ProjectSettings/InputManager.asset",
7171
SettingsProvider.GetSearchKeywordsFromPath("ProjectSettings/InputManager.asset"));
7272
return provider;
7373
}
7474
}
7575

76+
[CustomEditor(typeof(InputManager))]
77+
internal sealed class InputManagerEditor : Editor
78+
{
79+
public override void OnInspectorGUI()
80+
{
81+
if (PlayerSettings.disableOldInputManagerSupport)
82+
EditorGUILayout.HelpBox("This is where you can configure the controls to use with the UnityEngine.Input API. But you have switched input handling to \"Input System Package\" in your Player Settings. The Input Manager will not be used.", MessageType.Error);
83+
else
84+
EditorGUILayout.HelpBox("This is where you can configure the controls to use with the UnityEngine.Input API. Consider using the new Input System Package instead.", MessageType.Info);
85+
DrawDefaultInspector();
86+
}
87+
}
88+
7689
// Exposed as internal, editor-only, because we only need it do make a custom inspector
7790
[NativeClass(null)]
7891
internal sealed class TimeManager : ProjectSettingsBase

0 commit comments

Comments
 (0)