Skip to content

Commit dcd45f4

Browse files
author
Unity Technologies
committed
Unity 2020.1.0a13 C# reference source code
1 parent 9405cad commit dcd45f4

File tree

80 files changed

+2668
-840
lines changed

Some content is hidden

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

80 files changed

+2668
-840
lines changed

Editor/Mono/Animation/AnimationUtility.bindings.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -244,19 +244,19 @@ private static void Internal_InvokeOnCurveWasModified(AnimationClip clip, Editor
244244

245245
extern internal static void UpdateTangentsFromMode([NotNull] AnimationCurve curve);
246246

247-
[NativeThrows]
247+
[NativeThrows, ThreadSafe]
248248
extern public static TangentMode GetKeyLeftTangentMode([NotNull] AnimationCurve curve, int index);
249249

250-
[NativeThrows]
250+
[NativeThrows, ThreadSafe]
251251
extern public static TangentMode GetKeyRightTangentMode([NotNull] AnimationCurve curve, int index);
252252

253253
[NativeThrows]
254254
extern public static bool GetKeyBroken([NotNull] AnimationCurve curve, int index);
255255

256-
[NativeThrows]
256+
[NativeThrows, ThreadSafe]
257257
extern public static void SetKeyLeftTangentMode([NotNull] AnimationCurve curve, int index, TangentMode tangentMode);
258258

259-
[NativeThrows]
259+
[NativeThrows, ThreadSafe]
260260
extern public static void SetKeyRightTangentMode([NotNull] AnimationCurve curve, int index, TangentMode tangentMode);
261261

262262
[NativeThrows]

Editor/Mono/AssemblyInfo/AssemblyInfo.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
[assembly: InternalsVisibleTo("UnityEditor.EditorTestsRunner")]
5757
[assembly: InternalsVisibleTo("UnityEditor.TestRunner")]
5858
[assembly: InternalsVisibleTo("UnityEditor.TestRunner.Tests")]
59+
[assembly: InternalsVisibleTo("ExternalCSharpCompiler")]
5960
[assembly: InternalsVisibleTo("UnityEngine.TestRunner")]
6061
[assembly: InternalsVisibleTo("UnityEditor.VR")]
6162
[assembly: InternalsVisibleTo("Unity.RuntimeTests")]

Editor/Mono/AssetModificationProcessor.cs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -197,27 +197,16 @@ static void OnWillSaveAssets(string[] assets, out string[] assetsThatShouldBeSav
197197
}
198198
}
199199

