public static void MakePichu(string path = "C:\\Pichu\\") { if (!path.EndsWith("\\")) { path += "\\"; } DAT dat = new DAT(); dat.Read(new FileData(path + "PlPcNr.dat")); dat.PreRender(); //dat.ExportTextures(path, 0x401B1000); BoneNameFix(dat.bones); // model-------------------------------------------------------- ModelContainer converted = dat.wrapToNUD(); NUD nud = converted.nud; float sca = 0.6f; removeLowPolyNr(nud); nud.PreRender(); Runtime.ModelContainers.Add(converted); //------------------------------------------------- Runtime.TargetVBN = converted.vbn; MainForm.HashMatch(); Dictionary <string, SkelAnimation> anims = DAT_Animation.LoadAJ(path + "PlPcAJ.dat", converted.vbn); //ArrangeBones(converted.vbn, converted.nud); // note bone 40 - 51 is disabled for pika foreach (string an in anims.Keys) { effectiveScale(anims[an], Matrix4.CreateTranslation(0, 0, 0) * Matrix4.CreateScale(sca, sca, sca)); } effectiveScale(converted.nud, converted.vbn, Matrix4.CreateTranslation(0, 0, 0) * Matrix4.CreateScale(sca, sca, sca)); Directory.CreateDirectory(path + "build\\model\\body\\c00\\"); nud.Save(path + "build\\model\\body\\c00\\model.nud"); converted.vbn.Endian = Endianness.Little; converted.vbn.Save(path + "build\\model\\body\\c00\\model.vbn"); PAC org = new PAC(); PAC npac = new PAC(); org.Read(path + "main.pac"); foreach (string key in org.Files.Keys) { byte[] d = org.Files[key]; foreach (string an in anims.Keys) { string name = an.Replace("PlyPichu5K_Share_ACTION_", "").Replace("_figatree", ""); if (key.Contains(name)) { Console.WriteLine("Matched " + name + " with " + key); if (!anims[an].getNodes(true).Contains(0) && !key.Contains("Cliff")) { KeyNode node = anims[an].getNode(0, 0); node.t_type = 1; } d = OMO.createOMO(anims[an], converted.vbn); break; } } npac.Files.Add(key, d); } Directory.CreateDirectory(path + "build\\motion\\"); npac.Save(path + "build\\motion\\main.pac"); /*FileOutput omo = new FileOutput(); * converted.vbn.reset(); * converted.vbn.totalBoneCount = (uint)converted.vbn.bones.Count; * omo.writeBytes(OMO.createOMO(anims["PlyPichu5K_Share_ACTION_Wait1_figatree"], converted.vbn)); * omo.save(path + "PlyPichu5K_Share_ACTION_Wait1_figatree.omo");*/ }
private void exportToolStripMenuItem_Click(object sender, EventArgs e) { /*if (Runtime.TargetVBN == null) * { * return; * }*/ using (var sfd = new SaveFileDialog()) { sfd.Filter = "Supported Files (.omo, .anim, .pac, .mta)|*.omo;*.anim;*.pac;*.mta|" + "Object Motion (.omo)|*.omo|" + "Material Animation (.mta)|*.mta|" + "Maya Anim (.anim)|*.anim|" + "OMO Pack (.pac)|*.pac|" + "All Files (*.*)|*.*"; if (sfd.ShowDialog() == DialogResult.OK) { sfd.FileName = sfd.FileName; if (sfd.FileName.EndsWith(".anim")) { if (Runtime.TargetAnim.Tag is AnimTrack) { ((AnimTrack)Runtime.TargetAnim.Tag).createANIM(sfd.FileName, Runtime.TargetVBN); } else { ANIM.createANIM(sfd.FileName, Runtime.TargetAnim, Runtime.TargetVBN); } } if (sfd.FileName.EndsWith(".omo")) { if (Runtime.TargetAnim.Tag is FileData) { FileOutput o = new FileOutput(); o.writeBytes(((FileData)Runtime.TargetAnim.Tag).getSection(0, ((FileData)Runtime.TargetAnim.Tag).size())); o.save(sfd.FileName); } else { OMO.createOMO(Runtime.TargetAnim, Runtime.TargetVBN, sfd.FileName); } } if (sfd.FileName.EndsWith(".pac")) { var pac = new PAC(); foreach (var anim in Runtime.Animations) { var bytes = OMO.createOMO(anim.Value, Runtime.TargetVBN); if (Runtime.TargetAnim.Tag is FileData) { bytes = ((FileData)Runtime.TargetAnim.Tag).getSection(0, ((FileData)Runtime.TargetAnim.Tag).size()); } pac.Files.Add(anim.Key, bytes); } pac.Save(sfd.FileName); } if (sfd.FileName.EndsWith(".mta")) { FileOutput f = new FileOutput(); f.writeBytes(Runtime.TargetMTA.Rebuild()); f.save(sfd.FileName); } } } }