Skip to content

Commit e8c54a3

Browse files
author
Unity Technologies
committed
Unity 2020.1.0a16 C# reference source code
1 parent 2dce988 commit e8c54a3

File tree

184 files changed

+4862
-1922
lines changed

Some content is hidden

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

184 files changed

+4862
-1922
lines changed

Editor/Mono/Animation/AnimationWindow/AddCurvesPopupHierarchyGUI.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ internal class AddCurvesPopupHierarchyGUI : TreeViewGUI
1414
{
1515
public EditorWindow owner;
1616
public bool showPlusButton { get; set; }
17-
private GUIStyle plusButtonStyle = "OL Plus";
17+
private GUIStyle buttonStyle = "IconButton";
18+
private GUIContent plusIcon = EditorGUIUtility.TrIconContent("Toolbar Plus");
1819
private GUIStyle plusButtonBackgroundStyle = "Tag MenuItem";
1920
private GUIContent addPropertiesContent = EditorGUIUtility.TrTextContent("Add Properties");
2021
private const float plusButtonWidth = 17;
@@ -48,7 +49,7 @@ public override void OnRowGUI(Rect rowRect, TreeViewItem node, int row, bool sel
4849

4950
if (propertyPathMismatchWithHumanAvatar)
5051
{
51-
Rect iconRect = new Rect(rowRect.width - plusButtonWidth, rowRect.yMin, plusButtonWidth, plusButtonStyle.fixedHeight);
52+
Rect iconRect = new Rect(rowRect.width - plusButtonWidth, rowRect.yMin, plusButtonWidth, buttonStyle.fixedHeight);
5253
GUI.Label(iconRect, new GUIContent(warningIcon, "The Avatar definition does not match the property path. Please author using a hierarchy the Avatar was built with."), warningIconStyle);
5354
}
5455
}
@@ -60,14 +61,14 @@ private void DoAddCurveButton(Rect rowRect, TreeViewItem node)
6061
if (hierarchyNode == null || hierarchyNode.curveBindings == null || hierarchyNode.curveBindings.Length == 0)
6162
return;
6263

63-
Rect buttonRect = new Rect(rowRect.width - plusButtonWidth, rowRect.yMin, plusButtonWidth, plusButtonStyle.fixedHeight);
64+
Rect buttonRect = new Rect(rowRect.width - plusButtonWidth, rowRect.yMin, plusButtonWidth, buttonStyle.fixedHeight);
6465

6566
// TODO Make a style for add curves popup
6667
// Draw background behind plus button to prevent text overlapping
6768
GUI.Box(buttonRect, GUIContent.none, plusButtonBackgroundStyle);
6869

6970
// Check if the curve already exists and remove plus button
70-
if (GUI.Button(buttonRect, GUIContent.none, plusButtonStyle))
71+
if (GUI.Button(buttonRect, plusIcon, buttonStyle))
7172
{
7273
AddCurvesPopup.AddNewCurve(hierarchyNode);
7374

Editor/Mono/Animation/ZoomableArea.cs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -753,10 +753,11 @@ void SliderGUI()
753753
}
754754
min = shownXMin;
755755
max = shownXMin + shownXRange;
756+
float rectWidthWithinMargins = GetWidthInsideMargins(rect.width, true);
756757
if (min > area.xMin)
757-
min = Mathf.Min(min, max - rect.width / m_HScaleMax);
758+
min = Mathf.Min(min, max - rectWidthWithinMargins / m_HScaleMax);
758759
if (max < area.xMax)
759-
max = Mathf.Max(max, min + rect.width / m_HScaleMax);
760+
max = Mathf.Max(max, min + rectWidthWithinMargins / m_HScaleMax);
760761
SetShownHRangeInsideMargins(min, max);
761762
}
762763

@@ -787,10 +788,11 @@ void SliderGUI()
787788
}
788789
min = -(shownYMin + shownYRange);
789790
max = -shownYMin;
791+
float rectHeightWithinMargins = GetHeightInsideMargins(rect.height, true);
790792
if (min > area.yMin)
791-
min = Mathf.Min(min, max - rect.height / m_VScaleMax);
793+
min = Mathf.Min(min, max - rectHeightWithinMargins / m_VScaleMax);
792794
if (max < area.yMax)
793-
max = Mathf.Max(max, min + rect.height / m_VScaleMax);
795+
max = Mathf.Max(max, min + rectHeightWithinMargins / m_VScaleMax);
794796
SetShownVRangeInsideMargins(min, max);
795797
}
796798
else
@@ -816,10 +818,11 @@ void SliderGUI()
816818
}
817819
min = shownYMin;
818820
max = shownYMin + shownYRange;
821+
float rectHeightWithinMargins = GetHeightInsideMargins(rect.height, true);
819822
if (min > area.yMin)
820-
min = Mathf.Min(min, max - rect.height / m_VScaleMax);
823+
min = Mathf.Min(min, max - rectHeightWithinMargins / m_VScaleMax);
821824
if (max < area.yMax)
822-
max = Mathf.Max(max, min + rect.height / m_VScaleMax);
825+
max = Mathf.Max(max, min + rectHeightWithinMargins / m_VScaleMax);
823826
SetShownVRangeInsideMargins(min, max);
824827
}
825828
}

