Skip to content

Commit 0cf7cda

Browse files
author
Unity Technologies
committed
Unity 2019.3.0a12 C# reference source code
1 parent f50ab75 commit 0cf7cda

File tree

338 files changed

+14742
-7771
lines changed

Some content is hidden

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

338 files changed

+14742
-7771
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class Styles
6363
public readonly GUIContent copyMasterButton = EditorGUIUtility.TrTextContent("Copy Master's Settings", "Copy all master's settings into this variant.");
6464
public readonly GUIContent packButton = EditorGUIUtility.TrTextContent("Pack Preview", "Pack this atlas.");
6565

66-
public readonly GUIContent disabledPackLabel = EditorGUIUtility.TrTextContent("Sprite Atlas packing is disabled. Enable it in Edit > Settings > Editor.", null, EditorGUIUtility.GetHelpIcon(MessageType.Info));
66+
public readonly GUIContent disabledPackLabel = EditorGUIUtility.TrTextContent("Sprite Atlas packing is disabled. Enable it in Edit > Project Settings > Editor.", null, EditorGUIUtility.GetHelpIcon(MessageType.Info));
6767
public readonly GUIContent packableListLabel = EditorGUIUtility.TrTextContent("Objects for Packing", "Only accept Folder, Sprite Sheet (Texture) and Sprite.");
6868

6969
public readonly GUIContent notPowerOfTwoWarning = EditorGUIUtility.TrTextContent("This scale will produce a Sprite Atlas variant with a packed texture that is NPOT (non - power of two). This may cause visual artifacts in certain compression/texture formats.");

Editor/Mono/ActiveEditorTracker.bindings.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,19 @@ public bool isLocked
110110
set { Internal_SetIsLocked(this, value); }
111111
}
112112

113+
[FreeFunction]
114+
static extern bool Internal_GetDelayFlushDirtyRebuild();
115+
116+
[FreeFunction]
117+
static extern void Internal_SetDelayFlushDirtyRebuild(bool value);
118+
119+
// Enable or disable the ActiveEditorTracker rebuilding from ISceneInspector.DidFlushDirty calls.
120+
internal static bool delayFlushDirtyRebuild
121+
{
122+
get { return Internal_GetDelayFlushDirtyRebuild(); }
123+
set { Internal_SetDelayFlushDirtyRebuild(value); }
124+
}
125+
113126
[FreeFunction]
114127
static extern InspectorMode Internal_GetInspectorMode(ActiveEditorTracker self);
115128
[FreeFunction]
@@ -131,6 +144,10 @@ public bool hasComponentsWhichCannotBeMultiEdited
131144
static extern void Internal_RebuildIfNecessary(ActiveEditorTracker self);
132145
public void RebuildIfNecessary() { Internal_RebuildIfNecessary(this); }
133146

147+
[FreeFunction]
148+
static extern void Internal_RebuildAllIfNecessary();
149+
internal static void RebuildAllIfNecessary() { Internal_RebuildAllIfNecessary(); }
150+
134151
[FreeFunction]
135152
static extern void Internal_ForceRebuild(ActiveEditorTracker self);
136153
public void ForceRebuild() { Internal_ForceRebuild(this); }

Editor/Mono/Animation/AnimatorController.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,9 @@ internal static AnimatorController CreateAnimatorControllerForClip(AnimationClip
206206
if (string.IsNullOrEmpty(path))
207207
return null;
208208

209-
path = Path.Combine(FileUtil.DeleteLastPathNameComponent(path), animatedObject.name + "." + kControllerExtension);
209+
string name = System.Text.RegularExpressions.Regex.Replace(animatedObject.name, @"[\\\./]", "_");
210+
211+
path = Path.Combine(FileUtil.DeleteLastPathNameComponent(path), name + "." + kControllerExtension);
210212
path = AssetDatabase.GenerateUniqueAssetPath(path);
211213

212214
if (string.IsNullOrEmpty(path))

Editor/Mono/AssemblyHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ static public string ExtractInternalAssemblyName(string path)
6262
}
6363
catch
6464
{
65-
return ""; // Possible on just deleted FacebookSDK
65+
return "";
6666
}
6767
}
6868

Editor/Mono/AssemblyInfo/AssemblyInfo.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@
5959
[assembly: InternalsVisibleTo("UnityEditor.VR")]
6060
[assembly: InternalsVisibleTo("Unity.RuntimeTests")]
6161
[assembly: InternalsVisibleTo("Unity.RuntimeTests.Framework")]
62-
[assembly: InternalsVisibleTo("UnityEditor.Facebook.Extensions")]
6362
[assembly: InternalsVisibleTo("Assembly-CSharp-Editor-firstpass-testable")]
6463
[assembly: InternalsVisibleTo("Assembly-CSharp-Editor-testable")]
6564
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]

Editor/Mono/AssetDatabase/AssetDatabase.bindings.cs

