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; } }
private void btnSave_Click(object sender, EventArgs e) { ContentExporter cx = null; sfdSave.Filter = "TDX (*.tdx)|*.tdx|JPG (*.jpg)|*.jpg|PNG (*.png)|*.png|TIF (*.tif)|*.tif|BMP (*.bmp)|*.bmp"; if (sfdSave.ShowDialog() == DialogResult.OK) { switch (Path.GetExtension(sfdSave.FileName)) { case ".bmp": cx = new BMPExporter(); break; case ".jpg": cx = new JPGExporter(); break; case ".png": cx = new PNGExporter(); break; case ".tif": cx = new TIFExporter(); break; case ".tdx": //cx = new TDXExporter(); //cx.ExportSettings.AddSetting("Format", ToxicRagers.Helpers.D3DFormat.DXT5); break; } if (cx != null) { cx.Export(t, sfdSave.FileName); SceneManager.Current.UpdateProgress(string.Format("Saved {0}", sfdSave.FileName)); } } }
public static void SaveForCarmageddon2(string path) { string directory = Path.GetDirectoryName(path); HashSet <string> textures = new HashSet <string>(); if (!Directory.Exists(Path.Combine(directory, "tiffrgb"))) { Directory.CreateDirectory(Path.Combine(directory, "tiffrgb")); } ACTExporter ax = new ACTExporter(); ax.Export(SceneManager.Current.Models[0], path); DATExporter dx = new DATExporter(); dx.Export(SceneManager.Current.Models[0], Path.Combine(directory, $"{Path.GetFileNameWithoutExtension(path)}.dat")); MATExporter mx = new MATExporter(); mx.Export(SceneManager.Current.Materials, Path.Combine(directory, $"{Path.GetFileNameWithoutExtension(path)}.mat")); foreach (Material material in SceneManager.Current.Materials) { if (material == null) { continue; } if (material.Texture.Name != null && textures.Add(material.Texture.Name)) { TIFExporter tx = new TIFExporter(); tx.Export(material.Texture, Path.Combine(directory, "tiffrgb", $"{material.Texture.Name}.tif")); } } SceneManager.Current.UpdateProgress($"{Path.GetFileName(path)} saved successfully"); }