/// <summary> /// Exports a file of a given type. /// Formats available to export will depend on the type of the data. /// </summary> /// <param name="type">Type of the data to be exported</param> /// <param name="data">The data</param> /// <param name="arguments">Optional arguments to be used by the exporter</param> public static void export(fileType type, object data, params object[] arguments) { using (SaveFileDialog saveDlg = new SaveFileDialog()) { switch (type) { case fileType.model: OModelExportForm exportMdl = new OModelExportForm((RenderBase.OModelGroup)data, (int)arguments[0]); exportMdl.Show(); break; case fileType.texture: OTextureExportForm exportTex = new OTextureExportForm((RenderBase.OModelGroup)data, (int)arguments[0]); exportTex.Show(); break; case fileType.skeletalAnimation: saveDlg.Title = "Export Skeletal Animation"; saveDlg.Filter = "Source Model|*.smd"; if (saveDlg.ShowDialog() == DialogResult.OK) { switch (saveDlg.FilterIndex) { case 1: SMD.export((RenderBase.OModelGroup)data, saveDlg.FileName, (int)arguments[0], (int)arguments[1]); break; } } break; } } }
/// <summary> /// Exports a file of a given type. /// Formats available to export will depend on the type of the data. /// </summary> /// <param name="type">Type of the data to be exported</param> /// <param name="data">The data</param> /// <param name="arguments">Optional arguments to be used by the exporter</param> public static void export(FileIO.fileType type, object data, params int[] arguments) { using (SaveFileDialog saveDlg = new SaveFileDialog()) { switch (type) { case FileIO.fileType.model: OModelExportForm exportMdl = new OModelExportForm((RenderBase.OModelGroup)data, arguments[0]); exportMdl.Show(); break; case FileIO.fileType.texture: OTextureExportForm exportTex = new OTextureExportForm((RenderBase.OModelGroup)data, arguments[0]); exportTex.Show(); break; case FileIO.fileType.skeletalAnimation: saveDlg.Title = "Export Skeletal Animation"; saveDlg.Filter = "Source Model|*.smd"; if (saveDlg.ShowDialog() == DialogResult.OK) { switch (saveDlg.FilterIndex) { case 1: var warnings = SMD.export((RenderBase.OModelGroup)data, saveDlg.FileName, arguments[0], arguments[1]); foreach (var warning in warnings) { MessageBox.Show(warning, "SMD Exporter", MessageBoxButtons.OK, MessageBoxIcon.Error); } break; } } break; } } }