Пример #1
0
 public void OpenMoi(string pathMOI)
 {
     if (string.IsNullOrEmpty(pathMOI))
     {
         return;
     }
     MOI = new MOI(pathMOI);
 }
Пример #2
0
 public ModelContainer()
 {
     ImageKey         = "folder";
     SelectedImageKey = "folder";
     nud     = new NUD();
     nut     = new NUT();
     mta     = new MTA();
     MOI     = new MOI();
     jtb     = new JTB();
     XMB     = new XMBFile();
     Checked = true;
     Refresh();
 }
Пример #3
0
 public MOIEditor(MOI moi)
 {
     InitializeComponent();
     this.moi = moi;
 }
Пример #4
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();
            }
        }