Skip to content

Commit e93244b

Browse files
author
Unity Technologies
committed
Unity 2018.1.0b13 C# reference source code
1 parent 83cceb7 commit e93244b

16 files changed

Lines changed: 3735 additions & 3732 deletions

File tree

Editor/Mono/Collab/CollabHistoryWindow.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ public void UpdateState(HistoryState state, bool force)
161161
if (state == m_State && !force)
162162
return;
163163

164+
m_State = state;
164165
switch (state)
165166
{
166167
case HistoryState.Ready:
@@ -171,7 +172,6 @@ public void UpdateState(HistoryState state, bool force)
171172
return;
172173
}
173174

174-
m_State = state;
175175
m_Container.Clear();
176176
m_Container.Add(m_Views[m_State]);
177177
}

Editor/Mono/Collab/Presenters/CollabHistoryPresenter.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,7 @@ public void OnWindowEnabled()
4646
EditorApplication.playModeStateChanged += OnPlayModeStateChanged;
4747
m_Service.FetchRevisionsCallback += OnFetchRevisions;
4848

49-
if (Collab.instance.IsConnected())
50-
{
51-
m_ConnectState = UnityConnect.instance.GetConnectInfo();
52-
// Copy the initialized fields of the collab info, even if the instance hasn't connected yet.
53-
}
54-
// Copy the initialized fields of the collab info, even if the instance hasn't connected yet.
49+
m_ConnectState = UnityConnect.instance.GetConnectInfo();
5550
m_CollabState = Collab.instance.GetCollabInfo();
5651

5752
m_Window.revisionActionsEnabled = !EditorApplication.isPlayingOrWillChangePlaymode;
@@ -135,8 +130,7 @@ string tip
135130

136131
private void OnCollabRevisionUpdated(CollabInfo state)
137132
{
138-
if (m_CollabState.tip != state.tip)
139-
OnUpdatePage(m_CurrentPage);
133+
OnUpdatePage(m_CurrentPage);
140134
}
141135

142136
private void OnCollabJobsCompleted(CollabInfo state)

Editor/Mono/Inspector/AddComponent/AddComponentGUI.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@ public override void DrawItem(AdvancedDropdownItem item, bool selected, bool has
2929

3030
EditorGUILayout.Space();
3131

32-
EditorGUILayout.EnumPopup("Language", NewScriptDropdownItem.Language.CSharp);
33-
34-
EditorGUILayout.Space();
35-
3632
var canCreate = nsItem.CanCreate();
3733
if (!canCreate && nsItem.m_ClassName != "")
3834
GUILayout.Label(nsItem.GetError(), EditorStyles.helpBox);

Editor/Mono/Inspector/AddComponent/NewScriptDropdownItem.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@ public string className
2626
get { return m_ClassName; }
2727
}
2828

29-
internal enum Language
30-
{
31-
CSharp = 0
32-
}
33-
3429
public NewScriptDropdownItem() : base("New Script", -1) {}
3530

3631
public override bool OnAction()

Editor/Mono/Inspector/GenericInspector.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ public bool MissingMonoBehaviourGUI()
6767

6868
bool IsMissingMonoBehaviourTarget()
6969
{
70-
return target.GetType() == typeof(MonoBehaviour) || target.GetType() == typeof(ScriptableObject);
70+
if (target) // This test for native reference state first.
71+
return target.GetType() == typeof(MonoBehaviour) || target.GetType() == typeof(ScriptableObject);
72+
return target is MonoBehaviour || target is ScriptableObject;
7173
}
7274

7375
public override void OnInspectorGUI()

