Ejemplo n.º 1
0
        private void LoadAnim(ResU.SkeletalAnim ska)
        {
            Text = ska.Name;

            FrameCount    = ska.FrameCount;
            SkeletalAnimU = ska;

            Initialize();
        }
Ejemplo n.º 2
0
        private void UpdateAnimation(SkeletalAnim ska)
        {
            ska.Name = Text;

            if (SkeletalAnimU != null)
            {
                SkeletalAnimU = BfresPlatformConverter.FSKAConvertSwitchToWiiU(ska);
                LoadAnim(SkeletalAnimU);
            }
            else
            {
                SkeletalAnim = ska;
                LoadAnim(SkeletalAnim);
            }
        }
        public static ResU.SkeletalAnim FSKAConvertSwitchToWiiU(ResNX.SkeletalAnim skeletalAnimNX)
        {
            ResU.SkeletalAnim ska = new ResU.SkeletalAnim();
            ska.Name       = skeletalAnimNX.Name;
            ska.Path       = skeletalAnimNX.Path;
            ska.FrameCount = skeletalAnimNX.FrameCount;
            ska.FlagsScale = ResU.SkeletalAnimFlagsScale.None;

            if (skeletalAnimNX.FlagsScale.HasFlag(ResNX.SkeletalAnimFlagsScale.Maya))
            {
                ska.FlagsScale = ResU.SkeletalAnimFlagsScale.Maya;
            }
            if (skeletalAnimNX.FlagsScale.HasFlag(ResNX.SkeletalAnimFlagsScale.Softimage))
            {
                ska.FlagsScale = ResU.SkeletalAnimFlagsScale.Softimage;
            }
            if (skeletalAnimNX.FlagsScale.HasFlag(ResNX.SkeletalAnimFlagsScale.Standard))
            {
                ska.FlagsScale = ResU.SkeletalAnimFlagsScale.Standard;
            }

            ska.FrameCount  = skeletalAnimNX.FrameCount;
            ska.BindIndices = skeletalAnimNX.BindIndices;
            ska.BakedSize   = skeletalAnimNX.BakedSize;
            ska.Loop        = skeletalAnimNX.Loop;
            ska.Baked       = skeletalAnimNX.Baked;
            foreach (var boneAnimNX in skeletalAnimNX.BoneAnims)
            {
                var boneAnimU = new ResU.BoneAnim();
                ska.BoneAnims.Add(boneAnimU);
                boneAnimU.Name               = boneAnimNX.Name;
                boneAnimU.BeginRotate        = boneAnimNX.BeginRotate;
                boneAnimU.BeginTranslate     = boneAnimNX.BeginTranslate;
                boneAnimU.BeginBaseTranslate = boneAnimNX.BeginBaseTranslate;
                var baseData = new ResU.BoneAnimData();
                baseData.Translate       = boneAnimNX.BaseData.Translate;
                baseData.Scale           = boneAnimNX.BaseData.Scale;
                baseData.Rotate          = boneAnimNX.BaseData.Rotate;
                baseData.Flags           = boneAnimNX.BaseData.Flags;
                boneAnimU.BaseData       = baseData;
                boneAnimU.FlagsBase      = (ResU.BoneAnimFlagsBase)boneAnimNX.FlagsBase;
                boneAnimU.FlagsCurve     = (ResU.BoneAnimFlagsCurve)boneAnimNX.FlagsCurve;
                boneAnimU.FlagsTransform = (ResU.BoneAnimFlagsTransform)boneAnimNX.FlagsTransform;
                boneAnimU.Curves         = ConvertAnimCurveSwitchToWiiU(boneAnimNX.Curves);
            }

            return(ska);
        }
Ejemplo n.º 4
0
 public void FromChr0(string FileName, bool IsWiiU)
 {
     if (IsWiiU)
     {
         var SkeletalAnimNX = BrawlboxHelper.FSKAConverter.Chr02Fska(FileName);
         SkeletalAnimU      = BfresPlatformConverter.FSKAConvertSwitchToWiiU(SkeletalAnimNX);
         SkeletalAnimU.Name = Text;
         LoadAnim(SkeletalAnimU);
     }
     else
     {
         SkeletalAnim      = BrawlboxHelper.FSKAConverter.Chr02Fska(FileName);
         SkeletalAnim.Name = Text;
         LoadAnim(SkeletalAnim);
     }
 }
