mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-09-08 03:48:19 -05:00
update export package menu
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
@@ -35,6 +37,32 @@ namespace VRM
|
||||
return path;
|
||||
}
|
||||
|
||||
static IEnumerable<string> EnumerateFiles(string path)
|
||||
{
|
||||
if (Path.GetFileName(path).StartsWith(".git"))
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
|
||||
if (Directory.Exists(path))
|
||||
{
|
||||
foreach(var child in Directory.GetFileSystemEntries(path))
|
||||
{
|
||||
foreach(var x in EnumerateFiles(child))
|
||||
{
|
||||
yield return x;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Path.GetExtension(path).ToLower() != ".meta")
|
||||
{
|
||||
yield return path.Replace("\\", "/");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if VRM_DEVELOP
|
||||
[MenuItem("VRM/Export unitypackage")]
|
||||
#endif
|
||||
@@ -48,7 +76,10 @@ namespace VRM
|
||||
return;
|
||||
}
|
||||
|
||||
AssetDatabase.ExportPackage("Assets/VRM", path, ExportPackageOptions.Recurse);
|
||||
var files = EnumerateFiles("Assets/VRM")
|
||||
.ToArray();
|
||||
|
||||
AssetDatabase.ExportPackage(files, path, ExportPackageOptions.Interactive);
|
||||
Debug.LogFormat("exported: {0}", path);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user