Skip to content

Commit 9c1abe4

Browse files
author
Unity Technologies
committed
Unity 2017.1.0f1 C# reference source code
1 parent 8ce3570 commit 9c1abe4

38 files changed

+280
-78
lines changed

Editor/Mono/Animation/AnimationWindow/AnimationRecording.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,8 @@ static public UndoPropertyModification[] ProcessModifications(IAnimationRecordin
346346
{
347347
// TODO@mecanim keyframing of transform driven by an animator is disabled until we can figure out
348348
// how to rebind partially a controller at each sampling.
349-
if (animator != null && animator.isHuman && binding.type == typeof(Transform) && animator.IsBoneTransform(prop.target as Transform))
349+
if (animator != null && animator.isHuman && binding.type == typeof(Transform)
350+
&& animator.gameObject.transform != prop.target && animator.IsBoneTransform(prop.target as Transform))
350351
{
351352
Debug.LogWarning("Keyframing for humanoid rig is not supported!", prop.target as Transform);
352353
continue;

Editor/Mono/Animation/TransitionPreview.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,8 @@ private void CopyTransitionForPreview(AnimatorStateTransition src, ref AnimatorS
157157

158158
private bool MustResample(TransitionInfo info)
159159
{
160-
return mustResample || !info.IsEqual(m_RefTransitionInfo);
160+
bool isInPlayback = m_AvatarPreview != null && m_AvatarPreview.Animator != null && m_AvatarPreview.Animator.recorderMode == AnimatorRecorderMode.Playback;
161+
return mustResample || !info.IsEqual(m_RefTransitionInfo) || !isInPlayback;
161162
}
162163

163164
private void WriteParametersInController()

Editor/Mono/Annotation/SceneRenderModeWindow.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ public enum DrawCameraMode
6363
BakedTexelValidity = 28,
6464
BakedIndices = 29,
6565
BakedCharting = 30,
66-
6766
SpriteMask = 31,
6867
}
6968

Editor/Mono/BuildPipeline/AssemblyStripper.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ internal static void StripAssemblies(string stagingAreaData, IIl2CppPlatformProv
107107
{
108108
var managedAssemblyFolderPath = Path.GetFullPath(Path.Combine(stagingAreaData, "Managed"));
109109
var assemblies = GetUserAssemblies(rcr, managedAssemblyFolderPath);
110+
assemblies.AddRange(Directory.GetFiles(managedAssemblyFolderPath, "I18N*.dll", SearchOption.TopDirectoryOnly));
110111
var assembliesToStrip = assemblies.ToArray();
111112

112113
var searchDirs = new[]

Editor/Mono/EditorGraphicsSettings.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public struct TierSettings
3131

3232
public bool cascadedShadowMaps;
3333
public bool prefer32BitShadowMaps;
34+
public bool enableLPPV;
3435
public bool semitransparentShadows;
3536

3637
public RenderingPath renderingPath;

Editor/Mono/GUI/PackageImportTreeView.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using System.IO;
88
using System.Linq;
99
using UnityEditor.IMGUI.Controls;
10+
using UnityEditor.Utils;
1011
using UnityEngine;
1112
using UnityEditorInternal;
1213

@@ -545,8 +546,8 @@ public override void FetchData()
545546
if (PackageImport.HasInvalidCharInFilePath(item.destinationAssetPath))
546547
continue; // Do not add invalid paths (we already warn the user with a dialog in PackageImport.cs)
547548

548-
string filename = Path.GetFileName(item.destinationAssetPath);
549-
string folderPath = Path.GetDirectoryName(item.destinationAssetPath);
549+
string filename = Path.GetFileName(item.destinationAssetPath).ConvertSeparatorsToUnity();
550+
string folderPath = Path.GetDirectoryName(item.destinationAssetPath).ConvertSeparatorsToUnity();
550551

551552
// Ensure folders. This is for when installed packages have been moved to other folders.
552553
TreeViewItem targetFolder = EnsureFolderPath(folderPath, treeViewFolders, initExpandedState);

Editor/Mono/GUI/Toolbar.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ void OnGUI()
328328

329329
ReserveWidthLeft(32, ref pos);
330330
if (GUI.Button(GetThinArea(pos), s_CloudIcon))
331-
UnityConnectServiceCollection.instance.ShowService(HubAccess.kServiceName, true); // Should show hub when it's done
331+
UnityConnectServiceCollection.instance.ShowService(HubAccess.kServiceName, true, "cloud_icon"); // Should show hub when it's done
332332

333333
ReserveWidthLeft(space, ref pos);
334334
ReserveWidthLeft(kCollabButtonWidth, ref pos);

Editor/Mono/GUI/Tools/TransformManipulator.cs

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,10 @@ public void SetScaleDelta(Vector3 scaleDelta, Vector3 scalePivot, Quaternion sca
131131

132132
private void SetPosition(Vector3 newPosition)
133133
{
134-
SetPositionDelta(newPosition - position);
134+
SetPositionDelta(newPosition - position, true);
135135
}
136136

137-
public void SetPositionDelta(Vector3 positionDelta)
137+
public void SetPositionDelta(Vector3 positionDelta, bool applySmartRounding)
138138
{
139139
Vector3 localPositionDelta = positionDelta;
140140
Vector3 minDifference = ManipulationToolUtility.minDragDifference;
@@ -154,23 +154,37 @@ public void SetPositionDelta(Vector3 positionDelta)
154154
if (rectTransform == null)
155155
{
156156
Vector3 newLocalPosition = localPosition + localPositionDelta;
157-
newLocalPosition.x = zeroXDelta ? localPosition.x : MathUtils.RoundBasedOnMinimumDifference(newLocalPosition.x, minDifference.x);
158-
newLocalPosition.y = zeroYDelta ? localPosition.y : MathUtils.RoundBasedOnMinimumDifference(newLocalPosition.y, minDifference.y);
159-
newLocalPosition.z = zeroZDelta ? localPosition.z : MathUtils.RoundBasedOnMinimumDifference(newLocalPosition.z, minDifference.z);
157+
158+
if (applySmartRounding)
159+
{
160+
newLocalPosition.x = zeroXDelta ? localPosition.x : MathUtils.RoundBasedOnMinimumDifference(newLocalPosition.x, minDifference.x);
161+
newLocalPosition.y = zeroYDelta ? localPosition.y : MathUtils.RoundBasedOnMinimumDifference(newLocalPosition.y, minDifference.y);
162+
newLocalPosition.z = zeroZDelta ? localPosition.z : MathUtils.RoundBasedOnMinimumDifference(newLocalPosition.z, minDifference.z);
163+
}
164+
160165
transform.localPosition = newLocalPosition;
161166
}
162167
else
163168
{
164169
// Set position.z
165170
Vector3 newLocalPosition = localPosition + localPositionDelta;
166-
newLocalPosition.z = zeroZDelta ? localPosition.z : MathUtils.RoundBasedOnMinimumDifference(newLocalPosition.z, minDifference.z);
171+
172+
if (applySmartRounding)
173+
newLocalPosition.z = zeroZDelta ? localPosition.z : MathUtils.RoundBasedOnMinimumDifference(newLocalPosition.z, minDifference.z);
174+
167175
transform.localPosition = newLocalPosition;
168176

169177
// Set anchoredPosition
170178
Vector2 newAnchoredPosition = anchoredPosition + (Vector2)localPositionDelta;
171-
newAnchoredPosition.x = zeroXDelta ? anchoredPosition.x : MathUtils.RoundBasedOnMinimumDifference(newAnchoredPosition.x, minDifference.x);
172-
newAnchoredPosition.y = zeroYDelta ? anchoredPosition.y : MathUtils.RoundBasedOnMinimumDifference(newAnchoredPosition.y, minDifference.y);
179+
180+
if (applySmartRounding)
181+
{
182+
newAnchoredPosition.x = zeroXDelta ? anchoredPosition.x : MathUtils.RoundBasedOnMinimumDifference(newAnchoredPosition.x, minDifference.x);
183+
newAnchoredPosition.y = zeroYDelta ? anchoredPosition.y : MathUtils.RoundBasedOnMinimumDifference(newAnchoredPosition.y, minDifference.y);
184+
}
185+
173186
rectTransform.anchoredPosition = newAnchoredPosition;
187+
174188
if (rectTransform.drivenByObject != null)
175189
RectTransform.SendReapplyDrivenProperties(rectTransform);
176190
}
@@ -335,15 +349,24 @@ public static void SetPositionDelta(Vector3 positionDelta)
335349
if (s_MouseDownState == null)
336350
return;
337351

352+
if (positionDelta.magnitude == 0)
353+
return;
354+
338355
for (int i = 0; i < s_MouseDownState.Length; i++)
339356
{
340357
var cur = s_MouseDownState[i];
341358
Undo.RecordObject((cur.rectTransform != null ? (Object)cur.rectTransform : (Object)cur.transform), "Move");
342359
}
343360

344-
for (int i = 0; i < s_MouseDownState.Length; i++)
361+
if (s_MouseDownState.Length > 0)
345362
{
346-
s_MouseDownState[i].SetPositionDelta(positionDelta);
363+
s_MouseDownState[0].SetPositionDelta(positionDelta, true);
364+
Vector3 firstDelta = s_MouseDownState[0].transform.localPosition - s_MouseDownState[0].localPosition;
365+
366+
for (int i = 1; i < s_MouseDownState.Length; i++)
367+
{
368+
s_MouseDownState[i].SetPositionDelta(firstDelta, false);
369+
}
347370
}
348371
}
349372

Editor/Mono/GUI/WindowLayout.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ public static bool LoadWindowLayout(string path, bool newProjectLayoutWasCreated
608608
{
609609
if (UnityConnect.instance.online && UnityConnect.instance.loggedIn && UnityConnect.instance.shouldShowServicesWindow)
610610
{
611-
UnityConnectServiceCollection.instance.ShowService(HubAccess.kServiceName, true);
611+
UnityConnectServiceCollection.instance.ShowService(HubAccess.kServiceName, true, "new_project_created");
612612
}
613613
else
614614
{

Editor/Mono/Inspector/AddComponentWindow.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ internal class AddComponentWindow : EditorWindow
1919

2020
internal enum Language
2121
{
22-
CSharp = 0
22+
CSharp = 0,
23+
JavaScript = 1
2324
}
2425

2526
const Language kDefaultLanguage = Language.CSharp;
@@ -201,6 +202,8 @@ private string extension
201202
{
202203
case Language.CSharp:
203204
return "cs";
205+
case Language.JavaScript:
206+
return "js";
204207
default:
205208
throw new ArgumentOutOfRangeException();
206209
}
@@ -214,6 +217,8 @@ private string templatePath
214217
string basePath = Path.Combine(EditorApplication.applicationContentsPath, kResourcesTemplatePath);
215218
switch (s_Lang)
216219
{
220+
case Language.JavaScript:
221+
return Path.Combine(basePath, "82-Javascript-NewBehaviourScript.js.txt");
217222
case Language.CSharp:
218223
return Path.Combine(basePath, "81-C# Script-NewBehaviourScript.cs.txt");
219224
default:

0 commit comments

Comments
 (0)