Esempio n. 1
0
 private void chr_13_renderer_DragDrop(object sender, DragEventArgs e)
 {
     if (e.Data.GetDataPresent(DataFormats.FileDrop))
     {
         string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
         foreach (string filePath in files)
         {
             if (filePath.ToLower().EndsWith(".dds"))
             {
                 DDS dds = new DDS(new FileData(filePath));
                 if (sender == chr_13_renderer)
                 {
                     chr_13 = ReplaceTexture(dds.ToNutTexture(), 416, 416, chr_13);
                     if (chr_13_loc != null)
                     {
                         chr_13.Save(chr_13_loc);
                     }
                 }
                 if (sender == chr_00_renderer)
                 {
                     chr_00 = ReplaceTexture(dds.ToNutTexture(), 128, 128, chr_00);
                     if (chr_00_loc != null)
                     {
                         chr_00.Save(chr_00_loc);
                     }
                 }
                 if (sender == chr_11_renderer)
                 {
                     chr_11 = ReplaceTexture(dds.ToNutTexture(), 384, 384, chr_13);
                     if (chr_11_loc != null)
                     {
                         chr_11.Save(chr_11_loc);
                     }
                 }
             }
             if (filePath.ToLower().EndsWith(".png"))
             {
                 if (sender == stock_90_renderer)
                 {
                     stock_90 = ReplaceTexture(NUTEditor.fromPNG(filePath, 0), 64, 64, chr_13);
                     if (stock_90_loc != null)
                     {
                         stock_90.Save(stock_90_loc);
                     }
                 }
             }
         }
         ((GLControl)sender).Invalidate();
     }
 }
Esempio n. 2
0
 private void OpenEditor(object sender, EventArgs args)
 {
     if (Editor == null || Editor.IsDisposed)
     {
         Editor      = new NUTEditor(this);
         Editor.Text = Parent.Text + "\\" + Text;
         //Editor.ShowDialog();
         MainForm.Instance.AddDockedControl(Editor);
     }
     else
     {
         Editor.BringToFront();
     }
 }
Esempio n. 3
0
        public void Save(object sender, EventArgs args)
        {
            using (var sfd = new SaveFileDialog())
            {
                sfd.Filter = "Namco Universal Texture (.nut)|*.nut|" +
                             "All Files (*.*)|*.*";

                if (sfd.ShowDialog() == DialogResult.OK)
                {
                    NUTEditor.ShowGtxMipmapWarning(this);
                    File.WriteAllBytes(sfd.FileName, Rebuild());
                }
            }
        }
Esempio n. 4
0
        public void Save(object sender, EventArgs args)
        {
            using (var sfd = new SaveFileDialog())
            {
                sfd.Filter = "Namco Universal Texture (.nut)|*.nut|" +
                             "All Files (*.*)|*.*";

                if (sfd.ShowDialog() == DialogResult.OK)
                {
                    // TODO: Put these methods somewhere that makes sense.
                    NUTEditor.PromptUserToConfirmMipRegenIfGtx(this);

                    File.WriteAllBytes(sfd.FileName, Rebuild());
                }
            }
        }
Esempio n. 5
0
        private void openNUTEditorToolStripMenuItem_Click(object sender, EventArgs e)
        {
            NUTEditor ev = new NUTEditor();

            ev.Show();
        }
Esempio n. 6
0
        ///<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();
            }
        }