/// <summary>
        ///
        /// </summary>
        /// <param name="endValue"></param>
        /// <param name="startFrame"></param>
        /// <param name="endFrame"></param>
        /// <param name="trackType"></param>
        /// <returns></returns>
        public static void GenerateFOBJ(HSD_AOBJ aobj, float startValue, float endValue, float startFrame, float endFrame, JointTrackType trackType)
        {
            List <FOBJKey> keys = new List <FOBJKey>();

            if (startFrame != 0)
            {
                keys.Add(new FOBJKey()
                {
                    Frame = 0, Value = startValue, InterpolationType = GXInterpolationType.HSD_A_OP_CON
                });
            }

            keys.Add(new FOBJKey()
            {
                Frame = startFrame, Value = startValue, InterpolationType = GXInterpolationType.HSD_A_OP_LIN
            });

            keys.Add(new FOBJKey()
            {
                Frame = endFrame, Value = endValue, InterpolationType = GXInterpolationType.HSD_A_OP_CON
            });
            keys.Add(new FOBJKey()
            {
                Frame = 1600, Value = endValue, InterpolationType = GXInterpolationType.HSD_A_OP_CON
            });

            var fobj = new HSD_FOBJDesc();

            fobj.SetKeys(keys, (byte)trackType);

            if (aobj.FObjDesc == null)
            {
                aobj.FObjDesc = fobj;
            }
            else
            {
                aobj.FObjDesc.Add(fobj);
            }
        }
    {/// <summary>
     ///
     /// </summary>
     /// <param name="space"></param>
     /// <returns></returns>
        public static HSD_AnimJoint GenerateAnimJoint(MexMenuAnimation anim, HSD_JOBJ joint)
        {
            HSD_AnimJoint aj = new HSD_AnimJoint();

            if (anim == null || anim.StartFrame >= anim.EndFrame)
            {
                return(aj);
            }

            var aobj = new HSD_AOBJ();

            aobj.EndFrame = 1600;
            aobj.Flags    = AOBJ_Flags.FIRST_PLAY;

            if (anim.StartingPositionX != joint.TX)
            {
                GenerateFOBJ(aobj, anim.StartingPositionX, joint.TX, anim.StartFrame, anim.EndFrame, JointTrackType.HSD_A_J_TRAX);
            }

            if (anim.StartingPositionY != joint.TY)
            {
                GenerateFOBJ(aobj, anim.StartingPositionY, joint.TY, anim.StartFrame, anim.EndFrame, JointTrackType.HSD_A_J_TRAY);
            }

            if (anim.StartingPositionZ != joint.TZ)
            {
                GenerateFOBJ(aobj, anim.StartingPositionZ, joint.TZ, anim.StartFrame, anim.EndFrame, JointTrackType.HSD_A_J_TRAZ);
            }

            if (anim.StartingRotationX != joint.RX)
            {
                GenerateFOBJ(aobj, anim.StartingRotationX, joint.RX, anim.StartFrame, anim.EndFrame, JointTrackType.HSD_A_J_ROTX);
            }

            if (anim.StartingRotationY != joint.RY)
            {
                GenerateFOBJ(aobj, anim.StartingRotationY, joint.RY, anim.StartFrame, anim.EndFrame, JointTrackType.HSD_A_J_ROTY);
            }

            if (anim.StartingRotationZ != joint.RZ)
            {
                GenerateFOBJ(aobj, anim.StartingRotationZ, joint.RZ, anim.StartFrame, anim.EndFrame, JointTrackType.HSD_A_J_ROTZ);
            }

            if (anim.StartingScaleX != joint.SX)
            {
                GenerateFOBJ(aobj, anim.StartingRotationX, joint.SX, anim.StartFrame, anim.EndFrame, JointTrackType.HSD_A_J_SCAX);
            }

            if (anim.StartingScaleY != joint.SY)
            {
                GenerateFOBJ(aobj, anim.StartingRotationY, joint.SY, anim.StartFrame, anim.EndFrame, JointTrackType.HSD_A_J_SCAY);
            }

            if (anim.StartingScaleZ != joint.SZ)
            {
                GenerateFOBJ(aobj, anim.StartingRotationZ, joint.SZ, anim.StartFrame, anim.EndFrame, JointTrackType.HSD_A_J_SCAZ);
            }

            if (aobj.FObjDesc != null)
            {
                aj.AOBJ = aobj;
            }

            return(aj);

            // starting frame-600
            // 1600 total frames

            /*if (space.AnimType == MexMapAnimType.SlideInFromRight)
             *  joint.AOBJ = GenerateAOBJ(36, space.JOBJ.TX, space.StartFrame, space.EndFrame, JointTrackType.HSD_A_J_TRAX);
             * if (space.AnimType == MexMapAnimType.SlideInFromLeft)
             *  joint.AOBJ = GenerateAOBJ(-40, space.JOBJ.TX, space.StartFrame, space.EndFrame, JointTrackType.HSD_A_J_TRAX);
             * if (space.AnimType == MexMapAnimType.SlideInFromTop)
             *  joint.AOBJ = GenerateAOBJ(36, space.JOBJ.TY, space.StartFrame, space.EndFrame, JointTrackType.HSD_A_J_TRAY);
             * if (space.AnimType == MexMapAnimType.SlideInFromBottom)
             *  joint.AOBJ = GenerateAOBJ(-40, space.JOBJ.TY, space.StartFrame, space.EndFrame, JointTrackType.HSD_A_J_TRAY);
             * if (space.AnimType == MexMapAnimType.GrowFromNothing)
             * {
             *  joint.AOBJ = GenerateAOBJ(0, space.JOBJ.SX, space.StartFrame, space.EndFrame, JointTrackType.HSD_A_J_SCAX);
             *  joint.AOBJ.FObjDesc.Next = GenerateAOBJ(0, space.JOBJ.SY, space.StartFrame, space.EndFrame, JointTrackType.HSD_A_J_SCAY).FObjDesc;
             * }
             * if (space.AnimType == MexMapAnimType.SpinIn)
             * {
             *  joint.AOBJ = GenerateAOBJ(0, space.JOBJ.SX, space.StartFrame, space.EndFrame, JointTrackType.HSD_A_J_SCAX);
             *  joint.AOBJ.FObjDesc.Add(GenerateAOBJ(0, space.JOBJ.SY, space.StartFrame, space.EndFrame, JointTrackType.HSD_A_J_SCAY).FObjDesc);
             *  joint.AOBJ.FObjDesc.Add(GenerateAOBJ(-4, 0, space.StartFrame, space.EndFrame, JointTrackType.HSD_A_J_ROTZ).FObjDesc);
             * }
             * if (space.AnimType == MexMapAnimType.FlipIn)
             * {
             *  joint.AOBJ = GenerateAOBJ(0, space.JOBJ.SX, space.StartFrame, space.EndFrame, JointTrackType.HSD_A_J_SCAX);
             *  joint.AOBJ.FObjDesc.Add(GenerateAOBJ(0, space.JOBJ.SY, space.StartFrame, space.EndFrame, JointTrackType.HSD_A_J_SCAY).FObjDesc);
             *  joint.AOBJ.FObjDesc.Add(GenerateAOBJ(-4, 0, space.StartFrame, space.EndFrame, JointTrackType.HSD_A_J_ROTY).FObjDesc);
             * }*/
        }