public override long GetExportID(Object asset) { if (asset == Asset) { return(GetMainExportID(Asset)); } throw new ArgumentException(nameof(asset)); }
public override ExportPointer CreateExportPointer(Object asset, bool isLocal) { long exportID = GetExportID(asset); return(isLocal ? new ExportPointer(exportID) : new ExportPointer(exportID, Asset.GUID, AssetExporter.ToExportType(Asset))); }
public long GetExportID(Object asset) { if (asset == m_asset) { return(ExportCollection.GetMainExportID(m_asset)); } throw new ArgumentException(nameof(asset)); }
public NativeFormatImporter(Object mainObject) { if (mainObject == null) { throw new ArgumentNullException(nameof(mainObject)); } m_mainObject = mainObject; }
public void Export(string path, FileCollection fileCollection, IEnumerable <Object> assets) { VirtualSerializedFile virtualFile = new VirtualSerializedFile(); List <IExportCollection> collections = new List <IExportCollection>(); // speed up fetching a little bit List <Object> depList = new List <Object>(); HashSet <Object> depSet = new HashSet <Object>(); HashSet <Object> queued = new HashSet <Object>(); depList.AddRange(assets); depSet.UnionWith(depList); for (int i = 0; i < depList.Count; i++) { Object asset = depList[i]; if (!queued.Contains(asset)) { IExportCollection collection = CreateCollection(virtualFile, asset); foreach (Object element in collection.Assets) { queued.Add(element); } collections.Add(collection); } #warning TODO: if IsGenerateGUIDByContent set it should build collections and write actual references with persistent GUIS, but skip dependencies if (Config.IsExportDependencies) { foreach (Object dependency in asset.FetchDependencies(true)) { if (dependency == null) { continue; } if (!depSet.Contains(dependency)) { depList.Add(dependency); depSet.Add(dependency); } } } } depList.Clear(); depSet.Clear(); queued.Clear(); ProjectAssetContainer container = new ProjectAssetContainer(this, fileCollection.FetchAssets(), virtualFile, collections); foreach (IExportCollection collection in collections) { container.CurrentCollection = collection; bool isExported = collection.Export(container, path); if (isExported) { Logger.Log(LogType.Info, LogCategory.Export, $"'{collection.Name}' exported"); } } }
public static bool AssetSelector(Object asset) { // MRH - filter on AudioClips if (asset.ClassID == ClassIDType.AudioClip) { AudioClip audio = (AudioClip)asset; Console.WriteLine("queued {0}\\{1}", audio.ExportPath, audio.ValidName); return(true); } return(false); }
public ExportPointer CreateExportPointer(Object asset, bool isLocal) { if (isLocal) { throw new ArgumentException(nameof(isLocal)); } long exportId = GetExportID(asset); AssetType type = AssetExporter.ToExportType(asset); return(new ExportPointer(exportId, GUID.MissingReference, type)); }
private IExportCollection CreateCollection(VirtualSerializedFile file, Object asset) { Stack <IAssetExporter> exporters = m_exporters[asset.ClassID]; foreach (IAssetExporter exporter in exporters) { if (exporter.IsHandle(asset)) { return(exporter.CreateCollection(file, asset)); } } throw new Exception($"There is no exporter that can handle '{asset}'"); }
public IExportCollection CreateCollection(VirtualSerializedFile virtualFile, Object asset) { switch (asset.ClassID) { case ClassIDType.MonoManager: case ClassIDType.AssetBundle: case ClassIDType.PreloadData: return(new EmptyExportCollection()); default: return(new SkipExportCollection(this, asset)); } }
public SkipExportCollection(IAssetExporter assetExporter, Object asset) { if (assetExporter == null) { throw new ArgumentNullException(nameof(assetExporter)); } if (asset == null) { throw new ArgumentNullException(nameof(asset)); } AssetExporter = assetExporter; m_asset = asset; }
public IExportCollection CreateCollection(VirtualSerializedFile virtualFile, Object asset) { if (m_metaTypes.TryGetValue(asset.ClassID, out bool isEmptyCollection)) { if (isEmptyCollection) { return(new EmptyExportCollection()); } else { return(new SkipExportCollection(this, asset)); } } else { throw new NotSupportedException(asset.ClassID.ToString()); } }
public AssetExportCollection(IAssetExporter assetExporter, Object asset, IAssetImporter metaImporter) { if (assetExporter == null) { throw new ArgumentNullException(nameof(assetExporter)); } if (asset == null) { throw new ArgumentNullException(nameof(asset)); } if (metaImporter == null) { throw new ArgumentNullException(nameof(metaImporter)); } AssetExporter = assetExporter; Asset = asset; MetaImporter = metaImporter; }
private IExportCollection CreateCollection(VirtualSerializedFile file, Object asset) { Stack <IAssetExporter> exporters = m_exporters[asset.ClassID]; foreach (IAssetExporter exporter in exporters) { if (exporter.IsHandle(asset)) { if (asset.IsValid) { return(exporter.CreateCollection(file, asset)); } else { Logger.Log(LogType.Warning, LogCategory.Export, $"Can't export '{asset}' because it isn't valid"); return(new SkipExportCollection(exporter, asset)); } } } throw new Exception($"There is no exporter that can handle '{asset}'"); }
public ExportPointer CreateExportPointer(Object asset, bool isLocal) { throw new NotSupportedException(); }
public GUID GetExportGUID(Object asset) { throw new NotSupportedException(); }
public long GetExportID(Object asset) { throw new NotSupportedException(); }
public bool IsContains(Object asset) { return(false); }
public bool IsHandle(Object asset) { return(true); }
public static bool AssetSelector(Object asset) { return(true); }
public void Export(string path, FileCollection fileCollection, Object asset) { Export(path, fileCollection, new Object[] { asset }); }
public void Export(string path, FileCollection fileCollection, Object asset, ExportOptions options) { Export(path, fileCollection, new Object[] { asset }, options); }
public void Export(IExportContainer container, Object asset, string path, Action <IExportContainer, Object, string> callback) { throw new NotSupportedException(); }
public bool Export(IExportContainer container, Object asset, string path) { throw new NotSupportedException(); }
public bool IsHandle(Object asset, ExportOptions options) { return(true); }
private static bool DefaultFilter(Object asset) { return(true); }
public void Export(IExportContainer container, Object asset, string path) { }
public void Export(IExportContainer container, Object asset, string path, Action <IExportContainer, Object, string> callback) { }
public AssetExportCollection(IAssetExporter assetExporter, Object asset) : this(assetExporter, asset, new NativeFormatImporter(asset)) { }
public override bool IsContains(Object asset) { return(Asset == asset); }
public AssetType ToExportType(Object asset) { ToUnknownExportType(asset.ClassID, out AssetType assetType); return(assetType); }