Пример #1
0
 void OnGUI()
 {
     if (GUI.Button(new Rect(0, 0, 100, 100), "ExportFBX"))
     {
         MyExport myExport = new MyExport();
         //myExport.Init ();
         myExport.CreateDocument();
         myExport.Clear();
     }
 }
Пример #2
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (int.TryParse(textBox1.Text, out Common.pushBegin) && int.TryParse(textBox2.Text, out Common.pushEnd) &&
         int.TryParse(textBox4.Text, out Common.farBegin) && int.TryParse(textBox3.Text, out Common.farEnd) &&
         int.TryParse(textBox6.Text, out Common.backBegin) && int.TryParse(textBox5.Text, out Common.backEnd) &&
         int.TryParse(textBox8.Text, out Common.nearBegin) && int.TryParse(textBox7.Text, out Common.nearEnd) &&
         double.TryParse(textBox9.Text, out Common.h) && double.TryParse(textBox12.Text, out Common.e) &&
         double.TryParse(textBox10.Text, out Common.angel) && double.TryParse(textBox11.Text, out Common.r0))
     {
         //MessageBox.Show("正在计算中")
         Common.CalculateS();
         MyExport.ExportToExcel();
     }
     else
     {
         MessageBox.Show("数据不完整或有误! 请检查。", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
Пример #3
0
    private void OnGUI()
    {
        if (GUI.Button(new Rect(10, 10, 150, 50), "动画加载"))
        {
            controller.OpenFromFile(Application.streamingAssetsPath, "pose");
            anime.runtimeAnimatorController = controller.LoadAsset <RuntimeAnimatorController>("AC_Edit_F");
            anime.Stop();

            List <FMeshBoneInfo> SkeletonInfo = new List <FMeshBoneInfo>();
            UnityBoneTransform.CatchSkeleton(gameObject.transform, ref SkeletonInfo);
            orginSkeletonInfo = SkeletonInfo;
            StatisticsGenerateDataBegin(SkeletonInfo);
        }

        if (GUI.Button(new Rect(170, 10, 150, 50), "动画导出"))
        {
            controller.OpenFromFile(Application.streamingAssetsPath, "pose");
            anime.runtimeAnimatorController = controller.LoadAsset <RuntimeAnimatorController>("AC_Edit_F");
            anime.Stop();
            //anime.Play("tachi_pose_12");
            AnimatorClipInfo [] acinfo = anime.GetCurrentAnimatorClipInfo(0);
            foreach (var v in acinfo)
            {
                Debug.Log(v.clip.name);
            }

            List <AnimationClip> aniList = new List <AnimationClip>();
            foreach (var v in anime.runtimeAnimatorController.animationClips)
            {
                aniList.Add(v);
                Debug.Log(v + " " + v.length + " " + v.frameRate);
            }

            AnimSequence         anim         = UnityBoneTransform.CatchAnimationClip(aniList[8], gameObject.transform);
            List <FMeshBoneInfo> SkeletonInfo = new List <FMeshBoneInfo>();
            UnityBoneTransform.CatchSkeleton(gameObject.transform, ref SkeletonInfo);
            MyExport aMyExport = new MyExport();
            aMyExport.CreateDocument();
            aMyExport.ExportAnimSequence(anim, SkeletonInfo);
            aMyExport.WriteToFile("E:/1.fbx");
        }

        if (GUI.Button(new Rect(350, 10, 150, 50), "动画采样"))
        {
            List <AnimationClip> aniList = new List <AnimationClip>();
            foreach (var v in anime.runtimeAnimatorController.animationClips)
            {
                aniList.Add(v);
                Debug.Log(v + " " + v.length + " " + v.frameRate);
            }

            aniList[0].SampleAnimation(gameObject, fSampleTime);

            List <FMeshBoneInfo> SkeletonInfo = new List <FMeshBoneInfo>();
            UnityBoneTransform.CatchSkeleton(gameObject.transform, ref SkeletonInfo);
            StatisticsGenerateDataBegin(SkeletonInfo);

            Debug.Log(GameObject.Find("cf_J_Hips").transform.localRotation.eulerAngles);
            bSampleAniamtion = true;
        }


        if (GUI.Button(new Rect(620, 10, 150, 50), "重置T-Pose"))
        {
            UpdateTransformFromMeshBoneList(orginSkeletonInfo);
        }
    }