1
0
mirror of synced 2025-03-01 16:10:52 +01:00

Fix bone indices not saving and bounding radius.

This commit is contained in:
KillzXGaming 2019-03-25 10:06:12 -04:00
parent ba760057dd
commit 5264ec4f5d
12 changed files with 43 additions and 19 deletions

Binary file not shown.

View File

@ -179,8 +179,6 @@ namespace FirstPlugin
public static void ReadShapesVertices(FSHP fshp, Shape shp, VertexBuffer vertexBuffer, FMDL model) public static void ReadShapesVertices(FSHP fshp, Shape shp, VertexBuffer vertexBuffer, FMDL model)
{ {
fshp.boundingBoxes.Clear(); fshp.boundingBoxes.Clear();
fshp.boundingRadius.Clear();
fshp.BoneIndices.Clear();
foreach (Bounding bnd in shp.SubMeshBoundings) foreach (Bounding bnd in shp.SubMeshBoundings)
{ {
@ -189,10 +187,8 @@ namespace FirstPlugin
box.Extend = new Vector3(bnd.Extent.X, bnd.Extent.Y, bnd.Extent.Z); box.Extend = new Vector3(bnd.Extent.X, bnd.Extent.Y, bnd.Extent.Z);
fshp.boundingBoxes.Add(box); fshp.boundingBoxes.Add(box);
} }
foreach (float rad in shp.RadiusArray)
{ fshp.boundingRadius = shp.RadiusArray.ToList();
fshp.boundingRadius.Add(rad);
}
fshp.VertexBufferIndex = shp.VertexBufferIndex; fshp.VertexBufferIndex = shp.VertexBufferIndex;
fshp.Shape = shp; fshp.Shape = shp;
@ -203,11 +199,7 @@ namespace FirstPlugin
fshp.TargetAttribCount = shp.TargetAttribCount; fshp.TargetAttribCount = shp.TargetAttribCount;
fshp.MaterialIndex = shp.MaterialIndex; fshp.MaterialIndex = shp.MaterialIndex;
if (shp.SkinBoneIndices != null) fshp.BoneIndices = shp.SkinBoneIndices.ToList();
{
foreach (ushort bn in shp.SkinBoneIndices)
fshp.BoneIndices.Add(bn);
}
ReadMeshes(fshp, shp); ReadMeshes(fshp, shp);
ReadVertexBuffer(fshp, vertexBuffer, model); ReadVertexBuffer(fshp, vertexBuffer, model);

View File

@ -15,9 +15,6 @@ namespace Switch_Toolbox.Library.Animations
{ {
anim.NextFrame(skeleton); anim.NextFrame(skeleton);
//Add frames to the playing animation
anim.Frame += 1f;
//Reset it when it reaches the total frame count //Reset it when it reaches the total frame count
if (anim.Frame >= anim.FrameCount) if (anim.Frame >= anim.FrameCount)
anim.Frame = 0; anim.Frame = 0;
@ -36,6 +33,9 @@ namespace Switch_Toolbox.Library.Animations
seAnim.AddRotationKey(boneAnim.Text, frame, rotation.X, rotation.Y, rotation.Z, rotation.W); seAnim.AddRotationKey(boneAnim.Text, frame, rotation.X, rotation.Y, rotation.Z, rotation.W);
seAnim.AddScaleKey(boneAnim.Text, frame, scale.X, scale.Y, scale.Z); seAnim.AddScaleKey(boneAnim.Text, frame, scale.X, scale.Y, scale.Z);
} }
//Add frames to the playing animation
anim.Frame += 1f;
} }
seAnim.Write(FileName); seAnim.Write(FileName);

View File

