Skip to content

Commit 1df34c9

Browse files
author
Unity Technologies
committed
Unity 2021.2.0a6 C# reference source code
1 parent 47c6379 commit 1df34c9

File tree

68 files changed

+1126
-250
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+1126
-250
lines changed

Editor/Mono/Annotation/AnnotationWindow.cs

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

55
using UnityEngine;
66
using System.Collections.Generic;
7+
using UnityEditor.ShortcutManagement;
78

89
namespace UnityEditor
910
{
@@ -702,6 +703,18 @@ void SetGizmoState(AInfo ainfo, bool addToMostRecentChanged = true)
702703
AnnotationUtility.SetGizmoEnabled(ainfo.m_ClassID, ainfo.m_ScriptClass, ainfo.m_GizmoEnabled ? 1 : 0, addToMostRecentChanged);
703704
SceneView.RepaintAll();
704705
}
706+
707+
[Shortcut("Scene View/Toggle Selection Outline", typeof(SceneView))]
708+
static void ToggleSelectionOutline()
709+
{
710+
AnnotationUtility.showSelectionOutline = !AnnotationUtility.showSelectionOutline;
711+
}
712+
713+
[Shortcut("Scene View/Toggle Selection Wireframe", typeof(SceneView))]
714+
static void ToggleSelectionWireframe()
715+
{
716+
AnnotationUtility.showSelectionWire = !AnnotationUtility.showSelectionWire;
717+
}
705718
}
706719

707720
internal class AInfo : System.IComparable, System.IEquatable<AInfo>

Editor/Mono/AssetModificationProcessor.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System;
66
using System.Collections.Generic;
77
using UnityEngine;
8+
using UnityEngine.Scripting;
89
using UnityEditor.VersionControl;
910
using UnityEditorInternal;
1011
using UnityEditorInternal.VersionControl;
@@ -94,6 +95,7 @@ static System.Collections.Generic.IEnumerable<System.Type> AssetModificationProc
9495
}
9596
#pragma warning restore 0618
9697

