Skip to content

Commit c26c4fc

Browse files
author
Unity Technologies
committed
Unity 2018.3.10f1 C# reference source code
1 parent d6db6f7 commit c26c4fc

26 files changed

Lines changed: 106 additions & 11 deletions

File tree

Editor/Mono/AssemblyValidation.cs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,16 @@ public static bool PluginCompatibleWithEditor(string path)
144144
return pluginImporter.GetCompatibleWithEditor();
145145
}
146146

147+
public static bool ShouldValidateReferences(string path)
148+
{
149+
var pluginImporter = AssetImporter.GetAtPath(path) as PluginImporter;
150+
151+
if (pluginImporter == null)
152+
return true;
153+
154+
return pluginImporter.ValidateReferences;
155+
}
156+
147157
public static void PrintAssemblyDefinitions(AssemblyDefinition[] assemblyDefinitions)
148158
{
149159
foreach (var assemblyDefinition in assemblyDefinitions)
@@ -233,6 +243,13 @@ public static void CheckAssemblyReferences(string[] assemblyPaths,
233243
if (errors[i].HasFlag(ErrorFlags.IncompatibleWithEditor))
234244
continue;
235245

246+
var assemblyPath = assemblyPaths[i];
247+
248+
// Check if "Validate References" option is enabled
249+
// in the PluginImporter
250+
if (!ShouldValidateReferences(assemblyPath))
251+
continue;
252+
236253
ResolveAndSetupReferences(i,
237254
errors,
238255
assemblyDefinitions,
@@ -327,7 +344,7 @@ public static void ResolveAndSetupReferences(int index,
327344
catch (AssemblyResolutionException)
328345
{
329346
errors[index].Add(ErrorFlags.UnresolvableReference,
330-
string.Format("Unable to resolve reference '{0}'. Is the assembly missing or incompatible with the current platform?",
347+
string.Format("Unable to resolve reference '{0}'. Is the assembly missing or incompatible with the current platform?\nReference validation can be disabled in the Plugin Inspector.",
331348
reference.Name));
332349
}
333350
}

Editor/Mono/Collab/Collab.bindings.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,9 @@ public extern void TestClearSoftLockAsCollaborator(string projectGuid, string pr
218218
[NativeMethod(HasExplicitThis = true, ThrowsException = true, IsThreadSafe = true)]
219219
public extern void ClearSelectedChangesToPublish();
220220

221+
[NativeMethod(HasExplicitThis = true, ThrowsException = true, IsThreadSafe = true)]
222+
public extern void SendCollabInfoNotification();
223+
221224
[NativeMethod(HasExplicitThis = true, ThrowsException = true)]
222225
public extern SoftLock[] GetSoftLocks(string assetGuid);
223226
}

Editor/Mono/EditorGUI.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5447,7 +5447,7 @@ internal static GUIContent BeginPropertyInternal(Rect totalPosition, GUIContent
54475447
var hasPrefabOverride = property.prefabOverride;
54485448
if (!linkedProperties || hasPrefabOverride)
54495449
EditorGUIUtility.SetBoldDefaultFont(hasPrefabOverride);
5450-
if (hasPrefabOverride && !property.isDefaultOverride)
5450+
if (hasPrefabOverride && !property.isDefaultOverride && !property.isDrivenRectTransformProperty)
54515451
{
54525452
Rect highlightRect = totalPosition;
54535453
highlightRect.xMin += EditorGUI.indent;

Editor/Mono/Inspector/MaterialEditor.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public partial class MaterialEditor : Editor
1717
{
1818
private static class Styles
1919
{
20+
public static readonly GUIStyle inspectorBigInner = "IN BigTitle inner";
2021
public static readonly GUIStyle kReflectionProbePickerStyle = "PaneOptions";
2122
public static readonly GUIContent lightmapEmissiveLabel = EditorGUIUtility.TrTextContent("Global Illumination", "Controls if the emission is baked or realtime.\n\nBaked only has effect in scenes where baked global illumination is enabled.\n\nRealtime uses realtime global illumination if enabled in the scene. Otherwise the emission won't light up other objects.");
2223
public static GUIContent[] lightmapEmissiveStrings = { EditorGUIUtility.TextContent("Realtime"), EditorGUIUtility.TrTextContent("Baked"), EditorGUIUtility.TrTextContent("None") };
@@ -2072,5 +2073,10 @@ internal override bool HasLargeHeader()
20722073
{
20732074
return true;
20742075
}
2076+
2077+
internal override void OnHeaderIconGUI(Rect iconRect)
2078+
{
2079+
OnPreviewGUI(iconRect, Styles.inspectorBigInner);
2080+
}
20752081
}
20762082
} // namespace UnityEditor

Editor/Mono/ParticleSystemEditor/ParticleSystemModules/UVModuleUI.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,25 @@ override public void OnInspectorGUI(InitialModuleUI initial)
135135
if (!m_TimeMode.hasMultipleDifferentValues)
136136
{
137137
if (timeMode == (int)ParticleSystemAnimationTimeMode.FPS)
138+
{
138139
GUIFloat(s_Texts.fps, m_FPS);
140+
foreach (ParticleSystem ps in m_ParticleSystemUI.m_ParticleSystems)
141+
{
142+
if (ps.main.startLifetimeMultiplier == Mathf.Infinity)
143+
{
144+
EditorGUILayout.HelpBox("FPS mode does not work when using infinite particle lifetimes.", MessageType.Error, true);
145+
break;
146+
}
147+
}
148+
}
139149
else if (timeMode == (int)ParticleSystemAnimationTimeMode.Speed)
150+
{
140151
GUIMinMaxRange(s_Texts.speedRange, m_SpeedRange);
152+
}
141153
else
154+
{
142155
GUIMinMaxCurve(s_Texts.frameOverTime, m_FrameOverTime);
156+
}
143157
}
144158
GUIMinMaxCurve(s_Texts.startFrame, m_StartFrame);
145159

Editor/Mono/Scripting/ScriptCompilation/CSharpNamespaceParser.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ public static string GetNamespace(string sourceCode, string className, params st
4141
s_ClassName = className;
4242

4343
sourceCode = k_NewlineRegex.Replace(sourceCode, "\n");
44+
sourceCode = k_SingleQuote.Replace(sourceCode, "");
4445
sourceCode = k_Strings.Replace(sourceCode, "");
4546
sourceCode = k_BlockComments.Replace(sourceCode, "");
4647
sourceCode = k_LineComments.Replace(sourceCode, "\n");
4748
sourceCode = k_VerbatimStrings.Replace(sourceCode, "");
48-
sourceCode = k_SingleQuote.Replace(sourceCode, "");
4949
try
5050
{
5151
sourceCode = RemoveUnusedDefines(sourceCode, defines.ToList());

Editor/Mono/Scripting/ScriptCompilation/EditorBuildRules.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,14 @@ public static ScriptAssembly[] GenerateChangedScriptAssemblies(GenerateChangedSc
427427
args.NotCompiledTargetAssemblies.Add(targetAssembly);
428428
}
429429

430-
bool isAnyCustomScriptAssemblyDirty = dirtyTargetAssemblies.Any(entry => entry.Key.Type == TargetAssemblyType.Custom);
430+
bool isAnyCustomScriptAssemblyDirty = dirtyTargetAssemblies.Any(entry =>
431+
{
432+
var targetAssembly = entry.Key;
433+
bool isCustomScriptAssembly = targetAssembly.Type == TargetAssemblyType.Custom;
434+
bool isExplicitlyReferenced = (targetAssembly.Flags & AssemblyFlags.ExplicitlyReferenced) == AssemblyFlags.ExplicitlyReferenced;
435+
bool isTestAssembly = (targetAssembly.OptionalUnityReferences & OptionalUnityReferences.TestAssemblies) == OptionalUnityReferences.TestAssemblies;
436+
return isCustomScriptAssembly && !isExplicitlyReferenced && !isTestAssembly;
437+
});
431438

432439
// If we have any dirty custom target assemblies, then the predefined target assemblies are marked as dirty,
433440
// as the predefined assemblies always reference the custom script assemblies.

Editor/Mono/Scripting/ScriptCompilation/EditorCompilation.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -707,6 +707,7 @@ public Exception[] SetAllCustomScriptAssemblyJsons(string[] paths)
707707
if (loadedCustomScriptAssembly.References == null)
708708
loadedCustomScriptAssembly.References = new string[0];
709709

710+
710711
if (loadedCustomScriptAssembly.References.Length != loadedCustomScriptAssembly.References.Distinct().Count())
711712
{
712713
var duplicateRefs = loadedCustomScriptAssembly.References.GroupBy(r => r).Where(g => g.Count() > 0).Select(g => g.Key).ToArray();

Editor/Mono/SerializedProperty.bindings.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,19 @@ public bool isDefaultOverride
653653
[NativeName("IsDefaultOverride")]
654654
private extern bool GetIsDefaultOverrideInternal();
655655

656+
// Is property a driven property (using RectTransform driven properties)? (RO)
657+
internal bool isDrivenRectTransformProperty
658+
{
659+
get
660+
{
661+
Verify(VerifyFlags.IteratorNotAtEnd);
662+
return GetIsDrivenRectTransformPropertyInternal();
663+
}
664+
}
665+
666+
[NativeName("IsDrivenRectTransformProperty")]
667+
private extern bool GetIsDrivenRectTransformPropertyInternal();
668+
656669
// Type of this property (RO).
657670
public SerializedPropertyType propertyType
658671
{

Editor/Mono/SyncRiderProject.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,14 +199,25 @@ static string[] CollectPathsFromToolbox(
199199
var json = File.ReadAllText(a).Replace("active-application", "active_application");
200200
var toolbox = ToolboxInstallData.FromJson(json);
201201
var builds = toolbox.active_application.builds;
202-
if (builds.Any())
202+
if (builds != null && builds.Any())
203203
{
204204
var build = builds.First();
205205
var folder = Path.Combine(Path.Combine(channelDir, build), dirName);
206206
if (!isMac)
207207
return new[] {Path.Combine(folder, searchPattern)};
208208
return new DirectoryInfo(folder).GetDirectories(searchPattern).Select(f => f.FullName);
209209
}
210+
211+
// new toolbox format doesn't have active-application block, so return all found Rider installations
212+
return Directory.GetDirectories(channelDir)
213+
.SelectMany(b =>
214+
{
215+
var folder = Path.Combine(b, dirName);
216+
if (!isMac)
217+
return new[] {Path.Combine(folder, searchPattern)};
218+
return new DirectoryInfo(folder).GetDirectories(searchPattern).Select(f => f.FullName);
219+
})
220+
.Where(File.Exists).ToArray();
210221
}
211222
catch (Exception e)
212223
{

0 commit comments

Comments
 (0)