Skip to content

Commit 66fb618

Browse files
author
Unity Technologies
committed
Unity 2017.3.0p4 C# reference source code
1 parent bce308b commit 66fb618

File tree

10 files changed

+65
-37
lines changed

10 files changed

+65
-37
lines changed

Editor/Mono/EditorWindow.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ internal void ClearPersistentViewData()
116116
bool m_DontClearBackground;
117117
#pragma warning disable 649
118118
EventInterests m_EventInterests;
119+
bool m_DisableInputEvents;
119120

120121
// Dockarea we're inside.
121122
[NonSerialized]
@@ -326,6 +327,19 @@ public bool maximized
326327

327328
internal bool docked { get { return m_Parent != null && m_Parent.window != null && !m_Parent.window.IsNotDocked(); } }
328329

330+
// This property can be used to stop OS events from being sent to the EditorWindow
331+
internal bool disableInputEvents
332+
{
333+
get { return m_DisableInputEvents; }
334+
set
335+
{
336+
if (m_DisableInputEvents == value)
337+
return;
338+
m_DisableInputEvents = value;
339+
MakeParentsSettingsMatchMe();
340+
}
341+
}
342+
329343
// The EditorWindow which currently has keyboard focus (RO)
330344
static public EditorWindow focusedWindow
331345
{
@@ -413,6 +427,7 @@ internal void MakeParentsSettingsMatchMe()
413427
m_Parent.depthBufferBits = m_DepthBufferBits;
414428
m_Parent.SetInternalGameViewDimensions(m_GameViewRect, m_GameViewClippedRect, m_GameViewTargetSize);
415429
m_Parent.eventInterests = m_EventInterests;
430+
m_Parent.disableInputEvents = m_DisableInputEvents;
416431
Vector2 parentBorderSizes = new Vector2(m_Parent.borderSize.left + m_Parent.borderSize.right, m_Parent.borderSize.top + m_Parent.borderSize.bottom);
417432
m_Parent.SetMinMaxSizes(minSize + parentBorderSizes, maxSize + parentBorderSizes);
418433
if (parentChanged)

Editor/Mono/GUI/DockArea.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,17 @@ protected override void OnDestroy()
8888
Invoke("OnLostFocus");
8989

9090
actualView = null;
91-
foreach (EditorWindow w in m_Panes)
91+
92+
// Since m_Panes can me modified indirectly by OnDestroy() callbacks, make a copy of it for safe iteration
93+
var windows = new List<EditorWindow>(m_Panes);
94+
95+
foreach (EditorWindow w in windows)
96+
{
97+
// Avoid destroying a window that has already being destroyed (case 967778)
98+
if (w == null)
99+
continue;
92100
UnityEngine.Object.DestroyImmediate(w, true);
101+
}
93102

94103
base.OnDestroy();
95104
}

Editor/Mono/Inspector/AvatarPreview.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ private RenderTexture RenderPreviewShadowmap(Light light, float scale, Vector3 c
512512

513513
// Set ortho camera and position it
514514
var cam = previewUtility.camera;
515-
cam.orthographic = is2D;
515+
cam.orthographic = true;
516516
cam.orthographicSize = scale * 2.0f;
517517
cam.nearClipPlane = 1 * scale;
518518
cam.farClipPlane = 25 * scale;
@@ -655,7 +655,7 @@ public void DoRenderPreview(Rect previewRect, GUIStyle background)
655655

656656
// Render shadow map
657657
Matrix4x4 shadowMatrix;
658-
RenderTexture shadowMap = RenderPreviewShadowmap(previewUtility.lights[0], m_BoundingVolumeScale / 2, bodyPos, floorPos, out shadowMatrix);
658+
RenderTexture shadowMap = RenderPreviewShadowmap(previewUtility.lights[0], m_BoundingVolumeScale / 2, bodyPosition, floorPos, out shadowMatrix);
659659

660660
float tempZoomFactor = (is2D ? 1.0f : m_ZoomFactor);
661661
// Position camera

Editor/Mono/Inspector/BlendTreeInspector.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1305,6 +1305,11 @@ public void RemoveButton(UnityEditorInternal.ReorderableList list)
13051305
if (list.index >= m_Childs.arraySize)
13061306
list.index = m_Childs.arraySize - 1;
13071307
SetMinMaxThresholds();
1308+
1309+
serializedObject.ApplyModifiedProperties();
1310+
1311+
// Layout has changed, bail out now.
1312+
EditorGUIUtility.ExitGUI();
13081313
}
13091314
}
13101315