@ -1,4 +1,4 @@
namespace Switch_Toolbox namespace Toolbox
{ {
partial class CreditsWindow partial class CreditsWindow
{ {

View File

@ -8,7 +8,7 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
namespace Switch_Toolbox namespace Toolbox
{ {
public partial class CreditsWindow : Form public partial class CreditsWindow : Form
{ {

View File

@ -59,6 +59,8 @@
this.stPanel2 = new Switch_Toolbox.Library.Forms.STPanel(); this.stPanel2 = new Switch_Toolbox.Library.Forms.STPanel();
this.stToolStrip1 = new Switch_Toolbox.Library.Forms.STToolStrip(); this.stToolStrip1 = new Switch_Toolbox.Library.Forms.STToolStrip();
this.toolStripButton1 = new System.Windows.Forms.ToolStripButton(); this.toolStripButton1 = new System.Windows.Forms.ToolStripButton();
this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.creditsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip1.SuspendLayout(); this.menuStrip1.SuspendLayout();
this.stPanel1.SuspendLayout(); this.stPanel1.SuspendLayout();
this.tabControlContextMenuStrip.SuspendLayout(); this.tabControlContextMenuStrip.SuspendLayout();
@ -76,12 +78,14 @@
this.toolsToolStripMenuItem, this.toolsToolStripMenuItem,
this.experimentalToolStripMenuItem, this.experimentalToolStripMenuItem,
this.windowsToolStripMenuItem, this.windowsToolStripMenuItem,
this.settingsToolStripMenuItem}); this.settingsToolStripMenuItem,
this.aboutToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1"; this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(1108, 25); this.menuStrip1.Size = new System.Drawing.Size(1108, 25);
this.menuStrip1.TabIndex = 1; this.menuStrip1.TabIndex = 1;
this.menuStrip1.Text = "menuStrip1"; this.menuStrip1.Text = "menuStrip1";
this.menuStrip1.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.menuStrip1_ItemClicked);
// //
// fileToolStripMenuItem // fileToolStripMenuItem
// //
@ -231,7 +235,7 @@
// mainSettingsToolStripMenuItem // mainSettingsToolStripMenuItem
// //
this.mainSettingsToolStripMenuItem.Name = "mainSettingsToolStripMenuItem"; this.mainSettingsToolStripMenuItem.Name = "mainSettingsToolStripMenuItem";
this.mainSettingsToolStripMenuItem.Size = new System.Drawing.Size(161, 22); this.mainSettingsToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.mainSettingsToolStripMenuItem.Text = "Main Settings"; this.mainSettingsToolStripMenuItem.Text = "Main Settings";
this.mainSettingsToolStripMenuItem.Click += new System.EventHandler(this.mainSettingsToolStripMenuItem_Click); this.mainSettingsToolStripMenuItem.Click += new System.EventHandler(this.mainSettingsToolStripMenuItem_Click);
// //
@ -239,7 +243,7 @@
// //
this.fileAssociationsToolStripMenuItem.Enabled = false; this.fileAssociationsToolStripMenuItem.Enabled = false;
this.fileAssociationsToolStripMenuItem.Name = "fileAssociationsToolStripMenuItem"; this.fileAssociationsToolStripMenuItem.Name = "fileAssociationsToolStripMenuItem";
this.fileAssociationsToolStripMenuItem.Size = new System.Drawing.Size(161, 22); this.fileAssociationsToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.fileAssociationsToolStripMenuItem.Text = "File Associations"; this.fileAssociationsToolStripMenuItem.Text = "File Associations";
this.fileAssociationsToolStripMenuItem.Click += new System.EventHandler(this.fileAssociationsToolStripMenuItem_Click); this.fileAssociationsToolStripMenuItem.Click += new System.EventHandler(this.fileAssociationsToolStripMenuItem_Click);
// //
@ -309,6 +313,21 @@
this.toolStripButton1.Text = "toolStripButton1"; this.toolStripButton1.Text = "toolStripButton1";
this.toolStripButton1.ToolTipText = "Save File"; this.toolStripButton1.ToolTipText = "Save File";
// //
// aboutToolStripMenuItem
//
this.aboutToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.creditsToolStripMenuItem});
this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem";
this.aboutToolStripMenuItem.Size = new System.Drawing.Size(52, 21);
this.aboutToolStripMenuItem.Text = "About";
//
// creditsToolStripMenuItem
//
this.creditsToolStripMenuItem.Name = "creditsToolStripMenuItem";
this.creditsToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.creditsToolStripMenuItem.Text = "Credits";
this.creditsToolStripMenuItem.Click += new System.EventHandler(this.creditsToolStripMenuItem_Click);
//
// MainForm // MainForm
// //
this.AllowDrop = true; this.AllowDrop = true;
@ -373,6 +392,8 @@
private Switch_Toolbox.Library.Forms.STToolStrip stToolStrip1; private Switch_Toolbox.Library.Forms.STToolStrip stToolStrip1;
private System.Windows.Forms.ToolStripButton toolStripButton1; private System.Windows.Forms.ToolStripButton toolStripButton1;
private System.Windows.Forms.ToolStripMenuItem newFromFileToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem newFromFileToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem creditsToolStripMenuItem;
} }
} }

View File

@ -899,5 +899,16 @@ namespace Toolbox
FileAssociationForm form = new FileAssociationForm(); FileAssociationForm form = new FileAssociationForm();
form.ShowDialog(); form.ShowDialog();
} }
private void menuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
{
}
private void creditsToolStripMenuItem_Click(object sender, EventArgs e)
{
CreditsWindow window = new CreditsWindow();
window.Show();
}
} }
} }