Ejemplo n.º 5
0
 public void FromAnim(string FileName)
 {
     if (SkeletalAnimU != null)
     {
         var SkeletalAnimNX = BrawlboxHelper.FSKAConverter.Anim2Fska(FileName);
         SkeletalAnimU      = BfresPlatformConverter.FSKAConvertSwitchToWiiU(SkeletalAnimNX);
         SkeletalAnimU.Name = Text;
         LoadAnim(SkeletalAnimU);
     }
     else
     {
         SkeletalAnim      = BrawlboxHelper.FSKAConverter.Anim2Fska(FileName);
         SkeletalAnim.Name = Text;
         LoadAnim(SkeletalAnim);
     }
 }
Ejemplo n.º 6
0
        private void FromAssimp(string FileName, bool IsWiiU)
        {
            var anims = AssimpData.ImportAnimations(FileName);

            for (int i = 0; i < anims.Length; i++)
            {
                if (IsWiiU)
                {
                    SkeletalAnimU = BfresPlatformConverter.FSKAConvertSwitchToWiiU(FromGeneric(anims[i]));
                    LoadAnim(SkeletalAnimU);
                }
                else
                {
                    SkeletalAnim = FromGeneric(anims[i]);
                    LoadAnim(SkeletalAnim);
                }

                break;
            }
        }
Ejemplo n.º 7
0
        private void LoadAnimData(ResU.SkeletalAnim ska)
        {
            Nodes.Clear();
            Bones.Clear();

            CanLoop = ska.FlagsAnimSettings.HasFlag(ResU.SkeletalAnimFlags.Looping);

            foreach (ResU.BoneAnim bn in ska.BoneAnims)
            {
                BoneAnimNode bone = new BoneAnimNode(bn.Name, false);
                bone.BoneAnimU = bn;
                bone.UseSegmentScaleCompensate = bn.ApplySegmentScaleCompensate;

                Bones.Add(bone);
                //    Nodes.Add(bone);

                if (ska.FlagsRotate == ResU.SkeletalAnimFlagsRotate.EulerXYZ)
                {
                    bone.RotType = Animation.RotationType.EULER;
                }
                else
                {
                    bone.RotType = Animation.RotationType.QUATERNION;
                }


                if (bn.FlagsBase.HasFlag(ResU.BoneAnimFlagsBase.Scale))
                {
                    bone.XSCA.Keys.Add(new KeyFrame()
                    {
                        Frame = 0, Value = bn.BaseData.Scale.X, IsKeyed = true
                    });
                    bone.YSCA.Keys.Add(new KeyFrame()
                    {
                        Frame = 0, Value = bn.BaseData.Scale.Y, IsKeyed = true
                    });
                    bone.ZSCA.Keys.Add(new KeyFrame()
                    {
                        Frame = 0, Value = bn.BaseData.Scale.Z, IsKeyed = true
                    });
                }
                if (bn.FlagsBase.HasFlag(ResU.BoneAnimFlagsBase.Rotate))
                {
                    bone.XROT.Keys.Add(new KeyFrame()
                    {
                        Frame = 0, Value = bn.BaseData.Rotate.X, IsKeyed = true
                    });
                    bone.YROT.Keys.Add(new KeyFrame()
                    {
                        Frame = 0, Value = bn.BaseData.Rotate.Y, IsKeyed = true
                    });
                    bone.ZROT.Keys.Add(new KeyFrame()
                    {
                        Frame = 0, Value = bn.BaseData.Rotate.Z, IsKeyed = true
                    });
                    bone.WROT.Keys.Add(new KeyFrame()
                    {
                        Frame = 0, Value = bn.BaseData.Rotate.W, IsKeyed = true
                    });
                }
                if (bn.FlagsBase.HasFlag(ResU.BoneAnimFlagsBase.Translate))
                {
                    bone.XPOS.Keys.Add(new KeyFrame()
                    {
                        Frame = 0, Value = bn.BaseData.Translate.X, IsKeyed = true
                    });
                    bone.YPOS.Keys.Add(new KeyFrame()
                    {
                        Frame = 0, Value = bn.BaseData.Translate.Y, IsKeyed = true
                    });
                    bone.ZPOS.Keys.Add(new KeyFrame()
                    {
                        Frame = 0, Value = bn.BaseData.Translate.Z, IsKeyed = true
                    });
                }

                for (int curve = 0; curve < bn.Curves.Count; curve++)
                {
                    Animation.KeyGroup keyGroup = CurveHelper.CreateTrackWiiU(bn.Curves[curve]);
                    keyGroup.AnimDataOffset = bn.Curves[curve].AnimDataOffset;
                    switch (keyGroup.AnimDataOffset)
                    {
                    case (int)TrackType.XPOS: bone.XPOS.Keys.AddRange(keyGroup.Keys); break;

                    case (int)TrackType.YPOS: bone.YPOS.Keys.AddRange(keyGroup.Keys); break;

                    case (int)TrackType.ZPOS: bone.ZPOS.Keys.AddRange(keyGroup.Keys); break;

                    case (int)TrackType.XROT: bone.XROT.Keys.AddRange(keyGroup.Keys); break;

                    case (int)TrackType.YROT: bone.YROT.Keys.AddRange(keyGroup.Keys); break;

                    case (int)TrackType.ZROT: bone.ZROT.Keys.AddRange(keyGroup.Keys); break;

                    case (int)TrackType.WROT: bone.WROT.Keys.AddRange(keyGroup.Keys); break;

                    case (int)TrackType.XSCA: bone.XSCA.Keys.AddRange(keyGroup.Keys); break;

                    case (int)TrackType.YSCA: bone.YSCA.Keys.AddRange(keyGroup.Keys); break;

                    case (int)TrackType.ZSCA: bone.ZSCA.Keys.AddRange(keyGroup.Keys); break;

                    default: throw new Exception("Unknown Anim Offset " + keyGroup.AnimDataOffset);
                    }
                }
            }
        }
