private void jobjPostionUpdate(object sender, EventArgs e) { if (sender == jobjX) { float xdelta = (float)jobjX.Value - currentJobj.pos.X; jobjTranslate(currentJobj, new Vector3(xdelta, 0, 0), true); if (datToPrerender != null) { datToPrerender.PreRender(); } } if (sender == jobjY) { float ydelta = (float)jobjY.Value - currentJobj.pos.Y; jobjTranslate(currentJobj, new Vector3(0, ydelta, 0), true); if (datToPrerender != null) { datToPrerender.PreRender(); } } if (sender == jobjZ) { float zdelta = (float)jobjZ.Value - currentJobj.pos.Z; jobjTranslate(currentJobj, new Vector3(0, 0, zdelta), true); if (datToPrerender != null) { datToPrerender.PreRender(); } } }
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.UpdateRenderMeshes(); //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 = OMOOld.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");*/ }
///<summary> ///Open a file based on the filename ///</summary> /// <param name="filename"> Filename of file to open</param> public void openFile(string filename) { if (!filename.EndsWith(".mta") && !filename.EndsWith(".dat") && !filename.EndsWith(".smd")) { openAnimation(filename); } if (filename.EndsWith(".vbn")) { Runtime.TargetVBN = new VBN(filename); if (Directory.Exists("Skapon\\")) { NUD nud = Skapon.Create(Runtime.TargetVBN); ModelContainer con = new ModelContainer(); con.vbn = Runtime.TargetVBN; con.nud = nud; nud.PreRender(); Runtime.ModelContainers.Add(con); } } if (filename.EndsWith(".sb")) { SB sb = new SB(); sb.Read(filename); SwagEditor swagEditor = new SwagEditor(sb) { ShowHint = DockState.DockRight }; AddDockedControl(swagEditor); SwagEditors.Add(swagEditor); } if (filename.EndsWith(".dat")) { if (filename.EndsWith("AJ.dat")) { MessageBox.Show("This is animation; load with Animation -> Import"); return; } DAT dat = new DAT(); dat.Read(new FileData(filename)); ModelContainer c = new ModelContainer(); Runtime.ModelContainers.Add(c); c.dat_melee = dat; dat.PreRender(); HashMatch(); Runtime.TargetVBN = dat.bones; DAT_TreeView p = new DAT_TreeView() { ShowHint = DockState.DockLeft }; p.setDAT(dat); AddDockedControl(p); //Runtime.TargetVBN = dat.bones; meshList.refresh(); } if (filename.EndsWith(".nut")) { Runtime.TextureContainers.Add(new NUT(filename)); NUTEditor ev = new NUTEditor(); ev.Show(); } if (filename.EndsWith(".lvd")) { Runtime.TargetLVD = new LVD(filename); LVD test = Runtime.TargetLVD; lvdList.fillList(); } if (filename.EndsWith(".mta")) { Runtime.TargetMTA = new MTA(); Runtime.TargetMTA.Read(filename); viewports[0].loadMTA(Runtime.TargetMTA); MTAEditor temp = new MTAEditor(Runtime.TargetMTA) { ShowHint = DockState.DockLeft }; temp.Text = Path.GetFileName(filename); AddDockedControl(temp); mtaEditors.Add(temp); } if (filename.EndsWith(".mtable")) { //project.openACMD(filename); Runtime.Moveset = new MovesetManager(filename); } if (filename.EndsWith("path.bin")) { Runtime.TargetPath = new PathBin(filename); } else if (filename.EndsWith(".bin")) { //Note to whoever is readin this: //Eventually we need to look at the magic here (and also make all .bins look at magic) //Runtime.TargetCMR0 = new CMR0(); //Runtime.TargetCMR0.read(new FileData(filename)); PARAMEditor p = new PARAMEditor(filename) { ShowHint = DockState.Document }; p.Text = Path.GetFileName(filename); AddDockedControl(p); paramEditors.Add(p); } if (filename.EndsWith(".mdl0")) { MDL0Bones mdl0 = new MDL0Bones(); Runtime.TargetVBN = mdl0.GetVBN(new FileData(filename)); } if (filename.EndsWith(".smd")) { Runtime.TargetVBN = new VBN(); SMD.read(filename, new SkelAnimation(), Runtime.TargetVBN); } if (filename.ToLower().EndsWith(".dae")) { DAEImportSettings m = new DAEImportSettings(); m.ShowDialog(); if (m.exitStatus == DAEImportSettings.Opened) { if (Runtime.ModelContainers.Count < 1) { Runtime.ModelContainers.Add(new ModelContainer()); } Collada.DAEtoNUD(filename, Runtime.ModelContainers[0]); // apply settings m.Apply(Runtime.ModelContainers[0].nud); Runtime.ModelContainers[0].nud.MergePoly(); meshList.refresh(); } } if (filename.EndsWith(".mbn")) { MBN m = new MBN(); m.Read(filename); ModelContainer con = new ModelContainer(); BCH b = new BCH(); con.bch = b; b.mbn = m; b.Read("C:\\s\\Smash\\extract\\data\\fighter\\lucas\\Ness3DS - h00\\normal.bch"); Runtime.ModelContainers.Add(con); } /*if (filename.EndsWith(".bch")) * { * ModelContainer con = new ModelContainer(); * BCH b = new BCH(); * b.Read(filename); * con.bch = b; * Runtime.ModelContainers.Add(con); * }*/ if (filename.EndsWith(".nud")) { openNud(filename); } if (filename.EndsWith(".moi")) { MOI moi = new MOI(filename); AddDockedControl(new MOIEditor(moi) { ShowHint = DockState.DockRight }); } if (filename.EndsWith(".wrkspc")) { Workspace = new WorkspaceManager(project); Workspace.OpenWorkspace(filename); } if (Runtime.TargetVBN != null) { ModelContainer m = new ModelContainer(); m.vbn = Runtime.TargetVBN; Runtime.ModelContainers.Add(m); if (filename.EndsWith(".smd")) { m.nud = SMD.toNUD(filename); meshList.refresh(); } leftPanel.treeRefresh(); } else { foreach (ModelContainer m in Runtime.ModelContainers) { if (m.vbn != null) { Runtime.TargetVBN = Runtime.ModelContainers[0].vbn; break; } } } // Don't want to mess up the project tree if we // just set it up already if (!filename.EndsWith(".wrkspc")) { project.fillTree(); } }