Beispiel #1
0
        };                                                                                  // Default viewport
        #endregion

        #region ToolStripMenu
        private void openNUDToolStripMenuItem_Click(object sender, EventArgs e)
        {
            PARAMEditor currentParam      = null;
            ACMDEditor  currentACMD       = null;
            SwagEditor  currentSwagEditor = null;

            foreach (PARAMEditor p in paramEditors)
            {
                if (p.ContainsFocus)
                {
                    currentParam = p;
                }
            }

            foreach (ACMDEditor a in ACMDEditors)
            {
                if (a.ContainsFocus)
                {
                    currentACMD = a;
                }
            }

            foreach (SwagEditor s in SwagEditors)
            {
                if (s.ContainsFocus)
                {
                    currentSwagEditor = s;
                }
            }

            if (currentParam != null)
            {
                currentParam.saveAs();
            }
            else if (currentACMD != null)
            {
                currentACMD.save();
            }
            else if (currentSwagEditor != null)
            {
                currentSwagEditor.save();
            }
            else
            {
                string         filename = "";
                SaveFileDialog save     = new SaveFileDialog();
                save.Filter = "Supported Filetypes (VBN,LVD)|*.vbn;*.lvd;*.dae|Smash 4 Boneset|*.vbn|All files(*.*)|*.*";
                DialogResult result = save.ShowDialog();

                if (result == DialogResult.OK)
                {
                    filename = save.FileName;
                    if (filename.EndsWith(".vbn"))
                    {
                        Runtime.TargetVBN.Endian = Endianness.Big;
                        if (!checkBox1.Checked)
                        {
                            Runtime.TargetVBN.Endian = Endianness.Little;
                        }
                        Runtime.TargetVBN.Save(filename);
                    }
                    if (filename.EndsWith(".lvd") && Runtime.TargetLVD != null)
                    {
                        File.WriteAllBytes(filename, Runtime.TargetLVD.Rebuild());
                    }
                    else if (filename.EndsWith(".lvd"))
                    {
                        DAT d = null;
                        foreach (ModelContainer c in Runtime.ModelContainers)
                        {
                            if (c.dat_melee != null)
                            {
                                d = c.dat_melee;
                            }
                        }
                        if (d != null)
                        {
                            DialogResult r = MessageBox.Show("Would you like to save in safe mode?\n(This is not suggested, only use when needed)", "DAT -> LVD safe mode", MessageBoxButtons.YesNo);
                            if (r == DialogResult.Yes)
                            {
                                File.WriteAllBytes(filename, d.toLVD(true).Rebuild());
                            }
                            else if (r == DialogResult.No)
                            {
                                File.WriteAllBytes(filename, d.toLVD(false).Rebuild());
                            }
                        }
                    }

                    if (filename.EndsWith(".dae"))
                    {
                        if (Runtime.ModelContainers.Count > 0)
                        {
                            Collada.Save(filename, Runtime.ModelContainers[0]);
                        }
                    }
                    //OMO.createOMO (anim, vbn, "C:\\Users\\ploaj_000\\Desktop\\WebGL\\test_outut.omo", -1, -1);
                }
            }
        }