Ejemplo n.º 8
0
 public FSKA(ResU.SkeletalAnim ska)
 {
     LoadAnim(ska);
 }
Ejemplo n.º 9
0
        public void Replace(string FileName, ResFile resFileNX, ResU.ResFile resFileU)
        {
            string ext = Utils.GetExtension(FileName);

            if (ext == ".bfska")
            {
                bool IsSwitch = BfresUtilies.IsSubSectionSwitch(FileName);

                if (resFileU != null)
                {
                    //If it's a switch animation try to conver it to wii u
                    if (IsSwitch)
                    {
                        var ska = new SkeletalAnim();
                        ska.Import(FileName);
                        SkeletalAnimU      = BfresPlatformConverter.FSKAConvertSwitchToWiiU(ska);
                        SkeletalAnimU.Name = Text;
                        LoadAnim(SkeletalAnimU);
                    }
                    else
                    {
                        SkeletalAnimU.Import(FileName, resFileU);
                        SkeletalAnimU.Name = Text;
                        LoadAnim(SkeletalAnimU);
                    }
                }
                else
                {
                    if (IsSwitch)
                    {
                        SkeletalAnim.Import(FileName);
                        SkeletalAnim.Name = Text;
                        LoadAnim(SkeletalAnim);
                    }
                    else
                    {
                        //Create a new wii u skeletal anim and try to convert it instead
                        var ska = new ResU.SkeletalAnim();
                        ska.Import(FileName, new ResU.ResFile());
                        SkeletalAnim      = BfresPlatformConverter.FSKAConvertWiiUToSwitch(ska);
                        SkeletalAnim.Name = Text;
                        LoadAnim(SkeletalAnim);
                    }
                }
            }
            else if (ext == ".anim")
            {
                FromAnim(FileName);
            }
            else if (ext == ".seanim")
            {
                STSkeleton skeleton = GetActiveSkeleton();

                if (skeleton != null)
                {
                    var ska = FromGeneric(SEANIM.Read(FileName, skeleton));
                    ska.Loop = this.CanLoop;
                    UpdateAnimation(ska);
                }
                else
                {
                    STErrorDialog.Show("No matching skeleton bones found to assign!", "Skeleton Importer", "");
                }
            }
            else if (ext == ".smd")
            {
                STSkeleton skeleton = GetActiveSkeleton();

                if (skeleton != null)
                {
                    var ska = FromGeneric(SMD.Read(FileName, skeleton));
                    ska.Loop = this.CanLoop;
                    UpdateAnimation(ska);
                }
                else
                {
                    STErrorDialog.Show("No matching skeleton bones found to assign!", "Skeleton Importer", "");
                }
            }
            else if (ext == ".chr0")
            {
                FromChr0(FileName, resFileU != null);
            }
            else if (ext == ".dae")
            {
                //   FromAssimp(FileName, resFileU != null);
            }
            else if (ext == ".fbx")
            {
                //   FromAssimp(FileName, resFileU != null);
            }
        }
