Skip to content

Commit 0a2eeb7

Browse files
author
Unity Technologies
committed
Unity 2022.2.0a10 C# reference source code
1 parent d0fe81a commit 0a2eeb7

File tree

1,161 files changed

+43705
-23381
lines changed

Some content is hidden

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

1,161 files changed

+43705
-23381
lines changed

Editor/IncrementalBuildPipeline/BeeBuildProgramCommon.Data/Data.cs

+1
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,6 @@ public class ConfigurationData
3636
public bool AdvancedLicense;
3737
public bool Batchmode;
3838
public bool EmitDataForBeeWhy;
39+
public string NamedPipeOrUnixSocket;
3940
}
4041
}

Editor/IncrementalBuildPipeline/PlayerBuildProgramLibrary.Data/Data.cs

+5
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,21 @@ public class Il2CppConfig
6666
public bool EnableDeepProfilingSupport;
6767
public bool EnableFullGenericSharing;
6868
public string Profile;
69+
public string Defines;
6970

7071
public string ConfigurationName;
7172
public bool GcWBarrierValidation;
7273
public bool GcIncremental;
7374

7475
public string[] AdditionalCppFiles = new string[0];
7576
public string[] AdditionalArgs = new string[0];
77+
public string CompilerFlags;
78+
public string LinkerFlags;
7679
public string ExtraTypes;
7780
public bool CreateSymbolFiles;
7881
public bool AllowDebugging;
82+
public string SysRootPath;
83+
public string ToolChainPath;
7984
}
8085

8186
public class Services

Editor/IncrementalBuildPipeline/ScriptCompilationBuildProgram.Data/Data.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ public static class Constants
1414
public class ScriptCompilationData
1515
{
1616
public AssemblyData[] Assemblies;
17-
public AssemblyData[] CodegenAssemblies;
1817
public string DotnetRuntimePath;
1918
public string DotnetRoslynPath;
2019
public string MovedFromExtractorPath;
@@ -38,15 +37,18 @@ public class AssemblyData
3837
public int[] References = new int[0];
3938
public bool AllowUnsafeCode;
4039
public string RuleSet;
40+
public string AnalyzerConfigPath;
4141
public string LanguageVersion;
4242
public bool UseDeterministicCompilation;
4343
public bool SuppressCompilerWarnings;
4444
public string[] Analyzers = new string[0];
45+
public string[] AdditionalFiles = new string[0];
4546
public string Asmdef;
4647
public string[] BclDirectories = new string[0];
4748
public string[] CustomCompilerOptions = new string[0];
4849
public int DebugIndex;
4950
public bool SkipCodeGen;
51+
public string Path;
5052
}
5153

5254
public class ScriptCompilationData_Out

Editor/Mono/2D/Common/TexturePlatformSettingsView.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class Styles
2020
public readonly GUIContent compressionQualityLabel = EditorGUIUtility.TrTextContent("Compressor Quality");
2121
public readonly GUIContent compressionQualitySliderLabel = EditorGUIUtility.TrTextContent("Compressor Quality", "Use the slider to adjust compression quality from 0 (Fastest) to 100 (Best)");
2222

23-
public readonly int[] kMaxTextureSizeValues = { 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192 };
23+
public readonly int[] kMaxTextureSizeValues = { 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384 };
2424
public readonly GUIContent[] kMaxTextureSizeStrings;
2525

2626
public readonly GUIContent[] kTextureCompressionOptions =

Editor/Mono/2D/SpriteAtlas/SpriteAtlasImporterInspector.cs

+3-27
Original file line numberDiff line numberDiff line change
@@ -412,12 +412,6 @@ protected override void Apply()
412412
base.Apply();
413413
}
414414

415-
public void ApplyAndImportSpriteAtlas()
416-
{
417-
Apply();
418-
base.ApplyAndImport();
419-
}
420-
421415
protected void PackPreviewGUI()
422416
{
423417
EditorGUILayout.Space();
@@ -432,7 +426,7 @@ protected void PackPreviewGUI()
432426
{
433427
GUI.FocusControl(null);
434428
SpriteAtlasUtility.EnableV2Import(true);
435-
ApplyAndImportSpriteAtlas();
429+
SaveChanges();
436430
SpriteAtlasUtility.EnableV2Import(false);
437431
}
438432
}
@@ -447,26 +441,6 @@ private bool IsValidAtlas()
447441
return true;
448442
}
449443

