Skip to content

Commit e87c367

Browse files
author
Unity Technologies
committed
Unity 2020.1.0b2 C# reference source code
1 parent 1093ded commit e87c367

28 files changed

Lines changed: 293 additions & 165 deletions

Editor/Mono/Annotation/AnnotationWindow.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,15 @@ internal static bool ShowAtPosition(Rect buttonRect, bool isGameView)
173173
Event.current.Use();
174174
if (s_AnnotationWindow == null)
175175
s_AnnotationWindow = ScriptableObject.CreateInstance<AnnotationWindow>();
176+
else
177+
{
178+
// We are treating AnnotationWindow like a PopupWindow which has logic to reclose it when opened,
179+
// AuxWindows derived from EditorWindow reset/reopen when repeatedly clicking the open button by design.
180+
// Call Cancel() here if it is already open.
181+
s_AnnotationWindow.Cancel();
182+
return false;
183+
}
184+
176185
s_AnnotationWindow.Init(buttonRect, isGameView);
177186
return true;
178187
}

Editor/Mono/Collab/Collab.bindings.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ public static extern int GetRevisionsData(
7171

7272
public extern void SetSeat(bool value);
7373

74+
public extern void RefreshSeatAvailabilityAsync();
75+
7476
public extern string GetProjectGUID();
7577

7678
public extern bool ShouldDoInitialCommit();

Editor/Mono/ConsoleWindow.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,9 @@ static class Content
147147

148148
public ConsoleAttachToPlayerState(EditorWindow parentWindow, Action<string> connectedCallback = null) : base(parentWindow, connectedCallback)
149149
{
150+
// This is needed to force initialize the instance and the state so that messages from players are received and printed to the console (if that is the serialized state)
151+
// on creation of the ConsoleWindow UI instead of when the uer first clicks on the dropdown, and triggers AddItemsToMenu.
152+
PlayerConnectionLogReceiver.instance.State = PlayerConnectionLogReceiver.instance.State;
150153
}
151154

152155
bool IsConnected()

Editor/Mono/GUI/DockArea.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1094,7 +1094,8 @@ protected override void OldOnGUI()
10941094
if (Event.current.type == EventType.ContextClick && backRect.Contains(Event.current.mousePosition) && !ContainerWindow.s_Modal)
10951095
PopupGenericMenu(actualView, new Rect(Event.current.mousePosition.x, Event.current.mousePosition.y, 0, 0));
10961096

1097-
ShowGenericMenu(position.width - GetGenericMenuLeftOffset(true), backRect.yMin + Styles.genericMenuTopOffset);
1097+
// GetGenericMenuLeftOffset false because maximized window are not floating windows
1098+
ShowGenericMenu(position.width - GetGenericMenuLeftOffset(false), backRect.yMin + Styles.genericMenuTopOffset);
10981099

10991100
const float topBottomPadding = 0f;
11001101
Rect viewRect = maximizedViewRect;

Editor/Mono/GUI/PackageImportTreeView.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ override public void OnRowGUI(Rect rowRect, TreeViewItem tvItem, int row, bool s
369369
{
370370
Rect labelRect = new Rect(rowRect.xMax - 58, rowRect.y, rowRect.height, rowRect.height);
371371
EditorGUIUtility.SetIconSize(new Vector2(rowRect.height, rowRect.height));
372-
GUI.Label(labelRect, Constants.badgeWarn);
372+
GUI.Label(labelRect, Constants.badgeWarn, Constants.paddinglessStyle);
373373
EditorGUIUtility.SetIconSize(Vector2.zero);
374374
}
375375

Editor/Mono/GUI/RenameOverlay.cs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,6 @@ internal class RenameOverlay
4848
[System.NonSerialized]
4949
bool m_UndoRedoWasPerformed;
5050

51-
[System.NonSerialized]
52-
DelayedCallback m_DelayedCallback;
53-
5451
string k_RenameOverlayFocusName = "RenameOverlayField";
5552

5653
// property interface
@@ -84,7 +81,7 @@ public bool BeginRename(string name, int userData, float delay)
8481
m_ClientGUIView = GUIView.current;
8582

8683
if (delay > 0f)
87-
m_DelayedCallback = new DelayedCallback(BeginRenameInternalCallback, delay);
84+
EditorApplication.CallDelayed(BeginRenameInternalCallback, delay);
8885
else
8986
BeginRenameInternalCallback();
9087
return true;
@@ -109,8 +106,7 @@ public void EndRename(bool acceptChanges)
109106
return;
110107

111108
Undo.undoRedoPerformed -= UndoRedoWasPerformed;
112-
if (m_DelayedCallback != null)
113-
m_DelayedCallback.Clear();
109+
EditorApplication.update -= BeginRenameInternalCallback;
114110

115111
RemoveMessage();
116112

@@ -416,7 +412,7 @@ void Update()
416412
var callback = m_Callback;
417413
Clear();
418414

419-
callback();
415+
callback?.Invoke();
420416
}
421417
}
422418