200-
static void RequireTeamLicense()
201-
{
202-
if (!InternalEditorUtility.HasTeamLicense())
203-
throw new MethodAccessException("Requires team license");
204-
}
205-
206200
static AssetMoveResult OnWillMoveAsset(string fromPath, string toPath, string[] newPaths, string[] NewMetaPaths)
207201
{
208202
AssetMoveResult finalResult = AssetMoveResult.DidNotMove;
209-
if (!InternalEditorUtility.HasTeamLicense())
210-
return finalResult;
211-
212203
finalResult = AssetModificationHook.OnWillMoveAsset(fromPath, toPath);
213204

214205
foreach (var assetModificationProcessorClass in AssetModificationProcessors)
215206
{
216207
MethodInfo method = assetModificationProcessorClass.GetMethod("OnWillMoveAsset", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
217208
if (method != null)
218209
{
219-
RequireTeamLicense();
220-
221210
object[] args = { fromPath, toPath };
222211
if (!CheckArgumentsAndReturnType(args, method, finalResult.GetType()))
223212
continue;
@@ -232,16 +221,12 @@ static AssetMoveResult OnWillMoveAsset(string fromPath, string toPath, string[]
232221
static AssetDeleteResult OnWillDeleteAsset(string assetPath, RemoveAssetOptions options)
233222
{
234223
AssetDeleteResult finalResult = AssetDeleteResult.DidNotDelete;
235-
if (!InternalEditorUtility.HasTeamLicense())
236-
return finalResult;
237224

238225
foreach (var assetModificationProcessorClass in AssetModificationProcessors)
239226
{
240227
MethodInfo method = assetModificationProcessorClass.GetMethod("OnWillDeleteAsset", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
241228
if (method != null)
242229
{
243-
RequireTeamLicense();
244-
245230
object[] args = { assetPath, options };
246231
if (!CheckArgumentsAndReturnType(args, method, finalResult.GetType()))
247232
continue;
@@ -269,8 +254,6 @@ static MethodInfo[] GetIsOpenForEditMethods()
269254
MethodInfo method = assetModificationProcessorClass.GetMethod("IsOpenForEdit", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
270255
if (method != null)
271256
{
272-
RequireTeamLicense();
273-
274257
string dummy = "";
275258
bool bool_dummy = false;
276259
Type[] types = { dummy.GetType(), dummy.GetType().MakeByRefType() };
@@ -390,8 +373,6 @@ internal static void OnStatusUpdated()
390373
MethodInfo method = assetModificationProcessorClass.GetMethod("OnStatusUpdated", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
391374
if (method != null)
392375
{
393-
RequireTeamLicense();
394-
395376
object[] args = {};
396377
if (!CheckArgumentsAndReturnType(args, method, typeof(void)))
397378
continue;
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Unity C# reference source
2+
// Copyright (c) Unity Technologies. For terms of use, see
3+
// https://unity3d.com/legal/licenses/Unity_Reference_Only_License
4+
5+
using UnityEngine;
6+
using UnityEngine.Bindings;
7+
using uei = UnityEngine.Internal;
8+
9+
namespace UnityEditor.BugReporting
10+
{
11+
// Keep in sync with "Editor/Platform/Interface/BugReportingTools.h"
12+
internal enum BugReportMode { ManualOpen, CrashBug, FatalError, CocoaExceptionOrAssertion, ManualSimple }
13+
14+
[NativeHeader("Editor/Mono/BugReportingTools.bindings.h")]
15+
internal sealed class BugReportingTools
16+
{
17+
[StaticAccessor("BugReportingToolsBindings", StaticAccessorType.DoubleColon)]
18+
[NativeMethod("LaunchBugReportingTool")]
19+
public static extern void LaunchBugReporter(BugReportMode mode, string[] additionalArguments);
20+
}
21+
}

Editor/Mono/Collab/Collab.bindings.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,10 @@ partial class Collab
6464
public static extern int GetRevisionsData(
6565
bool withChanges, int startIndex, int numRevisions);
6666

67+
public static extern int GetSingleRevisionData(bool withChanges, string id);
68+
6769
public static extern RevisionsData PopulateRevisionsData(IntPtr nativeData);
70+
public static extern Revision PopulateSingleRevisionData(IntPtr nativeData);
6871

6972
public extern void SetSeat(bool value);
7073

@@ -203,18 +206,27 @@ public extern void TestClearSoftLockAsCollaborator(string projectGuid, string pr
203206
[NativeMethod(HasExplicitThis = true, ThrowsException = true)]
204207
extern Change[] GetChangesToPublishInternal();
205208

209+
[NativeMethod(HasExplicitThis = true, ThrowsException = true)]
210+
extern ChangeItem[] GetChangeItemsToPublishInternal_V2();
211+
206212
[NativeMethod(HasExplicitThis = true, ThrowsException = true, IsThreadSafe = true)]
207213
extern void SetChangesToPublishInternal(ChangeItem[] changes);
208214

209215
[NativeMethod(HasExplicitThis = true, ThrowsException = true, IsThreadSafe = true)]
210216
extern Change[] GetSelectedChangesInternal();
211217

218+
[NativeMethod(HasExplicitThis = true, ThrowsException = true, IsThreadSafe = true)]
219+
extern ChangeItem[] GetSelectedChangeItemsInternal_V2();
220+
212221
[NativeMethod(Name = "GetJobProgress", HasExplicitThis = true, ThrowsException = true)]
213222
extern bool GetJobProgressInternal([Out] ProgressInfo info, int jobId);
214223

215224
[NativeMethod(HasExplicitThis = true, ThrowsException = true)]
216225
public extern void Publish(string comment, bool useSelectedAssets, bool confirmMatchesPrevious);
217226

227+
[NativeMethod(HasExplicitThis = true, ThrowsException = true)]
228+
public extern void PublishAssetsAsync(string comment, ChangeItem[] changes);
229+
218230
[NativeMethod(HasExplicitThis = true, ThrowsException = true, IsThreadSafe = true)]
219231
public extern void ClearSelectedChangesToPublish();
220232

Editor/Mono/Collab/Collab.cs

Lines changed: 124 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,15 @@
1515
namespace UnityEditor.Collaboration
1616
{
1717
internal delegate void StateChangedDelegate(CollabInfo info);
18+
internal delegate void RevisionChangedDelegate(CollabInfo info, string rev, string action);
19+
internal delegate void SetErrorDelegate(UnityErrorInfo error);
1820
internal delegate void ErrorDelegate();
1921
internal delegate bool ShowToolbarAtPositionDelegate(Rect screenRect);
2022
internal delegate bool IsToolbarVisibleDelegate();
2123
internal delegate void ShowHistoryWindowDelegate();
2224
internal delegate void CloseToolbarDelegate();
25+
internal delegate void ChangesChangedDelegate(Change[] changes, bool isFiltered);
26+
internal delegate void ChangeItemsChangedDelegate(ChangeItem[] changes, bool isFiltered);
2327

2428
//*undocumented
2529
// We want to raise this exception from Cpp code but it fails
@@ -34,15 +38,25 @@ namespace UnityEditor.Collaboration
3438
internal partial class Collab
3539
{
3640
// Pointer to native Collab object used by automatic bindings system.
37-
#pragma warning disable 414 // The private field is assigned but its value is never used
41+
#pragma warning disable 414 // The private field is assigned but its value is never used
3842
IntPtr m_nativeCollab = IntPtr.Zero;
3943

4044
public event StateChangedDelegate StateChanged;
45+
4146
public event StateChangedDelegate RevisionUpdated;
47+
public event RevisionChangedDelegate RevisionUpdated_V2;
48+
4249
public event StateChangedDelegate JobsCompleted;
50+
4351
public event ErrorDelegate ErrorOccurred;
52+
public event SetErrorDelegate ErrorOccurred_V2;
53+
4454
public event ErrorDelegate ErrorCleared;
4555

56+
public event ChangeItemsChangedDelegate ChangeItemsChanged;
57+
public event ChangeItemsChangedDelegate SelectedChangeItemsChanged;
58+
public event StateChangedDelegate CollabInfoChanged;
59+
4660
// Toolbar delegates
4761
public static ShowToolbarAtPositionDelegate ShowToolbarAtPosition = null;
4862
public static IsToolbarVisibleDelegate IsToolbarVisible = null;
@@ -67,18 +81,18 @@ internal partial class Collab
6781
[Flags]
6882
public enum Operation
6983
{
70-
Noop = 0,
71-
Publish = 1 << 0,
72-
Update = 1 << 1,
73-
Revert = 1 << 2,
74-
GoBack = 1 << 3,
75-
Restore = 1 << 4,
76-
Diff = 1 << 5,
77-
ConflictDiff = 1 << 6,
78-
Exclude = 1 << 7,
79-
Include = 1 << 8,
80-
ChooseMine = 1 << 9,
81-
ChooseTheirs = 1 << 10,
84+
Noop = 0,
85+
Publish = 1 << 0,
86+
Update = 1 << 1,
87+
Revert = 1 << 2,
88+
GoBack = 1 << 3,
89+
Restore = 1 << 4,
90+
Diff = 1 << 5,
91+
ConflictDiff = 1 << 6,
92+
Exclude = 1 << 7,
93+
Include = 1 << 8,
94+
ChooseMine = 1 << 9,
95+
ChooseTheirs = 1 << 10,
8296
ExternalMerge = 1 << 11,
8397
}
8498

@@ -87,38 +101,38 @@ public enum Operation
87101
[Flags]
88102
public enum CollabStates : uint
89103
{
90-
kCollabNone = 0,
91-
kCollabLocal = 1,
92-
93-
kCollabSynced = 1 << 1,
94-
kCollabOutOfSync = 1 << 2,
95-
kCollabIgnored = 1 << 3,
96-
kCollabCheckedOutLocal = 1 << 4,
97-
kCollabCheckedOutRemote = 1 << 5,
98-
kCollabDeletedLocal = 1 << 6,
99-
kCollabDeletedRemote = 1 << 7,
100-
kCollabAddedLocal = 1 << 8,
101-
kCollabAddedRemote = 1 << 9,
102-
kCollabConflicted = 1 << 10,
103-
kCollabMovedLocal = 1 << 11,
104-
kCollabMovedRemote = 1 << 12,
105-
kCollabUpdating = 1 << 13,
106-
kCollabReadOnly = 1 << 14,
107-
kCollabMetaFile = 1 << 15,
108-
kCollabUseMine = 1 << 16,
109-
kCollabUseTheir = 1 << 17,
110-
kCollabMerged = 1 << 18,
111-
kCollabPendingMerge = 1 << 19,
112-
kCollabFolderMetaFile = 1 << 20,
113-
KCollabContentChanged = 1 << 21,
114-
KCollabContentConflicted = 1 << 22,
115-
KCollabContentDeleted = 1 << 23,
104+
kCollabNone = 0,
105+
kCollabLocal = 1,
106+
107+
kCollabSynced = 1 << 1,
108+
kCollabOutOfSync = 1 << 2,
109+
kCollabIgnored = 1 << 3,
110+
kCollabCheckedOutLocal = 1 << 4,
111+
kCollabCheckedOutRemote = 1 << 5,
112+
kCollabDeletedLocal = 1 << 6,
113+
kCollabDeletedRemote = 1 << 7,
114+
kCollabAddedLocal = 1 << 8,
115+
kCollabAddedRemote = 1 << 9,
116+
kCollabConflicted = 1 << 10,
117+
kCollabMovedLocal = 1 << 11,
118+
kCollabMovedRemote = 1 << 12,
119+
kCollabUpdating = 1 << 13,
120+
kCollabReadOnly = 1 << 14,
121+
kCollabMetaFile = 1 << 15,
122+
kCollabUseMine = 1 << 16,
123+
kCollabUseTheir = 1 << 17,
124+
kCollabMerged = 1 << 18,
125+
kCollabPendingMerge = 1 << 19,
126+
kCollabFolderMetaFile = 1 << 20,
127+
KCollabContentChanged = 1 << 21,
128+
KCollabContentConflicted = 1 << 22,
129+
KCollabContentDeleted = 1 << 23,
116130

117131
// always keep most significant
118-
kCollabInvalidState = 1 << 30,
132+
kCollabInvalidState = 1 << 30,
119133

120-
kAnyLocalChanged = (kCollabAddedLocal | kCollabCheckedOutLocal | kCollabDeletedLocal | kCollabMovedLocal),
121-
kAnyLocalEdited = (kCollabAddedLocal | kCollabCheckedOutLocal | kCollabMovedLocal),
134+
kAnyLocalChanged = (kCollabAddedLocal | kCollabCheckedOutLocal | kCollabDeletedLocal | kCollabMovedLocal),
135+
kAnyLocalEdited = (kCollabAddedLocal | kCollabCheckedOutLocal | kCollabMovedLocal),
122136
kCollabAny = 0xFFFFFFFF
123137
}
124138

@@ -383,6 +397,27 @@ public PublishInfo GetChangesToPublish()
383397
};
384398
}
385399

400+
public PublishInfo_V2 GetChangesToPublish_V2()
401+
{
402+
ChangeItem[] changes = GetChangeItemsToPublishInternal_V2();
403+
bool isFiltered = false;
404+
405+
if (SupportsAsyncChanges())
406+
{
407+
changes = GetSelectedChangeItemsInternal_V2();
408+
if (Toolbar.isLastShowRequestPartial)
409+
{
410+
isFiltered = true;
411+
}
412+
}
413+
414+
return new PublishInfo_V2()
415+
{
416+
changes = changes,
417+
filter = isFiltered
418+
};
419+
}
420+
386421
public void SetChangesToPublish(ChangeItem[] changes)
387422
{
388423
SetChangesToPublishInternal(changes);
@@ -413,21 +448,66 @@ private static void OnStateChanged()
413448
}
414449

415450
[RequiredByNativeCode]
416-
private static void OnRevisionUpdated()
451+
private static void OnRevisionUpdated(string revisionId, string action)
417452
{
418453
var handler = instance.RevisionUpdated;
419454
if (handler != null)
420455
{
421456
handler(instance.collabInfo);
422457
}
458+
459+
var handler_v2 = instance.RevisionUpdated_V2;
460+
if (handler_v2 != null)
461+
{
462+
handler_v2(instance.collabInfo, revisionId, action);
463+
}
423464
}
424465

425466
[RequiredByNativeCode]
426-
private static void SetCollabError()
467+
private static void OnChangeItemsChanged(ChangeItem[] changes, bool isFiltered)
468+
{
469+
var handler = instance.ChangeItemsChanged;
470+
if (handler != null)
471+
{
472+
handler(changes, isFiltered);
473+
}
474+
}
475+
476+
[RequiredByNativeCode]
477+
private static void OnSelectedChangeItemsChanged(ChangeItem[] changeItems, bool isFiltered)
478+
{
479+
var handler = instance.SelectedChangeItemsChanged;
480+
if (handler != null)
481+
{
482+
handler(changeItems, isFiltered);
483+
}
484+
}
485+
486+
[RequiredByNativeCode]
487+
private static void OnCollabInfoChanged()
488+
{
489+
var handler = instance.CollabInfoChanged;
490+
if (handler != null)
491+
{
492+
handler(instance.collabInfo);
493+
}
494+
}
495+
496+
[RequiredByNativeCode]
497+
private static void SetCollabError(int code, int priority, int behavior, string msg, string shortmsg, string codeStr)
427498
{
428499
var handler = instance.ErrorOccurred;
500+
429501
if (handler != null)
502+
{
430503
handler();
504+
}
505+
var handler_v2 = instance.ErrorOccurred_V2;
506+
507+
if (handler_v2 != null)
508+
{
509+
handler_v2(new UnityErrorInfo() { code = code, priority = priority, behaviour = behavior, msg = msg, shortMsg = shortmsg, codeStr = codeStr });
510+
}
431511
}
432512

433513
[RequiredByNativeCode]

0 commit comments

Comments
 (0)