public long GetExportID(Object asset)
 {
     throw new NotSupportedException();
 }
 public bool IsHandle(Object asset)
 {
     return(true);
 }
示例#3
0
 protected virtual string GetExportExtension(Object asset)
 {
     return(asset.ExportExtension);
 }
 public ManagerExportCollection(IAssetExporter assetExporter, Object asset) :
     this(assetExporter, (GlobalGameManager)asset)
 {
 }
示例#5
0
        public void Export(string path, GameCollection fileCollection, IEnumerable <SerializedFile> files, ExportOptions options)
        {
            EventExportPreparationStarted?.Invoke();
            VirtualSerializedFile    virtualFile = new VirtualSerializedFile(options);
            List <IExportCollection> collections = new List <IExportCollection>();
            // speed up fetching
            List <Object>    depList = new List <Object>();
            HashSet <Object> depSet  = new HashSet <Object>();
            HashSet <Object> queued  = new HashSet <Object>();

            foreach (SerializedFile file in files)
            {
                foreach (Object asset in file.FetchAssets())
                {
                    if (!options.Filter(asset))
                    {
                        continue;
                    }

                    depList.Add(asset);
                    depSet.Add(asset);
                }
            }


            for (int i = 0; i < depList.Count; i++)
            {
                Object asset = depList[i];
                if (!queued.Contains(asset))
                {
                    IExportCollection collection = CreateCollection(virtualFile, asset, options);
                    foreach (Object element in collection.Assets)
                    {
                        queued.Add(element);
                    }
                    collections.Add(collection);
                }

                if (options.ExportDependencies)
                {
                    DependencyContext context = new DependencyContext(asset.File.Version, asset.File.Platform, asset.File.Flags, true);
                    foreach (PPtr <Object> pointer in asset.FetchDependencies(context))
                    {
                        if (pointer.IsNull)
                        {
                            continue;
                        }

                        Object dependency = pointer.FindAsset(asset.File);
                        if (dependency == null)
                        {
                            string hierarchy = $"[{asset.File.Name}]" + asset.File.GetAssetLogString(asset.PathID) + "." + context.GetPointerPath();
                            Logger.Log(LogType.Warning, LogCategory.Export, $"{hierarchy}'s dependency {context.PointerName} = {pointer.ToLogString(asset.File)} wasn't found");
                            continue;
                        }

                        if (!depSet.Contains(dependency))
                        {
                            depList.Add(dependency);
                            depSet.Add(dependency);
                        }
                    }
                }
            }
            depList.Clear();
            depSet.Clear();
            queued.Clear();
            EventExportPreparationFinished?.Invoke();

            EventExportStarted?.Invoke();
            ProjectAssetContainer container = new ProjectAssetContainer(this, virtualFile, fileCollection.FetchAssets(), collections, options);

            for (int i = 0; i < collections.Count; i++)
            {
                IExportCollection collection = collections[i];
                container.CurrentCollection = collection;
                bool isExported = collection.Export(container, path);
                if (isExported)
                {
                    Logger.Log(LogType.Info, LogCategory.Export, $"'{collection.Name}' exported");
                }
                EventExportProgressUpdated?.Invoke(i, collections.Count);
            }
            EventExportFinished?.Invoke();
        }
示例#6
0
 public void Export(IExportContainer container, Object asset, string path, Action <IExportContainer, Object, string> callback)
 {
     throw new NotSupportedException("Need to export all scripts at once");
 }
 public bool IsHandle(Object asset, ExportOptions options)
 {
     return(true);
 }
示例#8
0
 public static bool AssetSelector(Object asset)
 {
     return(true);
 }
示例#9
0
 public override bool IsContains(Object asset)
 {
     return(m_scripts.ContainsKey(asset));
 }
示例#10
0
        public Object FindAsset(ClassIDType classID, string name)
        {
            Object asset = VirtualFile.FindAsset(classID, name);

            return(asset ?? File.FindAsset(classID, name));
        }
示例#11
0
 public void Export(IExportContainer container, Object asset, string path)
 {
     Export(container, asset, path, null);
 }
示例#12
0
        public Object FindAsset(ClassIDType classID)
        {
            Object asset = VirtualFile.FindAsset(classID);

            return(asset ?? File.FindAsset(classID));
        }
示例#13
0
        protected void ExportAsset(ProjectAssetContainer container, IAssetImporter importer, Object asset, string path, string name)
        {
            if (!DirectoryUtils.Exists(path))
            {
                DirectoryUtils.CreateVirtualDirectory(path);
            }

            string filePath = $"{Path.Combine(path, name)}.{asset.ExportExtension}";

            AssetExporter.Export(container, asset, filePath);
            Meta meta = new Meta(importer, asset.GUID);

            ExportMeta(container, meta, filePath);
        }
 public EngineGUID GetExportGUID(Object asset)
 {
     throw new NotSupportedException();
 }
示例#15
0
 public IExportCollection CreateCollection(VirtualSerializedFile virtualFile, Object asset)
 {
     return(new ScriptExportCollection(this, (MonoScript)asset));
 }
示例#16
0
 public override long GetExportID(Object asset)
 {
     return(GetMainExportID(asset));
 }
示例#17
0
 public bool Export(IExportContainer container, Object asset, string path)
 {
     throw new NotSupportedException("Need to export all scripts at once");
 }
示例#18
0
 public static long GetMainExportID(Object asset)
 {
     return(GetMainExportID((uint)asset.ClassID, 0));
 }
示例#19
0
 public AssetType ToExportType(Object asset)
 {
     return(AssetType.Meta);
 }
示例#20
0
 public static long GetMainExportID(Object asset, uint value)
 {
     return(GetMainExportID((uint)asset.ClassID, value));
 }
示例#21
0
 public void Export(IExportContainer container, Object asset, string path, Action <IExportContainer, Object, string> callback)
 {
     Export(container, asset, path);
     callback?.Invoke(container, asset, path);
 }
示例#22
0
 public abstract bool IsContains(Object asset);
 public override ExportPointer CreateExportPointer(Object asset, bool isLocal)
 {
     throw new NotSupportedException();
 }
示例#24
0
 public abstract long GetExportID(Object asset);
示例#25
0
 public AssetType ToExportType(Object asset)
 {
     ToUnknownExportType(asset.ClassID, out AssetType assetType);
     return(assetType);
 }
示例#26
0
 public abstract ExportPointer CreateExportPointer(Object asset, bool isLocal);
示例#27
0
 public IExportCollection CreateCollection(VirtualSerializedFile virtualFile, Object asset)
 {
     return(new AudioExportCollection(this, (AudioClip)asset));
 }
示例#28
0
        protected void ExportAsset(ProjectAssetContainer container, IAssetImporter importer, Object asset, string path, string name)
        {
            if (!DirectoryUtils.Exists(path))
            {
                DirectoryUtils.CreateVirtualDirectory(path);
            }

            string fullName   = $"{name}.{GetExportExtension(asset)}";
            string uniqueName = FileUtils.GetUniqueName(path, fullName, FileUtils.MaxFileNameLength - MetaExtension.Length);
            string filePath   = Path.Combine(path, uniqueName);

            AssetExporter.Export(container, asset, filePath);
            Meta meta = new Meta(importer, asset.GUID);

            ExportMeta(container, meta, filePath);
        }
示例#29
0
        protected virtual string AddExportExtension(string assetPath, Object asset)
        {
            var exportExtension = GetExportExtension(asset);

            return(string.IsNullOrWhiteSpace(exportExtension) ? assetPath : $"{assetPath}.{exportExtension}");
        }
 public bool IsContains(Object asset)
 {
     return(false);
 }