Ejemplo n.º 10
0
 public void Read(ResU.SkeletalAnim ska, ResU.ResFile b)
 {
 }
Ejemplo n.º 11
0
        public void FromSeanim(string FileName)
        {
            SEAnim anim = SEAnim.Read(FileName);

            if (GetResFileU() != null)
            {
                SkeletalAnimU             = new ResU.SkeletalAnim();
                SkeletalAnimU.FrameCount  = anim.FrameCount;
                SkeletalAnimU.FlagsScale  = ResU.SkeletalAnimFlagsScale.Maya;
                SkeletalAnimU.FlagsRotate = ResU.SkeletalAnimFlagsRotate.EulerXYZ;
                SkeletalAnimU.Loop        = anim.Looping;
                SkeletalAnimU.Name        = System.IO.Path.GetFileNameWithoutExtension(FileName);
                SkeletalAnimU.Path        = "";
            }
            else
            {
                SkeletalAnim             = new SkeletalAnim();
                SkeletalAnim.FrameCount  = anim.FrameCount;
                SkeletalAnim.FlagsScale  = SkeletalAnimFlagsScale.Maya;
                SkeletalAnim.FlagsRotate = SkeletalAnimFlagsRotate.EulerXYZ;
                SkeletalAnim.Loop        = anim.Looping;
                SkeletalAnim.Name        = System.IO.Path.GetFileNameWithoutExtension(FileName);
                SkeletalAnim.Path        = "";
            }

            for (int i = 0; i < anim.Bones.Count; i++)
            {
                if (GetResFileU() != null)
                {
                    var BoneAnimU = new ResU.BoneAnim();
                    BoneAnimU.Name = anim.Bones[i];
                    SkeletalAnimU.BoneAnims.Add(BoneAnimU);
                    SkeletalAnimU.BindIndices[i] = ushort.MaxValue;
                    bool IsRoot = false;

                    if (!IsRoot)
                    {
                        BoneAnimU.ApplyIdentity               = false;
                        BoneAnimU.ApplyRotateTranslateZero    = false;
                        BoneAnimU.ApplyRotateZero             = false;
                        BoneAnimU.ApplyScaleOne               = true;
                        BoneAnimU.ApplyScaleVolumeOne         = true;
                        BoneAnimU.ApplyScaleUniform           = true;
                        BoneAnimU.ApplySegmentScaleCompensate = true;
                        BoneAnimU.ApplyTranslateZero          = false;
                    }
                    else
                    {
                        BoneAnimU.ApplyIdentity               = true;
                        BoneAnimU.ApplyRotateTranslateZero    = true;
                        BoneAnimU.ApplyRotateZero             = true;
                        BoneAnimU.ApplyScaleOne               = true;
                        BoneAnimU.ApplyScaleVolumeOne         = true;
                        BoneAnimU.ApplyScaleUniform           = true;
                        BoneAnimU.ApplySegmentScaleCompensate = false;
                        BoneAnimU.ApplyTranslateZero          = true;
                    }
                }
                else
                {
                    var BoneAnim = new BoneAnim();
                    BoneAnim.Name = anim.Bones[i];
                    SkeletalAnim.BoneAnims.Add(BoneAnim);
                    SkeletalAnim.BindIndices[i] = ushort.MaxValue;

                    //Set base data and curves
                    var baseData = new BoneAnimData();
                    if (anim.AnimationPositionKeys.ContainsKey(anim.Bones[i]) &&
                        anim.AnimationPositionKeys[anim.Bones[i]].Count > 0)
                    {
                        BoneAnim.FlagsBase |= BoneAnimFlagsBase.Translate;
                        var keys = anim.AnimationPositionKeys[anim.Bones[i]];
                        var data = (SELib.Utilities.Vector3)keys[0].Data;

                        baseData.Translate = new Syroot.Maths.Vector3F((float)data.X, (float)data.Y, (float)data.Z);

                        if (keys.Count > 1)
                        {
                            AnimCurve curve = new AnimCurve();
                            BoneAnim.Curves.Add(curve);
                            CreateCurveData(curve, keys);
                        }
                    }
                    if (anim.AnimationRotationKeys.ContainsKey(anim.Bones[i]) &&
                        anim.AnimationRotationKeys[anim.Bones[i]].Count > 0)
                    {
                        BoneAnim.FlagsBase |= BoneAnimFlagsBase.Rotate;
                        var keys = anim.AnimationPositionKeys[anim.Bones[i]];
                        var data = (SELib.Utilities.Quaternion)keys[0].Data;

                        baseData.Rotate = new Syroot.Maths.Vector4F((float)data.X, (float)data.Y, (float)data.Z, (float)data.W);

                        if (keys.Count > 1)
                        {
                            AnimCurve curve = new AnimCurve();
                            BoneAnim.Curves.Add(curve);
                            CreateCurveData(curve, keys);
                        }
                    }
                    if (anim.AnimationScaleKeys.ContainsKey(anim.Bones[i]) &&
                        anim.AnimationScaleKeys[anim.Bones[i]].Count > 0)
                    {
                        BoneAnim.FlagsBase |= BoneAnimFlagsBase.Scale;
                        var keys = anim.AnimationPositionKeys[anim.Bones[i]];
                        var data = (SELib.Utilities.Vector3)keys[0].Data;

                        baseData.Scale = new Syroot.Maths.Vector3F((float)data.X, (float)data.Y, (float)data.Z);

                        if (keys.Count > 1)
                        {
                            AnimCurve curve = new AnimCurve();
                            BoneAnim.Curves.Add(curve);
                            CreateCurveData(curve, keys);
                        }
                    }


                    //Set transforms
                    bool IsRoot = false;
                    if (!IsRoot)
                    {
                        BoneAnim.ApplyIdentity               = false;
                        BoneAnim.ApplyRotateTranslateZero    = false;
                        BoneAnim.ApplyRotateZero             = false;
                        BoneAnim.ApplyScaleOne               = true;
                        BoneAnim.ApplyScaleVolumeOne         = true;
                        BoneAnim.ApplyScaleUniform           = true;
                        BoneAnim.ApplySegmentScaleCompensate = true;
                        BoneAnim.ApplyTranslateZero          = false;
                    }
                    else
                    {
                        BoneAnim.ApplyIdentity               = true;
                        BoneAnim.ApplyRotateTranslateZero    = true;
                        BoneAnim.ApplyRotateZero             = true;
                        BoneAnim.ApplyScaleOne               = true;
                        BoneAnim.ApplyScaleVolumeOne         = true;
                        BoneAnim.ApplyScaleUniform           = true;
                        BoneAnim.ApplySegmentScaleCompensate = false;
                        BoneAnim.ApplyTranslateZero          = true;
                    }
                }
            }

            for (int frame = 0; frame < anim.FrameCount; frame++)
            {
            }
        }
