Skip to content

Commit 127264c

Browse files
author
Unity Technologies
committed
Unity 2017.1.0p1 C# reference source code
1 parent 2d2489a commit 127264c

File tree

19 files changed

+129
-33
lines changed

19 files changed

+129
-33
lines changed

Editor/Mono/2D/SpriteAtlas/SpriteAtlasInspector.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ private enum AtlasType { Undefined = -1, Master = 0, Variant = 1 }
130130

131131
static bool IsPackable(Object o)
132132
{
133-
return o != null && (o.GetType() == typeof(Sprite) || o.GetType() == typeof(DefaultAsset) || o.GetType() == typeof(Texture2D));
133+
return o != null && (o.GetType() == typeof(Sprite) || o.GetType() == typeof(Texture2D) || (o.GetType() == typeof(DefaultAsset) && ProjectWindowUtil.IsFolder(o.GetInstanceID())));
134134
}
135135

136136
static Object ValidateObjectForPackableFieldAssignment(Object[] references, System.Type objType, SerializedProperty property, EditorGUI.ObjectFieldValidatorOptions options)
@@ -239,6 +239,7 @@ void SyncPlatformSettings()
239239
void AddPackable(ReorderableList list)
240240
{
241241
ObjectSelector.get.Show(null, typeof(Object), null, false);
242+
ObjectSelector.get.searchFilter = "t:sprite t:texture2d t:folder";
242243
ObjectSelector.get.objectSelectorID = s_Styles.packableSelectorHash;
243244
}
244245

@@ -311,6 +312,8 @@ public override void OnInspectorGUI()
311312

312313
// Packing an atlas might change platform settings in the process, reinitialize
313314
SyncPlatformSettings();
315+
316+
GUIUtility.ExitGUI();
314317
}
315318
}
316319
else

Editor/Mono/Annotation/SceneRenderModeWindow.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,9 @@ bool IsModeDisabled(DrawCameraMode mode)
317317
(mode == DrawCameraMode.BakedEmissive && (!m_EnableBakedGI.boolValue || !m_PathTracerBackend)) ||
318318
(mode == DrawCameraMode.BakedTexelValidity && (!m_EnableBakedGI.boolValue || !m_PathTracerBackend)) ||
319319
(mode == DrawCameraMode.BakedCharting && (!m_EnableBakedGI.boolValue || !m_PathTracerBackend)) ||
320-
(mode >= DrawCameraMode.RealtimeCharting && mode < DrawCameraMode.BakedLightmap && !m_EnableRealtimeGI.boolValue && (!m_EnableBakedGI.boolValue || (m_EnableBakedGI.boolValue && m_PathTracerBackend)));
320+
(mode >= DrawCameraMode.RealtimeCharting && mode < DrawCameraMode.BakedLightmap && !m_EnableRealtimeGI.boolValue && (!m_EnableBakedGI.boolValue || (m_EnableBakedGI.boolValue && m_PathTracerBackend)) ||
321+
(mode == DrawCameraMode.Clustering && !m_EnableRealtimeGI.boolValue && (!m_EnableBakedGI.boolValue || (m_EnableBakedGI.boolValue && m_PathTracerBackend))) ||
322+
(mode == DrawCameraMode.LitClustering && !m_EnableRealtimeGI.boolValue));
321323
}
322324

323325
void DoResolutionToggle(Rect rect, bool disabled)

