Some minor fixes

This commit is contained in:
VaDiM
2026-08-01 15:12:22 +03:00
parent 9f91ea667c
commit 175dd519b4
4 changed files with 28 additions and 25 deletions
+17 -16
View File
@@ -40,18 +40,18 @@ namespace AssetStudio
{
private readonly List<MeshData> m_MeshData;
private readonly int m_VertexCount;
public readonly List<uint> IndexBufferList;
private readonly List<uint> indexBufferList;
public LOD(ObjectReader reader)
{
m_MeshData = new List<MeshData>();
IndexBufferList = new List<uint>();
indexBufferList = new List<uint>();
var meshDataCount = reader.ReadInt32();
for (var i = 0; i < meshDataCount; i++)
{
var meshData = new MeshData(reader);
m_MeshData.Add(meshData);
IndexBufferList.AddRange(meshData.IndexBufferList);
indexBufferList.AddRange(meshData.IndexBufferList);
}
if (reader.version < (1, 5))
@@ -64,7 +64,7 @@ namespace AssetStudio
}
}
public List<SubMesh> ConvertToSubMeshes()
public List<SubMesh> GetSubMeshes()
{
var subMeshList = new List<SubMesh>(m_MeshData.Count);
foreach (var meshData in m_MeshData)
@@ -79,6 +79,11 @@ namespace AssetStudio
}
return subMeshList;
}
public uint[] GetIndexBuffer()
{
return indexBufferList.ToArray();
}
}
public class MinMaxAABB
@@ -552,23 +557,19 @@ namespace AssetStudio
{
if (version < 2) //2.0 down
{
LOD lod0 = null;
var m_LODDataCount = reader.ReadInt32();
for (var i = 0; i < m_LODDataCount; i++)
{
if (i == 0)
lod0 = new LOD(reader);
else
_ = new LOD(reader);
}
if (lod0 == null)
if (m_LODDataCount <= 0)
{
Logger.Warning("Can't find lod0 mesh data");
return;
}
m_IndexBuffer = lod0.IndexBufferList.ToArray();
m_SubMeshes = lod0.ConvertToSubMeshes();
var lod0 = new LOD(reader);
for (var i = 1; i < m_LODDataCount; i++)
{
_ = new LOD(reader);
}
m_IndexBuffer = lod0.GetIndexBuffer();
m_SubMeshes = lod0.GetSubMeshes();
}
else //2.0 and up
{
+3 -3
View File
@@ -212,14 +212,14 @@ namespace AssetStudio
return dataHash;
}
// https://docs.unity3d.com/2023.3/Documentation/Manual/class-TextureImporterOverride.html
// https://docs.unity3d.com/6000.0/Documentation/Manual/texture-formats-reference.html
private int GetImageDataSize(TextureFormat textureFormat)
{
var imgDataSize = m_Width * m_Height;
switch (textureFormat)
{
// https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_astc/
case TextureFormat.ASTC_RGBA_5x5:
// https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_astc/
imgDataSize = (int)(MathF.Floor((m_Width + 4) / 5f) * MathF.Floor((m_Height + 4) / 5f) * 16);
break;
case TextureFormat.ASTC_RGBA_6x6:
@@ -272,4 +272,4 @@ namespace AssetStudio
return imgDataSize;
}
}
}
}
+3 -2
View File
@@ -313,8 +313,9 @@
this.parseByTypetreeToolStripMenuItem.Name = "parseByTypetreeToolStripMenuItem";
this.parseByTypetreeToolStripMenuItem.Size = new System.Drawing.Size(241, 22);
this.parseByTypetreeToolStripMenuItem.Text = "Parse assets using their typetree";
this.parseByTypetreeToolStripMenuItem.ToolTipText = "(Applies to assets with typetree included)\r\nSlower but can parse non-standard ass" +
"ets.\r\nOnly for Texture2D, AnimationClip and Material assets for now.";
this.parseByTypetreeToolStripMenuItem.ToolTipText = "(Will have an effect if an asset bundle contains typetree info)\r\nSlower but can p" +
"arse modified assets.\r\nOnly for Texture2D, AnimationClip, Material and SkinnedMe" +
"shRenderer assets for now.";
this.parseByTypetreeToolStripMenuItem.CheckedChanged += new System.EventHandler(this.parseByTypetreeToolStripMenuItem_CheckedChanged);
//
// decompressBundlesToDiskToolStripMenuItem
+5 -4
View File
@@ -202,7 +202,7 @@
this.displayAllCheckBox.Location = new System.Drawing.Point(6, 22);
this.displayAllCheckBox.Name = "displayAllCheckBox";
this.displayAllCheckBox.Size = new System.Drawing.Size(348, 19);
this.displayAllCheckBox.TabIndex = 3;
this.displayAllCheckBox.TabIndex = 1;
this.displayAllCheckBox.Text = "Display all assets";
this.toolTip1.SetToolTip(this.displayAllCheckBox, "Check this option will display all types assets. Not extractable assets can expor" +
"t the RAW file.");
@@ -217,10 +217,11 @@
this.parseByTypetreeCheckBox.Location = new System.Drawing.Point(6, 72);
this.parseByTypetreeCheckBox.Name = "parseByTypetreeCheckBox";
this.parseByTypetreeCheckBox.Size = new System.Drawing.Size(348, 19);
this.parseByTypetreeCheckBox.TabIndex = 1;
this.parseByTypetreeCheckBox.TabIndex = 3;
this.parseByTypetreeCheckBox.Text = "Parse assets using their typetree";
this.toolTip1.SetToolTip(this.parseByTypetreeCheckBox, "(Applies to assets with typetree included)\r\nSlower but can parse non-standard ass" +
"ets.\r\nOnly for Texture2D, AnimationClip and Material assets for now.");
this.toolTip1.SetToolTip(this.parseByTypetreeCheckBox, "(Will have an effect if an asset bundle contains typetree info)\r\nSlower but can p" +
"arse modified assets.\r\nOnly for Texture2D, AnimationClip, Material and SkinnedMe" +
"shRenderer assets for now.");
this.parseByTypetreeCheckBox.UseVisualStyleBackColor = true;
//
// meshPreProcessingCheckBox