public long GetExportID(Object asset)
 {
     throw new NotSupportedException();
 }
 public bool IsHandle(Object asset)
 {
     return(true);
 }
Beispiel #3
0
 protected virtual string GetExportExtension(Object asset)
 {
     return(asset.ExportExtension);
 }
 public ManagerExportCollection(IAssetExporter assetExporter, Object asset) :
     this(assetExporter, (GlobalGameManager)asset)
 {
 }
Beispiel #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();
        }
Beispiel #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);
 }
Beispiel #8
0
 public static bool AssetSelector(Object asset)
 {
     return(true);
 }
Beispiel #9
0
 public override bool IsContains(Object asset)
 {
     return(m_scripts.ContainsKey(asset));
 }
Beispiel #10
0
        public Object FindAsset(ClassIDType classID, string name)
        {
            Object asset = VirtualFile.FindAsset(classID, name);

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

            return(asset ?? File.FindAsset(classID));
        }
Beispiel #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();
 }
Beispiel #15
0
 public IExportCollection CreateCollection(VirtualSerializedFile virtualFile, Object asset)
 {
     return(new ScriptExportCollection(this, (MonoScript)asset));
 }
Beispiel #16
0
 public override long GetExportID(Object asset)
 {
     return(GetMainExportID(asset));
 }
Beispiel #17
0
 public bool Export(IExportContainer container, Object asset, string path)
 {
     throw new NotSupportedException("Need to export all scripts at once");
 }
Beispiel #18
0
 public static long GetMainExportID(Object asset)
 {
     return(GetMainExportID((uint)asset.ClassID, 0));
 }
Beispiel #19
0
 public AssetType ToExportType(Object asset)
 {
     return(AssetType.Meta);
 }
Beispiel #20
0
 public static long GetMainExportID(Object asset, uint value)
 {
     return(GetMainExportID((uint)asset.ClassID, value));
 }
 public void Export(IExportContainer container, Object asset, string path, Action <IExportContainer, Object, string> callback)
 {
     Export(container, asset, path);
     callback?.Invoke(container, asset, path);
 }
Beispiel #22
0
 public abstract bool IsContains(Object asset);
 public override ExportPointer CreateExportPointer(Object asset, bool isLocal)
 {
     throw new NotSupportedException();
 }
Beispiel #24
0
 public abstract long GetExportID(Object asset);
 public AssetType ToExportType(Object asset)
 {
     ToUnknownExportType(asset.ClassID, out AssetType assetType);
     return(assetType);
 }
Beispiel #26
0
 public abstract ExportPointer CreateExportPointer(Object asset, bool isLocal);
 public IExportCollection CreateCollection(VirtualSerializedFile virtualFile, Object asset)
 {
     return(new AudioExportCollection(this, (AudioClip)asset));
 }
Beispiel #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);
        }
Beispiel #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);
 }