Editor/Mono/Inspector/InspectorWindow.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,7 +1100,7 @@ private void DrawEditor(Editor[] editors, int editorIndex, bool rebuildOptimized
11001100
// after that, either Active Editors are fetched again and the count is different OR the material is invalid and crashes the whole app
11011101
// The target is considered invalid if the MonoBehaviour is missing, to ensure that the missing MonoBehaviour field is drawn
11021102
// we only do not draw an editor if the target is invalid and it is not a MonoBehaviour. case: 917810
1103-
if (!target && target.GetType() != typeof(UnityEngine.MonoBehaviour))
1103+
if (!target && !(target is MonoBehaviour) && !(target is ScriptableObject))
11041104
return;
11051105
GUIUtility.GetControlID(target.GetInstanceID(), FocusType.Passive);
11061106
EditorGUIUtility.ResetGUIState();
@@ -1123,7 +1123,7 @@ private void DrawEditor(Editor[] editors, int editorIndex, bool rebuildOptimized
11231123

11241124
rebuildOptimizedGUIBlock |= editor.isInspectorDirty;
11251125

1126-
// Reset dirtyness when repainting
1126+
// Reset dirtiness when repainting
11271127
if (Event.current.type == EventType.Repaint)
11281128
{
11291129
editor.isInspectorDirty = false;

Extensions/Networking/Weaver/UNetWeaver.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<DebugType>full</DebugType>
1717
<Optimize>False</Optimize>
1818
<OutputPath>bin\Debug</OutputPath>
19-
<DefineConstants>DEBUG;</DefineConstants>
19+
<DefineConstants>DEBUG</DefineConstants>
2020
<ErrorReport>prompt</ErrorReport>
2121
<WarningLevel>4</WarningLevel>
2222
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
@@ -45,6 +45,7 @@
4545
</ItemGroup>
4646
<ItemGroup>
4747
<Compile Include="AssemblyInfo.cs" />
48+
<Compile Include="Helpers.cs" />
4849
<Compile Include="MessageClassProcessor.cs" />
4950
<Compile Include="MonoBehaviourProcessor.cs" />
5051
<Compile Include="Program.cs" />
@@ -53,7 +54,6 @@
5354
<SubType>Code</SubType>
5455
</Compile>
5556
<Compile Include="UNetWeaver.cs" />
56-
<Compile Include="Helpers.cs" />
5757
</ItemGroup>
5858
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
5959
</Project>

Modules/IMGUI/GUILayoutUtility.cs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -104,17 +104,16 @@ internal static void BeginContainer(LayoutCache cache)
104104
// Make a vertical group to encompass the whole thing
105105
if (Event.current.type == EventType.Layout)
106106
{
107-
current.topLevel = cache.topLevel = new GUILayoutGroup();
108-
current.layoutGroups.Clear();
109-
current.layoutGroups.Push(current.topLevel);
110-
current.windows = cache.windows = new GUILayoutGroup();
111-
}
112-
else
113-
{
114-
current.topLevel = cache.topLevel;
115-
current.layoutGroups = cache.layoutGroups;
116-
current.windows = cache.windows;
107+
// Make sure to update all the cached values of the LayoutCache when doing a Layout
108+
cache.topLevel = new GUILayoutGroup();
109+
cache.layoutGroups.Clear();
110+
cache.layoutGroups.Push(cache.topLevel);
111+
cache.windows = new GUILayoutGroup();
117112
}
113+
// Make sure to use the actual cache.
114+
current.topLevel = cache.topLevel;
115+
current.layoutGroups = cache.layoutGroups;
116+
current.windows = cache.windows;
118117
}
119118

120119
internal static void BeginWindow(int windowID, GUIStyle style, GUILayoutOption[] options)

Modules/UIElements/IMGUIContainer.cs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -197,12 +197,20 @@ private void DoOnGUI(Event evt)
197197

198198
try
199199
{
200-
Matrix4x4 currentTransform;
201-
Rect clippingRect;
202-
GetCurrentTransformAndClip(this, evt, out currentTransform, out clippingRect);
200+
// On a layout event, we should not try to get the worldTransform... it is dependant on the layout, which is being calculated (thus, not good)
201+
if (originalEventType != EventType.Layout)
202+
{
203+
Matrix4x4 currentTransform;
204+
Rect clippingRect;
205+
GetCurrentTransformAndClip(this, evt, out currentTransform, out clippingRect);
203206

204-
// Push UIElements matrix in GUIClip to make mouse position relative to the IMGUIContainer top left
205-
using (new GUIClip.ParentClipScope(currentTransform, clippingRect))
207+
// Push UIElements matrix in GUIClip to make mouse position relative to the IMGUIContainer top left
208+
using (new GUIClip.ParentClipScope(currentTransform, clippingRect))
209+
{
210+
m_OnGUIHandler();
211+
}
212+
}
213+
else
206214
{
207215
m_OnGUIHandler();
208216
}

0 commit comments

Comments
 (0)