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 List<MeshData> m_MeshData;
private readonly int m_VertexCount; private readonly int m_VertexCount;
public readonly List<uint> IndexBufferList; private readonly List<uint> indexBufferList;
public LOD(ObjectReader reader) public LOD(ObjectReader reader)
{ {
m_MeshData = new List<MeshData>(); m_MeshData = new List<MeshData>();
IndexBufferList = new List<uint>(); indexBufferList = new List<uint>();
var meshDataCount = reader.ReadInt32(); var meshDataCount = reader.ReadInt32();
for (var i = 0; i < meshDataCount; i++) for (var i = 0; i < meshDataCount; i++)
{ {
var meshData = new MeshData(reader); var meshData = new MeshData(reader);
m_MeshData.Add(meshData); m_MeshData.Add(meshData);
IndexBufferList.AddRange(meshData.IndexBufferList); indexBufferList.AddRange(meshData.IndexBufferList);
} }
if (reader.version < (1, 5)) 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); var subMeshList = new List<SubMesh>(m_MeshData.Count);
foreach (var meshData in m_MeshData) foreach (var meshData in m_MeshData)
@@ -79,6 +79,11 @@ namespace AssetStudio
} }
return subMeshList; return subMeshList;
} }
public uint[] GetIndexBuffer()
{
return indexBufferList.ToArray();
}
} }
public class MinMaxAABB public class MinMaxAABB
@@ -552,23 +557,19 @@ namespace AssetStudio
{ {
if (version < 2) //2.0 down if (version < 2) //2.0 down
{ {
LOD lod0 = null;
var m_LODDataCount = reader.ReadInt32(); var m_LODDataCount = reader.ReadInt32();
for (var i = 0; i < m_LODDataCount; i++) if (m_LODDataCount <= 0)
{
if (i == 0)
lod0 = new LOD(reader);
else
_ = new LOD(reader);
}
if (lod0 == null)
{ {
Logger.Warning("Can't find lod0 mesh data"); Logger.Warning("Can't find lod0 mesh data");
return; return;
} }
var lod0 = new LOD(reader);
m_IndexBuffer = lod0.IndexBufferList.ToArray(); for (var i = 1; i < m_LODDataCount; i++)
m_SubMeshes = lod0.ConvertToSubMeshes(); {
_ = new LOD(reader);
}
m_IndexBuffer = lod0.GetIndexBuffer();
m_SubMeshes = lod0.GetSubMeshes();
} }
else //2.0 and up else //2.0 and up
{ {
+3 -3
View File
@@ -212,14 +212,14 @@ namespace AssetStudio
return dataHash; 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) private int GetImageDataSize(TextureFormat textureFormat)
{ {
var imgDataSize = m_Width * m_Height; var imgDataSize = m_Width * m_Height;
switch (textureFormat) switch (textureFormat)
{ {
// https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_astc/
case TextureFormat.ASTC_RGBA_5x5: 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); imgDataSize = (int)(MathF.Floor((m_Width + 4) / 5f) * MathF.Floor((m_Height + 4) / 5f) * 16);
break; break;
case TextureFormat.ASTC_RGBA_6x6: case TextureFormat.ASTC_RGBA_6x6:
@@ -272,4 +272,4 @@ namespace AssetStudio
return imgDataSize; return imgDataSize;
} }
} }
} }
+3 -2
View File
@@ -313,8 +313,9 @@
this.parseByTypetreeToolStripMenuItem.Name = "parseByTypetreeToolStripMenuItem"; this.parseByTypetreeToolStripMenuItem.Name = "parseByTypetreeToolStripMenuItem";
this.parseByTypetreeToolStripMenuItem.Size = new System.Drawing.Size(241, 22); this.parseByTypetreeToolStripMenuItem.Size = new System.Drawing.Size(241, 22);
this.parseByTypetreeToolStripMenuItem.Text = "Parse assets using their typetree"; 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" + this.parseByTypetreeToolStripMenuItem.ToolTipText = "(Will have an effect if an asset bundle contains typetree info)\r\nSlower but can p" +
"ets.\r\nOnly for Texture2D, AnimationClip and Material assets for now."; "arse modified assets.\r\nOnly for Texture2D, AnimationClip, Material and SkinnedMe" +
"shRenderer assets for now.";
this.parseByTypetreeToolStripMenuItem.CheckedChanged += new System.EventHandler(this.parseByTypetreeToolStripMenuItem_CheckedChanged); this.parseByTypetreeToolStripMenuItem.CheckedChanged += new System.EventHandler(this.parseByTypetreeToolStripMenuItem_CheckedChanged);
// //
// decompressBundlesToDiskToolStripMenuItem // decompressBundlesToDiskToolStripMenuItem
+5 -4
View File
@@ -202,7 +202,7 @@
this.displayAllCheckBox.Location = new System.Drawing.Point(6, 22); this.displayAllCheckBox.Location = new System.Drawing.Point(6, 22);
this.displayAllCheckBox.Name = "displayAllCheckBox"; this.displayAllCheckBox.Name = "displayAllCheckBox";
this.displayAllCheckBox.Size = new System.Drawing.Size(348, 19); this.displayAllCheckBox.Size = new System.Drawing.Size(348, 19);
this.displayAllCheckBox.TabIndex = 3; this.displayAllCheckBox.TabIndex = 1;
this.displayAllCheckBox.Text = "Display all assets"; this.displayAllCheckBox.Text = "Display all assets";
this.toolTip1.SetToolTip(this.displayAllCheckBox, "Check this option will display all types assets. Not extractable assets can expor" + this.toolTip1.SetToolTip(this.displayAllCheckBox, "Check this option will display all types assets. Not extractable assets can expor" +
"t the RAW file."); "t the RAW file.");
@@ -217,10 +217,11 @@
this.parseByTypetreeCheckBox.Location = new System.Drawing.Point(6, 72); this.parseByTypetreeCheckBox.Location = new System.Drawing.Point(6, 72);
this.parseByTypetreeCheckBox.Name = "parseByTypetreeCheckBox"; this.parseByTypetreeCheckBox.Name = "parseByTypetreeCheckBox";
this.parseByTypetreeCheckBox.Size = new System.Drawing.Size(348, 19); 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.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" + this.toolTip1.SetToolTip(this.parseByTypetreeCheckBox, "(Will have an effect if an asset bundle contains typetree info)\r\nSlower but can p" +
"ets.\r\nOnly for Texture2D, AnimationClip and Material assets for now."); "arse modified assets.\r\nOnly for Texture2D, AnimationClip, Material and SkinnedMe" +
"shRenderer assets for now.");
this.parseByTypetreeCheckBox.UseVisualStyleBackColor = true; this.parseByTypetreeCheckBox.UseVisualStyleBackColor = true;
// //
// meshPreProcessingCheckBox // meshPreProcessingCheckBox