Editor/Mono/AssemblyInfo/AssemblyInfo.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@
111111
[assembly: InternalsVisibleTo("Unity.2D.Tilemap.Editor")]
112112
[assembly: InternalsVisibleTo("Unity.2D.Tilemap.EditorTests")]
113113
[assembly: InternalsVisibleTo("Unity.PackageCleanConsoleTest.Editor")]
114+
[assembly: InternalsVisibleTo("Unity.UIElements")]
115+
[assembly: InternalsVisibleTo("Unity.UIElements.Editor")]
116+
[assembly: InternalsVisibleTo("Unity.UIElements.Tests")]
117+
[assembly: InternalsVisibleTo("Unity.UIElements.EditorTests")]
114118
[assembly: InternalsVisibleTo("Unity.SceneTemplate.Editor")]
115119

116120
[assembly: AssemblyIsEditorAssembly]

Editor/Mono/AssemblyValidation.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,17 @@ public static void ResolveAndSetupReferences(int index,
388388
if (assemblyDefinitionNameToIndex.TryGetValue(referenceAssemblyDefinition.Name.Name,
389389
out referenceAssemblyDefinitionIndex))
390390
{
391+
bool isSigned = IsSigned(reference);
392+
if (isSigned)
393+
{
394+
var definition = assemblyDefinitions[referenceAssemblyDefinitionIndex];
395+
if (definition.Name.Version.ToString() != reference.Version.ToString())
396+
{
397+
errors[index].Add(ErrorFlags.UnresolvableReference,
398+
$"{assemblyDefinition.Name.Name} references strong named {reference.Name}, versions has to match. Assembly references: {reference.Version} Found in project: {definition.Name.Version}.");
399+
}
400+
}
401+
391402
referenceIndieces.Add(referenceAssemblyDefinitionIndex);
392403
}
393404
}
@@ -402,6 +413,19 @@ public static void ResolveAndSetupReferences(int index,
402413
assemblyAndReferences[index].referenceIndicies = referenceIndieces.ToArray();
403414
}
404415

