Exemple #1
0
 private void exportAllAsSMDToolStripMenuItem_Click(object sender, EventArgs e)
 {
     using (var ofd = new FolderSelectDialog())
     {
         ofd.Title = "Character Folder";
         if (ofd.ShowDialog() == DialogResult.OK)
         {
             string path = ofd.SelectedPath;
             foreach (TreeNode b in treeView1.Nodes)
             {
                 foreach (TreeNode v in b.Nodes)
                 {
                     foreach (TreeNode f in v.Nodes)
                     {
                         foreach (TreeNode a in f.Nodes)
                         {
                             if (a is Animation)
                             {
                                 Smd.Save(((Animation)a), Runtime.TargetVbn, path + "\\" + a.Text + ".smd");
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Exemple #2
0
        public void SaveAs(object sender, EventArgs args)
        {
            if (Runtime.TargetVbn == null)
            {
                MessageBox.Show("You must have a bone-set (VBN) selected to save animations.");
                return;
            }
            using (var sfd = new SaveFileDialog())
            {
                sfd.Filter = "Supported Files (.omo, .anim, .smd)|*.omo;*.anim;*.smd|" +
                             "Maya Anim (.anim)|*.anim|" +
                             "Object Motion (.omo)|*.omo|" +
                             "Source Animation (.smd)|*.smd|" +
                             "All Files (*.*)|*.*";

                sfd.DefaultExt = "smd"; //Set a default extension to prevent crashing if not specified by user
                if (sfd.ShowDialog() == DialogResult.OK)
                {
                    sfd.FileName = sfd.FileName;

                    if (sfd.FileName.EndsWith(".anim"))
                    {
                        if (Tag is AnimTrack)
                        {
                            ((AnimTrack)Tag).CreateAnim(sfd.FileName, Runtime.TargetVbn);
                        }
                        else
                        {
                            ANIM.CreateANIM(sfd.FileName, this, Runtime.TargetVbn);
                        }
                    }

                    if (sfd.FileName.EndsWith(".omo"))
                    {
                        if (Tag is FileData)
                        {
                            FileOutput o = new FileOutput();
                            o.WriteBytes(((FileData)Tag).GetSection(0,
                                                                    ((FileData)Tag).Size()));
                            o.Save(sfd.FileName);
                        }
                        else
                        {
                            File.WriteAllBytes(sfd.FileName, OMOOld.CreateOMOFromAnimation(this, Runtime.TargetVbn));
                        }
                    }


                    if (sfd.FileName.EndsWith(".smd"))
                    {
                        Smd.Save(this, Runtime.TargetVbn, sfd.FileName);
                    }
                }
            }
        }