Massive speed improvement to bfres saving with animations + bug fixes

Fixed bfres from taking too long to save with 100s or even 1000s of animations. From 30 - 70 minutes, to over 8- 20 seconds!
Fixed weights and buffers not importing properly.
Fixed byaml editor's dialog buttons improperly placed on resize.
This commit is contained in:
KillzXGaming 2019-03-30 21:54:19 -04:00
parent 7afcfc40a4
commit 9c439f099d
17 changed files with 41 additions and 10 deletions

Binary file not shown.

View file

@ -944,10 +944,10 @@ namespace FirstPlugin
case BRESGroupType.SkeletalAnim:
foreach (FSKA ska in group.Nodes)
{
ska.SkeletalAnim.BoneAnims.Clear();
// ska.SkeletalAnim.BoneAnims.Clear();
foreach (FSKA.BoneAnimNode bone in ska.Bones)
ska.SkeletalAnim.BoneAnims.Add(bone.SaveData());
// foreach (FSKA.BoneAnimNode bone in ska.Bones)
// ska.SkeletalAnim.BoneAnims.Add(bone.SaveData());
ska.SkeletalAnim.Name = ska.Text;
resFile.SkeletalAnims.Add(ska.SkeletalAnim);

View file

@ -867,7 +867,7 @@ namespace Bfres.Structs
shape.vertexAttributes = settings.CreateNewAttributes();
shape.BoneIndex = obj.BoneIndex;
STConsole.WriteLine(Text + " " + obj.MaterialIndex);
MessageBox.Show(shape.vertexAttributes.Count.ToString());
if (UseMats)
shape.MaterialIndex = obj.MaterialIndex + MatStartIndex;

View file

@ -745,7 +745,10 @@ namespace Bfres.Structs
else
{
if (v.boneIds.Count < 4)
{
STConsole.WriteLine(defBn.Index + " mesh " + Text + " bone " + bn);
v.boneIds.Add(defBn.Index);
}
}
}
i++;

View file

@ -552,6 +552,7 @@
this.chkBoxEnableWeightIndices.TabIndex = 25;
this.chkBoxEnableWeightIndices.Text = "Enable Indices/Weights";
this.chkBoxEnableWeightIndices.UseVisualStyleBackColor = true;
this.chkBoxEnableWeightIndices.CheckedChanged += new System.EventHandler(this.chkBoxEnableAttribute_CheckedChanged);
//
// chkBoxEnableBitans
//
@ -562,6 +563,7 @@
this.chkBoxEnableBitans.TabIndex = 24;
this.chkBoxEnableBitans.Text = "Enable Bitangents";
this.chkBoxEnableBitans.UseVisualStyleBackColor = true;
this.chkBoxEnableBitans.CheckedChanged += new System.EventHandler(this.chkBoxEnableAttribute_CheckedChanged);
//
// chkBoxEnableTans
//
@ -760,7 +762,7 @@
this.tabPageAdvanced.Location = new System.Drawing.Point(4, 25);
this.tabPageAdvanced.Name = "tabPageAdvanced";
this.tabPageAdvanced.Padding = new System.Windows.Forms.Padding(3);
this.tabPageAdvanced.Size = new System.Drawing.Size(530, 333);
this.tabPageAdvanced.Size = new System.Drawing.Size(192, 71);
this.tabPageAdvanced.TabIndex = 0;
this.tabPageAdvanced.Text = "Advanced Settings";
//
@ -777,7 +779,7 @@
this.stPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.stPanel1.Location = new System.Drawing.Point(3, 3);
this.stPanel1.Name = "stPanel1";
this.stPanel1.Size = new System.Drawing.Size(524, 327);
this.stPanel1.Size = new System.Drawing.Size(186, 65);
this.stPanel1.TabIndex = 17;
//
// BfresModelImportSettings

View file