Modules/UnityWebRequest/Public/WebRequestExtensions.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,9 @@ public static string EscapeURL(string s, Encoding e)
231231
if (e == null)
232232
return null;
233233

234-
return WWWTranscoder.URLEncode(s, e);
234+
var bytes = Encoding.UTF8.GetBytes(s);
235+
var decodedBytes = WWWTranscoder.URLEncode(bytes);
236+
return e.GetString(decodedBytes);
235237
}
236238

237239
public static string UnEscapeURL(string s)
@@ -247,7 +249,9 @@ public static string UnEscapeURL(string s, Encoding e)
247249
if (s.IndexOf('%') == -1 && s.IndexOf('+') == -1)
248250
return s;
249251

250-
return WWWTranscoder.URLDecode(s, e);
252+
var bytes = Encoding.UTF8.GetBytes(s);
253+
var decodedBytes = WWWTranscoder.URLDecode(bytes);
254+
return e.GetString(decodedBytes);
251255
}
252256

253257
public static byte[] SerializeFormSections(List<IMultipartFormSection> multipartFormSections, byte[] boundary)
@@ -269,11 +273,6 @@ public static byte[] SerializeFormSections(List<IMultipartFormSection> multipart
269273
string sectionName = section.sectionName;
270274
string fileName = section.fileName;
271275

272-
if (!string.IsNullOrEmpty(fileName))
273-
{
274-
disposition = "file";
275-
}
276-
277276
string header = "Content-Disposition: " + disposition;
278277

279278
if (!string.IsNullOrEmpty(sectionName))

Modules/UnityWebRequest/Public/WebRequestUtils.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,16 @@ internal static string MakeInitialUrl(string targetUrl, string localUrl)
546546

547547
// for file://protocol pass in unescaped string so we can pass it to VFS
548548
if (targetUrl.StartsWith("file://", StringComparison.OrdinalIgnoreCase))
549-
return targetUrl.Contains("%") ? UnityEngine.WWWTranscoder.URLDecode(targetUrl, System.Text.Encoding.UTF8) : targetUrl;
549+
{
550+
if (targetUrl.Contains("%"))
551+
{
552+
var urlBytes = Encoding.UTF8.GetBytes(targetUrl);
553+
var decodedBytes = UnityEngine.WWWTranscoder.URLDecode(urlBytes);
554+
return Encoding.UTF8.GetString(decodedBytes);
555+
}
556+
else
557+
return targetUrl;
558+
}
550559

551560
// if URL contains '%', assume it is properly escaped, otherwise '%2f' gets unescaped as '/' (which may not be correct)
552561
// otherwise escape it, i.e. replaces spaces by '%20'

Modules/UnityWebRequestWWW/Public/WWW.cs

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,7 @@ public static string EscapeURL(string s)
2222

2323
public static string EscapeURL(string s, Encoding e)
2424
{
25-
if (s == null)
26-
return null;
27-
28-
if (s == "")
29-
return "";
30-
31-
if (e == null)
32-
return null;
33-
34-
return WWWTranscoder.URLEncode(s, e);
25+
return UnityWebRequest.EscapeURL(s, e);
3526
}
3627

3728
public static string UnEscapeURL(string s)
@@ -41,13 +32,7 @@ public static string UnEscapeURL(string s)
4132

4233
public static string UnEscapeURL(string s, Encoding e)
4334
{
44-
if (null == s)
45-
return null;
46-
47-
if (s.IndexOf('%') == -1 && s.IndexOf('+') == -1)
48-
return s;
49-
50-
return WWWTranscoder.URLDecode(s, e);
35+
return UnityWebRequest.UnEscapeURL(s, e);
5136
}
5237

5338
public static WWW LoadFromCacheOrDownload(string url, int version)
@@ -85,12 +70,14 @@ public WWW(string url)
8570
public WWW(string url, WWWForm form)
8671
{
8772
_uwr = UnityWebRequest.Post(url, form);
73+
_uwr.chunkedTransfer = false;
8874
_uwr.SendWebRequest();
8975
}
9076

9177
public WWW(string url, byte[] postData)
9278
{
9379
_uwr = new UnityWebRequest(url, UnityWebRequest.kHttpVerbPOST);
80+
_uwr.chunkedTransfer = false;
9481
UploadHandler formUploadHandler = new UploadHandlerRaw(postData);
9582
formUploadHandler.contentType = "application/x-www-form-urlencoded";
9683
_uwr.uploadHandler = formUploadHandler;
@@ -103,6 +90,7 @@ public WWW(string url, byte[] postData, Hashtable headers)
10390
{
10491
var verb = postData == null ? UnityWebRequest.kHttpVerbGET : UnityWebRequest.kHttpVerbPOST;
10592
_uwr = new UnityWebRequest(url, verb);
93+
_uwr.chunkedTransfer = false;
10694
UploadHandler formUploadHandler = new UploadHandlerRaw(postData);
10795
formUploadHandler.contentType = "application/x-www-form-urlencoded";
10896
_uwr.uploadHandler = formUploadHandler;
@@ -117,6 +105,7 @@ public WWW(string url, byte[] postData, Dictionary<string, string> headers)
117105
{
118106
var verb = postData == null ? UnityWebRequest.kHttpVerbGET : UnityWebRequest.kHttpVerbPOST;
119107
_uwr = new UnityWebRequest(url, verb);
108+
_uwr.chunkedTransfer = false;
120109
UploadHandler formUploadHandler = new UploadHandlerRaw(postData);
121110
formUploadHandler.contentType = "application/x-www-form-urlencoded";
122111
_uwr.uploadHandler = formUploadHandler;

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Unity 2017.3.0p3 C# reference source code
1+
## Unity 2017.3.0p4 C# reference source code
22

33
The C# part of the Unity engine and editor source code.
44
May be used for reference purposes only.

artifacts/generated/common/editor/GUIViewBindings.gen.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,16 @@ internal extern bool mouseRayInvisible
158158
set;
159159
}
160160

161+
internal extern bool disableInputEvents
162+
{
163+
[UnityEngine.Scripting.GeneratedByOldBindingsGeneratorAttribute] // Temporarily necessary for bindings migration
164+
[System.Runtime.CompilerServices.MethodImplAttribute((System.Runtime.CompilerServices.MethodImplOptions)0x1000)]
165+
get;
166+
[UnityEngine.Scripting.GeneratedByOldBindingsGeneratorAttribute] // Temporarily necessary for bindings migration
167+
[System.Runtime.CompilerServices.MethodImplAttribute((System.Runtime.CompilerServices.MethodImplOptions)0x1000)]
168+
set;
169+
}
170+
161171
internal void GrabPixels (RenderTexture rd, Rect rect) {
162172
INTERNAL_CALL_GrabPixels ( this, rd, ref rect );
163173
}

artifacts/generated/common/editor/PlayerSettingsTVOSBindings.gen.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,6 @@ public extern static string targetOSVersionString
8686
[System.Runtime.CompilerServices.MethodImplAttribute((System.Runtime.CompilerServices.MethodImplOptions)0x1000)]
8787
extern internal static Texture2D[] GetLargeIconLayers () ;
8888

89-
[UnityEngine.Scripting.GeneratedByOldBindingsGeneratorAttribute] // Temporarily necessary for bindings migration
90-
[System.Runtime.CompilerServices.MethodImplAttribute((System.Runtime.CompilerServices.MethodImplOptions)0x1000)]
91-
extern internal static Texture2D[] GetLargeIconLayers2x () ;
92-
9389
[UnityEngine.Scripting.GeneratedByOldBindingsGeneratorAttribute] // Temporarily necessary for bindings migration
9490
[System.Runtime.CompilerServices.MethodImplAttribute((System.Runtime.CompilerServices.MethodImplOptions)0x1000)]
9591
extern internal static Texture2D[] GetTopShelfImageLayers () ;
@@ -118,10 +114,6 @@ public extern static string targetOSVersionString
118114
[System.Runtime.CompilerServices.MethodImplAttribute((System.Runtime.CompilerServices.MethodImplOptions)0x1000)]
119115
extern internal static void SetLargeIconLayers (Texture2D[] layers) ;
120116

121-
[UnityEngine.Scripting.GeneratedByOldBindingsGeneratorAttribute] // Temporarily necessary for bindings migration
122-
[System.Runtime.CompilerServices.MethodImplAttribute((System.Runtime.CompilerServices.MethodImplOptions)0x1000)]
123-
extern internal static void SetLargeIconLayers2x (Texture2D[] layers) ;
124-
125117
[UnityEngine.Scripting.GeneratedByOldBindingsGeneratorAttribute] // Temporarily necessary for bindings migration
126118
[System.Runtime.CompilerServices.MethodImplAttribute((System.Runtime.CompilerServices.MethodImplOptions)0x1000)]
127119
extern internal static void SetTopShelfImageLayers (Texture2D[] layers) ;

0 commit comments

Comments
 (0)