1
0
mirror of synced 2024-11-30 18:24:39 +01:00

Fix Wii U converting to switch fska (Also fixes chr0 importing for wii u bfres)

This commit is contained in:
KillzXGaming 2019-05-24 21:30:02 -04:00
parent d1e2b05b51
commit 16ae15328d
5 changed files with 13 additions and 26 deletions

Binary file not shown.

View File

@ -662,27 +662,6 @@ namespace BrawlboxHelper
return value.X == value.Y && value.X == value.Z; return value.X == value.Y && value.X == value.Z;
} }
private static bool HasKeyFrames(CHR0EntryNode entry)
{
for (int frame = 0; frame < entry.FrameCount; frame++)
{
var AnimFrame = entry.GetAnimFrame(frame);
if (frame > 0)
{
if (AnimFrame.hasTx) return true;
if (AnimFrame.hasTy) return true;
if (AnimFrame.hasTz) return true;
if (AnimFrame.hasRx) return true;
if (AnimFrame.hasRy) return true;
if (AnimFrame.hasRz) return true;
if (AnimFrame.hasSx) return true;
if (AnimFrame.hasSy) return true;
if (AnimFrame.hasSz) return true;
}
}
return false;
}
private static AnimCurve GenerateCurve(uint AnimOffset, CHR0EntryNode entry) private static AnimCurve GenerateCurve(uint AnimOffset, CHR0EntryNode entry)
{ {
AnimCurve curve = new AnimCurve(); AnimCurve curve = new AnimCurve();
@ -751,6 +730,8 @@ namespace BrawlboxHelper
} }
} }
Console.WriteLine($"AnimOffset {AnimOffset} Keys {Keys.Count}");
//Max value in frames is our end frame //Max value in frames is our end frame
curve.EndFrame = Frames.Max(); curve.EndFrame = Frames.Max();
curve.Frames = Frames.ToArray(); curve.Frames = Frames.ToArray();

View File

@ -350,21 +350,27 @@ namespace Bfres.Structs
boneAnimU.FlagsCurve = (ResU.BoneAnimFlagsCurve)boneAnimNX.FlagsCurve; boneAnimU.FlagsCurve = (ResU.BoneAnimFlagsCurve)boneAnimNX.FlagsCurve;
boneAnimU.FlagsTransform = (ResU.BoneAnimFlagsTransform)boneAnimNX.FlagsTransform; boneAnimU.FlagsTransform = (ResU.BoneAnimFlagsTransform)boneAnimNX.FlagsTransform;
foreach (var curveNX in boneAnimU.Curves) foreach (var curveNX in boneAnimNX.Curves)
{ {
ResU.AnimCurve curve = new ResU.AnimCurve(); ResU.AnimCurve curve = new ResU.AnimCurve();
curve.AnimDataOffset = curveNX.AnimDataOffset; curve.AnimDataOffset = curveNX.AnimDataOffset;
curve.CurveType = curveNX.CurveType; curve.CurveType = (ResU.AnimCurveType)curveNX.CurveType;
curve.Delta = curveNX.Delta; curve.Delta = curveNX.Delta;
curve.EndFrame = curveNX.EndFrame; curve.EndFrame = curveNX.EndFrame;
curve.Frames = curveNX.Frames; curve.Frames = curveNX.Frames;
curve.Keys = curveNX.Keys; curve.Keys = curveNX.Keys;
curve.KeyStepBoolData = curveNX.KeyStepBoolData; curve.KeyStepBoolData = curveNX.KeyStepBoolData;
curve.KeyType = curveNX.KeyType; curve.KeyType = (ResU.AnimCurveKeyType)curveNX.KeyType;
curve.FrameType = curveNX.FrameType; curve.FrameType = (ResU.AnimCurveFrameType)curveNX.FrameType;
curve.StartFrame = curveNX.StartFrame; curve.StartFrame = curveNX.StartFrame;
curve.Scale = curveNX.Scale; curve.Scale = curveNX.Scale;
curve.Offset = curveNX.Offset; if (curve.Offset.GetType() == typeof(float))
curve.Offset = (float)curveNX.Offset;
if (curve.Offset.GetType() == typeof(uint))
curve.Offset = (uint)curveNX.Offset;
if (curve.Offset.GetType() == typeof(int))
curve.Offset = (int)curveNX.Offset;
boneAnimU.Curves.Add(curve); boneAnimU.Curves.Add(curve);
} }
} }