Skip to content

Commit fa21edc

Browse files
author
Unity Technologies
committed
Unity 2018.3.12f1 C# reference source code
1 parent c26c4fc commit fa21edc

39 files changed

Lines changed: 544 additions & 348 deletions

Editor/Mono/Animation/AnimationWindow/AnimEditor.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -820,6 +820,12 @@ static void KeyModified(ShortcutArguments args)
820820
animEditor.Repaint();
821821
}
822822

823+
[Shortcut("Animation/Frame All", typeof(AnimationWindow), "#a")]
824+
static void FrameAll(ShortcutArguments args)
825+
{
826+
ExecuteShortcut(args, animEditor => { animEditor.triggerFraming = true; });
827+
}
828+
823829
private void PlayButtonOnGUI()
824830
{
825831
EditorGUI.BeginChangeCheck();

Editor/Mono/Animation/AnimationWindow/AnimationRecording.cs

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

55
using System;
6+
using System.Collections.Generic;
7+
using System.Globalization;
68
using System.Linq;
79
using UnityEngine;
810
using UnityEditor;
9-
using System.Collections.Generic;
1011

1112
namespace UnityEditorInternal
1213
{
@@ -484,7 +485,7 @@ static bool ValueFromPropertyModification(PropertyModification modification, Edi
484485
else
485486
{
486487
float temp;
487-
if (float.TryParse(modification.value, out temp))
488+
if (float.TryParse(modification.value, NumberStyles.Float, CultureInfo.InvariantCulture, out temp))
488489
{
489490
outObject = temp;
490491
return true;

Editor/Mono/Animation/AnimationWindow/CurveEditor.cs

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -824,29 +824,17 @@ private void RecalculateSelectionBounds()
824824
m_SelectionBoundsAreDirty = false;
825825
}
826826

827-
// Frame all curves to be visible.
828-
public void FrameClip(bool horizontally, bool vertically)
827+
public Bounds GetClipBounds()
829828
{
830-
Bounds frameBounds = curveBounds;
831-
if (frameBounds.size == Vector3.zero)
832-
return;
833-
834-
if (horizontally)
835-
SetShownHRangeInsideMargins(frameBounds.min.x, frameBounds.max.x);
836-
if (vertically)
837-
SetShownVRangeInsideMargins(frameBounds.min.y, frameBounds.max.y);
829+
return curveBounds;
838830
}
839831

840-
// Frame selected keys to be visible.
841-
public void FrameSelected(bool horizontally, bool vertically)
832+
public Bounds GetSelectionBounds()
842833
{
843834
if (!hasSelection)
844-
{
845-
FrameClip(horizontally, vertically);
846-
return;
847-
}
835+
return GetClipBounds();
848836

849-
Bounds frameBounds = new Bounds();
837+
Bounds frameBounds;
850838

851839
// Add neighboring keys in bounds if only a single key is selected.
852840
if (selectedCurves.Count == 1)
@@ -871,6 +859,26 @@ public void FrameSelected(bool horizontally, bool vertically)
871859
// Enforce minimum size of bounds
872860
frameBounds.size = new Vector3(Mathf.Max(frameBounds.size.x, 0.1F), Mathf.Max(frameBounds.size.y, 0.1F), 0);
873861

862+
return frameBounds;
863+
}
864+
865+
// Frame all curves to be visible.
866+
public void FrameClip(bool horizontally, bool vertically)
867+
{
868+
Frame(GetClipBounds(), horizontally, vertically);
869+
}
870+
871+
// Frame selected keys to be visible.
872+
public void FrameSelected(bool horizontally, bool vertically)
873+
{
874+
Frame(GetSelectionBounds(), horizontally, vertically);
875+
}
876+
877+
public void Frame(Bounds frameBounds, bool horizontally, bool vertically)
878+
{
879+
if (frameBounds.size == Vector3.zero)
880+
return;
881+
874882
if (horizontally)
875883
SetShownHRangeInsideMargins(frameBounds.min.x, frameBounds.max.x);
876884
if (vertically)
@@ -983,15 +991,6 @@ public void CurveGUI()
983991
DeleteSelectedKeys();
984992
evt.Use();
985993
}
986-
987-
// Frame All.
988-
// Manually handle hotkey unless we decide to add it to default Unity hotkeys like
989-
// we did for FrameSelected.
990-
if (evt.keyCode == KeyCode.A)
991-
{
992-
FrameClip(true, true);
993-
evt.Use();
994-
}
995994
break;
996995

997996
case EventType.ContextClick:
@@ -1988,6 +1987,9 @@ CurveSelection AddKeyAtTime(CurveWrapper cw, float time)
19881987
int keyIndex = AnimationUtility.AddInbetweenKey(cw.curve, time);
19891988
if (keyIndex >= 0)
19901989
{
1990+
CurveUtility.SetKeyModeFromContext(cw.curve, keyIndex);
1991+
AnimationUtility.UpdateTangentsFromModeSurrounding(cw.curve, keyIndex);
1992+
19911993
// Select the key
19921994
CurveSelection selectedPoint = new CurveSelection(cw.id, keyIndex);
19931995
cw.selected = CurveWrapper.SelectionMode.Selected;

Editor/Mono/Animation/AnimationWindow/CurveEditorWindow.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System;
66
using UnityEngine;
77
using UnityEditor;
8+
using UnityEditor.ShortcutManagement;
89
using System.Linq;
910

1011
using TangentMode = UnityEditor.AnimationUtility.TangentMode;
@@ -286,6 +287,16 @@ public void Show(Action<AnimationCurve> onCurveChanged, CurveEditorSettings sett
286287
ShowAuxWindow();
287288
}
288289

290+
public void FrameSelected()
291+
{
292+
m_CurveEditor.FrameSelected(true, true);
293+
}
294+
295+
public void FrameClip()
296+
{
297+
m_CurveEditor.FrameClip(true, true);
298+
}
299+
289300
internal class Styles
290301
{
291302
public GUIStyle curveEditorBackground = "PopupCurveEditorBackground";
@@ -608,5 +619,17 @@ void SendEvent(string eventName, bool exitGUI)
608619
}
609620
GUI.changed = true;
610621
}
622+
623+
[Shortcut("Curve Editor/Frame All", typeof(CurveEditorWindow), "#a")]
624+
static void FrameClip(ShortcutArguments args)
625+
{
626+
var curveEditorWindow = (CurveEditorWindow)args.context;
627+
628+
if (EditorWindow.focusedWindow != curveEditorWindow)
629+
return;
630+
631+
curveEditorWindow.FrameClip();
632+
curveEditorWindow.Repaint();
633+
}
611634
}
612635
}

Editor/Mono/Animation/AnimationWindow/DopeSheetEditor.cs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -703,18 +703,6 @@ private void HandleKeyboard()
703703
break;
704704
}
705705
}
706-
707-
// Frame All.
708-
// Manually handle hotkey unless we decide to add it to default Unity hotkeys like
709-
// we did for FrameSelected.
710-
if (Event.current.type == EventType.KeyDown)
711-
{
712-
if (Event.current.keyCode == KeyCode.A)
713-
{
714-
FrameClip();
715-
Event.current.Use();
716-
}
717-
}
718706
}
719707

