Esempio n. 1
0
        private void selectMesh()
        {
            if (dImportDialog.ShowDialog() == DialogResult.OK)
            {
                string     basefile = Path.GetDirectoryName(dImportDialog.FileName);
                string     filename = Path.GetFileName(dImportDialog.FileName);
                FileSystem fs       = new FileSystem();
                fs.addRoot(basefile);

                dAnimations.DropDownItems.Clear();

                ToolStripButton btn = new ToolStripButton("Add animations");
                btn.Click += new EventHandler(btn_Click);
                dAnimations.DropDownItems.Add(btn);

                string extent = Path.GetExtension(filename);
                if (extent == ".act")
                {
                    anim = null;

                    Actor act = ActorFile.Load(fs, filename);
                    def  = act.Mesh;
                    mesh = null;

                    foreach (KeyValuePair <string, Animation> an in act.Animations)
                    {
                        addAnimation(an.Key, an.Value);
                    }
                }
                else
                {
                    def  = MeshFile.Load(fs, filename);
                    anim = null;
                }

                newMesh(fs);
                updatePose();

                dModelActions.Text = filename;

                dMeshInfo.Text = string.Format("{0} points, {1} texcoords {2} tris, {3}/{4} bones", def.points.Count, def.uvs.Count, def.TriCount, def.bones.Count, new List <MeshDef.Bone>(def.RootBones).Count);

                forceRedraw();
            }
        }