Skip AssetPostProcessor when file in StreamingAssets folder. #166

This commit is contained in:
ousttrue
2019-02-04 15:42:26 +09:00
parent 4d94ca9751
commit cb91f66969
4 changed files with 39 additions and 0 deletions

View File

@@ -15,6 +15,12 @@ namespace UniGLTF
{
foreach (string path in importedAssets)
{
if (UnityPath.FromUnityPath(path).IsStreamingAsset)
{
Debug.LogFormat("Skip StreamingAssets: {0}", path);
continue;
}
var ext = Path.GetExtension(path).ToLower();
switch (ext)
{

View File

@@ -44,6 +44,19 @@ namespace UniGLTF
}
}
public bool IsStreamingAsset
{
get
{
if (IsNull)
{
return false;
}
return FullPath.StartsWith(Application.streamingAssetsPath + "/");
}
}
public string FileNameWithoutExtension
{
get { return Path.GetFileNameWithoutExtension(Value); }

View File

@@ -8,10 +8,23 @@ namespace UniHumanoid
{
public class bvhAssetPostprocessor : AssetPostprocessor
{
static bool IsStreamingAsset(string path)
{
var baseFullPath = Path.GetFullPath(Application.dataPath + "/..").Replace("\\", "/");
path = Path.Combine(baseFullPath, path).Replace("\\", "/");
return path.StartsWith(Application.streamingAssetsPath + "/");
}
static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
{
foreach (string path in importedAssets)
{
if (IsStreamingAsset(path))
{
Debug.LogFormat("Skip StreamingAssets: {0}", path);
continue;
}
var ext = Path.GetExtension(path).ToLower();
if (ext == ".bvh")
{

View File

@@ -3,6 +3,7 @@ using System.IO;
using System.Linq;
using UniGLTF;
using UnityEditor;
using UnityEngine;
namespace VRM
@@ -14,6 +15,12 @@ namespace VRM
{
foreach (string path in importedAssets)
{
if (UnityPath.FromUnityPath(path).IsStreamingAsset)
{
Debug.LogFormat("Skip StreamingAssets: {0}", path);
continue;
}
var ext = Path.GetExtension(path).ToLower();
if (ext == ".vrm")
{