Fix some anim exporting issues
This commit is contained in:
parent
395a9bd65d
commit
c4279e6404
@ -11,6 +11,32 @@ namespace Toolbox.Library.Animations
|
|||||||
//https://github.com/jam1garner/Smash-Forge/blob/3a5b770a96b2ba7e67ff3912ca23941851f6d9eb/Smash%20Forge/Filetypes/Animation/ANIM.cs
|
//https://github.com/jam1garner/Smash-Forge/blob/3a5b770a96b2ba7e67ff3912ca23941851f6d9eb/Smash%20Forge/Filetypes/Animation/ANIM.cs
|
||||||
public class ANIM
|
public class ANIM
|
||||||
{
|
{
|
||||||
|
private class AnimHeader
|
||||||
|
{
|
||||||
|
public string animVersion;
|
||||||
|
public string mayaVersion;
|
||||||
|
public float startTime;
|
||||||
|
public float endTime;
|
||||||
|
public float startUnitless;
|
||||||
|
public float endUnitless;
|
||||||
|
public string timeUnit;
|
||||||
|
public string linearUnit;
|
||||||
|
public string angularUnit;
|
||||||
|
|
||||||
|
public AnimHeader()
|
||||||
|
{
|
||||||
|
animVersion = "1.1";
|
||||||
|
mayaVersion = "2015";
|
||||||
|
startTime = 0;
|
||||||
|
endTime = 0;
|
||||||
|
startUnitless = 0;
|
||||||
|
endUnitless = 0;
|
||||||
|
timeUnit = "ntscf";
|
||||||
|
linearUnit = "cm";
|
||||||
|
angularUnit = "deg";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private class AnimKey{
|
private class AnimKey{
|
||||||
public float input, output;
|
public float input, output;
|
||||||
public string intan, outtan;
|
public string intan, outtan;
|
||||||
@ -181,8 +207,14 @@ namespace Toolbox.Library.Animations
|
|||||||
{
|
{
|
||||||
using (System.IO.StreamWriter file = new System.IO.StreamWriter(@fname))
|
using (System.IO.StreamWriter file = new System.IO.StreamWriter(@fname))
|
||||||
{
|
{
|
||||||
file.WriteLine("animVersion 1.1;");
|
AnimHeader header = new AnimHeader();
|
||||||
file.WriteLine("mayaVersion 2014 x64;\ntimeUnit ntscf;\nlinearUnit cm;\nangularUnit deg;\nstartTime 1;\nendTime " + (a.FrameCount+1) + ";");
|
file.WriteLine("animVersion " + header.animVersion + ";");
|
||||||
|
file.WriteLine("mayaVersion " + header.mayaVersion + ";");
|
||||||
|
file.WriteLine("timeUnit " + header.timeUnit + ";");
|
||||||
|
file.WriteLine("linearUnit " + header.linearUnit + ";");
|
||||||
|
file.WriteLine("angularUnit " + header.angularUnit + ";");
|
||||||
|
file.WriteLine("startTime " + 1 + ";");
|
||||||
|
file.WriteLine("endTime " + a.FrameCount + ";");
|
||||||
|
|
||||||
a.SetFrame(a.FrameCount - 1); //from last frame
|
a.SetFrame(a.FrameCount - 1); //from last frame
|
||||||
for (int li = 0; li < a.FrameCount; ++li) //go through each frame with nextFrame
|
for (int li = 0; li < a.FrameCount; ++li) //go through each frame with nextFrame
|
||||||
@ -203,7 +235,6 @@ namespace Toolbox.Library.Animations
|
|||||||
Animation.KeyNode n = a.GetBone(b.Text);
|
Animation.KeyNode n = a.GetBone(b.Text);
|
||||||
int ac = 0;
|
int ac = 0;
|
||||||
|
|
||||||
|
|
||||||
if (n.XPOS.HasAnimation())
|
if (n.XPOS.HasAnimation())
|
||||||
{
|
{
|
||||||
file.WriteLine("anim translate.translateX translateX " + b.Text + " 0 0 " + (ac++) + ";");
|
file.WriteLine("anim translate.translateX translateX " + b.Text + " 0 0 " + (ac++) + ";");
|
||||||
@ -259,6 +290,9 @@ namespace Toolbox.Library.Animations
|
|||||||
writeKey(file, n.ZSCA, n, a.Size(), "scaleZ");
|
writeKey(file, n.ZSCA, n, a.Size(), "scaleZ");
|
||||||
file.WriteLine("}");
|
file.WriteLine("}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ac == 0)
|
||||||
|
file.WriteLine("anim " + b.Text + " 0 0 0;");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user