From a10eea6e4ce647061813519d5b0ea496f29495b9 Mon Sep 17 00:00:00 2001
From: leonard Wu <364452445@qq.com>
Date: 星期四, 09 八月 2018 09:47:08 +0800
Subject: [PATCH] 同步最新svn内容
---
Assets/Editor/Tool/FBXCheck.cs | 150 +++++++++++++++++++++++++-------------------------
1 files changed, 75 insertions(+), 75 deletions(-)
diff --git a/Assets/Editor/Tool/FBXCheck.cs b/Assets/Editor/Tool/FBXCheck.cs
index 4f47403..3a77001 100644
--- a/Assets/Editor/Tool/FBXCheck.cs
+++ b/Assets/Editor/Tool/FBXCheck.cs
@@ -5,82 +5,82 @@
using System;
using System.IO;
-public class FBXCheck
-{
-
- static List<string> logs = new List<string>();
-
-
+public class FBXCheck
+{
+
+ static List<string> logs = new List<string>();
+
+
[MenuItem("Assets/瑙掕壊銆丯PC 妯″瀷妫�鏌�")]
- public static void LoadMesh()
- {
- var assets = Selection.GetFiltered(typeof(UnityEngine.Object), SelectionMode.DeepAssets);
-
- var total = assets.Length;
- var index = 0;
-
- var meshCount = 0;
- var normalCount = 0;
- var errorCount = 0;
-
- logs.Clear();
- logs.Add(StringUtility.Contact("搴忓彿", "\t", "璧勬簮鍚�", "\t", "椤剁偣鏁�", "\t", "涓夎闈�"));
-
- try
- {
- foreach (var asset in assets)
- {
- var assetPath = AssetDatabase.GetAssetPath(asset);
- if (!assetPath.Contains("@"))
- {
- var mesh = AssetDatabase.LoadAssetAtPath(assetPath, typeof(Mesh));
- if (mesh != null)
- {
- var count = ((Mesh)mesh).vertices.Length;
- var triangles = ((Mesh)mesh).triangles.Length / 3;
-
- var countStandard = 2500;
- var trianglesStandard = 2600;
-
- if (mesh.name.Contains("M") || mesh.name.Contains("N"))
- {
- countStandard = 2000;
- trianglesStandard = 2000;
- }
-
- if (count > countStandard || triangles > trianglesStandard)
- {
- Debug.LogErrorFormat("{0}鏂囦欢-->:椤剁偣鏁帮細{1},涓夎闈㈡暟锛歿2}", assetPath, count, triangles);
- errorCount++;
- }
- else
- {
- Debug.LogFormat("{0}鏂囦欢-->:椤剁偣鏁帮細{1},涓夎闈㈡暟锛歿2}", assetPath, count, triangles);
- normalCount++;
- }
-
- logs.Add(StringUtility.Contact(logs.Count, "\t", assetPath, "\t", count, "\t", triangles));
- meshCount++;
- }
- }
-
- index++;
-
- EditorUtility.DisplayProgressBar("妫�鏌esh鏂囦欢", StringUtility.Contact("妫�鏌ヨ祫婧愭枃浠讹細", asset.name, "(", index, "/", total, ")"), (float)index / total);
- }
-
- Debug.LogFormat("妫�鏌esh鏂囦欢缁撴潫锛屽叡妫�鏌0}涓狹esh鏂囦欢锛屽叾涓瓄1}涓枃浠舵甯革紝{2}涓枃浠剁枒浼煎紓甯�", meshCount, normalCount, errorCount);
- }
- catch (Exception ex)
- {
- Debug.LogError(ex);
- }
- finally
- {
- File.WriteAllLines(Application.dataPath + "/FbxCheckResult.txt", logs.ToArray());
- EditorUtility.ClearProgressBar();
- }
-
+ public static void LoadMesh()
+ {
+ var assets = Selection.GetFiltered(typeof(UnityEngine.Object), SelectionMode.DeepAssets);
+
+ var total = assets.Length;
+ var index = 0;
+
+ var meshCount = 0;
+ var normalCount = 0;
+ var errorCount = 0;
+
+ logs.Clear();
+ logs.Add(StringUtility.Contact("搴忓彿", "\t", "璧勬簮鍚�", "\t", "椤剁偣鏁�", "\t", "涓夎闈�"));
+
+ try
+ {
+ foreach (var asset in assets)
+ {
+ var assetPath = AssetDatabase.GetAssetPath(asset);
+ if (!assetPath.Contains("@"))
+ {
+ var mesh = AssetDatabase.LoadAssetAtPath(assetPath, typeof(Mesh));
+ if (mesh != null)
+ {
+ var count = ((Mesh)mesh).vertices.Length;
+ var triangles = ((Mesh)mesh).triangles.Length / 3;
+
+ var countStandard = 2500;
+ var trianglesStandard = 2600;
+
+ if (mesh.name.Contains("M") || mesh.name.Contains("N"))
+ {
+ countStandard = 2000;
+ trianglesStandard = 2000;
+ }
+
+ if (count > countStandard || triangles > trianglesStandard)
+ {
+ Debug.LogErrorFormat("{0}鏂囦欢-->:椤剁偣鏁帮細{1},涓夎闈㈡暟锛歿2}", assetPath, count, triangles);
+ errorCount++;
+ }
+ else
+ {
+ Debug.LogFormat("{0}鏂囦欢-->:椤剁偣鏁帮細{1},涓夎闈㈡暟锛歿2}", assetPath, count, triangles);
+ normalCount++;
+ }
+
+ logs.Add(StringUtility.Contact(logs.Count, "\t", assetPath, "\t", count, "\t", triangles));
+ meshCount++;
+ }
+ }
+
+ index++;
+
+ EditorUtility.DisplayProgressBar("妫�鏌esh鏂囦欢", StringUtility.Contact("妫�鏌ヨ祫婧愭枃浠讹細", asset.name, "(", index, "/", total, ")"), (float)index / total);
+ }
+
+ Debug.LogFormat("妫�鏌esh鏂囦欢缁撴潫锛屽叡妫�鏌0}涓狹esh鏂囦欢锛屽叾涓瓄1}涓枃浠舵甯革紝{2}涓枃浠剁枒浼煎紓甯�", meshCount, normalCount, errorCount);
+ }
+ catch (Exception ex)
+ {
+ Debug.LogError(ex);
+ }
+ finally
+ {
+ File.WriteAllLines(Application.dataPath + "/FbxCheckResult.txt", logs.ToArray());
+ EditorUtility.ClearProgressBar();
+ }
+
}
}
--
Gitblit v1.8.0