450-
public override void OnDisable()
451-
{
452-
453-
if (Unsupported.IsDestroyScriptableObject(this))
454-
{
455-
if (spriteAtlasAsset && HasModified())
456-
{
457-
if (EditorUtility.DisplayDialog("Unapplied import settings", "Unapplied import settings for \'" + m_AssetPath + "\'", "Apply", "Revert"))
458-
{
459-
ApplyAndImportSpriteAtlas();
460-
}
461-
else
462-
{
463-
ResetValues();
464-
}
465-
}
466-
}
467-
base.OnDisable();
468-
}
469-
470444
public override bool HasModified()
471445
{
472446
return base.HasModified() || m_ContentHash != GetInspectorHash();
@@ -535,6 +509,8 @@ public override void OnInspectorGUI()
535509
serializedAssetObject.ApplyModifiedProperties();
536510
PackPreviewGUI();
537511
}
512+
513+
ApplyRevertGUI();
538514
}
539515

540516
private void HandleCommonSettingUI()

Editor/Mono/ActiveEditorTracker.bindings.cs

+13
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using System.Runtime.InteropServices;
88
using UnityEngine;
99
using UnityEngine.Bindings;
10+
using UnityEngine.Scripting;
1011
using UnityObject = UnityEngine.Object;
1112

1213
namespace UnityEditor
@@ -15,6 +16,7 @@ namespace UnityEditor
1516
// Might want to add a manual dispose
1617
[NativeHeader("Editor/Src/Utility/ActiveEditorTracker.bindings.h")]
1718
[Serializable]
19+
[RequiredByNativeCode]
1820
public sealed class ActiveEditorTracker
1921
{
2022
#pragma warning disable 649
@@ -113,6 +115,17 @@ public bool isLocked
113115
set { Internal_SetIsLocked(this, value); }
114116
}
115117

118+
[FreeFunction]
119+
static extern bool Internal_HasUnsavedChanges(ActiveEditorTracker activeEditorTracker);
120+
public bool hasUnsavedChanges => Internal_HasUnsavedChanges(this);
121+
122+
[FreeFunction]
123+
static extern void Internal_UnsavedChangesStateChanged(ActiveEditorTracker self, int editorInstance, bool value);
124+
internal void UnsavedChangesStateChanged(Editor editor, bool value)
125+
{
126+
Internal_UnsavedChangesStateChanged(this, editor.GetInstanceID(), value);
127+
}
128+
116129
[FreeFunction]
117130
static extern bool Internal_GetDelayFlushDirtyRebuild();
118131

Editor/Mono/Animation/AnimationUtility.bindings.cs