Ejemplo n.º 12
0
        public static ResNX.SkeletalAnim FSKAConvertWiiUToSwitch(ResU.SkeletalAnim skeletalAnimU)
        {
            ResNX.SkeletalAnim ska = new ResNX.SkeletalAnim();
            ska.Name       = skeletalAnimU.Name;
            ska.Path       = skeletalAnimU.Path;
            ska.FrameCount = skeletalAnimU.FrameCount;
            ska.FlagsScale = ResNX.SkeletalAnimFlagsScale.None;

            if (skeletalAnimU.FlagsScale.HasFlag(ResU.SkeletalAnimFlagsScale.Maya))
            {
                ska.FlagsScale = ResNX.SkeletalAnimFlagsScale.Maya;
            }
            if (skeletalAnimU.FlagsScale.HasFlag(ResU.SkeletalAnimFlagsScale.Softimage))
            {
                ska.FlagsScale = ResNX.SkeletalAnimFlagsScale.Softimage;
            }
            if (skeletalAnimU.FlagsScale.HasFlag(ResU.SkeletalAnimFlagsScale.Standard))
            {
                ska.FlagsScale = ResNX.SkeletalAnimFlagsScale.Standard;
            }

            ska.FrameCount  = skeletalAnimU.FrameCount;
            ska.BindIndices = skeletalAnimU.BindIndices;
            ska.BakedSize   = skeletalAnimU.BakedSize;
            ska.Loop        = skeletalAnimU.Loop;
            ska.Baked       = skeletalAnimU.Baked;
            foreach (var userDataU in skeletalAnimU.UserData)
            {
                var parser     = new UserDataParser();
                var userDataNX = new ResNX.UserData();
                parser.Type         = userDataU.Value.Type.ToString();
                parser.UserDataName = userDataU.Value.Name;
                userDataNX.Name     = parser.UserDataName;
                if (parser.Type == "Byte")
                {
                    userDataNX.SetValue(parser.GetBytes());
                }
                if (parser.Type == "Single")
                {
                    parser.LoadValues(userDataU.Value.GetValueSingleArray());
                }
                userDataNX.SetValue(parser.GetFloats());
                if (parser.Type == "Int32")
                {
                    userDataNX.SetValue(parser.GetInts());
                }
                if (parser.Type == "String")
                {
                    userDataNX.SetValue(parser.GetStringASCII());
                }
                if (parser.Type == "WString")
                {
                    userDataNX.SetValue(parser.GetStringUnicode());
                }
                ska.UserDatas.Add(userDataNX);
            }
            foreach (var boneAnimU in skeletalAnimU.BoneAnims)
            {
                var boneAnim = new ResNX.BoneAnim();
                ska.BoneAnims.Add(boneAnim);
                boneAnim.Name               = boneAnimU.Name;
                boneAnim.BeginRotate        = boneAnimU.BeginRotate;
                boneAnim.BeginTranslate     = boneAnimU.BeginTranslate;
                boneAnim.BeginBaseTranslate = boneAnimU.BeginBaseTranslate;
                var baseData = new ResNX.BoneAnimData();
                baseData.Translate      = boneAnimU.BaseData.Translate;
                baseData.Scale          = boneAnimU.BaseData.Scale;
                baseData.Rotate         = boneAnimU.BaseData.Rotate;
                baseData.Flags          = boneAnimU.BaseData.Flags;
                boneAnim.BaseData       = baseData;
                boneAnim.FlagsBase      = (ResNX.BoneAnimFlagsBase)boneAnimU.FlagsBase;
                boneAnim.FlagsCurve     = (ResNX.BoneAnimFlagsCurve)boneAnimU.FlagsCurve;
                boneAnim.FlagsTransform = (ResNX.BoneAnimFlagsTransform)boneAnimU.FlagsTransform;
                boneAnim.Curves         = ConvertAnimCurveWiiUToSwitch(boneAnimU.Curves);
            }

            return(ska);
        }
