More exporting fixes

This commit is contained in:
KillzXGaming 2019-05-24 20:55:55 -04:00
parent 67f6703862
commit a4459533ec
15 changed files with 271 additions and 224 deletions

Binary file not shown.

View file

@ -131,7 +131,7 @@ namespace BrawlboxHelper
//Max of 4 values. Cubic using 4, linear using 2, and step using 1
float[] KeyValues = new float[4];
switch (AnimOffset)
switch (AnimOffset)
{
case 0: //Red
Keys.Add((float)entry.Colors[c].R / 255f);
@ -224,20 +224,20 @@ namespace BrawlboxHelper
public class FSKAConverter
{
static float Deg2Rad = (float)(Math.PI / 180f);
static float Rad2Deg = (float)(180f / Math.PI);
public static void Fska2Chr0(SkeletalAnim fska, string FileName)
{
CHR0Node chr0 = new CHR0Node();
chr0.FrameCount = fska.FrameCount;
chr0.Name = fska.Name;
chr0.OriginalPath = fska.Path;
chr0.UserEntries = new UserDataCollection();
chr0.Loop = fska.Loop;
chr0.CreateEntry();
foreach (var entry in fska.BoneAnims)
chr0.Children.Add(BoneAnim2Chr0Entry(entry, chr0));
BoneAnim2Chr0Entry(entry, chr0);
chr0.Export(FileName);
}
@ -251,13 +251,13 @@ namespace BrawlboxHelper
public float Frame = 0;
}
public static CHR0EntryNode BoneAnim2Chr0Entry(BoneAnim boneAnim, CHR0Node chr0)
public static void BoneAnim2Chr0Entry(BoneAnim boneAnim, CHR0Node chr0)
{
CHR0EntryNode chr0Entry = chr0.CreateEntry(boneAnim.Name);
chr0Entry.UseModelRotate = false;
chr0Entry.UseModelScale = false;
chr0Entry.UseModelTranslate = false;
chr0Entry.ScaleCompensateApply = boneAnim.ApplySegmentScaleCompensate;
//Float for time/frame
Dictionary<float, FSKAKeyNode> TranslateX = new Dictionary<float, FSKAKeyNode>();
@ -300,6 +300,7 @@ namespace BrawlboxHelper
Value = boneAnim.BaseData.Rotate.Z,
});
}
if (boneAnim.FlagsBase.HasFlag(BoneAnimFlagsBase.Scale))
{
ScaleX.Add(0, new FSKAKeyNode()
@ -315,33 +316,49 @@ namespace BrawlboxHelper
Value = boneAnim.BaseData.Scale.Z,
});
}
else
{
ScaleX.Add(0, new FSKAKeyNode() { Value = 1 });
ScaleY.Add(0, new FSKAKeyNode() { Value = 1 });
ScaleZ.Add(0, new FSKAKeyNode() { Value = 1 });
}
Console.WriteLine($"Curves { boneAnim.Curves.Count}");
foreach (var curve in boneAnim.Curves)
{
for (int frame = 0; frame < curve.Frames.Length; frame++)
{
Console.WriteLine($"frame {frame} AnimDataOffset {curve.AnimDataOffset}");
float time = curve.Frames[frame];
float value = 0;
float slope = 0;
float slope2 = 0;
float delta = 0;
float scale = curve.Scale;
if (scale <= 0)
scale = 1;
if (curve.CurveType == AnimCurveType.Cubic)
{
value = curve.AnimDataOffset + curve.Keys[frame, 0] * curve.Scale;
slope = curve.AnimDataOffset + curve.Keys[frame, 1] * curve.Scale;
slope2 = curve.AnimDataOffset + curve.Keys[frame, 2] * curve.Scale;
delta = curve.AnimDataOffset + curve.Keys[frame, 3] * curve.Scale;
value = curve.Offset + curve.Keys[frame, 0] * scale;
slope = curve.Offset + curve.Keys[frame, 1] * scale;
slope2 = curve.Offset + curve.Keys[frame, 2] * scale;
delta = curve.Offset + curve.Keys[frame, 3] * scale;
}
if (curve.CurveType == AnimCurveType.Linear)
{
value = curve.AnimDataOffset + curve.Keys[frame, 0] * curve.Scale;
delta = curve.AnimDataOffset + curve.Keys[frame, 1] * curve.Scale;
value = curve.Offset + curve.Keys[frame, 0] * scale;
delta = curve.Offset + curve.Keys[frame, 1] * scale;
}
if (curve.CurveType == AnimCurveType.Linear)
if (curve.CurveType == AnimCurveType.StepInt)
{
value = curve.AnimDataOffset + curve.Keys[frame, 0] * curve.Scale;
value = curve.Offset + curve.Keys[frame, 0] * scale;
}
switch (curve.AnimDataOffset)
{
case 0x10:
@ -467,75 +484,83 @@ namespace BrawlboxHelper
for (int frame = 0; frame < chr0.FrameCount; frame++)
{
CHRAnimationFrame keyFrame = new CHRAnimationFrame();
if (TranslateX.ContainsKey(frame))
{
CHRAnimationFrame keyFrame = new CHRAnimationFrame();
keyFrame.hasTx = true;
keyFrame.Translation._x = TranslateX[frame].Value;
chr0Entry.SetKeyframe(frame, keyFrame);
}
if (TranslateY.ContainsKey(frame))
{
CHRAnimationFrame keyFrame = new CHRAnimationFrame();
keyFrame.hasTy = true;
keyFrame.Translation._y = TranslateY[frame].Value;
chr0Entry.SetKeyframe(frame, keyFrame);
}
if (TranslateZ.ContainsKey(frame))
{
CHRAnimationFrame keyFrame = new CHRAnimationFrame();
keyFrame.hasTz = true;
keyFrame.Translation._z = TranslateZ[frame].Value;
chr0Entry.SetKeyframe(frame, keyFrame);
}
if (RotateX.ContainsKey(frame))
{
CHRAnimationFrame keyFrame = new CHRAnimationFrame();
keyFrame.hasRx = true;
keyFrame.Rotation._x = RotateX[frame].Value;
chr0Entry.SetKeyframe(frame, keyFrame);
keyFrame.Rotation._x = RotateX[frame].Value * Rad2Deg;
}
if (RotateY.ContainsKey(frame))
{
CHRAnimationFrame keyFrame = new CHRAnimationFrame();
keyFrame.hasRy = true;
keyFrame.Rotation._y = RotateY[frame].Value;
chr0Entry.SetKeyframe(frame, keyFrame);
keyFrame.Rotation._y = RotateY[frame].Value * Rad2Deg;
}
if (RotateZ.ContainsKey(frame))
{
CHRAnimationFrame keyFrame = new CHRAnimationFrame();
keyFrame.hasSz = true;
keyFrame.Rotation._z = RotateZ[frame].Value;
chr0Entry.SetKeyframe(frame, keyFrame);
keyFrame.hasRz = true;
keyFrame.Rotation._z = RotateZ[frame].Value * Rad2Deg;
}
if (ScaleX.ContainsKey(frame))
{
CHRAnimationFrame keyFrame = new CHRAnimationFrame();
keyFrame.hasSx = true;
keyFrame.Scale._x = ScaleX[frame].Value;
chr0Entry.SetKeyframe(frame, keyFrame);
}
if (ScaleY.ContainsKey(frame))
{
CHRAnimationFrame keyFrame = new CHRAnimationFrame();
keyFrame.hasSy = true;
keyFrame.Scale._y = ScaleY[frame].Value;
chr0Entry.SetKeyframe(frame, keyFrame);
}
if (ScaleZ.ContainsKey(frame))
{
CHRAnimationFrame keyFrame = new CHRAnimationFrame();
keyFrame.hasSz = true;
keyFrame.Scale._z = ScaleZ[frame].Value;
chr0Entry.SetKeyframe(frame, keyFrame);
}
if (keyFrame.HasKeys)
chr0Entry.SetKeyframe(frame, keyFrame);
Console.WriteLine(keyFrame);
/* var curretnFrame = chr0Entry.GetAnimFrame(0);
if (!curretnFrame.hasRx)
curretnFrame.Rotation._x = RotateX[0].Value;
if (!curretnFrame.hasRy)
curretnFrame.Rotation._y = RotateY[0].Value;
if (!curretnFrame.hasRz)
curretnFrame.Rotation._z = RotateZ[0].Value;
if (!curretnFrame.hasTx)
curretnFrame.Translation._x = TranslateX[0].Value;
if (!curretnFrame.hasTy)
curretnFrame.Translation._y = TranslateY[0].Value;
if (!curretnFrame.hasTz)
curretnFrame.Translation._z = TranslateZ[0].Value;
if (!curretnFrame.hasSx)
curretnFrame.Scale._x = ScaleX[0].Value;
if (!curretnFrame.hasSy)
curretnFrame.Scale._y = ScaleY[0].Value;
if (!curretnFrame.hasSz)
curretnFrame.Scale._z = ScaleZ[0].Value;*/
}
return chr0Entry;
}
public static SkeletalAnim Chr02Fska(string FileName)
@ -725,7 +750,7 @@ namespace BrawlboxHelper
curve.CurveType = AnimCurveType.Cubic;
List<float> Frames = new List<float>();
List<float[]> Keys = new List<float[]>();
List<float> Keys = new List<float>();
for (int frame = 0; frame < entry.FrameCount; frame++)
{
@ -737,59 +762,47 @@ namespace BrawlboxHelper
if (AnimFrame.hasTx && AnimOffset == 0x10)
{
Frames.Add(frame);
KeyValues[0] = AnimFrame.Translation._x;
Keys.Add(KeyValues);
Keys.Add(AnimFrame.Translation._x);
}
if (AnimFrame.hasTy && AnimOffset == 0x14)
{
Frames.Add(frame);
KeyValues[0] = AnimFrame.Translation._y;
Keys.Add(KeyValues);
Keys.Add(AnimFrame.Translation._y);
}
if (AnimFrame.hasTz && AnimOffset == 0x18)
{
Frames.Add(frame);
KeyValues[0] = AnimFrame.Translation._z;
Keys.Add(KeyValues);
Keys.Add(AnimFrame.Translation._z);
}
if (AnimFrame.hasRx && AnimOffset == 0x20)
{
Frames.Add(frame);
float xRadian = AnimFrame.Rotation._x * Deg2Rad;
KeyValues[0] = xRadian;
Keys.Add(KeyValues);
Keys.Add(AnimFrame.Rotation._x * Deg2Rad);
}
if (AnimFrame.hasRy && AnimOffset == 0x24)
{
Frames.Add(frame);
float yRadian = AnimFrame.Rotation._y * Deg2Rad;
KeyValues[0] = yRadian;
Keys.Add(KeyValues);
Keys.Add(AnimFrame.Rotation._y * Deg2Rad);
}
if (AnimFrame.hasRz && AnimOffset == 0x28)
{
Frames.Add(frame);
float zRadian = AnimFrame.Rotation._z * Deg2Rad;
KeyValues[0] = zRadian;
Keys.Add(KeyValues);
Keys.Add(AnimFrame.Rotation._z * Deg2Rad);
}
if (AnimFrame.hasSx && AnimOffset == 0x04)
{
Frames.Add(frame);
KeyValues[0] = AnimFrame.Scale._x;
Keys.Add(KeyValues);
Keys.Add(AnimFrame.Scale._x);
}
if (AnimFrame.hasSy && AnimOffset == 0x08)
{
Frames.Add(frame);
KeyValues[0] = AnimFrame.Scale._y;
Keys.Add(KeyValues);
Keys.Add(AnimFrame.Scale._y);
}
if (AnimFrame.hasSz && AnimOffset == 0x0C)
{
Frames.Add(frame);
KeyValues[0] = AnimFrame.Scale._z;
Keys.Add(KeyValues);
Keys.Add(AnimFrame.Scale._z);
}
}
@ -810,11 +823,11 @@ namespace BrawlboxHelper
float Delta = 0;
if (frame < Keys.Count - 1)
Delta = Keys[frame + 1][0] - Keys[frame][0];
Delta = Keys[frame + 1] - Keys[frame];
float value = Keys[frame][0];
float Slope = Keys[frame][1];
float Slope2 = Keys[frame][2];
float value = Keys[frame];
float Slope = 0;
float Slope2 = 0;
curve.Keys[frame, 0] = value;
curve.Keys[frame, 1] = Slope;
@ -827,7 +840,7 @@ namespace BrawlboxHelper
curve.Keys = new float[Keys.Count, 1];
for (int frame = 0; frame < Keys.Count; frame++)
{
curve.Keys[frame, 0] = Keys[frame][0];
curve.Keys[frame, 0] = Keys[frame];
}
break;
case AnimCurveType.Linear:
@ -839,9 +852,9 @@ namespace BrawlboxHelper
float Delta = 0;
if (frame < Keys.Count - 1)
Delta = Keys[frame + 1][0] - Keys[frame][0];
Delta = Keys[frame + 1] - Keys[frame];
curve.Keys[frame, 0] = Keys[frame][0];
curve.Keys[frame, 0] = Keys[frame];
curve.Keys[frame, 1] = Delta;
}
break;

View file

@ -36,6 +36,14 @@
<HintPath>..\Toolbox\Lib\BrawlLib.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Gl_EditorFramework">
<HintPath>..\Toolbox\Gl_EditorFramework.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="OpenTK, Version=3.0.1.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Toolbox\Lib\OpenTK.dll</HintPath>
</Reference>
<Reference Include="Syroot.BinaryData">
<HintPath>..\Toolbox\Lib\Syroot.BinaryData.dll</HintPath>
<Private>False</Private>
@ -54,6 +62,7 @@
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
@ -62,8 +71,16 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="BrawlboxHelper.cs" />
<Compile Include="BrawlHelperTest2.cs" />
<Compile Include="BrawlHelper.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Switch_Toolbox_Library\Switch_Toolbox_Library.csproj">
<Project>{96820047-2a39-4e5a-bfa4-e84fff5c66cf}</Project>
<Name>Switch_Toolbox_Library</Name>
<Private>False</Private>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View file

@ -123,14 +123,14 @@ namespace Bfres.Structs
}
else if (ext == ".chr0")
{
STSkeleton skeleton = GetActiveSkeleton();
if (GetResFileU() != null)
{
BrawlboxHelper.FSKAConverter.Fska2Chr0(ConvertWiiUToSwitch(SkeletalAnimU), FileName);
}
else
{
BrawlboxHelper.FSKAConverter.Fska2Chr0(SkeletalAnim, FileName);
}
// BrawlboxHelper.FSKAConverter.Fska2Chr0(this, skeleton, FileName);
}
else if (ext == ".smd")
{

View file

@ -46,17 +46,7 @@ namespace FirstPlugin.Forms
for (int frame = 0; frame < fska.FrameCount; frame++)
{
bool IsKeyed = (boneAnim.XPOS.HasAnimation() && boneAnim.XPOS.GetKeyFrame(frame).IsKeyed ||
boneAnim.YPOS.HasAnimation() && boneAnim.YPOS.GetKeyFrame(frame).IsKeyed ||
boneAnim.ZPOS.HasAnimation() && boneAnim.ZPOS.GetKeyFrame(frame).IsKeyed ||
boneAnim.XROT.HasAnimation() && boneAnim.XROT.GetKeyFrame(frame).IsKeyed ||
boneAnim.YROT.HasAnimation() && boneAnim.YROT.GetKeyFrame(frame).IsKeyed ||
boneAnim.ZROT.HasAnimation() && boneAnim.ZROT.GetKeyFrame(frame).IsKeyed ||
boneAnim.WROT.HasAnimation() && boneAnim.WROT.GetKeyFrame(frame).IsKeyed ||
boneAnim.XSCA.HasAnimation() && boneAnim.XSCA.GetKeyFrame(frame).IsKeyed ||
boneAnim.YSCA.HasAnimation() && boneAnim.YSCA.GetKeyFrame(frame).IsKeyed ||
boneAnim.ZSCA.HasAnimation() && boneAnim.ZSCA.GetKeyFrame(frame).IsKeyed);
bool IsKeyed = boneAnim.HasKeyedFrames(frame);
if (IsKeyed)
{
KeyFrame key = new KeyFrame();
@ -67,7 +57,7 @@ namespace FirstPlugin.Forms
var rot = boneAnim.GetRotation(frame);
Vector3 sca = boneAnim.GetScale(frame);
/* key.PosX = pos.X;
key.PosX = pos.X;
key.PosY = pos.Y;
key.PosZ = pos.Z;
@ -78,22 +68,22 @@ namespace FirstPlugin.Forms
key.ScaX = sca.X;
key.ScaY = sca.Y;
key.ScaZ = sca.Z;*/
key.ScaZ = sca.Z;
/* listViewCustom2.Items.Add(key.Frame.ToString()).SubItems.AddRange(
listViewCustom2.Items.Add(key.Frame.ToString()).SubItems.AddRange(
new ListViewItem.ListViewSubItem[]
{
new ListViewItem.ListViewSubItem() { Text = key.PosX.ToString() },
new ListViewItem.ListViewSubItem() { Text = key.PosY.ToString() },
new ListViewItem.ListViewSubItem() { Text = key.PosZ.ToString() },
new ListViewItem.ListViewSubItem() { Text = key.ScaX.ToString() },
new ListViewItem.ListViewSubItem() { Text = key.ScaY.ToString() },
new ListViewItem.ListViewSubItem() { Text = key.ScaZ.ToString() },
new ListViewItem.ListViewSubItem() { Text = key.RotX.ToString() },
new ListViewItem.ListViewSubItem() { Text = key.RotY.ToString() },
new ListViewItem.ListViewSubItem() { Text = key.RotZ.ToString() },
new ListViewItem.ListViewSubItem() { Text = key.RotW.ToString() },
new ListViewItem.ListViewSubItem() { Text = key.ScaX.ToString() },
new ListViewItem.ListViewSubItem() { Text = key.ScaY.ToString() },
new ListViewItem.ListViewSubItem() { Text = key.ScaZ.ToString() },
});*/
new ListViewItem.ListViewSubItem() { Text = key.PosX.ToString() },
new ListViewItem.ListViewSubItem() { Text = key.PosY.ToString() },
new ListViewItem.ListViewSubItem() { Text = key.PosZ.ToString() },
});
}
}
listViewCustom2.EndUpdate();

