mirror of
https://github.com/AssetRipper/AssetRipper.git
synced 2025-12-11 20:15:29 +01:00
* Add PrefabHierarchyObject and SceneHierarchyObject * Scene ordering remains the same, but prefabs get sorted by asset type * This might solve an issue with pptr's inside a prefab. Previously, AssetsExportCollection.File was not changing while enumerating ExportableAssets. * SceneExportCollection uses random export id's for artificially generated assets. Previously, there were no generated assets in scenes.
34 lines
729 B
C#
34 lines
729 B
C#
namespace AssetRipper.SourceGenerated.Extensions
|
|
{
|
|
public static class EnumerableExtensions
|
|
{
|
|
public static IEnumerable<T> WhereNotNull<T>(this IEnumerable<T?> enumerable) where T : notnull
|
|
{
|
|
foreach (T? item in enumerable)
|
|
{
|
|
if (item is not null)
|
|
{
|
|
yield return item;
|
|
}
|
|
}
|
|
}
|
|
|
|
public static IEnumerable<T> ThrowIfNull<T>(this IEnumerable<T?> enumerable) where T : notnull
|
|
{
|
|
foreach (T? item in enumerable)
|
|
{
|
|
if (item is null)
|
|
{
|
|
throw new NullReferenceException();
|
|
}
|
|
yield return item;
|
|
}
|
|
}
|
|
|
|
public static IEnumerable<T> MaybeAppend<T>(this IEnumerable<T> enumerable, T? item)
|
|
{
|
|
return item is not null ? enumerable.Append(item) : enumerable;
|
|
}
|
|
}
|
|
}
|