From 175dd519b40574d9e6a565fbf1a3da28e2cd4585 Mon Sep 17 00:00:00 2001 From: VaDiM Date: Sat, 1 Aug 2026 15:12:22 +0300 Subject: [PATCH] Some minor fixes --- AssetStudio/Classes/Mesh.cs | 33 ++++++++++--------- AssetStudio/Classes/Texture2D.cs | 6 ++-- AssetStudioGUI/AssetStudioGUIForm.Designer.cs | 5 +-- AssetStudioGUI/StudioOptionsForm.Designer.cs | 9 ++--- 4 files changed, 28 insertions(+), 25 deletions(-) diff --git a/AssetStudio/Classes/Mesh.cs b/AssetStudio/Classes/Mesh.cs index 8aaeb6d..dcfede4 100644 --- a/AssetStudio/Classes/Mesh.cs +++ b/AssetStudio/Classes/Mesh.cs @@ -40,18 +40,18 @@ namespace AssetStudio { private readonly List m_MeshData; private readonly int m_VertexCount; - public readonly List IndexBufferList; + private readonly List indexBufferList; public LOD(ObjectReader reader) { m_MeshData = new List(); - IndexBufferList = new List(); + indexBufferList = new List(); 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 ConvertToSubMeshes() + public List GetSubMeshes() { var subMeshList = new List(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 { diff --git a/AssetStudio/Classes/Texture2D.cs b/AssetStudio/Classes/Texture2D.cs index 5dbb984..abd74b8 100644 --- a/AssetStudio/Classes/Texture2D.cs +++ b/AssetStudio/Classes/Texture2D.cs @@ -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; } } -} \ No newline at end of file +} diff --git a/AssetStudioGUI/AssetStudioGUIForm.Designer.cs b/AssetStudioGUI/AssetStudioGUIForm.Designer.cs index 5e55670..17f5c91 100644 --- a/AssetStudioGUI/AssetStudioGUIForm.Designer.cs +++ b/AssetStudioGUI/AssetStudioGUIForm.Designer.cs @@ -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 diff --git a/AssetStudioGUI/StudioOptionsForm.Designer.cs b/AssetStudioGUI/StudioOptionsForm.Designer.cs index 07d72dc..2d55505 100644 --- a/AssetStudioGUI/StudioOptionsForm.Designer.cs +++ b/AssetStudioGUI/StudioOptionsForm.Designer.cs @@ -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