1
0
mirror of synced 2024-12-11 23:36:01 +01:00
Switch-Toolbox/Switch_Toolbox_Library/FileFormats/Animation/SEANIM.cs
KillzXGaming cd57a856fc Add improvements from yesterday.
PBR shader slghtly improved.
Skyobx toggle now works while viewport is active,
Cubemaps now have a check wether or not the file given is a valid cube map dds.
Update column sizing so forms load much faster
Option to right click and clear paths in settings if set
2019-05-15 15:35:05 -04:00

38 lines
1.2 KiB
C#

using SELib;
using OpenTK;
namespace Switch_Toolbox.Library.Animations
{
public class SEANIM
{
public static void SaveAnimation(string FileName, Animation anim, STSkeleton skeleton)
{
SEAnim seAnim = new SEAnim();
//Reset active animation to 0
anim.SetFrame(0);
for (int frame = 0; frame < anim.FrameCount; frame++)
{
anim.NextFrame(skeleton, false, true);
foreach (Animation.KeyNode boneAnim in anim.Bones)
{
STBone bone = skeleton.GetBone(boneAnim.Text);
if (bone == null) continue;
Vector3 position = bone.GetPosition();
Quaternion rotation = bone.GetRotation();
Vector3 scale = bone.GetScale();
seAnim.AddTranslationKey(boneAnim.Text, frame, bone.pos.X, bone.pos.Y, bone.pos.Z);
seAnim.AddRotationKey(boneAnim.Text, frame, bone.rot.X, bone.rot.Y, bone.rot.Z, bone.rot.W);
//seAnim.AddScaleKey(boneAnim.Text, frame, scale.X, scale.Y, scale.Z);
}
}
seAnim.Write(FileName);
}
}
}