Some improvements

This commit is contained in:
Perfare 2018-04-18 11:17:33 +08:00
parent ffda15a1a5
commit bd5eb3be5d
3 changed files with 18 additions and 15 deletions

View File

@ -50,6 +50,7 @@
this.exportallobjectssplitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.exportallobjectssplitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.exportselectedobjectsMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.exportselectedobjectsMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.exportAllObjectssplitToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.exportSelectedObjectsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.exportSelectedObjectsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.exportSelectedObjectsWithAnimationClipToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.exportSelectedObjectsWithAnimationClipToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.exportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.exportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -113,7 +114,6 @@
this.exportAnimatorwithselectedAnimationClipMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.exportAnimatorwithselectedAnimationClipMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.exportobjectswithselectedAnimationClipMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.exportobjectswithselectedAnimationClipMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.showOriginalFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.showOriginalFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.exportAllObjectssplitToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip1.SuspendLayout(); this.menuStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel1.SuspendLayout();
@ -317,6 +317,13 @@
this.toolStripSeparator1.Name = "toolStripSeparator1"; this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(320, 6); this.toolStripSeparator1.Size = new System.Drawing.Size(320, 6);
// //
// exportAllObjectssplitToolStripMenuItem1
//
this.exportAllObjectssplitToolStripMenuItem1.Name = "exportAllObjectssplitToolStripMenuItem1";
this.exportAllObjectssplitToolStripMenuItem1.Size = new System.Drawing.Size(323, 22);
this.exportAllObjectssplitToolStripMenuItem1.Text = "Export all objects (split)";
this.exportAllObjectssplitToolStripMenuItem1.Click += new System.EventHandler(this.exportAllObjectssplitToolStripMenuItem1_Click);
//
// exportSelectedObjectsToolStripMenuItem // exportSelectedObjectsToolStripMenuItem
// //
this.exportSelectedObjectsToolStripMenuItem.Name = "exportSelectedObjectsToolStripMenuItem"; this.exportSelectedObjectsToolStripMenuItem.Name = "exportSelectedObjectsToolStripMenuItem";
@ -383,7 +390,6 @@
this.showTypeToolStripMenuItem.Name = "showTypeToolStripMenuItem"; this.showTypeToolStripMenuItem.Name = "showTypeToolStripMenuItem";
this.showTypeToolStripMenuItem.Size = new System.Drawing.Size(83, 21); this.showTypeToolStripMenuItem.Size = new System.Drawing.Size(83, 21);
this.showTypeToolStripMenuItem.Text = "Show Type"; this.showTypeToolStripMenuItem.Text = "Show Type";
this.showTypeToolStripMenuItem.Visible = false;
// //
// allToolStripMenuItem // allToolStripMenuItem
// //
@ -391,7 +397,7 @@
this.allToolStripMenuItem.CheckOnClick = true; this.allToolStripMenuItem.CheckOnClick = true;
this.allToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; this.allToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
this.allToolStripMenuItem.Name = "allToolStripMenuItem"; this.allToolStripMenuItem.Name = "allToolStripMenuItem";
this.allToolStripMenuItem.Size = new System.Drawing.Size(90, 22); this.allToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.allToolStripMenuItem.Text = "All"; this.allToolStripMenuItem.Text = "All";
this.allToolStripMenuItem.Click += new System.EventHandler(this.typeToolStripMenuItem_Click); this.allToolStripMenuItem.Click += new System.EventHandler(this.typeToolStripMenuItem_Click);
// //
@ -931,13 +937,6 @@
this.showOriginalFileToolStripMenuItem.Visible = false; this.showOriginalFileToolStripMenuItem.Visible = false;
this.showOriginalFileToolStripMenuItem.Click += new System.EventHandler(this.showOriginalFileToolStripMenuItem_Click); this.showOriginalFileToolStripMenuItem.Click += new System.EventHandler(this.showOriginalFileToolStripMenuItem_Click);
// //
// exportAllObjectssplitToolStripMenuItem1
//
this.exportAllObjectssplitToolStripMenuItem1.Name = "exportAllObjectssplitToolStripMenuItem1";
this.exportAllObjectssplitToolStripMenuItem1.Size = new System.Drawing.Size(323, 22);
this.exportAllObjectssplitToolStripMenuItem1.Text = "Export all objects (split)";
this.exportAllObjectssplitToolStripMenuItem1.Click += new System.EventHandler(this.exportAllObjectssplitToolStripMenuItem1_Click);
//
// AssetStudioForm // AssetStudioForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);

