UniVRM/Scripts/Editor/bvhAssetPostprocessor.cs
ousttrue 8a35345bb0 Squashed 'UniHumanoid/' content from commit 9af6c0d
git-subtree-dir: UniHumanoid
git-subtree-split: 9af6c0d3995ca8886c1ad87429dd9f28c7b4375d
2018-12-28 21:08:56 +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);
}
}
}
}
}
}