UniVRM/UniHumanoid/Scripts/Editor/bvhAssetPostprocessor.cs
ousttrue e115c65576 Merge commit '8a35345bb0f3b60fe23552e2f04b7f9d55f86f8f' as 'UniHumanoid'
Co-authored-by: ousttrue <oustrrue@gmail.com>
Co-authored-by: ousttrue <ousttrrue@gmail.com>
Co-authored-by: ousttrue <ousttrue@gmail.com>
Co-authored-by: yutopp <yutopp@gmail.com>
2018-12-28 21:10:59 +09:00

37 lines
1.1 KiB
C#

using System;
using System.IO;
using UnityEditor;
using UnityEngine;
namespace UniHumanoid
{
public class bvhAssetPostprocessor : AssetPostprocessor
{
static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
{
foreach (string path in importedAssets)
{
var ext = Path.GetExtension(path).ToLower();
if (ext == ".bvh")
{
Debug.LogFormat("ImportBvh: {0}", path);
var context = new BvhImporterContext();
try
{
context.Parse(path);
context.Load();
context.SaveAsAsset();
context.Destroy(false);
}
catch(Exception ex)
{
Debug.LogError(ex);
context.Destroy(true);
}
}
}
}
}
}