Skip to content

Commit e8a5c67

Browse files
author
Unity Technologies
committed
Unity 2019.1.0a4 C# reference source code
1 parent 0546568 commit e8a5c67

60 files changed

Lines changed: 3838 additions & 643 deletions

File tree

Some content is hidden

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

Editor/Mono/BuildPlayerWindow.cs

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -403,19 +403,16 @@ static bool IsColorSpaceValid(BuildPlatform platform)
403403
if (BuildTargetDiscovery.PlatformHasFlag(platform.defaultTarget, TargetAttributes.OpenGLES))
404404
{
405405
var apis = PlayerSettings.GetGraphicsAPIs(platform.defaultTarget);
406-
hasMinGraphicsAPI = (apis.Contains(GraphicsDeviceType.Vulkan) || apis.Contains(GraphicsDeviceType.OpenGLES3)) && !apis.Contains(GraphicsDeviceType.OpenGLES2);
407-
}
408-
409-
if (platform.targetGroup == BuildTargetGroup.iOS)
410-
{
411-
Version requiredVersion = new Version(8, 0);
412-
hasMinOSVersion = PlayerSettings.iOS.IsTargetVersionEqualOrHigher(requiredVersion);
413-
}
414-
else if (platform.targetGroup == BuildTargetGroup.Android)
415-
{
416-
hasMinOSVersion = (int)PlayerSettings.Android.minSdkVersion >= 18;
406+
if (platform.targetGroup == BuildTargetGroup.Android)
407+
{
408+
hasMinOSVersion = (int)PlayerSettings.Android.minSdkVersion >= 18;
409+
hasMinGraphicsAPI = (apis.Contains(GraphicsDeviceType.Vulkan) || apis.Contains(GraphicsDeviceType.OpenGLES3)) && !apis.Contains(GraphicsDeviceType.OpenGLES2);
410+
}
411+
else if (platform.targetGroup == BuildTargetGroup.iOS || platform.targetGroup == BuildTargetGroup.tvOS)
412+
{
413+
hasMinGraphicsAPI = !apis.Contains(GraphicsDeviceType.OpenGLES3) && !apis.Contains(GraphicsDeviceType.OpenGLES2);
414+
}
417415
}
418-
419416
return hasMinGraphicsAPI && hasMinOSVersion;
420417
}
421418
else
@@ -435,9 +432,6 @@ static bool IsLightmapEncodingValid(BuildPlatform platform)
435432
{
436433
var apis = PlayerSettings.GetGraphicsAPIs(BuildTarget.iOS);
437434
hasMinGraphicsAPI = apis.Contains(GraphicsDeviceType.Metal) && !apis.Contains(GraphicsDeviceType.OpenGLES3) && !apis.Contains(GraphicsDeviceType.OpenGLES2);
438-
439-
Version requiredVersion = new Version(8, 0);
440-
hasMinOSVersion = PlayerSettings.iOS.IsTargetVersionEqualOrHigher(requiredVersion);
441435
}
442436
else if (platform.targetGroup == BuildTargetGroup.tvOS)
443437
{

Editor/Mono/BuildTargetDiscovery.bindings.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ public enum TargetAttributes
4545
WarnForMouseEvents = (1 << 19),
4646
HideInUI = (1 << 20),
4747
GPUSkinningNotSupported = (1 << 21),
48-
StrippingNotSupported = (1 << 22)
48+
StrippingNotSupported = (1 << 22),
49+
IsMTRenderingDisabledByDefault = (1 << 23),
4950
}
5051

5152
public enum TargetDefaultScriptingBackend

Editor/Mono/Collab/Collab.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -364,11 +364,16 @@ public bool SetConflictsResolvedTheirs(string[] paths)
364364

365365
public PublishInfo GetChangesToPublish()
366366
{
367-
Change[] changes = GetSelectedChangesInternal();
367+
Change[] changes = GetChangesToPublishInternal();
368368
bool isFiltered = false;
369-
if (Toolbar.isLastShowRequestPartial)
369+
370+
if (SupportsAsyncChanges())
370371
{
371-
isFiltered = true;
372+
changes = GetSelectedChangesInternal();
373+
if (Toolbar.isLastShowRequestPartial)
374+
{
375+
isFiltered = true;
376+
}
372377
}
373378

374379
return new PublishInfo()

Editor/Mono/ConsoleWindow.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,7 @@ void OnGUI()
603603
EditorGUIUtility.SetIconSize(new Vector2(rowHeight, rowHeight));
604604
GUIContent tempContent = new GUIContent();
605605
int id = GUIUtility.GetControlID(0);
606+
int rowDoubleClicked = -1;
606607

607608
/////@TODO: Make Frame selected work with ListViewState
608609
using (new GettingLogEntriesScope(m_ListView))
@@ -688,11 +689,16 @@ void OnGUI()
688689

689690
if (openSelectedItem)
690691
{
691-
LogEntries.RowGotDoubleClicked(selectedRow);
692-
Event.current.Use();
692+
rowDoubleClicked = selectedRow;
693+
e.Use();
693694
}
694695
}
695696

