Fix animations with zero frame count saving with no animation data
This commit is contained in:
parent
6826fa01cf
commit
13af269adb
@ -213,6 +213,8 @@ namespace Toolbox.Library.Animations
|
||||
|
||||
using (System.IO.StreamWriter file = new System.IO.StreamWriter(@fname))
|
||||
{
|
||||
float frameCount = Math.Max(1, a.FrameCount);
|
||||
|
||||
AnimHeader header = new AnimHeader();
|
||||
file.WriteLine("animVersion " + header.animVersion + ";");
|
||||
file.WriteLine("mayaVersion " + header.mayaVersion + ";");
|
||||
@ -220,10 +222,10 @@ namespace Toolbox.Library.Animations
|
||||
file.WriteLine("linearUnit " + header.linearUnit + ";");
|
||||
file.WriteLine("angularUnit " + header.angularUnit + ";");
|
||||
file.WriteLine("startTime " + 1 + ";");
|
||||
file.WriteLine("endTime " + a.FrameCount + ";");
|
||||
file.WriteLine("endTime " + frameCount + ";");
|
||||
|
||||
a.SetFrame(a.FrameCount - 1); //from last frame
|
||||
for (int li = 0; li < a.FrameCount; ++li) //go through each frame with nextFrame
|
||||
a.SetFrame(frameCount - 1); //from last frame
|
||||
for (int li = 0; li < frameCount; ++li) //go through each frame with nextFrame
|
||||
a.NextFrame(vbn, false, true);
|
||||
a.NextFrame(vbn, false, true); //go on first frame
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
using SELib;
|
||||
using OpenTK;
|
||||
using System.Linq;
|
||||
using System;
|
||||
|
||||
namespace Toolbox.Library.Animations
|
||||
{
|
||||
@ -176,7 +177,7 @@ namespace Toolbox.Library.Animations
|
||||
seAnim.AnimType = AnimationType.Absolute;
|
||||
|
||||
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.NextFrame();
|
||||
|
@ -305,7 +305,7 @@ namespace Toolbox.Library.Animations
|
||||
|
||||
file.WriteLine("skeleton");
|
||||
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.NextFrame();
|
||||
|
Loading…
Reference in New Issue
Block a user