View file

@ -31,6 +31,19 @@
this.splitter1 = new System.Windows.Forms.Splitter();
this.stPanel2 = new Switch_Toolbox.Library.Forms.STPanel();
this.stPanel4 = new Switch_Toolbox.Library.Forms.STPanel();
this.objectListView1 = new BrightIdeasSoftware.ObjectListView();
this.olvColumn1 = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn()));
this.olvColumn2 = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn()));
this.olvColumn3 = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn()));
this.olvColumn4 = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn()));
this.olvColumn5 = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn()));
this.olvColumn6 = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn()));
this.olvColumn7 = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn()));
this.olvColumn8 = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn()));
this.olvColumn9 = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn()));
this.olvColumn10 = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn()));
this.olvColumn11 = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn()));
this.listViewCustom1 = new Switch_Toolbox.Library.Forms.ListViewCustom();
this.splitter2 = new System.Windows.Forms.Splitter();
this.stPanel3 = new Switch_Toolbox.Library.Forms.STPanel();
this.btnRemove = new Switch_Toolbox.Library.Forms.STButton();
@ -57,21 +70,10 @@
this.stLabel2 = new Switch_Toolbox.Library.Forms.STLabel();
this.stPanel1 = new Switch_Toolbox.Library.Forms.STPanel();
this.stPropertyGrid1 = new Switch_Toolbox.Library.Forms.STPropertyGrid();
this.listViewCustom1 = new Switch_Toolbox.Library.Forms.ListViewCustom();
this.objectListView1 = new BrightIdeasSoftware.ObjectListView();
this.olvColumn1 = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn()));
this.olvColumn2 = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn()));
this.olvColumn3 = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn()));
this.olvColumn4 = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn()));
this.olvColumn5 = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn()));
this.olvColumn6 = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn()));
this.olvColumn7 = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn()));
this.olvColumn8 = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn()));
this.olvColumn9 = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn()));
this.olvColumn10 = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn()));
this.olvColumn11 = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn()));
this.stButton1 = new Switch_Toolbox.Library.Forms.STButton();
this.stPanel2.SuspendLayout();
this.stPanel4.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.objectListView1)).BeginInit();
this.stPanel3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.currentFrameUD)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownFloat11)).BeginInit();
@ -85,7 +87,6 @@
((System.ComponentModel.ISupportInitialize)(this.numericUpDownFloat8)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownFloat9)).BeginInit();
this.stPanel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.objectListView1)).BeginInit();
this.SuspendLayout();
//
// splitter1
@ -120,6 +121,107 @@
this.stPanel4.Size = new System.Drawing.Size(800, 242);
this.stPanel4.TabIndex = 27;
//
// objectListView1
//
this.objectListView1.AllColumns.Add(this.olvColumn1);
this.objectListView1.AllColumns.Add(this.olvColumn2);
this.objectListView1.AllColumns.Add(this.olvColumn3);
this.objectListView1.AllColumns.Add(this.olvColumn4);
this.objectListView1.AllColumns.Add(this.olvColumn5);
this.objectListView1.AllColumns.Add(this.olvColumn6);
this.objectListView1.AllColumns.Add(this.olvColumn7);
this.objectListView1.AllColumns.Add(this.olvColumn8);
this.objectListView1.AllColumns.Add(this.olvColumn9);
this.objectListView1.AllColumns.Add(this.olvColumn10);
this.objectListView1.AllColumns.Add(this.olvColumn11);
this.objectListView1.CellEditUseWholeCell = false;
this.objectListView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.olvColumn1,
this.olvColumn2,
this.olvColumn3,
this.olvColumn4,
this.olvColumn5,
this.olvColumn6,
this.olvColumn7,
this.olvColumn8,
this.olvColumn9,
this.olvColumn10,
this.olvColumn11});
this.objectListView1.Cursor = System.Windows.Forms.Cursors.Default;
this.objectListView1.Dock = System.Windows.Forms.DockStyle.Fill;
this.objectListView1.Location = new System.Drawing.Point(0, 0);
this.objectListView1.Name = "objectListView1";
this.objectListView1.Size = new System.Drawing.Size(800, 242);
this.objectListView1.TabIndex = 1;
this.objectListView1.UseCompatibleStateImageBehavior = false;
this.objectListView1.View = System.Windows.Forms.View.Details;
//
// olvColumn1
//
this.olvColumn1.AspectName = "Frame";
this.olvColumn1.Text = "Frame";
//
// olvColumn2
//
this.olvColumn2.AspectName = "PosX";
this.olvColumn2.Text = "Pos X";
//
// olvColumn3
//
this.olvColumn3.AspectName = "PosY";
this.olvColumn3.Text = "Pos Y";
//
// olvColumn4
//
this.olvColumn4.AspectName = "PosZ";
this.olvColumn4.Text = "Pos Z";
//
// olvColumn5
//
this.olvColumn5.AspectName = "RotX";
this.olvColumn5.Text = "Rot X";
//
// olvColumn6
//
this.olvColumn6.AspectName = "RotY";
this.olvColumn6.Text = "Rot Y";
//
// olvColumn7
//
this.olvColumn7.AspectName = "RotZ";
this.olvColumn7.Text = "Rot Z";
//
// olvColumn8
//
this.olvColumn8.AspectName = "RotW";
this.olvColumn8.Text = "Rot W";
//
// olvColumn9
//
this.olvColumn9.AspectName = "ScaX";
this.olvColumn9.Text = "Sca X";
//
// olvColumn10
//
this.olvColumn10.AspectName = "ScaY";
this.olvColumn10.Text = "Sca Y";
//
// olvColumn11
//
this.olvColumn11.AspectName = "ScaZ";
this.olvColumn11.Text = "Sca Z";
//
// listViewCustom1
//
this.listViewCustom1.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.listViewCustom1.Dock = System.Windows.Forms.DockStyle.Fill;
this.listViewCustom1.Location = new System.Drawing.Point(0, 0);
this.listViewCustom1.Name = "listViewCustom1";
this.listViewCustom1.OwnerDraw = true;
this.listViewCustom1.Size = new System.Drawing.Size(800, 242);
this.listViewCustom1.TabIndex = 0;
this.listViewCustom1.UseCompatibleStateImageBehavior = false;
//
// splitter2
//
this.splitter2.Dock = System.Windows.Forms.DockStyle.Bottom;
@ -131,6 +233,7 @@
//
// stPanel3
//
this.stPanel3.Controls.Add(this.stButton1);
this.stPanel3.Controls.Add(this.btnRemove);
this.stPanel3.Controls.Add(this.frameCountLbl);
this.stPanel3.Controls.Add(this.btnInsert);
@ -514,125 +617,36 @@
// stPropertyGrid1
//
this.stPropertyGrid1.AutoScroll = true;
this.stPropertyGrid1.ShowHintDisplay = true;
this.stPropertyGrid1.Dock = System.Windows.Forms.DockStyle.Fill;
this.stPropertyGrid1.Location = new System.Drawing.Point(0, 0);
this.stPropertyGrid1.Name = "stPropertyGrid1";
this.stPropertyGrid1.ShowHintDisplay = true;
this.stPropertyGrid1.Size = new System.Drawing.Size(802, 234);
this.stPropertyGrid1.TabIndex = 0;
//
// listViewCustom1
// stButton1
//
this.listViewCustom1.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.listViewCustom1.Dock = System.Windows.Forms.DockStyle.Fill;
this.listViewCustom1.Location = new System.Drawing.Point(0, 0);
this.listViewCustom1.Name = "listViewCustom1";
this.listViewCustom1.OwnerDraw = true;
this.listViewCustom1.Size = new System.Drawing.Size(800, 242);
this.listViewCustom1.TabIndex = 0;
this.listViewCustom1.UseCompatibleStateImageBehavior = false;
this.stButton1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.stButton1.Location = new System.Drawing.Point(436, 6);
this.stButton1.Name = "stButton1";
this.stButton1.Size = new System.Drawing.Size(75, 23);
this.stButton1.TabIndex = 25;
this.stButton1.Text = "stButton1";
this.stButton1.UseVisualStyleBackColor = false;
this.stButton1.Click += new System.EventHandler(this.stButton1_Click);
//
// objectListView1
//
this.objectListView1.AllColumns.Add(this.olvColumn1);
this.objectListView1.AllColumns.Add(this.olvColumn2);
this.objectListView1.AllColumns.Add(this.olvColumn3);
this.objectListView1.AllColumns.Add(this.olvColumn4);
this.objectListView1.AllColumns.Add(this.olvColumn5);
this.objectListView1.AllColumns.Add(this.olvColumn6);
this.objectListView1.AllColumns.Add(this.olvColumn7);
this.objectListView1.AllColumns.Add(this.olvColumn8);
this.objectListView1.AllColumns.Add(this.olvColumn9);
this.objectListView1.AllColumns.Add(this.olvColumn10);
this.objectListView1.AllColumns.Add(this.olvColumn11);
this.objectListView1.CellEditUseWholeCell = false;
this.objectListView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.olvColumn1,
this.olvColumn2,
this.olvColumn3,
this.olvColumn4,
this.olvColumn5,
this.olvColumn6,
this.olvColumn7,
this.olvColumn8,
this.olvColumn9,
this.olvColumn10,
this.olvColumn11});
this.objectListView1.Cursor = System.Windows.Forms.Cursors.Default;
this.objectListView1.Dock = System.Windows.Forms.DockStyle.Fill;
this.objectListView1.Location = new System.Drawing.Point(0, 0);
this.objectListView1.Name = "objectListView1";
this.objectListView1.Size = new System.Drawing.Size(800, 242);
this.objectListView1.TabIndex = 1;
this.objectListView1.UseCompatibleStateImageBehavior = false;
this.objectListView1.View = System.Windows.Forms.View.Details;
//
// olvColumn1
//
this.olvColumn1.AspectName = "Frame";
this.olvColumn1.Text = "Frame";
//
// olvColumn2
//
this.olvColumn2.AspectName = "PosX";
this.olvColumn2.Text = "Pos X";
//
// olvColumn3
//
this.olvColumn3.AspectName = "PosY";
this.olvColumn3.Text = "Pos Y";
//
// olvColumn4
//
this.olvColumn4.AspectName = "PosZ";
this.olvColumn4.Text = "Pos Z";
//
// olvColumn5
//
this.olvColumn5.AspectName = "RotX";
this.olvColumn5.Text = "Rot X";
//
// olvColumn6
//
this.olvColumn6.AspectName = "RotY";
this.olvColumn6.Text = "Rot Y";
//
// olvColumn7
//
this.olvColumn7.AspectName = "RotZ";
this.olvColumn7.Text = "Rot Z";
//
// olvColumn8
//
this.olvColumn8.AspectName = "RotW";
this.olvColumn8.Text = "Rot W";
//
// olvColumn9
//
this.olvColumn9.AspectName = "ScaX";
this.olvColumn9.Text = "Sca X";
//
// olvColumn10
//
this.olvColumn10.AspectName = "ScaY";
this.olvColumn10.Text = "Sca Y";
//
// olvColumn11
//
this.olvColumn11.AspectName = "ScaZ";
this.olvColumn11.Text = "Sca Z";
//
// BoneAnimEditor
// BoneAnimEditor2
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.stPanel2);
this.Controls.Add(this.splitter1);
this.Controls.Add(this.stPanel1);
this.Name = "BoneAnimEditor";
this.Name = "BoneAnimEditor2";
this.Size = new System.Drawing.Size(802, 640);
this.stPanel2.ResumeLayout(false);
this.stPanel4.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.objectListView1)).EndInit();
this.stPanel3.ResumeLayout(false);
this.stPanel3.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.currentFrameUD)).EndInit();
@ -647,7 +661,6 @@
((System.ComponentModel.ISupportInitialize)(this.numericUpDownFloat8)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownFloat9)).EndInit();
this.stPanel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.objectListView1)).EndInit();
this.ResumeLayout(false);
}
@ -696,5 +709,6 @@
private BrightIdeasSoftware.OLVColumn olvColumn9;
private BrightIdeasSoftware.OLVColumn olvColumn10;
private BrightIdeasSoftware.OLVColumn olvColumn11;
private Switch_Toolbox.Library.Forms.STButton stButton1;
}
}