@ -101,6 +101,19 @@ namespace FirstPlugin
{
List<FSHP.VertexAttribute> attribute = new List<FSHP.VertexAttribute>();
Console.WriteLine($"EnablePositions {EnablePositions}");
Console.WriteLine($"EnableNormals {EnableNormals}");
Console.WriteLine($"EnableVertexColors {EnableVertexColors}");
Console.WriteLine($"EnableUV0 {EnableUV0}");
Console.WriteLine($"EnableUV1 {EnableUV1}");
Console.WriteLine($"EnableUV2 {EnableUV2}");
Console.WriteLine($"EnableUV2 {EnableUV2}");
Console.WriteLine($"EnableTangents {EnableTangents}");
Console.WriteLine($"EnableTangents {EnableTangents}");
Console.WriteLine($"EnableBitangents {EnableBitangents}");
Console.WriteLine($"EnableWeights {EnableWeights}");
Console.WriteLine($"EnableIndices {EnableIndices}");
if (EnablePositions)
{
FSHP.VertexAttribute att = new FSHP.VertexAttribute();

View file

@ -46,6 +46,7 @@
this.stButton2 = new Switch_Toolbox.Library.Forms.STButton();
this.contentContainer.SuspendLayout();
this.contextMenuStrip1.SuspendLayout();
this.stPanel1.SuspendLayout();
this.SuspendLayout();
//
// contentContainer
@ -62,9 +63,9 @@
this.treeView1.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.treeView1.ContextMenuStrip = this.contextMenuStrip1;
this.treeView1.Dock = System.Windows.Forms.DockStyle.Fill;
this.treeView1.Location = new System.Drawing.Point(0, 25);
this.treeView1.Location = new System.Drawing.Point(0, 0);
this.treeView1.Name = "treeView1";
this.treeView1.Size = new System.Drawing.Size(543, 368);
this.treeView1.Size = new System.Drawing.Size(543, 336);
this.treeView1.TabIndex = 0;
this.treeView1.BeforeExpand += new System.Windows.Forms.TreeViewCancelEventHandler(this.BeforeExpand);
//
@ -157,14 +158,15 @@
this.stPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.stPanel1.Controls.Add(this.treeView1);
this.stPanel1.Location = new System.Drawing.Point(0, 25);
this.stPanel1.Name = "stPanel1";
this.stPanel1.Size = new System.Drawing.Size(543, 336);
this.stPanel1.TabIndex = 11;
this.stPanel1.Controls.Add(this.treeView1);
//
// stButton1
//
this.stButton1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.stButton1.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.stButton1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.stButton1.Location = new System.Drawing.Point(465, 367);
@ -176,6 +178,7 @@
//
// stButton2
//
this.stButton2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.stButton2.DialogResult = System.Windows.Forms.DialogResult.OK;
this.stButton2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.stButton2.Location = new System.Drawing.Point(369, 367);
@ -196,6 +199,7 @@
this.Controls.SetChildIndex(this.contentContainer, 0);
this.contentContainer.ResumeLayout(false);
this.contextMenuStrip1.ResumeLayout(false);
this.stPanel1.ResumeLayout(false);
this.ResumeLayout(false);
}

View file

@ -345,6 +345,12 @@ namespace Switch_Toolbox.Library
obj.boneList = GetBoneList(msh);
obj.VertexSkinCount = (byte)GetVertexSkinCount(msh);
Console.WriteLine($"MESH {msh.Name}");
Console.WriteLine($"HasUv0 {obj.HasUv0}");
Console.WriteLine($"HasIndices {obj.HasIndices}");
Console.WriteLine($"HasWeights {obj.HasWeights}");
STGenericObject.LOD_Mesh lod = new STGenericObject.LOD_Mesh();
lod.faces = GetFaces(msh);
lod.IndexFormat = STIndexFormat.UInt16;
@ -446,6 +452,9 @@ namespace Switch_Toolbox.Library
}
if (msh.HasBones)
{
STConsole.WriteLine(msh.Name + " HasBones " + msh.HasBones);
STConsole.WriteLine(msh.Name + " BoneCount " + msh.BoneCount);
for (int i = 0; i < msh.BoneCount; i++)
{
Bone bn = msh.Bones[i];

View file

@ -128,7 +128,7 @@ namespace Toolbox
DialogResult result;
using (DialogCenteringService centeringService = new DialogCenteringService(this)) // center message box
{
result = MessageBox.Show($"A new update is available {UpdateProgram.LatestRelease.TagName} {UpdateProgram.LatestRelease.Body}!" +
result = MessageBox.Show($"A new update is available {UpdateProgram.LatestRelease.TagName} \n\n{UpdateProgram.LatestRelease.Body}!" +
$" Would you like to install it?", "Updater", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
}
if (result == DialogResult.Yes)