697+
// Prevent dead locking in EditorMonoConsole by delaying callbacks (which can log to the console) until after LogEntries.EndGettingEntries() has been
698+
// called (this releases the mutex in EditorMonoConsole so logging again is allowed). Fix for case 1081060.
699+
if (rowDoubleClicked != -1)
700+
LogEntries.RowGotDoubleClicked(rowDoubleClicked);
701+
696702
EditorGUIUtility.SetIconSize(Vector2.zero);
697703

698704
// Display active text (We want word wrapped text with a vertical scrollbar)

Editor/Mono/ContainerWindow.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ internal void ShowPopupWithMode(ShowMode mode)
8282
m_RootView.SetWindowRecurse(this);
8383
Internal_SetTitle(m_Title);
8484
Save();
85-
Internal_BringLiveAfterCreation(false, false);
85+
// only set focus iff mode is a popupMenu.
86+
Internal_BringLiveAfterCreation(false, mode == ShowMode.PopupMenu);
8687
}
8788

8889
static Color skinBackgroundColor

Editor/Mono/EditorGUI.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
using UnityEditor.SceneManagement;
1212
using UnityEngine;
1313
using UnityEngine.Scripting;
14+
using UnityEngine.Rendering;
1415
using UnityEditorInternal;
1516
using UnityEditor.Scripting.ScriptCompilation;
1617
using Object = UnityEngine.Object;
1718
using Event = UnityEngine.Event;
1819
using UnityEditor.Build;
1920
using UnityEditor.StyleSheets;
2021
using UnityEngine.Internal;
21-
using UnityEngine.Rendering;
2222
using DescriptionAttribute = System.ComponentModel.DescriptionAttribute;
2323

2424
namespace UnityEditor

Editor/Mono/GUI/EditorStyles.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,12 @@ public sealed class EditorStyles
146146
public static GUIStyle foldoutPreDrop { get { return s_Current.m_FoldoutPreDrop; } }
147147
private GUIStyle m_FoldoutPreDrop;
148148

149+
public static GUIStyle foldoutHeader { get { return s_Current.m_FoldoutHeader;} }
150+
GUIStyle m_FoldoutHeader;
151+
152+
public static GUIStyle foldoutHeaderIcon { get { return s_Current.m_FoldoutHeaderIcon; } }
153+
GUIStyle m_FoldoutHeaderIcon;
154+
149155
// Style used for headings for EditorGUILayout::ref::BeginToggleGroup.
150156
public static GUIStyle toggleGroup { get { return s_Current.m_ToggleGroup; } }
151157
private GUIStyle m_ToggleGroup;
@@ -366,6 +372,8 @@ private void InitSharedStyles()
366372
m_ProgressBarBar = GetStyle("ProgressBarBar");
367373
m_ProgressBarText = GetStyle("ProgressBarText");
368374
m_FoldoutPreDrop = GetStyle("FoldoutPreDrop");
375+
m_FoldoutHeader = GetStyle("FoldoutHeader");
376+
m_FoldoutHeaderIcon = GetStyle("FoldoutHeaderIcon");
369377
m_InspectorTitlebar = GetStyle("IN Title");
370378
m_InspectorTitlebarText = GetStyle("IN TitleText");
371379
m_ToggleGroup = GetStyle("BoldToggle");