View file

@ -23,8 +23,12 @@ namespace FirstPlugin.Forms
objectListView1.ForeColor = FormThemes.BaseTheme.FormForeColor;
}
private FSKA.BoneAnimNode ActiveBoneAnim;
public void LoadBoneAnim(FSKA.BoneAnimNode boneAnim)
{
ActiveBoneAnim = boneAnim;
objectListView1.BeginUpdate();
objectListView1.ClearObjects();
objectListView1.ShowGroups = false;
@ -39,21 +43,9 @@ namespace FirstPlugin.Forms
frameCountLbl.Text = $" / {fska.FrameCount}";
currentFrameUD.Maximum = fska.FrameCount;
return;
for (int frame = 0; frame <= fska.FrameCount; frame++)
{
bool IsKeyed = (boneAnim.XPOS.HasAnimation() && boneAnim.XPOS.GetKeyFrame(frame).IsKeyed ||
boneAnim.YPOS.HasAnimation() && boneAnim.YPOS.GetKeyFrame(frame).IsKeyed ||
boneAnim.ZPOS.HasAnimation() && boneAnim.ZPOS.GetKeyFrame(frame).IsKeyed ||
boneAnim.XROT.HasAnimation() && boneAnim.XROT.GetKeyFrame(frame).IsKeyed ||
boneAnim.YROT.HasAnimation() && boneAnim.YROT.GetKeyFrame(frame).IsKeyed ||
boneAnim.ZROT.HasAnimation() && boneAnim.ZROT.GetKeyFrame(frame).IsKeyed ||
boneAnim.WROT.HasAnimation() && boneAnim.WROT.GetKeyFrame(frame).IsKeyed ||
boneAnim.XSCA.HasAnimation() && boneAnim.XSCA.GetKeyFrame(frame).IsKeyed ||
boneAnim.YSCA.HasAnimation() && boneAnim.YSCA.GetKeyFrame(frame).IsKeyed ||
boneAnim.ZSCA.HasAnimation() && boneAnim.ZSCA.GetKeyFrame(frame).IsKeyed);
bool IsKeyed = boneAnim.HasKeyedFrames(frame);
if (IsKeyed)
{
KeyFrame key = new KeyFrame();
@ -136,5 +128,12 @@ namespace FirstPlugin.Forms
{
}
private void stButton1_Click(object sender, EventArgs e)
{
AnimKeyViewer viewer = new AnimKeyViewer();
viewer.LoadKeyData(ActiveBoneAnim.XPOS);
viewer.Show();
}
}
}

View file

@ -135,6 +135,20 @@ namespace Switch_Toolbox.Library.Animations
if (dialog.ShowDialog() == DialogResult.OK) { Text = dialog.textBox1.Text; }
}
public bool HasKeyedFrames(float frame)
{
return (XPOS.HasAnimation() && XPOS.GetKeyFrame(frame).IsKeyed ||
YPOS.HasAnimation() && YPOS.GetKeyFrame(frame).IsKeyed ||
ZPOS.HasAnimation() && ZPOS.GetKeyFrame(frame).IsKeyed ||
XROT.HasAnimation() && XROT.GetKeyFrame(frame).IsKeyed ||
YROT.HasAnimation() && YROT.GetKeyFrame(frame).IsKeyed ||
ZROT.HasAnimation() && ZROT.GetKeyFrame(frame).IsKeyed ||
WROT.HasAnimation() && WROT.GetKeyFrame(frame).IsKeyed ||
XSCA.HasAnimation() && XSCA.GetKeyFrame(frame).IsKeyed ||
YSCA.HasAnimation() && YSCA.GetKeyFrame(frame).IsKeyed ||
ZSCA.HasAnimation() && ZSCA.GetKeyFrame(frame).IsKeyed);
}
public Vector3 GetPosition(float frame)
{
Vector3 pos = new Vector3(0);