private void OnExport() { Skeleton skele; ModelDefinition model; ImcVariant variant; int m, b; if (!TryGetModel(out skele, out model, out variant, out m, out b)) { return; } List <PapFile> paps = SearchPaps(model.File.Path, m); VistaFolderBrowserDialog dialog = new VistaFolderBrowserDialog { Description = "Select folder to export to", UseDescriptionForTitle = true }; bool?result = dialog.ShowDialog(); if (result.HasValue && result.Value && !string.IsNullOrEmpty(dialog.SelectedPath)) { Task.Run(() => { string identifier = SelectedEntry.ToString().Replace(" / ", "_"); string folderName = Path.Combine(dialog.SelectedPath, identifier); Directory.CreateDirectory(folderName); string fileName = Path.Combine(folderName, identifier + ".fbx"); // Set IsExporting for feedback IsExporting = true; int exportResult = FbxExport.ExportFbx(fileName, model.GetModel(0).Meshes, skele, paps); FbxExport.ExportMonsterMaterials(Parent.Realm, folderName, model.GetModel(0).Definition.Materials, variant); IsExporting = false; if (exportResult == 0) { System.Windows.MessageBox.Show("The export of " + Path.GetFileName(fileName) + " has completed.", "Export Complete", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK, System.Windows.MessageBoxOptions.DefaultDesktopOnly); } else { System.Windows.MessageBox.Show("The export of " + Path.GetFileName(fileName) + " has failed.", "Export Failed", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK, System.Windows.MessageBoxOptions.DefaultDesktopOnly); } }); } }
private void OnAdd() { Skeleton skele; ModelDefinition model; ImcVariant variant; int m, b; if (TryGetModel(out skele, out model, out variant, out m, out b)) { Parent.EngineHelper.AddToLast(SelectedEntry.ToString(), (e) => CreateModel(e, skele, model, variant, m, b)); } }
private void OnExport() { Skeleton skele; ModelDefinition model; ImcVariant variant; int m, b; if (!TryGetModel(out skele, out model, out variant, out m, out b)) { return; } var papPath = string.Format(PapPathFormat, m, b); PapFile pap = null; // We have animation if (Parent.Realm.Packs.TryGetFile(papPath, out var papFileBase)) { pap = new PapFile(papFileBase); } VistaSaveFileDialog dialog = new VistaSaveFileDialog { OverwritePrompt = true, Title = "Export FBX to...", FileName = SelectedEntry.ToString().Replace(" / ", "_"), DefaultExt = ".fbx", Filter = "Autodesk FBX Files|*.fbx" }; bool?result = dialog.ShowDialog(); if (result.HasValue && result.Value && !string.IsNullOrEmpty(dialog.FileName)) { Task.Run(() => { // Set IsExporting for feedback IsExporting = true; int exportResult = FbxExport.ExportFbx(dialog.FileName, model.GetModel(0).Meshes, skele, pap); IsExporting = false; if (exportResult == 0) { System.Windows.MessageBox.Show("The export of " + Path.GetFileName(dialog.FileName) + " has completed.", "Export Complete", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK, System.Windows.MessageBoxOptions.DefaultDesktopOnly); } else { System.Windows.MessageBox.Show("The export of " + Path.GetFileName(dialog.FileName) + " has failed.", "Export Failed", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK, System.Windows.MessageBoxOptions.DefaultDesktopOnly); } }); } }
private void DemoBitmapMenuItem_Click(object sender, System.EventArgs e) { MessageBox.Show(SelectedEntry.ToString()); }