720708
private void HandleSelectAll()

Editor/Mono/BuildPipeline/AssemblyStripper.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,9 +422,10 @@ private static string GetMethodPreserveBlacklistContents(RuntimeClassRegistry rc
422422
return sb.ToString();
423423
}
424424

425-
static public void InvokeFromBuildPlayer(BuildTarget buildTarget, RuntimeClassRegistry usedClasses, ManagedStrippingLevel managedStrippingLevel, BuildReport report)
425+
static public void StripForMonoBackend(BuildTarget buildTarget, RuntimeClassRegistry usedClasses, ManagedStrippingLevel managedStrippingLevel, BuildReport report, string stagingAreaData)
426426
{
427-
var stagingAreaData = Paths.Combine("Temp", "StagingArea", "Data");
427+
if (managedStrippingLevel == ManagedStrippingLevel.Disabled)
428+
return;
428429

429430
var platformProvider = new BaseIl2CppPlatformProvider(buildTarget, Path.Combine(stagingAreaData, "Libraries"), report);
430431

Editor/Mono/BuildPipeline/DesktopStandalonePostProcessor.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,13 @@ private void SetupStagingArea(BuildPostProcessArgs args, HashSet<string> filesTo
257257
ProcessIl2CppOutputForBinary(args);
258258
}
259259
}
260+
else
261+
{
262+
var buildTargetGroup = BuildPipeline.GetBuildTargetGroup(args.target);
263+
var managedStrippingLevel = PlayerSettings.GetManagedStrippingLevel(buildTargetGroup);
264+
var stagingAreaData = Paths.Combine("Temp", "StagingArea", "Data");
265+
AssemblyStripper.StripForMonoBackend(args.target, args.usedClassRegistry, managedStrippingLevel, args.report, stagingAreaData);
266+
}
260267