98+
[RequiredByNativeCode]
9799
static void OnWillCreateAsset(string path)
98100
{
99101
foreach (var assetModificationProcessorClass in AssetModificationProcessors)
@@ -129,6 +131,7 @@ static void FileModeChanged(string[] assets, FileMode mode)
129131

130132
// Postprocess on all assets once an automatic import has completed
131133
// ReSharper disable once UnusedMember.Local - invoked from native code
134+
[RequiredByNativeCode]
132135
static void OnWillSaveAssets(string[] assets, out string[] assetsThatShouldBeSaved, out string[] assetsThatShouldBeReverted, bool explicitlySaveAsset)
133136
{
134137
assetsThatShouldBeReverted = new string[0];
@@ -375,7 +378,7 @@ static Editability GetPathEditability(string assetPath)
375378
return Editability.Never;
376379

377380
// other paths that are not know to asset database, and not versioned, are considered always editable
378-
if (!Provider.PathIsVersioned(assetPath))
381+
if (!VersionControlUtils.IsPathVersioned(assetPath))
379382
return Editability.Always;
380383

381384
return Editability.Maybe;

Editor/Mono/BuildTarget.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,9 @@ public enum BuildTarget
124124

125125
CloudRendering = 41,
126126

127+
[System.Obsolete("GameCoreScarlett is deprecated, please use GameCoreXboxSeries (UnityUpgradable) -> GameCoreXboxSeries", false)]
127128
GameCoreScarlett = 42,
129+
GameCoreXboxSeries = 42, // GameCoreXboxSeries intentionally set to the same as GameCoreScarlett
128130
GameCoreXboxOne = 43,
129131

130132
PS5 = 44,

Editor/Mono/BuildTargetConverter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ internal static class BuildTargetConverter
4242
return RuntimePlatform.WebGLPlayer;
4343
case BuildTarget.Lumin:
4444
return RuntimePlatform.Lumin;
45-
case BuildTarget.GameCoreScarlett:
46-
return RuntimePlatform.GameCoreScarlett;
45+
case BuildTarget.GameCoreXboxSeries:
46+
return RuntimePlatform.GameCoreXboxSeries;
4747
case BuildTarget.GameCoreXboxOne:
4848
return RuntimePlatform.GameCoreXboxOne;
4949
default:

Editor/Mono/BuildTargetGroup.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,9 @@ public enum BuildTargetGroup
101101

102102
CloudRendering = 30,
103103

104+
[System.Obsolete("GameCoreScarlett is deprecated, please use GameCoreXboxSeries (UnityUpgradable) -> GameCoreXboxSeries", false)]
104105
GameCoreScarlett = 31,
106+
GameCoreXboxSeries = 31, // GameCoreXboxSeries intentionally set to the same as GameCoreScarlett
105107
GameCoreXboxOne = 32,
106108

107109
PS5 = 33,

Editor/Mono/EditorApplication.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
using UnityEditor.Scripting;
1414
using UnityEngine.TestTools;
1515
using Unity.Profiling;
16+
using UnityEditor.VersionControl;
1617
using UnityEngine.Profiling;
1718

1819
namespace UnityEditor
@@ -114,6 +115,10 @@ static bool Internal_EditorApplicationWantsToQuit()
114115

115116
static void Internal_EditorApplicationQuit()
116117
{
118+
// VersionControlObject might depend on packages that cleanup themselves using quitting event.
119+
// Therefore it's important to deactivate it beforehand.
120+
VersionControlManager.Deactivate();
121+
117122
quitting?.Invoke();
118123
editorApplicationQuit?.Invoke();
119124
ScriptCompilers.Cleanup();

Editor/Mono/EditorGUI.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2830,7 +2830,7 @@ internal static GenericMenu FillPropertyContextMenu(SerializedProperty property,
28302830
// If property is a reference and we're using VCS, add item to check it out
28312831
// This menu is not excluded when the field is disabled
28322832
// because it is nice to get information about the property even when it's disabled.
2833-
if (propertyWithPath.propertyType == SerializedPropertyType.ObjectReference && Provider.isActive)
2833+
if (propertyWithPath.propertyType == SerializedPropertyType.ObjectReference && VersionControlUtils.isVersionControlConnected)
28342834
{
28352835
var obj = propertyWithPath.objectReferenceValue;
28362836
if (obj != null && !AssetDatabase.IsOpenForEdit(obj))

Editor/Mono/EditorHandles/Slider1D.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ internal class Slider1D
1313
// Used for plane intersection translation
1414
static Vector3 s_ConstraintOrigin, s_ConstraintDirection, s_HandleOffset;
1515
static float s_StartHandleSize;
16+
static Matrix4x4 s_StartInverseHandleMatrix;
1617

1718
// Used for 2D translation (fallback when ray plane intersection fails)
1819
static Vector2 s_StartMousePosition;
@@ -60,6 +61,7 @@ internal static Vector3 Do(int id, Vector3 position, Vector3 offset, Vector3 han
6061
: Vector3.zero;
6162
evt.Use();
6263
s_StartHandleSize = HandleUtility.GetHandleSize(point);
64+
s_StartInverseHandleMatrix = Handles.inverseMatrix;
6365
}
6466

6567
break;
@@ -91,7 +93,8 @@ internal static Vector3 Do(int id, Vector3 position, Vector3 offset, Vector3 han
9193
worldPosition = Snapping.Snap(worldPosition, GridSettings.size, (SnapAxis) new SnapAxisFilter(s_ConstraintDirection));
9294
}
9395

94-
position = Handles.inverseMatrix.MultiplyPoint(worldPosition);
96+
position = s_StartInverseHandleMatrix.MultiplyPoint(worldPosition);
97+
9598
s_StartPosition = position;
9699
s_StartMousePosition = evt.mousePosition;
97100
}

Editor/Mono/EditorUserSettings.bindings.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ public static string GetConfigValue(string name)
5353
public static extern bool overlayIcons { get; set; }
5454

5555
[NativeProperty("VCHierarchyOverlayIcons")]
56-
internal static extern bool hierarchyOverlayIcons { get; set; }
56+
public static extern bool hierarchyOverlayIcons { get; set; }
5757

5858
[NativeProperty("VCOtherOverlayIcons")]
59-
internal static extern bool otherOverlayIcons { get; set; }
59+
public static extern bool otherOverlayIcons { get; set; }
6060

6161
[NativeProperty("VCAllowAsyncUpdate")]
6262
public static extern bool allowAsyncStatusUpdate { get; set; }

Editor/Mono/GUI/ReorderableList.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,12 @@ public void DrawElement(Rect rect, SerializedProperty element, System.Object lis
385385
EditorGUIUtility.labelWidth = FieldLabelSize(rect, prop);
386386

387387
var handler = ScriptAttributeUtility.GetHandler(prop);
388+
EditorGUI.BeginChangeCheck();
388389
handler.OnGUI(rect, prop, null, true);
390+
if (EditorGUI.EndChangeCheck())
391+
{
392+
prop.serializedObject.ApplyModifiedProperties();
393+
}
389394
if (Event.current.type == EventType.MouseDown && Event.current.button == 1 && rect.Contains(Event.current.mousePosition)) Event.current.Use();
390395

391396
EditorGUIUtility.labelWidth = oldLabelWidth;

0 commit comments

Comments
 (0)