Skip to content

Commit

Permalink
Merge pull request #171 from dwango/skip_import_in_streamingassets
Browse files Browse the repository at this point in the history
Skip AssetPostProcessor when file in StreamingAssets folder. #166
  • Loading branch information
ousttrue authored Feb 4, 2019
2 parents 0e5ea32 + cb91f66 commit 99a150a
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Assets/VRM/UniGLTF/Editor/gltfAssetPostprocessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ static void OnPostprocessAllAssets(string[] importedAssets,
{
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)
{
Expand Down
13 changes: 13 additions & 0 deletions Assets/VRM/UniGLTF/Scripts/IO/UnityPath.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,19 @@ public bool IsUnderAssetsFolder
}
}

public bool IsStreamingAsset
{
get
{
if (IsNull)
{
return false;
}

return FullPath.StartsWith(Application.streamingAssetsPath + "/");
}
}

public string FileNameWithoutExtension
{
get { return Path.GetFileNameWithoutExtension(Value); }
Expand Down
13 changes: 13 additions & 0 deletions Assets/VRM/UniHumanoid/Editor/bvhAssetPostprocessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
{
Expand Down
7 changes: 7 additions & 0 deletions Assets/VRM/UniVRM/Editor/Format/vrmAssetPostprocessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Linq;
using UniGLTF;
using UnityEditor;
using UnityEngine;


namespace VRM
Expand All @@ -14,6 +15,12 @@ static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAsse
{
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")
{
Expand Down

0 comments on commit 99a150a

Please sign in to comment.