Skip to content

Commit 8242978

Browse files
author
Unity Technologies
committed
Unity 2023.1.0a14 C# reference source code
1 parent fcef208 commit 8242978

File tree

103 files changed

+4873
-2495
lines changed

Some content is hidden

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

103 files changed

+4873
-2495
lines changed

Editor/Mono/AssetDatabase/AssetDatabaseSearching.cs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ private static IEnumerator<T> FindInFolders<T>(SearchFilter searchFilter, Func<H
6565
}
6666
}
6767

68+
HierarchyProperty propertyWithFilter = null;
6869
foreach (var folderPath in folders)
6970
{
7071
var sanitizedFolderPath = folderPath.ConvertSeparatorsToUnity().TrimTrailingSlashes();
@@ -86,7 +87,14 @@ private static IEnumerator<T> FindInFolders<T>(SearchFilter searchFilter, Func<H
8687
if (property.Find(folderInstanceID, null))
8788
{
8889
// Set filter after we found the folder
89-
property.SetSearchFilter(searchFilter);
90+
if (propertyWithFilter != null)
91+
propertyWithFilter.CopySearchFilterFrom(property);
92+
else
93+
{
94+
property.SetSearchFilter(searchFilter);
95+
propertyWithFilter = property;
96+
}
97+
9098
int folderDepth = property.depth;
9199
int[] expanded = null; // enter all children of folder
92100
while (property.NextWithDepthCheck(expanded, folderDepth + 1))
@@ -118,10 +126,16 @@ private static IEnumerator<T> FindEverywhere<T>(SearchFilter searchFilter, Func<
118126
rootPaths.Add(package.assetPath);
119127
}
120128
}
129+
130+
HierarchyProperty lastProperty = null;
121131
foreach (var rootPath in rootPaths)
122132
{
123133
var property = new HierarchyProperty(rootPath);
124-
property.SetSearchFilter(searchFilter);
134+
if (lastProperty != null)
135+
property.CopySearchFilterFrom(lastProperty);
136+
else
137+
property.SetSearchFilter(searchFilter);
138+
lastProperty = property;
125139
while (property.Next(null))
126140
{
127141
yield return selector(property);

Editor/Mono/AssetPipeline/SpeedTreeImporter.bindings.cs

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public extern bool isV8
5555

5656

5757
/////////////////////////////////////////////////////////////////////////////
58-
// Common material properties
58+
// Material properties
5959

6060
public extern Color mainColor { get; set; }
6161

@@ -71,6 +71,24 @@ public extern bool isV8
7171

7272
public extern Color hueVariation { get; set; }
7373
public extern float alphaTestRef { get; set; }
74+
public extern bool enableBumpByDefault { get; set; }
75+
public extern bool enableHueByDefault { get; set; }
76+
public extern bool enableSubsurfaceByDefault { get; set; }
77+
78+
/////////////////////////////////////////////////////////////////////////////
79+
// Lighting properties
80+
81+
public extern bool castShadowsByDefault { get; set; }
82+
public extern bool receiveShadowsByDefault { get; set; }
83+
public extern bool useLightProbesByDefault { get; set; }
84+
public extern int reflectionProbeUsagesByDefault { get; set; }
85+
86+
/////////////////////////////////////////////////////////////////////////////
87+
// Wind properties
88+
89+
public static readonly string[] windQualityNames = new[] { "None", "Fastest", "Fast", "Better", "Best", "Palm" };
90+
public extern int bestWindQuality { get; }
91+
public extern int selectedWindQuality { get; set; }
7492

7593

7694
/////////////////////////////////////////////////////////////////////////////
@@ -82,11 +100,21 @@ public extern bool hasBillboard
82100
get;
83101
}
84102

103+
85104
public extern bool enableSmoothLODTransition { get; set; }
86105
public extern bool animateCrossFading { get; set; }
87106
public extern float billboardTransitionCrossFadeWidth { get; set; }
88107
public extern float fadeOutWidth { get; set; }
89108

109+
public extern bool[] enableSettingOverride
110+
{
111+
[FreeFunction(Name = "SpeedTreeImporterBindings::GetEnableSettingOverride", HasExplicitThis = true)]
112+
get;
113+
[NativeThrows]
114+
[FreeFunction(Name = "SpeedTreeImporterBindings::SetEnableSettingOverride", HasExplicitThis = true)]
115+
set;
116+
}
117+
90118
public extern float[] LODHeights
91119
{
92120
[FreeFunction(Name = "SpeedTreeImporterBindings::GetLODHeights", HasExplicitThis = true)]
@@ -159,10 +187,6 @@ public extern bool[] enableSubsurface
159187
set;
160188
}
161189

162-
public static readonly string[] windQualityNames = new[] { "None", "Fastest", "Fast", "Better", "Best", "Palm" };
163-
164-
public extern int bestWindQuality { get; }
165-
166190
public extern int[] windQualities
167191
{
168192
[FreeFunction(Name = "SpeedTreeImporterBindings::GetWindQuality", HasExplicitThis = true)]

Editor/Mono/EditorGUIUtility.bindings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,6 @@ [ExcludeFromDocs] public SessionState() {}
204204
public static extern void EraseVector3(string key);
205205
public static extern void EraseIntArray(string key);
206206
public static extern void SetIntArray(string key, int[] value);
207-
public static extern int[] GetIntArray(string key, int[] defaultValue);
207+
public static extern int[] GetIntArray(string key, [Unmarshalled]int[] defaultValue);
208208
}
209209
}

Editor/Mono/EditorMode/ModeService.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ internal enum ModeCapability
3838
StatusBarExtraFeatures,
3939
SafeMode,
4040
Remember,
41-
AllowAssetCreation
41+
AllowAssetCreation,
42+
SearchPopupButton
4243
}
4344

4445
[Serializable]

Editor/Mono/EditorSceneManager.bindings.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ internal static void RemapAssetReferencesInScene(UnityEngine.SceneManagement.Sce
203203
[NativeThrows]
204204
[StaticAccessor("EditorSceneManagerBindings", StaticAccessorType.DoubleColon)]
205205
[NativeMethod("SaveScenes")]
206-
public extern static bool SaveScenes(Scene[] scenes);
206+
public extern static bool SaveScenes([NotNull("NullReferenceException")] Scene[] scenes);
207207

208208
[NativeThrows]
209209
[StaticAccessor("EditorSceneManagerBindings", StaticAccessorType.DoubleColon)]
@@ -213,7 +213,7 @@ internal static void RemapAssetReferencesInScene(UnityEngine.SceneManagement.Sce
213213
[NativeThrows]
214214
[StaticAccessor("EditorSceneManagerBindings", StaticAccessorType.DoubleColon)]
215215
[NativeMethod("SaveModifiedScenesIfUserWantsTo")]
216-
public extern static bool SaveModifiedScenesIfUserWantsTo(Scene[] scenes);
216+
public extern static bool SaveModifiedScenesIfUserWantsTo([NotNull("NullReferenceException")] Scene[] scenes);
217217

218218
[StaticAccessor("GetSceneManager()", StaticAccessorType.Dot)]
219219
[NativeMethod("EnsureUntitledSceneHasBeenSaved")]

Editor/Mono/GameView/GameView.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,7 @@ private void DoToolbarGUI()
774774
}
775775

776776
if (GUILayout.Button(Styles.frameDebuggerContent, EditorStyles.toolbarButton))
777-
FrameDebuggerWindow.ShowFrameDebuggerWindow();
777+
FrameDebuggerWindow.OpenWindowAndToggleEnabled();
778778

779779
if (RenderDoc.IsLoaded())
780780
{

Editor/Mono/HierarchyProperty.bindings.cs

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,9 @@ void Dispose()
153153
public extern int colorCode { get; }
154154

155155
[FreeFunction("HierarchyPropertyBindings::IsExpanded", HasExplicitThis = true)]
156-
public extern bool IsExpanded(int[] expanded);
156+
private extern bool IsExpanded_internal(int[] expanded, bool nonNullEmptyArray);
157+
158+
public bool IsExpanded(int[] expanded) => IsExpanded_internal(expanded, expanded != null && expanded.Length == 0);
157159

158160
public extern string guid { [FreeFunction("HierarchyPropertyBindings::GetGuid", HasExplicitThis = true)] get; }
159161
public extern bool alphaSorted { [NativeName("IsAlphaSorted")] get; set; }
@@ -167,18 +169,24 @@ void Dispose()
167169
public extern GUID[] dynamicDependencies { get; }
168170

169171
[FreeFunction("HierarchyPropertyBindings::Next", HasExplicitThis = true)]
170-
public extern bool Next(int[] expanded);
172+
private extern bool Next_internal(int[] expanded, bool nonNullEmptyArray);
173+
public bool Next(int[] expanded) => Next_internal(expanded, expanded != null && expanded.Length == 0);
171174
[FreeFunction("HierarchyPropertyBindings::NextWithDepthCheck", HasExplicitThis = true)]
172-
public extern bool NextWithDepthCheck(int[] expanded, int minDepth);
175+
private extern bool NextWithDepthCheck_internal(int[] expanded, int minDepth, bool nonNullEmptyArray);
176+
public bool NextWithDepthCheck(int[] expanded, int minDepth) => NextWithDepthCheck_internal(expanded, minDepth, expanded != null && expanded.Length == 0);
173177
[FreeFunction("HierarchyPropertyBindings::Previous", HasExplicitThis = true)]
174-
public extern bool Previous(int[] expanded);
178+
private extern bool Previous_internal(int[] expanded, bool nonNullEmptyArray);
179+
public bool Previous(int[] expanded) => Previous_internal(expanded, expanded != null && expanded.Length == 0);
175180
public extern bool Parent();
176181
[FreeFunction("HierarchyPropertyBindings::Find", HasExplicitThis = true)]
177-
public extern bool Find(int instanceID, int[] expanded);
182+
private extern bool Find_internal(int instanceID, int[] expanded, bool nonNullEmptyArray);
183+
public bool Find(int instanceID, int[] expanded) => Find_internal(instanceID, expanded, expanded != null && expanded.Length == 0);
178184
[FreeFunction("HierarchyPropertyBindings::Skip", HasExplicitThis = true)]
179-
public extern bool Skip(int count, int[] expanded);
185+
private extern bool Skip_internal(int count, int[] expanded, bool nonNullEmptyArray);
186+
public bool Skip(int count, int[] expanded) =>Skip_internal(count, expanded, expanded != null && expanded.Length == 0);
180187
[FreeFunction("HierarchyPropertyBindings::CountRemaining", HasExplicitThis = true)]
181-
public extern int CountRemaining(int[] expanded);
188+
private extern int CountRemaining_internal(int[] expanded, bool nonNullEmptyArray);
189+
public int CountRemaining(int[] expanded) => CountRemaining_internal(expanded, expanded != null && expanded.Length == 0);
182190

183191
public extern int GetInstanceIDIfImported();
184192

@@ -205,8 +213,19 @@ internal void SetSearchFilter(SearchFilter filter)
205213
SetSearchFilterImpl(SearchFilter.Split(filter.nameFilter), filter.classNames, filter.assetLabels, filter.assetBundleNames, filter.versionControlStates, filter.softLockControlStates, filter.referencingInstanceIDs, filter.sceneHandles, filter.GlobToRegex().ToArray(), filter.productIds, filter.anyWithAssetOrigin, filter.showAllHits, filter.importLogFlags);
206214
}
207215

216+
internal void CopySearchFilterFrom(HierarchyProperty other)
217+
{
218+
if (other == null)
219+
throw new ArgumentNullException(nameof(other));
220+
CopySearchFilterImpl(other);
221+
}
222+
208223
[FreeFunction("HierarchyPropertyBindings::SetSearchFilterImpl", HasExplicitThis = true)]
209224
extern void SetSearchFilterImpl(string[] nameFilters, string[] classNames, string[] assetLabels, string[] assetBundleNames, string[] versionControlStates, string[] softLockControlStates, int[] referencingInstanceIDs, int[] sceneHandles, string[] regex, int[] productIds, bool anyWithAssetOrigin, bool showAllHits, ImportLogFlags importLogFlags);
225+
226+
[FreeFunction("HierarchyPropertyBindings::CopySearchFilterImpl", HasExplicitThis = true)]
227+
extern void CopySearchFilterImpl(HierarchyProperty other);
228+
210229
[FreeFunction("HierarchyPropertyBindings::FindAllAncestors", HasExplicitThis = true)]
211230
public extern int[] FindAllAncestors(int[] instanceIDs);
212231
[FreeFunction("HierarchyPropertyBindings::ClearSceneObjectsFilter")]

Editor/Mono/ImportSettings/SpeedTreeImporterMaterialEditor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ private static class Styles
3333
public static GUIContent InternalMaterialHelp = EditorGUIUtility.TrTextContent("Materials are embedded inside the imported asset.");
3434
public static GUIContent MaterialAssignmentsHelp = EditorGUIUtility.TrTextContent("Material assignments can be remapped below.");
3535

36-
public static GUIContent ExternalMaterialSearchHelp = EditorGUIUtility.TrTextContent("Remap the imported materials to materials from the Unity project.");
36+
public static GUIContent ExternalMaterialSearchHelp = EditorGUIUtility.TrTextContent("Searches the user provided directory and matches the materials that share the same name and LOD with the originally imported material.");
3737

3838
public static GUIContent SelectMaterialFolder = EditorGUIUtility.TrTextContent("Select Materials Folder");
3939
}

0 commit comments

Comments
 (0)