View File

@ -231,7 +231,6 @@ namespace AssetStudio
showTypeToolStripMenuItem.DropDownItems.Add(typeItem); showTypeToolStripMenuItem.DropDownItems.Add(typeItem);
} }
allToolStripMenuItem.Checked = true; allToolStripMenuItem.Checked = true;
showTypeToolStripMenuItem.Visible = true;
StatusStripUpdate($"Finished loading {assetsfileList.Count} files with {assetListView.Items.Count} exportable assets."); StatusStripUpdate($"Finished loading {assetsfileList.Count} files with {assetListView.Items.Count} exportable assets.");
treeSearch.Select(); treeSearch.Select();
})); }));

View File

@ -226,9 +226,10 @@ namespace AssetStudio
ImportedMaterial iMat = ConvertMaterial(mat); ImportedMaterial iMat = ConvertMaterial(mat);
iSubmesh.Material = iMat.Name; iSubmesh.Material = iMat.Name;
iSubmesh.VertexList = new List<ImportedVertex>((int)submesh.vertexCount); iSubmesh.VertexList = new List<ImportedVertex>((int)submesh.vertexCount);
var vertexColours = mesh.m_Colors != null && mesh.m_Colors.Length > 0;
for (var j = mesh.m_SubMeshes[i].firstVertex; j < mesh.m_SubMeshes[i].firstVertex + mesh.m_SubMeshes[i].vertexCount; j++) for (var j = mesh.m_SubMeshes[i].firstVertex; j < mesh.m_SubMeshes[i].firstVertex + mesh.m_SubMeshes[i].vertexCount; j++)
{ {
var iVertex = new ImportedVertexWithColour(); var iVertex = vertexColours ? new ImportedVertexWithColour() : new ImportedVertex();
//Vertices //Vertices
int c = 3; int c = 3;
if (mesh.m_Vertices.Length == mesh.m_VertexCount * 4) if (mesh.m_Vertices.Length == mesh.m_VertexCount * 4)
@ -250,15 +251,15 @@ namespace AssetStudio
iVertex.Normal = new Vector3(-mesh.m_Normals[j * c], mesh.m_Normals[j * c + 1], mesh.m_Normals[j * c + 2]); iVertex.Normal = new Vector3(-mesh.m_Normals[j * c], mesh.m_Normals[j * c + 1], mesh.m_Normals[j * c + 2]);
} }
//Colors //Colors
if (mesh.m_Colors != null && mesh.m_Colors.Length > 0) if (vertexColours)
{ {
if (mesh.m_Colors.Length == mesh.m_VertexCount * 3) if (mesh.m_Colors.Length == mesh.m_VertexCount * 3)
{ {
iVertex.Colour = new Color4(mesh.m_Colors[j * 3], mesh.m_Colors[j * 3 + 1], mesh.m_Colors[j * 3 + 2], 1.0f); ((ImportedVertexWithColour)iVertex).Colour = new Color4(mesh.m_Colors[j * 3], mesh.m_Colors[j * 3 + 1], mesh.m_Colors[j * 3 + 2], 1.0f);
} }
else else
{ {
iVertex.Colour = new Color4(mesh.m_Colors[j * 4], mesh.m_Colors[j * 4 + 1], mesh.m_Colors[j * 4 + 2], mesh.m_Colors[j * 4 + 3]); ((ImportedVertexWithColour)iVertex).Colour = new Color4(mesh.m_Colors[j * 4], mesh.m_Colors[j * 4 + 1], mesh.m_Colors[j * 4 + 2], mesh.m_Colors[j * 4 + 3]);
} }
} }
//UV //UV
@ -266,6 +267,10 @@ namespace AssetStudio
{ {
iVertex.UV = new[] { mesh.m_UV1[j * 2], -mesh.m_UV1[j * 2 + 1] }; iVertex.UV = new[] { mesh.m_UV1[j * 2], -mesh.m_UV1[j * 2 + 1] };
} }
else if (mesh.m_UV2 != null && mesh.m_UV2.Length == mesh.m_VertexCount * 2)
{
iVertex.UV = new[] { mesh.m_UV2[j * 2], -mesh.m_UV2[j * 2 + 1] };
}
//Tangent //Tangent
if (mesh.m_Tangents != null) if (mesh.m_Tangents != null)
{ {