Skip to content

Commit 4fed962

Browse files
author
Unity Technologies
committed
Unity 2018.1.0f1 C# reference source code
1 parent e93244b commit 4fed962

38 files changed

Lines changed: 417 additions & 179 deletions

Editor/Mono/AssetPipeline/AssetImporter.bindings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public extern string assetBundleVariant
9191
[NativeName("SetAssetBundleName")]
9292
extern public void SetAssetBundleNameAndVariant(string assetBundleName, string assetBundleVariant);
9393

94-
[FreeFunction("FindAssetImporterInstanceAtAssetPath")]
94+
[FreeFunction("FindAssetImporterAtAssetPath")]
9595
extern public static AssetImporter GetAtPath(string path);
9696

9797
public void SaveAndReimport()

Editor/Mono/BuildPipeline/AssemblyStripper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ private static string GetMethodPreserveBlacklistContents(RuntimeClassRegistry rc
285285
foreach (var assembly in groupedByAssembly)
286286
{
287287
var assemblyName = assembly.Key;
288-
sb.AppendLine(string.Format("\t<assembly fullname=\"{0}\">", assemblyName));
288+
sb.AppendLine(string.Format("\t<assembly fullname=\"{0}\" ignoreIfMissing=\"1\">", assemblyName));
289289
var groupedByType = assembly.GroupBy(m => m.fullTypeName);
290290
foreach (var type in groupedByType)
291291
{

Editor/Mono/BuildPlayerSceneTreeView.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,12 @@ public void UpdateName()
3636
}
3737
}
3838

39-
public BuildPlayerSceneTreeViewItem(int id, int depth, string path, bool state) : base(id, depth)
39+
public BuildPlayerSceneTreeViewItem(int id, int depth, GUID g, bool state) : base(id, depth)
4040
{
4141
active = state;
4242
counter = kInvalidCounter;
43-
guid = new GUID(AssetDatabase.AssetPathToGUID(path));
43+
guid = g;
4444
fullName = "";
45-
displayName = path;
4645
UpdateName();
4746
}
4847
}
@@ -72,7 +71,7 @@ protected override TreeViewItem BuildRoot()
7271
List<EditorBuildSettingsScene> scenes = new List<EditorBuildSettingsScene>(EditorBuildSettings.scenes);
7372
foreach (var sc in scenes)
7473
{
75-
var item = new BuildPlayerSceneTreeViewItem(sc.guid.GetHashCode(), 0, sc.path, sc.enabled);
74+
var item = new BuildPlayerSceneTreeViewItem(sc.guid.GetHashCode(), 0, sc.guid, sc.enabled);
7675
root.AddChild(item);
7776
}
7877
return root;