+2
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ internal static System.Type GetEditorCurveValueType(ScriptableObject scriptableO
168168
extern private static System.Type Internal_GetScriptableObjectEditorCurveValueType([NotNull] ScriptableObject scriptableObject, EditorCurveBinding binding);
169169

170170
extern public static bool GetFloatValue([NotNull] GameObject root, EditorCurveBinding binding, out float data);
171+
extern public static bool GetDiscreteIntValue([NotNull] GameObject root, EditorCurveBinding binding, out int data);
171172
public static bool GetObjectReferenceValue(GameObject root, EditorCurveBinding binding, out Object data)
172173
{
173174
data = Internal_GetObjectReferenceValue(root, binding);
@@ -388,6 +389,7 @@ public static AnimationCurve GetEditorCurve(AnimationClip clip, string relativeP
388389
extern public static string CalculateTransformPath([NotNull] Transform targetTransform, Transform root);
389390

390391
extern public static AnimationClipSettings GetAnimationClipSettings([NotNull] AnimationClip clip);
392+
extern internal static void RebuildMecanimData([NotNull] AnimationClip clip);
391393
extern public static void SetAnimationClipSettings([NotNull] AnimationClip clip, AnimationClipSettings srcClipInfo);
392394
extern internal static void SetAnimationClipSettingsNoDirty([NotNull] AnimationClip clip, AnimationClipSettings srcClipInfo);
393395

Editor/Mono/Animation/AnimationWindow/AddCurvesPopupHierarchyDataSource.cs

+20-21
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ private TreeViewItem AddGameObjectToHierarchy(GameObject gameObject, GameObject
7575
// Don't show for the root go
7676
if (curveBinding.path != "")
7777
{
78-
TreeViewItem newNode = CreateNode(singleObjectBindings.ToArray(), node);
78+
TreeViewItem newNode = CreateNode(singleObjectBindings.ToArray(), node, null);
7979
if (newNode != null)
8080
childNodes.Add(newNode);
8181
singleObjectBindings.Clear();
@@ -111,20 +111,6 @@ private TreeViewItem AddGameObjectToHierarchy(GameObject gameObject, GameObject
111111
}
112112
}
113113

114-
var animator = rootGameObject.GetComponent<Animator>();
115-
if (animator != null)
116-
{
117-
//If the Animator has a human avatar, we need to check if the avatar's hierarchy matches that of the current GameObject. If they do not match, disable the node.
118-
if (animator.avatarRoot != null && animator.isHuman)
119-
{
120-
if (animator.avatarRoot.Find(path) == null)
121-
{
122-
node.propertyPathMismatchWithHumanAvatar = true;
123-
}
124-
}
125-
}
126-
127-
128114
if (showEntireHierarchy)
129115
{
130116
// Iterate over all child GOs
@@ -137,6 +123,13 @@ private TreeViewItem AddGameObjectToHierarchy(GameObject gameObject, GameObject
137123
}
138124
}
139125

126+
// Remove Leaf nodes without properties.
127+
if (childNodes.Count == 0)
128+
{
129+
node.parent = null;
130+
return null;
131+
}
132+
140133
TreeViewUtility.SetChildParentReferences(childNodes, node);
141134
return node;
142135
}
@@ -191,17 +184,24 @@ private TreeViewItem AddAnimatableObjectToHierarchy(EditorCurveBinding[] curveBi
191184

192185
List<TreeViewItem> childNodes = new List<TreeViewItem>();
193186
List<EditorCurveBinding> singlePropertyBindings = new List<EditorCurveBinding>();
187+
SerializedObject so = null;
194188

195189
for (int i = 0; i < curveBindings.Length; i++)
196190
{
197191
EditorCurveBinding curveBinding = curveBindings[i];
192+
if (curveBinding.isSerializeReferenceCurve)
193+
{
194+
var animatedObject = AnimationUtility.GetAnimatedObject(AddCurvesPopup.s_State.activeRootGameObject, curveBinding);
195+
if (animatedObject != null && (so == null || so.targetObject != animatedObject))
196+
so = new SerializedObject(animatedObject);
197+
}
198198

199199
singlePropertyBindings.Add(curveBinding);
200200

201201
// We expect curveBindings to come sorted by propertyname
202202
if (i == curveBindings.Length - 1 || AnimationWindowUtility.GetPropertyGroupName(curveBindings[i + 1].propertyName) != AnimationWindowUtility.GetPropertyGroupName(curveBinding.propertyName))
203203
{
204-
TreeViewItem newNode = CreateNode(singlePropertyBindings.ToArray(), node);
204+
TreeViewItem newNode = CreateNode(singlePropertyBindings.ToArray(), node, so);
205205
if (newNode != null)
206206
childNodes.Add(newNode);
207207
singlePropertyBindings.Clear();
@@ -214,9 +214,9 @@ private TreeViewItem AddAnimatableObjectToHierarchy(EditorCurveBinding[] curveBi
214214
return node;
215215
}
216216

217-
private TreeViewItem CreateNode(EditorCurveBinding[] curveBindings, TreeViewItem parentNode)
217+
private TreeViewItem CreateNode(EditorCurveBinding[] curveBindings, TreeViewItem parentNode, SerializedObject so)
218218
{
219-
var node = new AddCurvesPopupPropertyNode(parentNode, curveBindings);
219+
var node = new AddCurvesPopupPropertyNode(parentNode, curveBindings, AnimationWindowUtility.GetNicePropertyDisplayName(curveBindings[0], so));
220220

221221
// For RectTransform.position we only want .z
222222
if (AnimationWindowUtility.IsRectTransformPosition(node.curveBindings[0]))
@@ -234,7 +234,6 @@ public void UpdateData()
234234

235235
internal class AddCurvesPopupGameObjectNode : TreeViewItem
236236
{
237-
internal bool propertyPathMismatchWithHumanAvatar = false;
238237
public AddCurvesPopupGameObjectNode(GameObject gameObject, TreeViewItem parent, string displayName)
239238
: base(gameObject.GetInstanceID(), parent != null ? parent.depth + 1 : -1, parent, displayName)
240239
{
@@ -253,8 +252,8 @@ internal class AddCurvesPopupPropertyNode : TreeViewItem
253252
{
254253
public EditorCurveBinding[] curveBindings;
255254

256-
public AddCurvesPopupPropertyNode(TreeViewItem parent, EditorCurveBinding[] curveBindings)
257-
: base(curveBindings[0].GetHashCode(), parent.depth + 1, parent, AnimationWindowUtility.NicifyPropertyGroupName(curveBindings[0].type, AnimationWindowUtility.GetPropertyGroupName(curveBindings[0].propertyName)))
255+
public AddCurvesPopupPropertyNode(TreeViewItem parent, EditorCurveBinding[] curveBindings, string displayPath)
256+
: base(curveBindings[0].GetHashCode(), parent.depth + 1, parent, displayPath)
258257
{
259258
this.curveBindings = curveBindings;
260259
}

Editor/Mono/Animation/AnimationWindow/AddCurvesPopupHierarchyGUI.cs

+3-24
Original file line numberDiff line numberDiff line change
@@ -20,38 +20,17 @@ internal class AddCurvesPopupHierarchyGUI : TreeViewGUI
2020
private GUIContent addPropertiesContent = EditorGUIUtility.TrTextContent("Add Properties");
2121
private const float plusButtonWidth = 17;
2222

23-
static Texture2D warningIcon = (Texture2D)EditorGUIUtility.LoadRequired("Icons/ShortcutManager/alertDialog.png");
24-
public static GUIStyle warningIconStyle;
25-
2623
public AddCurvesPopupHierarchyGUI(TreeViewController treeView, EditorWindow owner)
2724
: base(treeView, true)
2825
{
2926
this.owner = owner;
30-
warningIconStyle = new GUIStyle();
31-
warningIconStyle.margin = new RectOffset(15, 15, 15, 15);
3227
}
3328

3429
public override void OnRowGUI(Rect rowRect, TreeViewItem node, int row, bool selected, bool focused)
3530
{
36-
bool propertyPathMismatchWithHumanAvatar = false;
37-
AddCurvesPopupGameObjectNode addCurvesPopupNode = node as AddCurvesPopupGameObjectNode;
38-
if (addCurvesPopupNode != null)
39-
{
40-
propertyPathMismatchWithHumanAvatar = addCurvesPopupNode.propertyPathMismatchWithHumanAvatar;
41-
}
42-
43-
using (new EditorGUI.DisabledScope(propertyPathMismatchWithHumanAvatar))
44-
{
45-
base.OnRowGUI(rowRect, node, row, selected, focused);
46-
DoAddCurveButton(rowRect, node);
47-
HandleContextMenu(rowRect, node);
48-
}
49-
50-
if (propertyPathMismatchWithHumanAvatar)
51-
{
52-
Rect iconRect = new Rect(rowRect.width - plusButtonWidth, rowRect.yMin, plusButtonWidth, buttonStyle.fixedHeight);
53-
GUI.Label(iconRect, new GUIContent(warningIcon, "The Avatar definition does not match the property path. Please author using a hierarchy the Avatar was built with."), warningIconStyle);
54-
}
31+
base.OnRowGUI(rowRect, node, row, selected, focused);
32+
DoAddCurveButton(rowRect, node);
33+
HandleContextMenu(rowRect, node);
5534
}
5635

5736
private void DoAddCurveButton(Rect rowRect, TreeViewItem node)

Editor/Mono/Animation/AnimationWindow/AnimationRecording.cs

-6
Original file line numberDiff line numberDiff line change
@@ -510,12 +510,6 @@ static void AddKey(IAnimationRecordingState state, EditorCurveBinding binding, T
510510
{
511511
if (state.currentFrame != 0)
512512
{
513-
// case 1373924
514-
// In the case of a new curve, we also have to convert the previousValue to float for a discrete int
515-
if(binding.isDiscreteCurve)
516-
{
517-
previousValue = UnityEngine.Animations.DiscreteEvaluationAttributeUtilities.ConvertDiscreteIntToFloat((int)previousValue);
518-
}
519513
AnimationWindowUtility.AddKeyframeToCurve(curve, previousValue, type, AnimationKeyTime.Frame(0, clip.frameRate));
520514
}
521515
}

Editor/Mono/Animation/AnimationWindow/AnimationWindow.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -224,15 +224,15 @@ void OnEnable()
224224

225225
OnSelectionChange();
226226

227-
Undo.undoRedoPerformed += UndoRedoPerformed;
227+
Undo.undoRedoEvent += UndoRedoPerformed;
228228
}
229229

230230
void OnDisable()
231231
{
232232
s_AnimationWindows.Remove(this);
233233
m_AnimEditor.OnDisable();
234234

235-
Undo.undoRedoPerformed -= UndoRedoPerformed;
235+
Undo.undoRedoEvent -= UndoRedoPerformed;
236236
}
237237

238238
void OnDestroy()
@@ -452,7 +452,7 @@ private bool ShouldUpdateSelection(AnimationWindowSelectionItem selectedItem)
452452
return (selectedItem.GetRefreshHash() != currentSelection.GetRefreshHash());
453453
}
454454

455-
private void UndoRedoPerformed()
455+
private void UndoRedoPerformed(in UndoRedoInfo info)
456456
{
457457
Repaint();
458458
}

0 commit comments

Comments
 (0)