416+
private static bool IsSigned(AssemblyNameReference reference)
417+
{
418+
//Bug in Cecil where HasPublicKey is always false
419+
foreach (var publicTokenByte in reference.PublicKeyToken)
420+
{
421+
if (publicTokenByte != 0)
422+
{
423+
return true;
424+
}
425+
}
426+
return false;
427+
}
428+
405429
public static AssemblyNameReference[] GetAssemblyNameReferences(AssemblyDefinition assemblyDefinition)
406430
{
407431
List<AssemblyNameReference> result = new List<AssemblyNameReference>

Editor/Mono/ContainerWindow.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ private void DragTitleBar(Rect titleBarRect)
471471
// If the mouse is inside the title bar rect, we say that we're the hot control
472472
if (titleBarRect.Contains(evt.mousePosition) && GUIUtility.hotControl == 0 && evt.button == 0)
473473
{
474-
if (Application.platform == RuntimePlatform.WindowsEditor)
474+
if (Application.platform != RuntimePlatform.LinuxEditor)
475475
{
476476
Event.current.Use();
477477
m_DraggingNativeTitleBarCaption = true;

Editor/Mono/EditorApplication.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ public static void DirtyHierarchyWindowSorting()
179179

180180
public static event Action quitting;
181181

182-
public static event Action delayCall;
182+
public static CallbackFunction delayCall;
183183

184184
// Each time an object is (or a group of objects are) created, renamed, parented, unparented or destroyed this callback is raised.
185185
public static event Action hierarchyChanged;
@@ -319,7 +319,7 @@ static void Internal_CallUpdateFunctions()
319319

320320
static void Internal_CallDelayFunctions()
321321
{
322-
var delay = delayCall;
322+
CallbackFunction delay = delayCall;
323323
delayCall = null;
324324

325325
if (delay != null)

Editor/Mono/EditorGUI.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1390,7 +1390,7 @@ internal static Rect GetInspectorTitleBarObjectFoldoutRenderRect(Rect rect)
13901390

13911391
internal static Rect GetInspectorTitleBarObjectFoldoutRenderRect(Rect rect, GUIStyle baseStyle)
13921392
{
1393-
return new Rect(rect.x + EditorStyles.foldout.margin.left + 1f, rect.y + (rect.height - kInspTitlebarFoldoutIconWidth) / 2 + (baseStyle != null ? baseStyle.padding.top : 0), kInspTitlebarFoldoutIconWidth, kInspTitlebarFoldoutIconWidth);
1393+
return new Rect(rect.x + EditorStyles.titlebarFoldout.margin.left + 1f, rect.y + (rect.height - kInspTitlebarFoldoutIconWidth) / 2 + (baseStyle != null ? baseStyle.padding.top : 0), kInspTitlebarFoldoutIconWidth, kInspTitlebarFoldoutIconWidth);
13941394
}
13951395

13961396
[SuppressMessage("ReSharper", "RedundantCast.0")]
@@ -1559,7 +1559,7 @@ private static void DoObjectFoldoutInternal(bool foldout, Rect renderRect, int i
15591559
{
15601560
case EventType.Repaint:
15611561
bool isPressed = GUIUtility.hotControl == id;
1562-
EditorStyles.foldout.Draw(renderRect, isPressed, isPressed, foldout, false);
1562+
EditorStyles.titlebarFoldout.Draw(renderRect, isPressed, isPressed, foldout, false);
15631563
break;
15641564
}
15651565

@@ -5325,7 +5325,7 @@ internal static bool ToggleTitlebar(Rect position, GUIContent label, bool foldou
53255325

53265326
GUIStyle baseStyle = EditorStyles.inspectorTitlebar;
53275327
GUIStyle textStyle = EditorStyles.inspectorTitlebarText;
5328-
GUIStyle foldoutStyle = EditorStyles.foldout;
5328+
GUIStyle foldoutStyle = EditorStyles.titlebarFoldout;
53295329

53305330
Rect toggleRect = new Rect(position.x + baseStyle.padding.left, position.y + baseStyle.padding.top, kInspTitlebarIconWidth, kInspTitlebarIconWidth);
53315331
Rect textRect = new Rect(toggleRect.xMax + kInspTitlebarSpacing, toggleRect.y, 200, kInspTitlebarIconWidth);
@@ -5373,7 +5373,7 @@ internal static bool FoldoutTitlebar(Rect position, GUIContent label, bool foldo
53735373

53745374
break;
53755375
case EventType.Repaint:
5376-
GUIStyle foldoutStyle = EditorStyles.foldout;
5376+
GUIStyle foldoutStyle = EditorStyles.titlebarFoldout;
53775377
Rect textRect =
53785378
new Rect(
53795379
position.x + baseStyle.padding.left +

Editor/Mono/EditorGUIUtility.bindings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ public static void RenderGameViewCameras(RenderTexture target, int targetDisplay
156156
private static extern Texture2D FindTextureByName(string name);
157157
private static extern Texture2D FindTextureByType([NotNull] Type type);
158158
private static extern string GetObjectNameWithInfo(Object obj);
159-
private static extern string GetTypeNameWithInfo(string typeName);
159+
private static extern string GetTypeNameWithInfo(string typeName, int instanceID);
160160
private static extern void Internal_SetupEventValues(object evt);
161161
private static extern Vector2 Internal_GetIconSize();
162162
private static extern bool Internal_GetKeyboardRect(int id, out Rect rect);

Editor/Mono/EditorGUIUtility.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -799,6 +799,11 @@ internal static void Internal_SwitchSkin()
799799

800800
// Return a GUIContent object with the name and icon of an Object.
801801
public static GUIContent ObjectContent(UnityObject obj, Type type)
802+
{
803+
return ObjectContent(obj, type, ReferenceEquals(obj, null) ? 0 : obj.GetInstanceID());
804+
}
805+
806+
internal static GUIContent ObjectContent(UnityObject obj, Type type, int instanceID)
802807
{
803808
if (obj)
804809
{
@@ -807,7 +812,7 @@ public static GUIContent ObjectContent(UnityObject obj, Type type)
807812
}
808813
else if (type != null)
809814
{
810-
s_ObjectContent.text = GetTypeNameWithInfo(type.Name);
815+
s_ObjectContent.text = GetTypeNameWithInfo(type.Name, instanceID);
811816
s_ObjectContent.image = AssetPreview.GetMiniTypeThumbnail(type);
812817
}
813818
else

Editor/Mono/EditorSettings.bindings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ internal static extern string Internal_ProjectGenerationUserExtensions
256256
public static extern bool serializeInlineMappingsOnOneLine { get; set; }
257257

258258
[StaticAccessor("GetEditorSettings()", StaticAccessorType.Dot)]
259-
public static extern AssetPipelineMode assetPipelineMode { get; set; }
259+
public static extern AssetPipelineMode assetPipelineMode { get; }
260260

261261
[StaticAccessor("GetEditorSettings()", StaticAccessorType.Dot)]
262262
public static extern CacheServerMode cacheServerMode { get; set; }

0 commit comments

Comments
 (0)