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

View file

@ -36,6 +36,14 @@
<HintPath>..\Toolbox\Lib\BrawlLib.dll</HintPath> <HintPath>..\Toolbox\Lib\BrawlLib.dll</HintPath>
<Private>False</Private> <Private>False</Private>
</Reference> </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"> <Reference Include="Syroot.BinaryData">
<HintPath>..\Toolbox\Lib\Syroot.BinaryData.dll</HintPath> <HintPath>..\Toolbox\Lib\Syroot.BinaryData.dll</HintPath>
<Private>False</Private> <Private>False</Private>
@ -54,6 +62,7 @@
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" /> <Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" /> <Reference Include="Microsoft.CSharp" />
@ -62,8 +71,16 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="BrawlboxHelper.cs" /> <Compile Include="BrawlHelperTest2.cs" />
<Compile Include="BrawlHelper.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup> </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" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> </Project>

View file

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

View file

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

View file

@ -31,6 +31,19 @@
this.splitter1 = new System.Windows.Forms.Splitter(); this.splitter1 = new System.Windows.Forms.Splitter();
this.stPanel2 = new Switch_Toolbox.Library.Forms.STPanel(); this.stPanel2 = new Switch_Toolbox.Library.Forms.STPanel();
this.stPanel4 = 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.splitter2 = new System.Windows.Forms.Splitter();
this.stPanel3 = new Switch_Toolbox.Library.Forms.STPanel(); this.stPanel3 = new Switch_Toolbox.Library.Forms.STPanel();
this.btnRemove = new Switch_Toolbox.Library.Forms.STButton(); this.btnRemove = new Switch_Toolbox.Library.Forms.STButton();
@ -57,21 +70,10 @@
this.stLabel2 = new Switch_Toolbox.Library.Forms.STLabel(); this.stLabel2 = new Switch_Toolbox.Library.Forms.STLabel();
this.stPanel1 = new Switch_Toolbox.Library.Forms.STPanel(); this.stPanel1 = new Switch_Toolbox.Library.Forms.STPanel();
this.stPropertyGrid1 = new Switch_Toolbox.Library.Forms.STPropertyGrid(); this.stPropertyGrid1 = new Switch_Toolbox.Library.Forms.STPropertyGrid();
this.listViewCustom1 = new Switch_Toolbox.Library.Forms.ListViewCustom(); this.stButton1 = new Switch_Toolbox.Library.Forms.STButton();
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.stPanel2.SuspendLayout(); this.stPanel2.SuspendLayout();
this.stPanel4.SuspendLayout(); this.stPanel4.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.objectListView1)).BeginInit();
this.stPanel3.SuspendLayout(); this.stPanel3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.currentFrameUD)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.currentFrameUD)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownFloat11)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownFloat11)).BeginInit();
@ -85,7 +87,6 @@
((System.ComponentModel.ISupportInitialize)(this.numericUpDownFloat8)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownFloat8)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownFloat9)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownFloat9)).BeginInit();
this.stPanel1.SuspendLayout(); this.stPanel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.objectListView1)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
// splitter1 // splitter1
@ -120,6 +121,107 @@
this.stPanel4.Size = new System.Drawing.Size(800, 242); this.stPanel4.Size = new System.Drawing.Size(800, 242);
this.stPanel4.TabIndex = 27; 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 // splitter2
// //
this.splitter2.Dock = System.Windows.Forms.DockStyle.Bottom; this.splitter2.Dock = System.Windows.Forms.DockStyle.Bottom;
@ -131,6 +233,7 @@
// //
// stPanel3 // stPanel3
// //
this.stPanel3.Controls.Add(this.stButton1);
this.stPanel3.Controls.Add(this.btnRemove); this.stPanel3.Controls.Add(this.btnRemove);
this.stPanel3.Controls.Add(this.frameCountLbl); this.stPanel3.Controls.Add(this.frameCountLbl);
this.stPanel3.Controls.Add(this.btnInsert); this.stPanel3.Controls.Add(this.btnInsert);
@ -514,125 +617,36 @@
// stPropertyGrid1 // stPropertyGrid1
// //
this.stPropertyGrid1.AutoScroll = true; this.stPropertyGrid1.AutoScroll = true;
this.stPropertyGrid1.ShowHintDisplay = true;
this.stPropertyGrid1.Dock = System.Windows.Forms.DockStyle.Fill; this.stPropertyGrid1.Dock = System.Windows.Forms.DockStyle.Fill;
this.stPropertyGrid1.Location = new System.Drawing.Point(0, 0); this.stPropertyGrid1.Location = new System.Drawing.Point(0, 0);
this.stPropertyGrid1.Name = "stPropertyGrid1"; this.stPropertyGrid1.Name = "stPropertyGrid1";
this.stPropertyGrid1.ShowHintDisplay = true;
this.stPropertyGrid1.Size = new System.Drawing.Size(802, 234); this.stPropertyGrid1.Size = new System.Drawing.Size(802, 234);
this.stPropertyGrid1.TabIndex = 0; this.stPropertyGrid1.TabIndex = 0;
// //
// listViewCustom1 // stButton1
// //
this.listViewCustom1.BorderStyle = System.Windows.Forms.BorderStyle.None; this.stButton1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.listViewCustom1.Dock = System.Windows.Forms.DockStyle.Fill; this.stButton1.Location = new System.Drawing.Point(436, 6);
this.listViewCustom1.Location = new System.Drawing.Point(0, 0); this.stButton1.Name = "stButton1";
this.listViewCustom1.Name = "listViewCustom1"; this.stButton1.Size = new System.Drawing.Size(75, 23);
this.listViewCustom1.OwnerDraw = true; this.stButton1.TabIndex = 25;
this.listViewCustom1.Size = new System.Drawing.Size(800, 242); this.stButton1.Text = "stButton1";
this.listViewCustom1.TabIndex = 0; this.stButton1.UseVisualStyleBackColor = false;
this.listViewCustom1.UseCompatibleStateImageBehavior = false; this.stButton1.Click += new System.EventHandler(this.stButton1_Click);
// //
// objectListView1 // BoneAnimEditor2
//
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
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.stPanel2); this.Controls.Add(this.stPanel2);
this.Controls.Add(this.splitter1); this.Controls.Add(this.splitter1);
this.Controls.Add(this.stPanel1); this.Controls.Add(this.stPanel1);
this.Name = "BoneAnimEditor"; this.Name = "BoneAnimEditor2";
this.Size = new System.Drawing.Size(802, 640); this.Size = new System.Drawing.Size(802, 640);
this.stPanel2.ResumeLayout(false); this.stPanel2.ResumeLayout(false);
this.stPanel4.ResumeLayout(false); this.stPanel4.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.objectListView1)).EndInit();
this.stPanel3.ResumeLayout(false); this.stPanel3.ResumeLayout(false);
this.stPanel3.PerformLayout(); this.stPanel3.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.currentFrameUD)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.currentFrameUD)).EndInit();
@ -647,7 +661,6 @@
((System.ComponentModel.ISupportInitialize)(this.numericUpDownFloat8)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownFloat8)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownFloat9)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownFloat9)).EndInit();
this.stPanel1.ResumeLayout(false); this.stPanel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.objectListView1)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
} }
@ -696,5 +709,6 @@
private BrightIdeasSoftware.OLVColumn olvColumn9; private BrightIdeasSoftware.OLVColumn olvColumn9;
private BrightIdeasSoftware.OLVColumn olvColumn10; private BrightIdeasSoftware.OLVColumn olvColumn10;
private BrightIdeasSoftware.OLVColumn olvColumn11; 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; objectListView1.ForeColor = FormThemes.BaseTheme.FormForeColor;
} }
private FSKA.BoneAnimNode ActiveBoneAnim;
public void LoadBoneAnim(FSKA.BoneAnimNode boneAnim) public void LoadBoneAnim(FSKA.BoneAnimNode boneAnim)
{ {
ActiveBoneAnim = boneAnim;
objectListView1.BeginUpdate(); objectListView1.BeginUpdate();
objectListView1.ClearObjects(); objectListView1.ClearObjects();
objectListView1.ShowGroups = false; objectListView1.ShowGroups = false;
@ -39,21 +43,9 @@ namespace FirstPlugin.Forms
frameCountLbl.Text = $" / {fska.FrameCount}"; frameCountLbl.Text = $" / {fska.FrameCount}";
currentFrameUD.Maximum = fska.FrameCount; currentFrameUD.Maximum = fska.FrameCount;
return;
for (int frame = 0; frame <= fska.FrameCount; frame++) for (int frame = 0; frame <= fska.FrameCount; frame++)
{ {
bool IsKeyed = (boneAnim.XPOS.HasAnimation() && boneAnim.XPOS.GetKeyFrame(frame).IsKeyed || bool IsKeyed = boneAnim.HasKeyedFrames(frame);
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);
if (IsKeyed) if (IsKeyed)
{ {
KeyFrame key = new KeyFrame(); 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; } 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) public Vector3 GetPosition(float frame)
{ {
Vector3 pos = new Vector3(0); Vector3 pos = new Vector3(0);