Пример #1
0
 private void actionExportObj_Click(object sender, EventArgs e)
 {
     try
     {
         if (ctr != null)
         {
             if (fbd.ShowDialog() == DialogResult.OK)
             {
                 ctr.Export(fbd.SelectedPath);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Пример #2
0
        static void ConvertFile(string s)
        {
            string basepath = Path.GetDirectoryName(s);
            string name     = Path.GetFileNameWithoutExtension(s);
            string ext      = Path.GetExtension(s).ToLower();

            switch (ext)
            {
            case ".lev":
            {
                Scene scn = Scene.FromFile(s);
                scn.quads = scn.quads.OrderBy(o => o.id).ToList();
                scn.Export(basepath, ExportFlags.All);

                break;
            }

            case ".ctr":
            case ".dyn":
            {
                CtrModel d = new CtrModel(s);
                d.Export(basepath);

                break;
            }

            case ".mpk":
            {
                ModelPack mpk = new ModelPack(s);
                mpk.Extract(Path.Combine(basepath, name), CtrVrm.FromFile(Path.Combine(basepath, "shared.vrm")));

                break;
            }
            }
            Console.WriteLine("Done!");
        }
Пример #3
0
        static void ConvertFile(string filename)
        {
            string basepath = Path.GetDirectoryName(filename);
            string name     = Path.GetFileNameWithoutExtension(filename);
            string ext      = Path.GetExtension(filename).ToLower();

            switch (ext)
            {
            case ".lev":
            {
                Scene scn = Scene.FromFile(filename);
                //scn.quads = scn.quads.OrderBy(o => o.id).ToList();
                scn.Export(basepath, ExportFlags.All);
                break;
            }

            case ".ctr":
            case ".dyn":
            {
                CtrModel d = CtrModel.FromFile(filename);
                d.Export(basepath);

                break;
            }

            case ".obj":
            {
                OBJ      obj = OBJ.FromFile(filename);
                CtrModel ctr = CtrModel.FromObj(obj);
                ctr.Save(basepath);

                break;
            }

            case ".ply":
            {
                CtrModel ctr = CtrModel.FromPly(filename);
                ctr.Save(basepath);

                break;
            }

            case ".mpk":
            {
                string vrampath = Path.ChangeExtension(filename, "vrm");

                if (!File.Exists(vrampath))
                {
                    vrampath = Path.Combine(Path.GetDirectoryName(filename), "shared.vrm");

                    if (!File.Exists(vrampath))
                    {
                        Console.WriteLine("Warning! No vram file found.\r\nPlease put shared.vrm file with mpk you want to extract.");
                        vrampath = "";
                    }
                }

                ModelPack mpk = ModelPack.FromFile(filename);
                mpk.Extract(Path.Combine(basepath, name), CtrVrm.FromFile(vrampath).GetVram());

                break;
            }

            default:
            {
                Console.WriteLine($"Unsupported file: {filename}");
                return;
            }
            }

            Console.WriteLine("Done!");
        }