コード例 #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();
            }
        }
コード例 #2
0
        static void Main(string[] args)
        {
            string     filepath = args[0];
            string     dir      = Path.GetDirectoryName(filepath);
            string     filename = Path.GetFileName(filepath);
            FileSystem fs       = new FileSystem();

            fs.addRoot(dir);
            fs.addRoot(Environment.CurrentDirectory);

            Actor actor = ActorFile.Load(fs, filename);

            string meshtarget = Path.Combine(dir, Path.ChangeExtension(filename, "mdf"));

            WriteMesh(actor.Mesh, meshtarget);

            foreach (KeyValuePair <string, Animation> animation in actor.Animations)
            {
                string filetarget = Path.ChangeExtension(Path.Combine(dir, animation.Key), "anm");
                WriteAnimation(filetarget, animation.Value);
            }
        }