Skip to content

Commit b9bc712

Browse files
author
Unity Technologies
committed
Unity 2018.3.0a11 C# reference source code
1 parent 087254d commit b9bc712

61 files changed

Lines changed: 910 additions & 510 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/Animation/AnimationWindow/AnimationWindowUtility.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// https://unity3d.com/legal/licenses/Unity_Reference_Only_License
44

55
using System;
6+
using System.Globalization;
67
using System.Linq;
78
using System.IO;
89
using System.Collections.Generic;
@@ -588,7 +589,7 @@ public static PropertyModification[] SerializedPropertyToPropertyModifications(S
588589
if (isObject)
589590
objectReference = singleProperty.objectReferenceValue;
590591
else if (isFloat)
591-
value = singleProperty.floatValue.ToString();
592+
value = singleProperty.floatValue.ToString(CultureInfo.InvariantCulture);
592593
else if (isInt)
593594
value = singleProperty.intValue.ToString();
594595
else if (isEnum)
@@ -614,7 +615,7 @@ public static PropertyModification[] SerializedPropertyToPropertyModifications(S
614615
if (isObject)
615616
objectReference = propertyIter.objectReferenceValue;
616617
else if (isFloat)
617-
value = propertyIter.floatValue.ToString();
618+
value = propertyIter.floatValue.ToString(CultureInfo.InvariantCulture);
618619
else if (isInt)
619620
value = propertyIter.intValue.ToString();
620621
else // if (isBool)

Editor/Mono/AssetStore/AssetStoreAssetSelection.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ public static void AddAsset(AssetStoreAsset searchResult, Texture2D placeholderP
116116
else
117117
{
118118
searchResult.previewBundle = cr.assetBundle;
119+
#pragma warning disable 618
119120
if (cr.assetBundle == null || cr.assetBundle.mainAsset == null)
120121
{
121122
// Failed downloading live preview. Fallback to static
@@ -124,6 +125,7 @@ public static void AddAsset(AssetStoreAsset searchResult, Texture2D placeholderP
124125
}
125126
else
126127
searchResult.previewAsset = searchResult.previewBundle.mainAsset;
128+
#pragma warning restore 618
127129
}
128130
};
129131

Editor/Mono/AssetStoreToolUtils.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ public partial class AssetStoreToolUtils
1717
public static bool PreviewAssetStoreAssetBundleInInspector(AssetBundle bundle, AssetStoreAsset info)
1818
{
1919
info.id = 0; // make sure the id is zero when previewing
20+
#pragma warning disable 618
2021
info.previewAsset = bundle.mainAsset;
22+
#pragma warning restore 618
2123
AssetStoreAssetSelection.Clear();
2224
AssetStoreAssetSelection.AddAssetInternal(info);
2325

Editor/Mono/BuildPipeline/DesktopStandaloneBuildWindowExtension.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ internal abstract class DesktopStandaloneBuildWindowExtension : DefaultBuildWind
1212
{
1313
private GUIContent m_StandaloneTarget = EditorGUIUtility.TrTextContent("Target Platform", "Destination platform for standalone build");
1414
private GUIContent m_Architecture = EditorGUIUtility.TrTextContent("Architecture", "Build m_Architecture for standalone");
15-
private GUIContent m_HeadlessMode = EditorGUIUtility.TrTextContent("Server Build");
15+
private GUIContent m_HeadlessMode = EditorGUIUtility.TrTextContent("Server Build", "Headless player build tailored for server environments");
1616
private BuildTarget[] m_StandaloneSubtargets;
1717
private GUIContent[] m_StandaloneSubtargetStrings;
1818

Editor/Mono/BuildPipeline/MonoCrossCompile.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -294,10 +294,6 @@ static void CrossCompileAOT(BuildTarget target, string crossCompilerAbsolutePath
294294
process.StartInfo.CreateNoWindow = true;
295295
process.StartInfo.RedirectStandardOutput = true;
296296

297-
298-
// todo: move this out of this file ... it needs to be initialised in the per-platform extension
299-
// ArtifactsPath = Environment.ExpandEnvironmentVariables("%tmp%\\UnityPSVitaArtifacts\\");
300-
301297
if (ArtifactsPath != null)
302298
{
303299
if (!Directory.Exists(ArtifactsPath)) Directory.CreateDirectory(ArtifactsPath);

Editor/Mono/EditorApplication.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,6 @@ static void Internal_EditorApplicationQuit()
9797
editorApplicationQuit();
9898
}
9999

100-
internal static bool supportsHiDPI { get { return Application.platform == RuntimePlatform.OSXEditor || Application.platform == RuntimePlatform.WindowsEditor; } }
101-
102100
// Delegate to be called for every visible list item in the ProjectWindow on every OnGUI event.
103101
public delegate void ProjectWindowItemCallback(string guid, Rect selectionRect);
104102

Editor/Mono/EditorHandles/RectHandle.cs

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,43 +9,44 @@ namespace UnityEditor
99
{
1010
public sealed partial class Handles
1111
{
12-
internal static Vector2 DoRectHandles(Quaternion rotation, Vector3 position, Vector2 size)
12+
internal static Vector2 DoRectHandles(Quaternion rotation, Vector3 position, Vector2 size, bool handlesOnly)
1313
{
14-
Vector3 forward = rotation * Vector3.forward;
1514
Vector3 up = rotation * Vector3.up;
1615
Vector3 right = rotation * Vector3.right;
1716

1817
float halfWidth = 0.5f * size.x;
1918
float halfHeight = 0.5f * size.y;
2019

21-
Vector3 topRight = position + up * halfHeight + right * halfWidth;
22-
Vector3 bottomRight = position - up * halfHeight + right * halfWidth;
23-
Vector3 bottomLeft = position - up * halfHeight - right * halfWidth;
24-
Vector3 topLeft = position + up * halfHeight - right * halfWidth;
20+
if (!handlesOnly)
21+
{
22+
Vector3 topRight = position + up * halfHeight + right * halfWidth;
23+
Vector3 bottomRight = position - up * halfHeight + right * halfWidth;
24+
Vector3 bottomLeft = position - up * halfHeight - right * halfWidth;
25+
Vector3 topLeft = position + up * halfHeight - right * halfWidth;
2526

26-
// Draw rectangle
27-
DrawLine(topRight, bottomRight);
28-
DrawLine(bottomRight, bottomLeft);
29-
DrawLine(bottomLeft, topLeft);
30-
DrawLine(topLeft, topRight);
27+
// Draw rectangle
28+
DrawLine(topRight, bottomRight);
29+
DrawLine(bottomRight, bottomLeft);
30+
DrawLine(bottomLeft, topLeft);
31+
DrawLine(topLeft, topRight);
32+
}
3133

3234
// Give handles twice the alpha of the lines
33-
Color col = Handles.color;
34-
col.a = Mathf.Clamp01(col.a * 2);
35-
Handles.color = col;
35+
Color origCol = color;
36+
Color col = color;
37+
col.a = Mathf.Clamp01(color.a * 2);
38+
color = ToActiveColorSpace(col);
3639

3740
// Draw handles
3841
halfHeight = SizeSlider(position, up, halfHeight);
3942
halfHeight = SizeSlider(position, -up, halfHeight);
4043
halfWidth = SizeSlider(position, right, halfWidth);
4144
halfWidth = SizeSlider(position, -right, halfWidth);
4245

43-
// Draw the area light's normal only if it will not overlap with the current tool
44-
if (!((Tools.current == Tool.Move || Tools.current == Tool.Scale) && Tools.pivotRotation == PivotRotation.Local))
45-
DrawLine(position, position + forward);
46+
size.x = Mathf.Max(0f, 2.0f * halfWidth);
47+
size.y = Mathf.Max(0f, 2.0f * halfHeight);
4648

47-
size.x = 2.0f * halfWidth;
48-
size.y = 2.0f * halfHeight;
49+
color = origCol;
4950

5051
return size;
5152
}

Editor/Mono/EditorWindow.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public partial class EditorWindow : ScriptableObject
4040

4141
[SerializeField]
4242
[HideInInspector]
43-
internal Rect m_Pos = new Rect(0, 0, 320, 240);
43+
internal Rect m_Pos = new Rect(0, 0, 320, 550);
4444

4545
private readonly Dictionary<Type, VisualElement> m_RootElementPerEditorMode = new Dictionary<Type, VisualElement>();
4646

Editor/Mono/GI/Lightmapping.bindings.cs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ internal struct GeoMemLabels
7272
public UInt64[] triCounts;
7373
}
7474

75+
internal struct TetrahedralizationData
76+
{
77+
public int[] indices;
78+
public Vector3[] positions;
79+
}
80+
7581
[NativeHeader("Editor/Src/GI/EditorHelpers.h")]
7682
internal struct LightingStats
7783
{
@@ -320,15 +326,14 @@ private static void Internal_CallCompletedFunctions()
320326
// Calculates a Delaunay Tetrahedralization of the 'positions' point set - the same way the lightmapper
321327
public static void Tetrahedralize(Vector3[] positions, out int[] outIndices, out Vector3[] outPositions)
322328
{
323-
outIndices = new int[0];
324-
outPositions = new Vector3[0];
325-
326-
TetrahedralizeInternal(positions, outIndices, outPositions);
329+
TetrahedralizationData data = TetrahedralizeInternal(positions);
330+
outIndices = data.indices;
331+
outPositions = data.positions;
327332
}
328333

329-
[NativeName("Tetrahedralize")]
334+
[NativeName("LightProbeUtils::Tetrahedralize")]
330335
[FreeFunction]
331-
private static extern void TetrahedralizeInternal(Vector3[] positions, [Out] int[] outIndices, [Out] Vector3[] outPositions);
336+
private static extern TetrahedralizationData TetrahedralizeInternal(Vector3[] positions);
332337

333338
[FreeFunction]
334339
public static extern bool BakeReflectionProbe(ReflectionProbe probe, string path);

Editor/Mono/GUI/TreeView/GameObjectTreeViewGUI.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
using System.Linq;
66
using System.Collections.Generic;
7+
using UnityEditor.Experimental;
78
using UnityEditor.Experimental.SceneManagement;
89
using UnityEditor.IMGUI.Controls;
910
using UnityEditor.SceneManagement;
@@ -37,9 +38,7 @@ internal static class GameObjectStyles
3738
public static GUIStyle rightArrow = "ArrowNavigationRight";
3839
public static GUIStyle hoveredItemBackgroundStyle = "WhiteBackground";
3940
public static Color hoveredBackgroundColor =
40-
EditorGUIUtility.isProSkin
41-
? new Color(48.0f / 255.0f, 48.0f / 255.0f, 48.0f / 255.0f)
42-
: new Color(170.0f / 255.0f, 170.0f / 255.0f, 170.0f / 255.0f);
41+
EditorResources.GetStyle("game-object-tree-view").GetColor("-unity-object-tree-hovered-color");
4342

4443
public static Texture2D sceneAssetIcon = EditorGUIUtility.FindTexture(typeof(SceneAsset));
4544
public static Texture2D prefabIcon = EditorGUIUtility.FindTexture("Prefab Icon");

0 commit comments

Comments
 (0)