Editor/Mono/BuildPlayerWindowBuildMethods.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -329,15 +329,15 @@ static bool PickBuildLocation(BuildTargetGroup targetGroup, BuildTarget target,
329329
string title = "Build " + BuildPlatforms.instance.GetBuildTargetDisplayName(targetGroup, target);
330330
string path = EditorUtility.SaveBuildPanel(target, title, defaultFolder, defaultName, extension, out updateExistingBuild);
331331

332+
if (path == string.Empty)
333+
return false;
334+
332335
if (isWindowsStandalone)
333336
{
334337
extension = realExtension;
335338
path = Path.Combine(path, Path.GetFileName(path) + '.' + extension);
336339
}
337340

338-
if (path == string.Empty)
339-
return false;
340-
341341
// Enforce extension if needed
342342
if (extension != string.Empty && FileUtil.GetPathExtension(path).ToLower() != extension)
343343
path += '.' + extension;

Editor/Mono/EditorBuildSettings.bindings.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,19 @@ public static EditorBuildSettingsScene[] scenes
7676
{
7777
get
7878
{
79-
return GetEditorBuildSettingsScenes();
79+
var result = GetEditorBuildSettingsScenes();
80+
foreach (var scene in result)
81+
{
82+
if (scene.guid.Empty())
83+
{
84+
scene.guid = new GUID(AssetDatabase.AssetPathToGUID(scene.path));
85+
}
86+
else
87+
{
88+
scene.path = AssetDatabase.GUIDToAssetPath(scene.guid.ToString());
89+
}
90+
}
91+
return result;
8092
}
8193
set
8294
{

Editor/Mono/EditorGUI.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4149,6 +4149,7 @@ private static Color DoColorField(Rect position, int id, Color value, bool showE
41494149

41504150
var names = new[] {"Copy", "Paste"};
41514151
var enabled = new[] {true, ColorClipboard.HasColor()};
4152+
var currentView = GUIView.current;
41524153

41534154
EditorUtility.DisplayCustomMenu(
41544155
position,
@@ -4160,12 +4161,12 @@ private static Color DoColorField(Rect position, int id, Color value, bool showE
41604161
if (selected == 0)
41614162
{
41624163
Event e = EditorGUIUtility.CommandEvent(EventCommandNames.Copy);
4163-
GUIView.current.SendEvent(e);
4164+
currentView.SendEvent(e);
41644165
}
41654166
else if (selected == 1)
41664167
{
41674168
Event e = EditorGUIUtility.CommandEvent(EventCommandNames.Paste);
4168-
GUIView.current.SendEvent(e);
4169+
currentView.SendEvent(e);
41694170
}
41704171
},
41714172
null);

Editor/Mono/Inspector/EditorDragging.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ void HandleEditorDragging(int editorIndex, Rect targetRect, float markerY, bool
207207
{
208208
var gameObject = targetComponent.gameObject;
209209
foreach (var script in scripts)
210-
addedComponents[index++] = Undo.AddComponent(gameObject, script.GetClass());
210+
addedComponents[index++] = ObjectFactory.AddComponent(gameObject, script.GetClass());
211211
}
212212

213213
// Move added components relative to target components

Editor/Mono/Inspector/PlayerSettingsEditor/PlayerSettingsEditor.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,11 @@ static class Styles
144144
public static readonly GUIContent requireAEP = EditorGUIUtility.TrTextContent("Require ES3.1+AEP");
145145
public static readonly GUIContent skinOnGPU = EditorGUIUtility.TrTextContent("GPU Skinning*", "Use DX11/ES3 GPU Skinning");
146146
public static readonly GUIContent skinOnGPUPS4 = EditorGUIUtility.TrTextContent("Compute Skinning*", "Use Compute pipeline for Skinning");
147-
public static readonly GUIContent skinOnGPUAndroidWarning = EditorGUIUtility.TrTextContent("GPU skinning on Android devices is only enabled in VR builds, and is experimental. Be sure to validate behavior and performance on your target devices.");
148147
public static readonly GUIContent disableStatistics = EditorGUIUtility.TrTextContent("Disable HW Statistics*", "Disables HW Statistics (Pro Only)");
149148
public static readonly GUIContent scriptingDefineSymbols = EditorGUIUtility.TrTextContent("Scripting Define Symbols*");
150149
public static readonly GUIContent scriptingRuntimeVersion = EditorGUIUtility.TrTextContent("Scripting Runtime Version*", "The scripting runtime version to be used. Unity uses different scripting backends based on platform, so these options are listed as equivalent expected behavior.");
151-
public static readonly GUIContent scriptingRuntimeVersionLegacy = EditorGUIUtility.TrTextContent("Legacy (.NET 3.5 Equivalent)");
152-
public static readonly GUIContent scriptingRuntimeVersionLatest = EditorGUIUtility.TrTextContent("Stable (.NET 4.x Equivalent)");
150+
public static readonly GUIContent scriptingRuntimeVersionLegacy = EditorGUIUtility.TrTextContent(".NET 3.5 Equivalent");
151+
public static readonly GUIContent scriptingRuntimeVersionLatest = EditorGUIUtility.TrTextContent(".NET 4.x Equivalent");
153152
public static readonly GUIContent scriptingBackend = EditorGUIUtility.TrTextContent("Scripting Backend");
154153
public static readonly GUIContent il2cppCompilerConfiguration = EditorGUIUtility.TrTextContent("C++ Compiler Configuration");
155154
public static readonly GUIContent scriptingMono2x = EditorGUIUtility.TrTextContent("Mono");
@@ -1634,11 +1633,6 @@ private void OtherSectionRenderingGUI(BuildPlatform platform, BuildTargetGroup t
16341633
}
16351634
}
16361635

1637-
if ((targetGroup == BuildTargetGroup.Android) && PlayerSettings.gpuSkinning)
1638-
{
1639-
EditorGUILayout.HelpBox(Styles.skinOnGPUAndroidWarning.text, MessageType.Warning);
1640-
}
1641-
16421636
if (targetGroup == BuildTargetGroup.XboxOne)
16431637
{
16441638
// on XBoxOne, we only have kGfxJobModeNative active for Dx12 API and kGfxJobModeLegacy for the DX11 API
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
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 System;
6+
using System.Text.RegularExpressions;
7+
using System.IO;
8+
using System.Collections.Generic;
9+
using System.ComponentModel;
10+
using System.Diagnostics;
11+
using System.Linq;
12+
using System.Text;
13+
using System.Threading;
14+
using UnityEditor;
15+
using Debug = UnityEngine.Debug;
16+
17+
namespace UnityEditor.PlatformSupport
18+
{
19+
internal class iOSEditorPrefKeys
20+
{
21+
public readonly static string kDefaultiOSAutomaticallySignBuild = "DefaultiOSAutomaticallySignBuild";
22+
public readonly static string kDefaultiOSAutomaticSignTeamId = "DefaultiOSAutomaticSignTeamId";
23+
24+
public readonly static string kDefaultiOSProvisioningProfileUUID = "DefaultiOSProvisioningProfileUUID";
25+
public readonly static string kDefaulttvOSProvisioningProfileUUID = "DefaulttvOSProvisioningProfileUUID";
26+
public readonly static string kDefaultiOSProvisioningProfileType = "kDefaultiOSProvisioningProfileType";
27+
public readonly static string kDefaulttvOSProvisioningProfileType = "kDefaulttvOSProvisioningProfileType";
28+
}
29+
30+
internal class ProvisioningProfile
31+
{
32+
private string m_UUID = string.Empty;
33+
private ProvisioningProfileType m_Type = ProvisioningProfileType.Development;
34+
35+
public string UUID { get { return m_UUID; } set { m_UUID = value; } }
36+
public ProvisioningProfileType type { get { return m_Type; } set { m_Type = value; } }
37+
38+
// regex patterns used for finding specific parts of data from a provisioning profile
39+
static readonly string s_PatternUUID = "<key>UUID<\\/key>[\n\t]*<string>((\\w*\\-?){5})";
40+
private static readonly string s_PatternDeveloperCertificates =
41+
"<key>DeveloperCertificates<\\/key>[\n\t]*<array>[\n\t]*<data>([\\w\\/+=\\.\\_]+)<\\/data>";
42+
static readonly string s_DistributionPattern = "iPhone Distribution: ";
43+
44+
internal static ProvisioningProfile ParseProvisioningProfileAtPath(string pathToFile)
45+
{
46+
ProvisioningProfile profile = new ProvisioningProfile();
47+
parseFile(pathToFile, profile);
48+
return profile;
49+
}
50+
51+
private ProvisioningProfile() {}
52+
53+
public ProvisioningProfile(string UUID, ProvisioningProfileType type)
54+
{
55+
m_UUID = UUID;
56+
m_Type = type;
57+
}
58+
59+
internal static void parseFile(string filePath, ProvisioningProfile profile)
60+
{
61+
var provisioningFileContents = File.ReadAllText(filePath);
62+
Match matchUUID = Regex.Match(provisioningFileContents, s_PatternUUID, RegexOptions.Singleline);
63+
if (matchUUID.Success)
64+
{
65+
profile.UUID = matchUUID.Groups[1].Value;
66+
}
67+
68+
Match matchCertificate = Regex.Match(provisioningFileContents, s_PatternDeveloperCertificates,
69+
RegexOptions.Singleline);
70+
if (matchCertificate.Success)
71+
{
72+
string value = matchCertificate.Groups[1].Value;
73+
string decodedCertificate = Encoding.UTF8.GetString(Convert.FromBase64String(value));
74+
75+
if (decodedCertificate.Contains(s_DistributionPattern))
76+
{
77+
profile.type = ProvisioningProfileType.Distribution;
78+
}
79+
else
80+
{
81+
profile.type = ProvisioningProfileType.Development;
82+
}
83+
}
84+
}
85+
86+
internal static readonly string[] DefaultProvisioningProfileSearchPaths = new string[]
87+
{
88+
"{Home}/Library/MobileDevice/Provisioning Profiles",
89+
};
90+
91+
internal static ProvisioningProfile FindLocalProfileByUUID(string UUID, string[] searchPaths = null)
92+
{
93+
var localProfilePath = LoadLocalProfiles(searchPaths).FirstOrDefault(p => p.Contains(UUID));
94+
95+
if (localProfilePath != null && File.Exists(localProfilePath))
96+
{
97+
return ParseProvisioningProfileAtPath(localProfilePath);
98+
}
99+
return null;
100+
}
101+
102+
internal static List<string> LoadLocalProfiles(string[] searchPaths = null)
103+
{
104+
if (searchPaths == null)
105+
searchPaths = DefaultProvisioningProfileSearchPaths;
106+
107+
List<string> localProfiles = new List<string>();
108+
foreach (var path in searchPaths)
109+
{
110+
var profilesFolder =
111+
path.Replace("{Home}", Environment.GetFolderPath(Environment.SpecialFolder.Personal));
112+
113+
if (!Directory.Exists(profilesFolder))
114+
continue;
115+
116+
foreach (var file in Directory.GetFiles(profilesFolder))
117+
{
118+
if (Path.GetExtension(file) == ".mobileprovision")
119+
{
120+
localProfiles.Add(file);
121+
}
122+
}
123+
}
124+
return localProfiles;
125+
}
126+
}
127+
}

0 commit comments

Comments
 (0)