mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-11-25 22:10:22 +00:00
Fix animations with zero frame count saving with no animation data
This commit is contained in:
parent
6826fa01cf
commit
13af269adb
3 changed files with 8 additions and 5 deletions
|
@ -213,6 +213,8 @@ namespace Toolbox.Library.Animations
|
||||||
|
|
||||||
using (System.IO.StreamWriter file = new System.IO.StreamWriter(@fname))
|
using (System.IO.StreamWriter file = new System.IO.StreamWriter(@fname))
|
||||||
{
|
{
|
||||||
|
float frameCount = Math.Max(1, a.FrameCount);
|
||||||
|
|
||||||
AnimHeader header = new AnimHeader();
|
AnimHeader header = new AnimHeader();
|
||||||
file.WriteLine("animVersion " + header.animVersion + ";");
|
file.WriteLine("animVersion " + header.animVersion + ";");
|
||||||
file.WriteLine("mayaVersion " + header.mayaVersion + ";");
|
file.WriteLine("mayaVersion " + header.mayaVersion + ";");
|
||||||
|
@ -220,10 +222,10 @@ namespace Toolbox.Library.Animations
|
||||||
file.WriteLine("linearUnit " + header.linearUnit + ";");
|
file.WriteLine("linearUnit " + header.linearUnit + ";");
|
||||||
file.WriteLine("angularUnit " + header.angularUnit + ";");
|
file.WriteLine("angularUnit " + header.angularUnit + ";");
|
||||||
file.WriteLine("startTime " + 1 + ";");
|
file.WriteLine("startTime " + 1 + ";");
|
||||||
file.WriteLine("endTime " + a.FrameCount + ";");
|
file.WriteLine("endTime " + frameCount + ";");
|
||||||
|
|
||||||
a.SetFrame(a.FrameCount - 1); //from last frame
|
a.SetFrame(frameCount - 1); //from last frame
|
||||||
for (int li = 0; li < a.FrameCount; ++li) //go through each frame with nextFrame
|
for (int li = 0; li < frameCount; ++li) //go through each frame with nextFrame
|
||||||
a.NextFrame(vbn, false, true);
|
a.NextFrame(vbn, false, true);
|
||||||
a.NextFrame(vbn, false, true); //go on first frame
|
a.NextFrame(vbn, false, true); //go on first frame
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
using SELib;
|
using SELib;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace Toolbox.Library.Animations
|
namespace Toolbox.Library.Animations
|
||||||
{
|
{
|
||||||
|
@ -176,7 +177,7 @@ namespace Toolbox.Library.Animations
|
||||||
seAnim.AnimType = AnimationType.Absolute;
|
seAnim.AnimType = AnimationType.Absolute;
|
||||||
|
|
||||||
anim.SetFrame(0);
|
anim.SetFrame(0);
|
||||||
for (int frame = 0; frame < anim.FrameCount; frame++)
|
for (int frame = 0; frame < Math.Max(1, anim.FrameCount); frame++)
|
||||||
{
|
{
|
||||||
anim.SetFrame(frame);
|
anim.SetFrame(frame);
|
||||||
anim.NextFrame();
|
anim.NextFrame();
|
||||||
|
|
|
@ -305,7 +305,7 @@ namespace Toolbox.Library.Animations
|
||||||
|
|
||||||
file.WriteLine("skeleton");
|
file.WriteLine("skeleton");
|
||||||
anim.SetFrame(0);
|
anim.SetFrame(0);
|
||||||
for (int i = 0; i <= anim.FrameCount; i++)
|
for (int i = 0; i <= Math.Max(1, anim.FrameCount); i++)
|
||||||
{
|
{
|
||||||
anim.SetFrame(i);
|
anim.SetFrame(i);
|
||||||
anim.NextFrame();
|
anim.NextFrame();
|
||||||
|
|
Loading…
Reference in a new issue