Skip to content

Commit a20a90d

Browse files
committed
add Texture & Model Overiview Report.
1 parent 52ae38e commit a20a90d

File tree

13 files changed

+788
-6
lines changed

13 files changed

+788
-6
lines changed

Assets/ResourceInfo/Src/Editor/ModelInfo.cs

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,27 @@ public class ModelInfo : BaseInfo
1212
public bool ImportMaterials;
1313
public bool ImportAnimation;
1414
public ModelImporterMeshCompression MeshCompression = ModelImporterMeshCompression.Off;
15+
public bool bHasUV;
16+
public bool bHasUV2;
17+
public bool bHasUV3;
18+
public bool bHasUV4;
19+
public bool bHasColor;
20+
public bool bHasNormal;
21+
public bool bHasTangent;
22+
public int vertexCount;
23+
public int triangleCount;
1524

1625
public static ModelInfo CreateModelInfo(string assetPath)
1726
{
1827
ModelInfo tInfo = null;
19-
if (!m_dictTexInfo.TryGetValue(assetPath, out tInfo))
28+
if (!m_dictModelInfo.TryGetValue(assetPath, out tInfo))
2029
{
2130
tInfo = new ModelInfo();
22-
m_dictTexInfo.Add(assetPath, tInfo);
31+
m_dictModelInfo.Add(assetPath, tInfo);
2332
}
2433
ModelImporter tImport = AssetImporter.GetAtPath(assetPath) as ModelImporter;
34+
Mesh mesh = AssetDatabase.LoadAssetAtPath<Mesh>(assetPath);
35+
2536
if (tImport == null)
2637
return null;
2738

@@ -32,6 +43,16 @@ public static ModelInfo CreateModelInfo(string assetPath)
3243
tInfo.ImportAnimation = tImport.importAnimation;
3344
tInfo.MeshCompression = tImport.meshCompression;
3445

46+
tInfo.bHasUV = mesh.uv != null && mesh.uv.Length != 0;
47+
tInfo.bHasUV2 = mesh.uv2 != null && mesh.uv2.Length != 0;
48+
tInfo.bHasUV3 = mesh.uv3 != null && mesh.uv3.Length != 0;
49+
tInfo.bHasUV4 = mesh.uv4 != null && mesh.uv4.Length != 0;
50+
tInfo.bHasColor = mesh.colors != null && mesh.colors.Length != 0;
51+
tInfo.bHasNormal = mesh.normals != null && mesh.normals.Length != 0;
52+
tInfo.bHasTangent = mesh.tangents != null && mesh.tangents.Length != 0;
53+
tInfo.vertexCount = mesh.vertexCount;
54+
tInfo.triangleCount = mesh.triangles.Length / 3;
55+
3556
tInfo.MemSize = EditorTool.CalculateModelSizeBytes(assetPath);
3657

3758
if (m_loadCount % 256 == 0)
@@ -43,6 +64,6 @@ public static ModelInfo CreateModelInfo(string assetPath)
4364
}
4465

4566
private static int m_loadCount = 0;
46-
private static Dictionary<string, ModelInfo> m_dictTexInfo = new Dictionary<string, ModelInfo>();
67+
private static Dictionary<string, ModelInfo> m_dictModelInfo = new Dictionary<string, ModelInfo>();
4768
}
4869
}

Assets/ResourceInfo/Src/Editor/TextureInfo.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ public class TextureInfo : BaseInfo
2828
public TextureWrapMode WrapMode;
2929
public FilterMode FilterMode;
3030
public TextureImporterShape ImportShape;
31+
public int AndroidSize;
32+
public int IosSize;
33+
public int Width;
34+
public int Height;
3135

3236
public static TextureInfo CreateTextureInfo(string assetPath)
3337
{
@@ -53,9 +57,11 @@ public static TextureInfo CreateTextureInfo(string assetPath)
5357
tInfo.AndroidFormat = settingAndroid.format;
5458
TextureImporterPlatformSettings settingIos = tImport.GetPlatformTextureSettings(EditorConst.PlatformIos);
5559
tInfo.IosFormat = settingIos.format;
56-
tInfo.MemSize = Mathf.Max(
57-
EditorTool.CalculateTextureSizeBytes(texture, tInfo.AndroidFormat),
58-
EditorTool.CalculateTextureSizeBytes(texture, tInfo.IosFormat));
60+
tInfo.Width = texture.width;
61+
tInfo.Height = texture.height;
62+
tInfo.AndroidSize = EditorTool.CalculateTextureSizeBytes(texture, tInfo.AndroidFormat);
63+
tInfo.IosSize = EditorTool.CalculateTextureSizeBytes(texture, tInfo.IosFormat);
64+
tInfo.MemSize = Mathf.Max(tInfo.AndroidSize, tInfo.IosSize);
5965

6066
if (Selection.activeObject != texture)
6167
{

Assets/ResourceOverview.meta

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/ResourceOverview/Src.meta

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/ResourceOverview/Src/Editor.meta

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/ResourceOverview/Src/Editor/Model.meta

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)