Ejemplo n.º 13
0
        public void Read(ResU.SkeletalAnim ska)
        {
            Nodes.Clear();
            Bones.Clear();

            FrameCount    = ska.FrameCount;
            SkeletalAnimU = ska;

            foreach (ResU.BoneAnim bn in ska.BoneAnims)
            {
                FSKANode bonean = new FSKANode(bn);

                Animation.KeyNode bone = new Animation.KeyNode("");
                Bones.Add(bone);
                if (ska.FlagsRotate == ResU.SkeletalAnimFlagsRotate.EulerXYZ)
                {
                    bone.RotType = Animation.RotationType.EULER;
                }
                else
                {
                    bone.RotType = Animation.RotationType.QUATERNION;
                }

                bone.Text = bonean.Text;


                for (int Frame = 0; Frame < ska.FrameCount; Frame++)
                {
                    if (Frame == 0)
                    {
                        if (bn.FlagsBase.HasFlag(ResU.BoneAnimFlagsBase.Scale))
                        {
                            bone.XSCA.Keys.Add(new KeyFrame()
                            {
                                Frame = 0, Value = bonean.sca.X
                            });
                            bone.YSCA.Keys.Add(new KeyFrame()
                            {
                                Frame = 0, Value = bonean.sca.Y
                            });
                            bone.ZSCA.Keys.Add(new KeyFrame()
                            {
                                Frame = 0, Value = bonean.sca.Z
                            });
                        }
                        if (bn.FlagsBase.HasFlag(ResU.BoneAnimFlagsBase.Rotate))
                        {
                            bone.XROT.Keys.Add(new KeyFrame()
                            {
                                Frame = 0, Value = bonean.rot.X
                            });
                            bone.YROT.Keys.Add(new KeyFrame()
                            {
                                Frame = 0, Value = bonean.rot.Y
                            });
                            bone.ZROT.Keys.Add(new KeyFrame()
                            {
                                Frame = 0, Value = bonean.rot.Z
                            });
                            bone.WROT.Keys.Add(new KeyFrame()
                            {
                                Frame = 0, Value = bonean.rot.W
                            });
                        }
                        if (bn.FlagsBase.HasFlag(ResU.BoneAnimFlagsBase.Translate))
                        {
                            bone.XPOS.Keys.Add(new KeyFrame()
                            {
                                Frame = 0, Value = bonean.pos.X
                            });
                            bone.YPOS.Keys.Add(new KeyFrame()
                            {
                                Frame = 0, Value = bonean.pos.Y
                            });
                            bone.ZPOS.Keys.Add(new KeyFrame()
                            {
                                Frame = 0, Value = bonean.pos.Z
                            });
                        }
                    }
                    foreach (FSKATrack track in bonean.tracks)
                    {
                        KeyFrame frame = new KeyFrame();
                        frame.InterType = Animation.InterpolationType.HERMITE;
                        frame.Frame     = Frame;

                        FSKAKey left  = track.GetLeft(Frame);
                        FSKAKey right = track.GetRight(Frame);
                        float   value;

                        value = Animation.Hermite(Frame, left.frame, right.frame, 0, 0, left.unk1, right.unk1);

                        // interpolate the value and apply
                        switch (track.flag)
                        {
                        case (int)TrackType.XPOS: frame.Value = value; bone.XPOS.Keys.Add(frame); break;

                        case (int)TrackType.YPOS: frame.Value = value; bone.YPOS.Keys.Add(frame); break;

                        case (int)TrackType.ZPOS: frame.Value = value; bone.ZPOS.Keys.Add(frame); break;

                        case (int)TrackType.XROT: frame.Value = value; bone.XROT.Keys.Add(frame); break;

                        case (int)TrackType.YROT: frame.Value = value; bone.YROT.Keys.Add(frame); break;

                        case (int)TrackType.ZROT: frame.Value = value; bone.ZROT.Keys.Add(frame); break;

                        case (int)TrackType.XSCA: frame.Value = value; bone.XSCA.Keys.Add(frame); break;

                        case (int)TrackType.YSCA: frame.Value = value; bone.YSCA.Keys.Add(frame); break;

                        case (int)TrackType.ZSCA: frame.Value = value; bone.ZSCA.Keys.Add(frame); break;
                        }
                    }
                }
            }
        }