261268
RenameFilesInStagingArea(args);
262269
}

Editor/Mono/BuildPlayerWindowBuildMethods.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
using System;
1414
using UnityEditor.Build.Reporting;
1515
using UnityEditor.Connect;
16+
using UnityEditor.Utils;
1617

1718
namespace UnityEditor
1819
{
@@ -356,7 +357,7 @@ static bool PickBuildLocation(BuildTargetGroup targetGroup, BuildTarget target,
356357
if (isWindowsStandalone)
357358
{
358359
extension = realExtension;
359-
path = Path.Combine(path, PlayerSettings.productName + '.' + extension);
360+
path = Path.Combine(path, Paths.MakeValidFileName(PlayerSettings.productName) + '.' + extension);
360361
}
361362

362363
if (!IsBuildPathValid(path))

Editor/Mono/EditorGUI.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1933,7 +1933,7 @@ internal static void DoNumberField(RecycledTextEditor editor, Rect position, Rec
19331933
{
19341934
if (!editor.IsEditingControl(id))
19351935
{
1936-
str = s_RecycledCurrentEditingString = isDouble ? doubleVal.ToString(formatString) : longVal.ToString(formatString);
1936+
str = s_RecycledCurrentEditingString = isDouble ? doubleVal.ToString(formatString, CultureInfo.InvariantCulture) : longVal.ToString(formatString, CultureInfo.InvariantCulture);
19371937
}
19381938
else
19391939
{
@@ -1946,13 +1946,13 @@ internal static void DoNumberField(RecycledTextEditor editor, Rect position, Rec
19461946
*/
19471947
if (evt.type == EventType.ValidateCommand && evt.commandName == EventCommandNames.UndoRedoPerformed)
19481948
{
1949-
str = isDouble ? doubleVal.ToString(formatString) : longVal.ToString(formatString);
1949+
str = isDouble ? doubleVal.ToString(formatString, CultureInfo.InvariantCulture) : longVal.ToString(formatString, CultureInfo.InvariantCulture);
19501950
}
19511951
}
19521952
}
19531953
else
19541954
{
1955-
str = isDouble ? doubleVal.ToString(formatString) : longVal.ToString(formatString);
1955+
str = isDouble ? doubleVal.ToString(formatString, CultureInfo.InvariantCulture) : longVal.ToString(formatString, CultureInfo.InvariantCulture);
19561956
}
19571957

19581958
if (GUIUtility.keyboardControl == id)

Editor/Mono/EditorGUIUtility.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ internal static void RepaintCurrentWindow()
109109
internal static bool HasCurrentWindowKeyFocus()
110110
{
111111
CheckOnGUI();
112-
return GUIView.current.hasFocus;
112+
return GUIView.current != null ? GUIView.current.hasFocus : false;
113113
}
114114

115115
public static Rect PointsToPixels(Rect rect)

0 commit comments

Comments
 (0)