mirror of
https://github.com/AssetRipper/AssetRipper.git
synced 2025-12-11 20:15:29 +01:00
Delete IAssetContainer
This commit is contained in:
parent
bde19f1e47
commit
9f7cc2d772
@ -10,7 +10,7 @@ namespace AssetRipper.Assets.Collections;
|
||||
/// <summary>
|
||||
/// A collection of <see cref="IUnityObjectBase"/> assets.
|
||||
/// </summary>
|
||||
public abstract class AssetCollection : IReadOnlyCollection<IUnityObjectBase>, IAssetContainer
|
||||
public abstract class AssetCollection : IReadOnlyCollection<IUnityObjectBase>
|
||||
{
|
||||
protected AssetCollection(Bundle bundle)
|
||||
{
|
||||
|
||||
@ -1,29 +0,0 @@
|
||||
using AssetRipper.IO.Files;
|
||||
using AssetRipper.IO.Files.SerializedFiles;
|
||||
|
||||
namespace AssetRipper.Assets.Collections
|
||||
{
|
||||
public interface IAssetContainer
|
||||
{
|
||||
/// <summary>
|
||||
/// Try to find an asset in the current serialized file
|
||||
/// </summary>
|
||||
/// <param name="pathID">Path ID of the asset</param>
|
||||
/// <returns>Found asset or null</returns>
|
||||
IUnityObjectBase? TryGetAsset(long pathID);
|
||||
/// <summary>
|
||||
/// Try to get asset in the dependency file with specified file index
|
||||
/// </summary>
|
||||
/// <param name="fileIndex">Dependent file index</param>
|
||||
/// <param name="pathID">Path ID of the asset</param>
|
||||
/// <returns>Found asset or null</returns>
|
||||
IUnityObjectBase? TryGetAsset(int fileIndex, long pathID);
|
||||
|
||||
string Name { get; }
|
||||
UnityVersion Version { get; }
|
||||
BuildTarget Platform { get; }
|
||||
TransferInstructionFlags Flags { get; }
|
||||
|
||||
IReadOnlyList<AssetCollection?> Dependencies { get; }
|
||||
}
|
||||
}
|
||||
@ -5,7 +5,7 @@ using AssetRipper.IO.Files.SerializedFiles;
|
||||
|
||||
namespace AssetRipper.Assets.Export
|
||||
{
|
||||
public interface IExportContainer : IAssetContainer
|
||||
public interface IExportContainer
|
||||
{
|
||||
long GetExportID(IUnityObjectBase asset);
|
||||
AssetType ToExportType(Type type);
|
||||
|
||||
@ -42,16 +42,6 @@ namespace AssetRipper.Export.UnityProjects
|
||||
m_scenes = scenes.ToArray();
|
||||
}
|
||||
|
||||
public IUnityObjectBase? TryGetAsset(long pathID)
|
||||
{
|
||||
return File.TryGetAsset(pathID);
|
||||
}
|
||||
|
||||
public virtual IUnityObjectBase? TryGetAsset(int fileIndex, long pathID)
|
||||
{
|
||||
return File.TryGetAsset(fileIndex, pathID);
|
||||
}
|
||||
|
||||
public long GetExportID(IUnityObjectBase asset)
|
||||
{
|
||||
if (m_assetCollections.TryGetValue(asset, out IExportCollection? collection))
|
||||
@ -93,16 +83,11 @@ namespace AssetRipper.Export.UnityProjects
|
||||
|
||||
public IExportCollection CurrentCollection { get; set; }
|
||||
public AssetCollection File => CurrentCollection.File;
|
||||
public string Name => File.Name;
|
||||
public UnityVersion Version => File.Version;
|
||||
public BuildTarget Platform => File.Platform;
|
||||
public TransferInstructionFlags Flags => File.Flags;
|
||||
public UnityVersion ExportVersion { get; }
|
||||
public BuildTarget ExportPlatform { get; }
|
||||
private readonly TransferInstructionFlags _exportFlags;
|
||||
public TransferInstructionFlags ExportFlags => _exportFlags | CurrentCollection.Flags;
|
||||
public IReadOnlyList<AssetCollection?> Dependencies => File.Dependencies;
|
||||
|
||||
private readonly TransferInstructionFlags _exportFlags;
|
||||
private readonly ProjectExporter m_exporter;
|
||||
private readonly Dictionary<IUnityObjectBase, IExportCollection> m_assetCollections = new();
|
||||
|
||||
|
||||
@ -54,21 +54,21 @@ namespace AssetRipper.SourceGenerated.Extensions
|
||||
|
||||
public static void SetExportData(this IOcclusionCullingData occlusionCullingData, IExportContainer container)
|
||||
{
|
||||
// if < 3.0.0 this asset doesn't exist
|
||||
// If < 3.0.0, this asset doesn't exist.
|
||||
|
||||
// 3.0.0 to 5.5.0 this asset is created by culling settings so it has set data already
|
||||
if (container.Version.LessThan(5, 5))
|
||||
// For 3.0.0 to 5.5.0, this asset is created by culling settings, so its data is already set.
|
||||
if (occlusionCullingData.Collection.Version.LessThan(5, 5))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// if >= 5.5.0 and !Release this asset containts renderer data
|
||||
if (!container.Flags.IsRelease())
|
||||
// If >= 5.5.0 and not Release, this asset contains renderer data,
|
||||
if (!occlusionCullingData.Collection.Flags.IsRelease())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// if >= 5.5.0 and Release this asset doesn't containt renderers data so we need to create it
|
||||
// If >= 5.5.0 and Release. this asset doesn't contain renderer data, so we need to create it.
|
||||
List<IOcclusionCullingSettings> cullingSettings = new();
|
||||
foreach (IUnityObjectBase asset in occlusionCullingData.Collection.Bundle.FetchAssetsInHierarchy())
|
||||
{
|
||||
@ -131,10 +131,7 @@ namespace AssetRipper.SourceGenerated.Extensions
|
||||
|
||||
private static void SetObjectID(this ISceneObjectIdentifier sceneObjectIdentifier, IExportContainer container, IUnityObjectBase? asset)
|
||||
{
|
||||
if (sceneObjectIdentifier is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(sceneObjectIdentifier));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(sceneObjectIdentifier);
|
||||
|
||||
long lid = asset == null ? 0 : container.GetExportID(asset);
|
||||
sceneObjectIdentifier.TargetObject = lid;
|
||||
|
||||
@ -12,7 +12,7 @@ public static class PPtrExtensions
|
||||
return asset;
|
||||
}
|
||||
|
||||
public static bool IsAsset<T>(this IPPtr<T> pptr, IAssetContainer file, IUnityObjectBase asset) where T : IUnityObjectBase
|
||||
public static bool IsAsset<T>(this IPPtr<T> pptr, AssetCollection file, IUnityObjectBase asset) where T : IUnityObjectBase
|
||||
{
|
||||
if (asset.PathID != pptr.PathID)
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user