private void ExportAsset(ProjectAssetContainer container, NamedObject asset, string path) { NativeFormatImporter importer = new NativeFormatImporter(container.ExportLayout); importer.MainObjectFileID = GetExportID(asset); ExportAsset(container, importer, asset, path, asset.Name); }
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); }
public override bool Export(ProjectAssetContainer container, string dirPath) { string subPath = Path.Combine(dirPath, ProjectSettingsName); string fileName = $"{Asset.ExportPath}.asset"; string filePath = Path.Combine(subPath, fileName); if (!DirectoryUtils.Exists(subPath)) { DirectoryUtils.CreateVirtualDirectory(subPath); } ExportInner(container, filePath); return(true); }
public override bool Export(ProjectAssetContainer container, string dirPath) { string subPath; string fileName; if (container.TryGetResourcePathFromAssets(Assets, out Object asset, out string subResourcePath)) { string resourcePath = Path.Combine(dirPath, $"{subResourcePath}.{GetExportExtension(asset)}"); subPath = Path.GetDirectoryName(resourcePath); string resFileName = Path.GetFileName(resourcePath); #warning TODO: combine assets with the same res path into one big asset // Unity distinguish assets with non unique path by its type, but file system doesn't support it fileName = GetUniqueFileName(subPath, resFileName); }
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 bool Export(ProjectAssetContainer container, string dirPath) { return(false); }
public bool Export(ProjectAssetContainer container, string dirPath) { Logger.Log(LogType.Warning, LogCategory.Export, $"Unable to export asset {Name}"); return(false); }
public abstract bool Export(ProjectAssetContainer container, string dirPath);
protected override bool ExportInner(ProjectAssetContainer container, string filePath) { return(AssetExporter.Export(container, Assets.Select(t => t.Convert(container)), 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.CreateVirtualDirectory(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.ExportPath}.asset"; filePath = Path.Combine(subPath, fileName); AssetExporter.Export(container, NavMeshProjectSettings, filePath); } if (NetworkManager != null) { fileName = $"{NetworkManager.ExportPath}.asset"; filePath = Path.Combine(subPath, fileName); AssetExporter.Export(container, NetworkManager, filePath); } if (Physics2DSettings != null) { fileName = $"{Physics2DSettings.ExportPath}.asset"; filePath = Path.Combine(subPath, fileName); AssetExporter.Export(container, Physics2DSettings, filePath); } if (UnityConnectSettings != null) { fileName = $"{UnityConnectSettings.ExportPath}.asset"; filePath = Path.Combine(subPath, fileName); AssetExporter.Export(container, UnityConnectSettings, filePath); } if (QualitySettings != null) { fileName = $"{QualitySettings.ExportPath}.asset"; filePath = Path.Combine(subPath, fileName); AssetExporter.Export(container, QualitySettings, filePath); } fileName = $"ProjectVersion.txt"; filePath = Path.Combine(subPath, fileName); using (Stream fileStream = FileUtils.CreateVirtualFile(filePath)) { using (StreamWriter writer = new InvariantStreamWriter(fileStream, new UTF8Encoding(false))) { writer.Write("m_EditorVersion: 2017.3.0f3"); } } return(true); }
private void ExportAsset(ProjectAssetContainer container, NamedObject asset, string path) { NativeFormatImporter importer = new NativeFormatImporter(asset); ExportAsset(container, importer, asset, path, asset.Name); }
public override bool Export(ProjectAssetContainer container, string dirPath) => false;