Editor/Mono/HostView.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -648,9 +648,6 @@ internal float GetExtraButtonsWidth()
648648
internal const float k_iconMargin = 1f;
649649
protected void ShowGenericMenu(float leftOffset, float topOffset)
650650
{
651-
if (Event.current.isKey)
652-
return;
653-
654651
Rect paneMenu = new Rect(leftOffset, topOffset, Styles.paneOptions.fixedWidth, Styles.paneOptions.fixedHeight);
655652
if (EditorGUI.DropdownButton(paneMenu, GUIContent.none, FocusType.Passive, Styles.paneOptions))
656653
PopupGenericMenu(m_ActualView, paneMenu);

Editor/Mono/Inspector/CameraEditor.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,6 @@ public virtual void OnOverlayGUI(Object target, SceneView sceneView)
788788
{
789789
// setup camera and render
790790
previewCamera.CopyFrom(c);
791-
previewCamera.cameraType = CameraType.Preview;
792791

793792
// make sure the preview camera is rendering the same stage as the SceneView is
794793
if (sceneView.overrideSceneCullingMask != 0)

Editor/Mono/Inspector/GraphicsSettingsInspector.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@ public override void OnInspectorGUI()
149149

150150

151151
bool usingSRP = GraphicsSettings.currentRenderPipeline != null;
152-
153152
if (usingSRP)
154153
EditorGUILayout.HelpBox("A Scriptable Render Pipeline is in use, some settings will not be used and are hidden", MessageType.Info);
155154

@@ -164,7 +163,17 @@ public override void OnInspectorGUI()
164163

165164
float labelWidth = EditorGUIUtility.labelWidth;
166165

167-
TierSettingsGUI();
166+
// Hide tier settings for SRPs and close tier settings window if open
167+
if (usingSRP)
168+
{
169+
TierSettingsWindow window = TierSettingsWindow.GetInstance();
170+
if (window != null)
171+
window.Close();
172+
}
173+
else
174+
{
175+
TierSettingsGUI();
176+
}
168177

169178
EditorGUIUtility.labelWidth = labelWidth;
170179

Editor/Mono/Inspector/InspectorWindow.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ private void RestoreLockStateFromSerializedData()
399399
m_Tracker.SetObjectsLockedByThisTracker(m_ObjectsLockedBeforeSerialization);
400400
// since this method likely got called during OnEnable, and rebuilding the tracker could call OnDisable on all Editors,
401401
// some of which might not have gotten their enable yet, the rebuilding needs to happen delayed in EditorApplication.update
402-
new DelayedCallback(tracker.RebuildIfNecessary, 0f);
402+
EditorApplication.CallDelayed(tracker.RebuildIfNecessary, 0f);
403403
}
404404

405405
internal static bool AddInspectorWindow(InspectorWindow window)

0 commit comments

Comments
 (0)