spine资源检查
This commit is contained in:
parent
a3bfc439fc
commit
45b92fde2b
@ -0,0 +1,21 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BFEditor.Resource
|
||||
{
|
||||
public class BFSpineChecker : BFMainChecker
|
||||
{
|
||||
protected override GUIContent InitGUIContent()
|
||||
{
|
||||
return new GUIContent("spine", BFEditorUtils.GetSystemIcon(typeof(Spine.Unity.SkeletonDataAsset)));
|
||||
}
|
||||
|
||||
protected override List<BFSubChecker> InitSubCheckers()
|
||||
{
|
||||
return new List<BFSubChecker>()
|
||||
{
|
||||
new SpineSubChecker(),
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e9c0f8968ad84174b9bc2d446ec36e7b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e339cd1033ed11b4f9e49a9760fef963
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,71 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using System.IO;
|
||||
|
||||
namespace BFEditor.Resource
|
||||
{
|
||||
public class SpineSubChecker : BFSubChecker
|
||||
{
|
||||
Dictionary<string, bool> mustNeedAni = new Dictionary<string, bool>(){
|
||||
{"born", true},
|
||||
{"death", true},
|
||||
{"idle", true},
|
||||
{"suffer", true},
|
||||
{"vertigo", true},
|
||||
{"frozen", true},
|
||||
// {"attack", true},
|
||||
};
|
||||
public override string InitName()
|
||||
{
|
||||
return "Spine";
|
||||
}
|
||||
|
||||
public override bool DoCheck(string assetPath, AssetImporter assetImporter, Object assetObj)
|
||||
{
|
||||
bool passed = true;
|
||||
if (assetPath.Contains("characters"))
|
||||
{
|
||||
var skeletonDataAsset = AssetDatabase.LoadAssetAtPath<Spine.Unity.SkeletonDataAsset>(assetPath);
|
||||
var animationState = skeletonDataAsset.GetAnimationStateData();
|
||||
Dictionary<string, bool> haveAni = new Dictionary<string, bool>();
|
||||
foreach (var animation in animationState.SkeletonData.Animations)
|
||||
{
|
||||
haveAni[animation.Name] = true;
|
||||
}
|
||||
foreach (var key in mustNeedAni.Keys)
|
||||
{
|
||||
if (!haveAni.ContainsKey(key))
|
||||
{
|
||||
currentBadRes.AddBadLog("没有动画" + key);
|
||||
passed = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
string floderPath = Path.GetDirectoryName(assetPath);
|
||||
string[] paths = Directory.GetFiles(floderPath);
|
||||
int fileCount = 0;
|
||||
foreach (string unitPath in paths)
|
||||
{
|
||||
if (Path.GetExtension(unitPath) != ".meta")
|
||||
{
|
||||
fileCount++;
|
||||
}
|
||||
}
|
||||
if (fileCount > 6) // 只能有六个文件
|
||||
{
|
||||
currentBadRes.AddBadLog("文件夹文件数量异常");
|
||||
passed = false;
|
||||
}
|
||||
|
||||
return passed;
|
||||
}
|
||||
|
||||
protected override List<string> GetAssetPathList()
|
||||
{
|
||||
return BFEditorUtils.GetAssetPathsWithSuffix(ResourceProcessConfig.SPINE_TEXTURE_PATH, ".asset", "skeletondata");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 45556e9bea3af1b4b96c6e7a1fec9552
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,25 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System.IO;
|
||||
|
||||
namespace BFEditor.Resource
|
||||
{
|
||||
public class BFSpineImporter : BFMainImporter
|
||||
{
|
||||
protected override List<BFSubImporter> InitSubImporters()
|
||||
{
|
||||
return new List<BFSubImporter>()
|
||||
{
|
||||
new BFSpineSubImporter(),
|
||||
};
|
||||
}
|
||||
|
||||
public override bool NeedDeal(string assetPath)
|
||||
{
|
||||
var suffix = Path.GetExtension(assetPath);
|
||||
return suffix == ".asset";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aec487ce03f96b141b9363cbb898e894
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f5bc4bc411f27624fa3eb792290cbd09
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,21 @@
|
||||
using System.IO;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
namespace BFEditor.Resource
|
||||
{
|
||||
public class BFSpineSubImporter : BFSubImporter
|
||||
{
|
||||
public override bool NeedDeal(string assetPath)
|
||||
{
|
||||
return assetPath.Contains(ResourceProcessConfig.SPINE_TEXTURE_PATH);
|
||||
}
|
||||
|
||||
protected override void DoImport(string assetPath, AssetImporter assetImporter, bool isFix)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 95690334d8b9a8b4b82d428441cc2095
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -133,6 +133,7 @@ namespace BFEditor.Resource
|
||||
new BFPrefabImporter(),
|
||||
new BFMaterialImporter(),
|
||||
new BFShaderImporter(),
|
||||
new BFSpineImporter(),
|
||||
};
|
||||
|
||||
//资源白名单 检查时过滤
|
||||
@ -201,6 +202,7 @@ namespace BFEditor.Resource
|
||||
new BFAudioChecker(),
|
||||
new BFMaterialChecker(),
|
||||
new BFShaderChecker(),
|
||||
new BFSpineChecker(),
|
||||
};
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -285,7 +285,7 @@ namespace BFEditor
|
||||
return string.Format("{0}分{1}秒", minus, second);
|
||||
}
|
||||
|
||||
public static List<string> GetAssetPathsWithSuffix(string path, string suffix)
|
||||
public static List<string> GetAssetPathsWithSuffix(string path, string suffix, string containsStr = "")
|
||||
{
|
||||
var result = new List<string>();
|
||||
var fileInfos = new List<FileInfo>();
|
||||
@ -295,8 +295,18 @@ namespace BFEditor
|
||||
{
|
||||
var resourcePath = "Assets" + fileInfos[i].FullName.Replace("\\", "/").Remove(0, Application.dataPath.Length);
|
||||
resourcePath = resourcePath.Replace('\\', '/');
|
||||
if (containsStr == "")
|
||||
{
|
||||
result.Add(resourcePath);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (fileInfos[i].FullName.Contains(containsStr))
|
||||
{
|
||||
result.Add(resourcePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user