Example #1
0
        private void menuSaveForClick(object sender, EventArgs e)
        {
            ToolStripMenuItem mi = (ToolStripMenuItem)sender;

            switch (mi.Text)
            {
                case "Carmageddon 2":
                    sfdBrowse.Filter = "BRender ACT files (*.act)|*.act";

                    if (sfdBrowse.ShowDialog() == DialogResult.OK)
                    {
                        string directory = Path.GetDirectoryName(sfdBrowse.FileName) + "\\";
                        var textures = new HashSet<string>();
                        if (!Directory.Exists(directory + "tiffrgb")) { Directory.CreateDirectory(directory + "tiffrgb"); }

                        var ax = new ACTExporter();
                        ax.Export(SceneManager.Current.Models[0], sfdBrowse.FileName);

                        var dx = new DATExporter();
                        dx.Export(SceneManager.Current.Models[0], directory + Path.GetFileNameWithoutExtension(sfdBrowse.FileName) + ".dat");

                        var mx = new MATExporter();
                        mx.Export(SceneManager.Current.Materials, directory + Path.GetFileNameWithoutExtension(sfdBrowse.FileName) + ".mat");

                        foreach (var material in SceneManager.Current.Materials)
                        {
                            if (material.Texture.Name != null && textures.Add(material.Texture.Name))
                            {
                                var tx = new TIFExporter();
                                tx.Export(material.Texture, directory + "tiffrgb\\" + material.Texture.Name + ".tif");
                            }
                        }

                        SceneManager.Current.UpdateProgress(Path.GetFileName(sfdBrowse.FileName) + " saved successfully");
                    }
                    break;

                case "Carmageddon Reincarnation":
                    sfdBrowse.Filter = "Stainless CNT files (*.cnt)|*.cnt";
                    if (sfdBrowse.ShowDialog() == DialogResult.OK)
                    {
                        var cx = new CNTExporter();
                        cx.Export(SceneManager.Current.Models[0], sfdBrowse.FileName);

                        var mx = new MDLExporter();
                        mx.Export(SceneManager.Current.Models[0], Path.GetDirectoryName(sfdBrowse.FileName) + "\\");
                    }
                    break;
            }
        }
Example #2
0
        private void menuExportClick(object sender, EventArgs e)
        {
            ToolStripMenuItem mi = (ToolStripMenuItem)sender;

            switch (mi.Text)
            {
                case "Autodesk FBX File...":
                    sfdBrowse.Filter = "Autodesk FBX files (*.fbx)|*.fbx";
                    if (sfdBrowse.ShowDialog() == DialogResult.OK)
                    {
                        var fx = new ContentPipeline.Core.FBXExporter();
                        fx.Export(SceneManager.Current.Models[0], sfdBrowse.FileName);
                        SceneManager.Current.UpdateProgress(string.Format("Saved {0}", Path.GetFileName(sfdBrowse.FileName)));
                    }
                    break;

                case "Stainless CNT File...":
                    sfdBrowse.Filter = "Stainless CNT files (*.cnt)|*.cnt";
                    if (sfdBrowse.ShowDialog() == DialogResult.OK)
                    {
                        var cx = new CNTExporter();
                        cx.Export(SceneManager.Current.Models[0], sfdBrowse.FileName);
                        SceneManager.Current.UpdateProgress(string.Format("Saved {0}", Path.GetFileName(sfdBrowse.FileName)));
                    }
                    break;
            }
        }