Editor/Mono/GUI/FoldoutHeader.cs

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
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 UnityEngine;
6+
using UnityEngine.Internal;
7+
using System;
8+
9+
namespace UnityEditor
10+
{
11+
public sealed partial class EditorGUILayout
12+
{
13+
public static bool BeginFoldoutHeaderGroup(bool foldout, string content, [DefaultValue("EditorStyles.foldoutHeader")]
14+
GUIStyle style = null, Action<Rect> menuAction = null, GUIStyle menuIcon = null)
15+
{
16+
return BeginFoldoutHeaderGroup(foldout, GUIContent.Temp(content), style, menuAction, menuIcon);
17+
}
18+
19+
public static bool BeginFoldoutHeaderGroup(bool foldout, GUIContent content, [DefaultValue("EditorStyles.foldoutHeader")] GUIStyle style = null, Action<Rect> menuAction = null, GUIStyle menuIcon = null)
20+
{
21+
if (style == null)
22+
style = EditorStyles.foldoutHeader;
23+
var backgroundRect = GUILayoutUtility.GetRect(content, style);
24+
return EditorGUI.BeginFoldoutHeaderGroup(backgroundRect, foldout, content, style, menuAction, menuIcon);
25+
}
26+
27+
public static void EndFoldoutHeaderGroup()
28+
{
29+
EditorGUI.EndFoldoutHeaderGroup();
30+
}
31+
}
32+
33+
public sealed partial class EditorGUI
34+
{
35+
static bool s_FoldoutHeaderGroupActive;
36+
37+
public static bool BeginFoldoutHeaderGroup(Rect position, bool foldout, string content, [DefaultValue("EditorStyles.foldoutHeader")]
38+
GUIStyle style = null, Action<Rect> menuAction = null, GUIStyle menuIcon = null)
39+
{
40+
return BeginFoldoutHeaderGroup(position, foldout, GUIContent.Temp(content), style, menuAction, menuIcon);
41+
}
42+
43+
public static bool BeginFoldoutHeaderGroup(Rect position, bool foldout, GUIContent content, [DefaultValue("EditorStyles.foldoutHeader")] GUIStyle style = null, Action<Rect> menuAction = null, GUIStyle menuIcon = null)
44+
{
45+
if (style == null)
46+
style = EditorStyles.foldoutHeader;
47+
if (s_FoldoutHeaderGroupActive)
48+
{
49+
EditorGUI.HelpBox(position, L10n.Tr("You can't nest Foldout Headers, end it with EndHeaderFoldoutGroup."), MessageType.Error);
50+
return false;
51+
}
52+
s_FoldoutHeaderGroupActive = true;
53+
54+
const float iconSize = 16;
55+
Rect menuRect = new Rect
56+
{
57+
x = position.xMax - style.padding.right - iconSize,
58+
y = position.y + style.padding.top,
59+
size = Vector2.one * iconSize
60+
};
61+
62+
bool menuIconHover = menuRect.Contains(Event.current.mousePosition);
63+
bool menuIconActive = (menuIconHover && Event.current.type == EventType.MouseDown && Event.current.button == 0);
64+
if (menuAction != null && menuIconActive)
65+
{
66+
menuAction.Invoke(menuRect);
67+
Event.current.Use();
68+
}
69+
70+
foldout = GUI.Toggle(position, foldout, content, style);
71+
72+
// Menu icon
73+
if (menuAction != null && Event.current.type == EventType.Repaint)
74+
{
75+
if (menuIcon == null)
76+
menuIcon = EditorStyles.foldoutHeaderIcon;
77+
78+
menuIcon.Draw(menuRect, menuIconHover, menuIconActive, false, false);
79+
}
80+
81+
return foldout;
82+
}
83+
84+
public static void EndFoldoutHeaderGroup()
85+
{
86+
s_FoldoutHeaderGroupActive = false;
87+
}
88+
}
89+
}

Editor/Mono/Inspector/LightingSettingsInspector.cs

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@ static class Styles
6565
public static readonly GUIStyle OpenPreviewStyle = EditorStyles.objectFieldThumb.name + "LightmapPreviewOverlay";
6666
public static readonly int PreviewPadding = 30;
6767
public static readonly int PreviewWidth = 104;
68-
public static readonly GUIContent CastShadowsProgressiveGPUWarning = EditorGUIUtility.TrTextContent("Cast Shadows is forced to 'On' when using the GPU lightmapper (Preview), it will be supported in a later version. Use the CPU lightmapper instead if you need this functionality.");
69-
public static readonly GUIContent ReceiveShadowsProgressiveGPUWarning = EditorGUIUtility.TrTextContent("Receive Shadows is forced to 'On' when using the GPU lightmapper (Preview), it will be supported in a later version. Use the CPU lightmapper instead if you need this functionality.");
7068
}
7169

7270
bool m_ShowChartingSettings = true;
@@ -162,25 +160,13 @@ public void RenderMeshSettings(bool showLightmapSettings)
162160
m_GameObjectsSerializedObject.Update();
163161
m_LightmapSettings.Update();
164162

165-
// TODO(RadeonRays): remove scope for GPU lightmapper once the feature has been implemented.
166-
using (new EditorGUI.DisabledScope(LightmapEditorSettings.lightmapper == LightmapEditorSettings.Lightmapper.ProgressiveGPU))
167-
{
168-
EditorGUILayout.PropertyField(m_CastShadows, Styles.CastShadows, true);
169-
}
170-
if (LightmapEditorSettings.lightmapper == LightmapEditorSettings.Lightmapper.ProgressiveGPU)
171-
EditorGUILayout.HelpBox(Styles.CastShadowsProgressiveGPUWarning.text, MessageType.Info);
172-
163+
EditorGUILayout.PropertyField(m_CastShadows, Styles.CastShadows, true);
173164
bool isDeferredRenderingPath = SceneView.IsUsingDeferredRenderingPath();
174165

175166
if (SupportedRenderingFeatures.active.rendererSupportsReceiveShadows)
176167
{
177-
// TODO(RadeonRays): remove scope for GPU lightmapper once the feature has been implemented.
178-
using (new EditorGUI.DisabledScope(isDeferredRenderingPath || LightmapEditorSettings.lightmapper == LightmapEditorSettings.Lightmapper.ProgressiveGPU))
179-
{
168+
using (new EditorGUI.DisabledScope(isDeferredRenderingPath))
180169
EditorGUILayout.PropertyField(m_ReceiveShadows, Styles.ReceiveShadows, true);
181-
}
182-
if (LightmapEditorSettings.lightmapper == LightmapEditorSettings.Lightmapper.ProgressiveGPU)
183-
EditorGUILayout.HelpBox(Styles.ReceiveShadowsProgressiveGPUWarning.text, MessageType.Info);
184170
}
185171

186172
if (SupportedRenderingFeatures.active.rendererSupportsMotionVectors)

0 commit comments

Comments
 (0)