Editor/Mono/Inspector/PlayerSettingsEditor/PlayerSettingsEditor.cs

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -550,8 +550,10 @@ private void CommonSettings()
550550
// Get icons and icon sizes for selected platform (or default)
551551
GUI.changed = false;
552552
string platformName = "";
553-
Texture2D[] icons = PlayerSettings.GetIconsForPlatform(platformName);
554-
int[] widths = PlayerSettings.GetIconWidthsForPlatform(platformName);
553+
Texture2D[] icons = PlayerSettings.GetAllIconsForPlatform(platformName);
554+
int[] widths = PlayerSettings.GetIconWidthsOfAllKindsForPlatform(platformName);
555+
IconKind[] kinds = PlayerSettings.GetIconKindsForPlatform(platformName);
556+
555557
// Ensure the default icon list is always populated correctly
556558
if (icons.Length != widths.Length)
557559
{
@@ -562,7 +564,7 @@ private void CommonSettings()
562564
if (GUI.changed)
563565
{
564566
Undo.RecordObject(this.target, Styles.undoChangedIconString);
565-
PlayerSettings.SetIconsForPlatform(platformName, icons);
567+
PlayerSettings.SetIconsForPlatform(platformName, icons, kinds);
566568
}
567569

568570
GUILayout.Space(3);
@@ -648,9 +650,10 @@ private void IconSectionGUI(BuildTargetGroup targetGroup, ISettingEditorExtensio
648650
else
649651
{
650652
// Get icons and icon sizes for selected platform (or default)
651-
Texture2D[] icons = PlayerSettings.GetIconsForPlatform(platformName);
652-
int[] widths = PlayerSettings.GetIconWidthsForPlatform(platformName);
653-
int[] heights = PlayerSettings.GetIconHeightsForPlatform(platformName);
653+
Texture2D[] icons = PlayerSettings.GetAllIconsForPlatform(platformName);
654+
int[] widths = PlayerSettings.GetIconWidthsOfAllKindsForPlatform(platformName);
655+
int[] heights = PlayerSettings.GetIconHeightsOfAllKindsForPlatform(platformName);
656+
IconKind[] kinds = PlayerSettings.GetIconKindsForPlatform(platformName);
654657

655658
bool overrideIcons = true;
656659

@@ -671,7 +674,7 @@ private void IconSectionGUI(BuildTargetGroup targetGroup, ISettingEditorExtensio
671674
icons = new Texture2D[0];
672675

673676
if (GUI.changed)
674-
PlayerSettings.SetIconsForPlatform(platformName, icons);
677+
PlayerSettings.SetIconsForPlatform(platformName, icons, kinds);
675678
}
676679
}
677680

@@ -686,17 +689,23 @@ private void IconSectionGUI(BuildTargetGroup targetGroup, ISettingEditorExtensio
686689
{
687690
// Spotlight icons begin with 120 but there are two in the list.
688691
// So check if the next one is 80.
689-
if (i + 1 < widths.Length && widths[i + 1] == 80)
692+
if (kinds[i] == IconKind.Spotlight && kinds[i - 1] != IconKind.Spotlight)
690693
{
691694
Rect labelRect = GUILayoutUtility.GetRect(EditorGUIUtility.labelWidth, 20);
692695
GUI.Label(new Rect(labelRect.x, labelRect.y, EditorGUIUtility.labelWidth, 20), "Spotlight icons", EditorStyles.boldLabel);
693696
}
694697

695-
if (widths[i] == 87)
698+
if (kinds[i] == IconKind.Settings && kinds[i - 1] != IconKind.Settings)
696699
{
697700
Rect labelRect = GUILayoutUtility.GetRect(EditorGUIUtility.labelWidth, 20);
698701
GUI.Label(new Rect(labelRect.x, labelRect.y, EditorGUIUtility.labelWidth, 20), "Settings icons", EditorStyles.boldLabel);
699702
}
703+
704+
if (kinds[i] == IconKind.Notification && kinds[i - 1] != IconKind.Notification)
705+
{
706+
Rect labelRect = GUILayoutUtility.GetRect(EditorGUIUtility.labelWidth, 20);
707+
GUI.Label(new Rect(labelRect.x, labelRect.y, EditorGUIUtility.labelWidth, 20), "Notification icons", EditorStyles.boldLabel);
708+
}
700709
}
701710

702711
Rect rect = GUILayoutUtility.GetRect(kSlotSize, Mathf.Max(kSlotSize, previewHeight) + kIconSpacing);
@@ -720,7 +729,7 @@ private void IconSectionGUI(BuildTargetGroup targetGroup, ISettingEditorExtensio
720729

721730
// Preview
722731
Rect previewRect = new Rect(rect.x + width - kMaxPreviewSize, rect.y, previewWidth, previewHeight);
723-
Texture2D closestIcon = PlayerSettings.GetIconForPlatformAtSize(platformName, widths[i], heights[i]);
732+
Texture2D closestIcon = PlayerSettings.GetIconForPlatformAtSize(platformName, widths[i], heights[i], kinds[i]);
724733
if (closestIcon != null)
725734
GUI.DrawTexture(previewRect, closestIcon);
726735
else
@@ -730,7 +739,7 @@ private void IconSectionGUI(BuildTargetGroup targetGroup, ISettingEditorExtensio
730739
if (GUI.changed)
731740
{
732741
Undo.RecordObject(this.target, Styles.undoChangedIconString);
733-
PlayerSettings.SetIconsForPlatform(platformName, icons);
742+
PlayerSettings.SetIconsForPlatform(platformName, icons, kinds);
734743
}
735744
GUI.enabled = enabled;
736745

@@ -1278,7 +1287,8 @@ private void OtherSectionRenderingGUI(BuildPlatform platform, BuildTargetGroup t
12781287
|| targetGroup == BuildTargetGroup.XboxOne
12791288
|| targetGroup == BuildTargetGroup.WSA
12801289
|| targetGroup == BuildTargetGroup.WiiU
1281-
|| targetGroup == BuildTargetGroup.WebGL)
1290+
|| targetGroup == BuildTargetGroup.WebGL
1291+
|| targetGroup == BuildTargetGroup.Switch)
12821292
{
12831293
using (new EditorGUI.DisabledScope(EditorApplication.isPlaying)) // switching color spaces in play mode is not supported
12841294
{

Editor/Mono/ObjectSelector.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ void FilterSettingsChanged()
218218
{
219219
SearchFilter filter = new SearchFilter();
220220
filter.SearchFieldStringToFilter(m_SearchFilter);
221-
if (!string.IsNullOrEmpty(m_RequiredType))
221+
if (!string.IsNullOrEmpty(m_RequiredType) && filter.classNames.Length == 0)
222222
{
223223
filter.classNames = new[] { m_RequiredType };
224224
}

Editor/Mono/SceneModeWindows/LightingWindow.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ void Buttons()
275275
bool showBakeButton = isContinuous || !Lightmapping.isRunning;
276276
if (showBakeButton)
277277
{
278-
if (EditorGUI.ButtonWithDropdownList(Styles.BuildLabel, s_BakeModeOptions, BakeDropDownCallback, GUILayout.Width(180)))
278+
if (EditorGUI.ButtonWithDropdownList(Styles.BuildLabel, s_BakeModeOptions, BakeDropDownCallback, GUILayout.Width(170)))
279279
{
280280
DoBake();
281281

0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)