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)));
        }
Ejemplo n.º 3
0
 public long GetExportID(Object asset)
 {
     if (asset == m_asset)
     {
         return(ExportCollection.GetMainExportID(m_asset));
     }
     throw new ArgumentException(nameof(asset));
 }
Ejemplo n.º 4
0
 public NativeFormatImporter(Object mainObject)
 {
     if (mainObject == null)
     {
         throw new ArgumentNullException(nameof(mainObject));
     }
     m_mainObject = mainObject;
 }
Ejemplo n.º 5
0
        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");
                }
            }
        }
Ejemplo n.º 6
0
 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);
 }
Ejemplo n.º 7
0
        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));
        }
Ejemplo n.º 8
0
        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}'");
        }
Ejemplo n.º 9
0
        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));
            }
        }
Ejemplo n.º 10
0
        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;
        }
Ejemplo n.º 11
0
 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());
     }
 }
Ejemplo n.º 12
0
 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;
 }
Ejemplo n.º 13
0
        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);
 }
Ejemplo n.º 18
0
 public bool IsHandle(Object asset)
 {
     return(true);
 }
Ejemplo n.º 19
0
 public static bool AssetSelector(Object asset)
 {
     return(true);
 }
Ejemplo n.º 20
0
 public void Export(string path, FileCollection fileCollection, Object asset)
 {
     Export(path, fileCollection, new Object[] { asset });
 }
Ejemplo n.º 21
0
 public void Export(string path, FileCollection fileCollection, Object asset, ExportOptions options)
 {
     Export(path, fileCollection, new Object[] { asset }, options);
 }
Ejemplo n.º 22
0
 public void Export(IExportContainer container, Object asset, string path, Action <IExportContainer, Object, string> callback)
 {
     throw new NotSupportedException();
 }
Ejemplo n.º 23
0
 public bool Export(IExportContainer container, Object asset, string path)
 {
     throw new NotSupportedException();
 }
Ejemplo n.º 24
0
 public bool IsHandle(Object asset, ExportOptions options)
 {
     return(true);
 }
Ejemplo n.º 25
0
 private static bool DefaultFilter(Object asset)
 {
     return(true);
 }
Ejemplo n.º 26
0
 public void Export(IExportContainer container, Object asset, string path)
 {
 }
Ejemplo n.º 27
0
 public void Export(IExportContainer container, Object asset, string path, Action <IExportContainer, Object, string> callback)
 {
 }
Ejemplo n.º 28
0
 public AssetExportCollection(IAssetExporter assetExporter, Object asset) :
     this(assetExporter, asset, new NativeFormatImporter(asset))
 {
 }
Ejemplo n.º 29
0
 public override bool IsContains(Object asset)
 {
     return(Asset == asset);
 }
Ejemplo n.º 30
0
 public AssetType ToExportType(Object asset)
 {
     ToUnknownExportType(asset.ClassID, out AssetType assetType);
     return(assetType);
 }