コード例 #1
0
ファイル: FormMD5Viewer.cs プロジェクト: QuakeEngines/qio
 private void updateAnimStatusLabel()
 {
     if (md5anim == null)
     {
         trackBarFrame.Enabled = false;
         lb_animInfo.Text      = "No animation loaded.";
         return;
     }
     lb_animInfo.Text      = "Frame " + curFrame + " of " + md5anim.getFrameCount() + ".";
     trackBarFrame.Maximum = md5anim.getFrameCount();
     trackBarFrame.Minimum = 0;
     if (trackBarFrame.Value >= trackBarFrame.Maximum)
     {
         trackBarFrame.Value = 0;
         curFrame            = 0;
     }
     trackBarFrame.Enabled = true;
     bones = new BoneOrientations(md5anim.getJointCount());
 }
コード例 #2
0
ファイル: FormObjViewer.cs プロジェクト: QuakeEngines/qio
        private void mD5ModelAnimationPoseToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // first ask user for md5mesh file
            openFileDialog1.Filter = "Doom3/Quake4 MD5mesh|*.md5mesh|All files (*.*)|*.*";
            openFileDialog1.Title  = "Open new model.";
            if (openFileDialog1.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            string   md5meshFileName = openFileDialog1.FileName;
            MD5Model md5             = new MD5Model();

            if (md5.loadMD5MeshFile(md5meshFileName))
            {
                return;
            }
            if (md5.getMeshCount() == 0)
            {
                MessageBox.Show("MD5 model you tried to import has no surfaces.",
                                "MD5 model has 0 surfaces.",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation,
                                MessageBoxDefaultButton.Button1);
                return;
            }
            // then ask user for md5anim file
            openFileDialog1.Filter = "Doom3/Quake4 MD5anim|*.md5anim|All files (*.*)|*.*";
            openFileDialog1.Title  = "Open new anim.";
            if (openFileDialog1.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            string md5animFileName = openFileDialog1.FileName;

#if false
            // then md5anim file
            FormImportMD5AnimatedFrame f = new FormImportMD5AnimatedFrame();
            f.setOBJViewerForm(this);
            f.ShowDialog();
#else
            MD5Anim anim = new MD5Anim();
            if (anim.loadMD5AnimFile(md5animFileName))
            {
                return;
            }
            if (anim.getFrameCount() == 0)
            {
                MessageBox.Show("MD5 model you tried to import has no surfaces.",
                                "MD5 model has 0 surfaces.",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation,
                                MessageBoxDefaultButton.Button1);
                return;
            }
            BoneOrientations bones = new BoneOrientations();
            bones.allocBones(anim.getJointCount());
            anim.buildFrameABSBones(0, bones);
            md5.buildVertices(bones);
            importMD5ModelMeshes(md5);
#endif
        }