public bool Run(BuildPipeline.BuildContext context) { var assetEntities = AssetExporter.Export(context); if (assetEntities.Count == 0) { return(true); } using (var tmpWorld = new World(AssetsScene.Guid.ToString("N"))) { // Copy asset entities into temporary world foreach (var pair in assetEntities) { CopyEntity(pair.Value, context.World, tmpWorld); } // Export assets scene var outputFile = context.DataDirectory.GetFile(tmpWorld.Name); if (!ExportWorld(outputFile, context.Project, AssetsScene.Path, tmpWorld)) { return(false); } // Update manifest context.Manifest.Add(AssetsScene.Guid, AssetsScene.Path, outputFile.AsEnumerable()); } return(true); }
public override bool Export(ProjectAssetContainer container, string dirPath) { string subPath = Path.Combine(dirPath, ProjectSettingsName); string fileName = $"{EditorBuildSettings.ClassID.ToString()}.asset"; string filePath = Path.Combine(subPath, fileName); if (!DirectoryUtils.Exists(subPath)) { DirectoryUtils.CreateDirectory(subPath); } BuildSettings asset = (BuildSettings)Asset; IEnumerable <Scene> scenes = asset.Scenes.Select(t => new Scene(t, container.SceneNameToGUID(t))); EditorBuildSettings.Initialize(scenes); AssetExporter.Export(container, EditorBuildSettings, filePath); fileName = $"{EditorSettings.ClassID.ToString()}.asset"; filePath = Path.Combine(subPath, fileName); AssetExporter.Export(container, EditorSettings, filePath); fileName = $"ProjectVersion.txt"; filePath = Path.Combine(subPath, fileName); using (FileStream file = FileUtils.Create(filePath)) { using (StreamWriter writer = new StreamWriter(file)) { writer.Write("m_EditorVersion: 2017.3.0f3"); } } return(true); }
public override bool Export(ProjectAssetContainer container, string dirPath) { string folderPath = Path.Combine(dirPath, Object.AssetsKeyWord, OcclusionCullingSettings.SceneKeyWord); string sceneSubPath = GetSceneName(container); string fileName = $"{sceneSubPath}.unity"; string filePath = Path.Combine(folderPath, fileName); folderPath = Path.GetDirectoryName(filePath); if (!DirectoryUtils.Exists(folderPath)) { DirectoryUtils.CreateVirtualDirectory(folderPath); } AssetExporter.Export(container, Components, filePath); SceneImporter sceneImporter = new SceneImporter(); Meta meta = new Meta(sceneImporter, GUID); ExportMeta(container, meta, filePath); string sceneName = Path.GetFileName(sceneSubPath); string subFolderPath = Path.Combine(folderPath, sceneName); if (OcclusionCullingData != null) { OcclusionCullingData.Initialize(container, m_occlusionCullingSettings); ExportAsset(container, OcclusionCullingData, subFolderPath); } return(true); }
protected override string ExportInner(ProjectAssetContainer container, string filePath) { if (m_convert) { string dirPath = Path.GetDirectoryName(filePath); string fileName = Path.GetFileNameWithoutExtension(filePath); filePath = $"{Path.Combine(dirPath, fileName)}.png"; } AssetExporter.Export(container, Asset, filePath); return(filePath); }
public override bool Export(ProjectAssetContainer container, string dirPath) { if (m_export.Count == 0) { return(false); } string scriptFolder = m_export[0].ExportPath; string scriptPath = Path.Combine(dirPath, scriptFolder); AssetExporter.Export(container, m_export, scriptPath, OnScriptExported); return(true); }
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); }
protected override string ExportInner(ProjectAssetContainer container, string filePath) { AudioClip audioClip = (AudioClip)Asset; if (AudioAssetExporter.IsSupported(audioClip)) { string dir = Path.GetDirectoryName(filePath); string newName = $"{Path.GetFileNameWithoutExtension(filePath)}.wav"; filePath = Path.Combine(dir, newName); } AssetExporter.Export(container, Asset, filePath); return(filePath); }
protected void ExportAsset(ProjectAssetContainer container, AssetImporter 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(asset.GUID, importer); ExportMeta(container, meta, filePath); }
public override bool Export(ProjectAssetContainer container, string dirPath) { string folderPath = Path.Combine(dirPath, Object.AssetsKeyword, OcclusionCullingSettings.SceneKeyword); string sceneSubPath = GetSceneName(container); string fileName = $"{sceneSubPath}.unity"; string filePath = Path.Combine(folderPath, fileName); if (IsDuplicate(container)) { if (FileUtils.Exists(filePath)) { Logger.Log(LogType.Warning, LogCategory.Export, $"Duplicate scene '{sceneSubPath}' has been found. Skipping"); return(false); } } folderPath = Path.GetDirectoryName(filePath); if (!DirectoryUtils.Exists(folderPath)) { DirectoryUtils.CreateVirtualDirectory(folderPath); } AssetExporter.Export(container, Components.Select(t => t.Convert(container)), filePath); DefaultImporter sceneImporter = new DefaultImporter(container.ExportLayout); Meta meta = new Meta(GUID, sceneImporter); ExportMeta(container, meta, filePath); string sceneName = Path.GetFileName(sceneSubPath); string subFolderPath = Path.Combine(folderPath, sceneName); if (OcclusionCullingData != null) { OcclusionCullingData.Initialize(container, m_occlusionCullingSettings); ExportAsset(container, OcclusionCullingData, subFolderPath); } return(true); }
protected override bool ExportInner(ProjectAssetContainer container, string filePath) { return(AssetExporter.Export(container, Asset, filePath)); }
public override bool Export(ProjectAssetContainer container, string dirPath) { string subPath = Path.Combine(dirPath, ProjectSettingsName); string fileName = $"{EditorBuildSettings.ClassID.ToString()}.asset"; string filePath = Path.Combine(subPath, fileName); if (!DirectoryUtils.Exists(subPath)) { DirectoryUtils.CreateDirectory(subPath); } BuildSettings asset = (BuildSettings)Asset; IEnumerable <Scene> scenes = asset.Scenes.Select(t => new Scene(t, container.SceneNameToGUID(t))); EditorBuildSettings.Initialize(scenes); AssetExporter.Export(container, EditorBuildSettings, filePath); fileName = $"{EditorSettings.ClassID.ToString()}.asset"; filePath = Path.Combine(subPath, fileName); AssetExporter.Export(container, EditorSettings, filePath); if (NavMeshProjectSettings != null) { fileName = $"{NavMeshProjectSettings.ExportName}.asset"; filePath = Path.Combine(subPath, fileName); AssetExporter.Export(container, NavMeshProjectSettings, filePath); } if (NetworkManager != null) { fileName = $"{NetworkManager.ExportName}.asset"; filePath = Path.Combine(subPath, fileName); AssetExporter.Export(container, NetworkManager, filePath); } if (Physics2DSettings != null) { fileName = $"{Physics2DSettings.ExportName}.asset"; filePath = Path.Combine(subPath, fileName); AssetExporter.Export(container, Physics2DSettings, filePath); } if (UnityConnectSettings != null) { fileName = $"{UnityConnectSettings.ExportName}.asset"; filePath = Path.Combine(subPath, fileName); AssetExporter.Export(container, UnityConnectSettings, filePath); } if (QualitySettings != null) { fileName = $"{QualitySettings.ExportName}.asset"; filePath = Path.Combine(subPath, fileName); AssetExporter.Export(container, QualitySettings, filePath); } fileName = $"ProjectVersion.txt"; filePath = Path.Combine(subPath, fileName); using (FileStream file = FileUtils.Create(filePath)) { using (StreamWriter writer = new InvariantStreamWriter(file, Encoding.UTF8)) { writer.Write("m_EditorVersion: 2017.3.0f3"); } } return(true); }
protected override bool ExportInner(ProjectAssetContainer container, string filePath) { return(AssetExporter.Export(container, Assets.Select(t => t.Convert(container)), filePath)); }
protected virtual string ExportInner(ProjectAssetContainer container, string filePath) { AssetExporter.Export(container, Asset, filePath); return(filePath); }
protected override string ExportInner(ProjectAssetContainer container, string filePath) { AssetExporter.Export(container, Assets, filePath); return(filePath); }