Lines changed: 0 additions & 164 deletions
This file was deleted.

Editor/Mono/AssetDatabase/AssetDatabase.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// Copyright (c) Unity Technologies. For terms of use, see
33
// https://unity3d.com/legal/licenses/Unity_Reference_Only_License
44

5+
using System;
6+
using System.Collections.Generic;
57
using UnityEngine.Scripting;
68

79
namespace UnityEditor
@@ -53,5 +55,16 @@ private static void Internal_CallImportPackageFailed(string packageName, string
5355
if (importPackageFailed != null)
5456
importPackageFailed(packageName, errorMessage);
5557
}
58+
59+
public static void IsOpenForEdit(string[] assetOrMetaFilePaths, List<string> outNotEditablePaths, StatusQueryOptions statusQueryOptions = StatusQueryOptions.UseCachedIfPossible)
60+
{
61+
if (assetOrMetaFilePaths == null)
62+
throw new ArgumentNullException(nameof(assetOrMetaFilePaths));
63+
if (outNotEditablePaths == null)
64+
throw new ArgumentNullException(nameof(outNotEditablePaths));
65+
UnityEngine.Profiling.Profiler.BeginSample("AssetDatabase.IsOpenForEdit");
66+
AssetModificationProcessorInternal.IsOpenForEdit(assetOrMetaFilePaths, outNotEditablePaths, statusQueryOptions);
67+
UnityEngine.Profiling.Profiler.EndSample();
68+
}
5669
}
5770
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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 System;
6+
7+
namespace UnityEditor.Experimental
8+
{
9+
internal struct AssetMoveInfo : IEquatable<AssetMoveInfo>
10+
{
11+
public AssetMoveInfo(string sourceAssetPath, string destinationAssetPath)
12+
{
13+
this.sourceAssetPath = sourceAssetPath;
14+
this.destinationAssetPath = destinationAssetPath;
15+
}
16+
17+
public string sourceAssetPath { get; }
18+
public string destinationAssetPath { get; }
19+
20+
public bool Equals(AssetMoveInfo other)
21+
{
22+
return string.Equals(sourceAssetPath, other.sourceAssetPath) && string.Equals(destinationAssetPath, other.destinationAssetPath);
23+
}
24+
25+
public override bool Equals(object obj)
26+
{
27+
if (ReferenceEquals(null, obj)) return false;
28+
return obj is AssetMoveInfo && Equals((AssetMoveInfo)obj);
29+
}
30+
31+
public override int GetHashCode()
32+
{
33+
unchecked
34+
{
35+
return ((sourceAssetPath != null ? sourceAssetPath.GetHashCode() : 0) * 397) ^ (destinationAssetPath != null ? destinationAssetPath.GetHashCode() : 0);
36+
}
37+
}
38+
39+
public static bool operator==(AssetMoveInfo left, AssetMoveInfo right)
40+
{
41+
return left.Equals(right);
42+
}
43+
44+
public static bool operator!=(AssetMoveInfo left, AssetMoveInfo right)
45+
{
46+
return !left.Equals(right);
47+
}
48+
}
49+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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 System;
6+
using System.Collections.Generic;
7+
8+
namespace UnityEditor.Experimental
9+
{
10+
internal abstract class AssetsModifiedProcessor
11+
{
12+
internal HashSet<string> assetsReportedChanged { get; set; }
13+
14+
protected void ReportAssetChanged(string assetChanged)
15+
{
16+
if (assetsReportedChanged == null)
17+
throw new InvalidOperationException("Cannot call ReportAssetChanged outside of the OnAssetsModified callback");
18+
19+
assetsReportedChanged.Add(assetChanged);
20+
}
21+
22+
//Note: changedAssets including added and moved assets may be a usability issue. Review before making public.
23+
///<summary>Fired when the [[AssetDatabase]] detects Asset changes before any Assets are imported.</summary>
24+
///<param name="changedAssets">Paths to the Assets whose file contents have changed. Includes all added and moved Assets.</param>
25+
///<param name="addedAssets">Paths to added Assets.</param>
26+
///<param name="deletedAssets">Paths to deleted Assets.</param>
27+
///<param name="movedAssets">Array of AssetMoveInfo that contains the previous and current location of any moved Assets.</param>
28+
///<description> An Asset will only be reported moved if its .meta file is moved as well.</description>
29+
protected abstract void OnAssetsModified(string[] changedAssets, string[] addedAssets, string[] deletedAssets, AssetMoveInfo[] movedAssets);
30+
31+
internal void Internal_OnAssetsModified(string[] changedAssets, string[] addedAssets, string[] deletedAssets, AssetMoveInfo[] movedAssets)
32+
{
33+
OnAssetsModified(changedAssets, addedAssets, deletedAssets, movedAssets);
34+
}
35+
}
36+
}

0 commit comments

Comments
 (0)