Skip to content

Commit

Permalink
Fix texture pattern offsetting due to quantization
Browse files Browse the repository at this point in the history
  • Loading branch information
KillzXGaming committed Nov 30, 2024
1 parent b6aab90 commit fa561fa
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Plugins/CafeLibrary/Bfres/Animations/BfresCameraAnim.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,17 @@ private void ReplaceAction()
if (dlg.ShowDialog())
{
CameraAnim.Import(dlg.FilePath, ResFile);
CameraAnim.Name = this.Name;
CameraAnim.Name = this.UINode.Header;

//Update types if needed as can be broken by user error
foreach (var curve in CameraAnim.Curves)
{
var maxFrame = curve.Frames.Max(x => x);
if (maxFrame > 255 && curve.FrameType == AnimCurveFrameType.Byte)
curve.FrameType = AnimCurveFrameType.Decimal10x5;
if (maxFrame > ushort.MaxValue)
curve.FrameType = AnimCurveFrameType.Single;
}

Reload(CameraAnim);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ public static void ConvertAnimation(BfresMaterialAnim anim, MaterialAnim animTar
samplerAnimHelper.Name = track.Name;
samplerAnimHelper.Constant = (ushort)track.KeyFrames[0].Value;

((BfresAnimationTrack)track).Offset = 0;
((BfresAnimationTrack)track).Scale = 1f;

if (track.KeyFrames.Count > 1)
samplerAnimHelper.Curve = ConvertCurve((BfresAnimationTrack)track, 0);

Expand Down

0 comments on commit fa561fa

Please sign in to comment.