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 testExport3() { Model model = null; string tmpSkel = "chara/monster/m0595/skeleton/base/b0001/skl_m0595b0001.sklb"; string tmpPap = "chara/monster/m0595/animation/a0001/bt_common/resident/mount.pap"; realm.Packs.TryGetFile(tmpSkel, out File sklb); realm.Packs.TryGetFile(tmpPap, out File pap); List <PapFile> papList = new List <PapFile>(); List <SklbFile> skeleList = new List <SklbFile>(); papList.Add(new PapFile(pap)); skeleList.Add(new SklbFile(sklb)); FbxExport.ExportFbx("mounttest.fbx", new List <Mesh>(), skeleList, papList); }
public void Export() { // System.Diagnostics.Debug.WriteLine(Parent.EquipmentSelect.MainhandSelect.SelectedEquipment); // not needed for now //CharaMakeTypeStruct[] sheet = Data.LoadCharaMakeType(Parent.Realm); Quad bbase = new Quad(0); Exportable ex = GetExportableData(); var meshes = new List <Mesh>(); var skeletons = new List <SklbFile>(); var paps = new List <PapFile>(); //ignore mainhand/offhand //face // var faceMdl = PathFormatter.Instance.GetFaceModelPath(ex.Tribe, ex.Sex, 1); // string faceSkele = ""; int what = 1; // while (faceSkele == "") // faceSkele = PathFormatter.Instance.GetFaceSkeletonPath(ex.Tribe, ex.Sex, what++); //body // string bodyMdl = ""; // what = 1; // while (bodyMdl == "") // bodyMdl = PathFormatter.Instance.GetBodyModelPath(ex.Tribe, ex.Sex, what++); var bodySkele = PathFormatter.Instance.GetBodySkeletonPath(ex.Tribe, ex.Sex); //hair // var hairMdl = PathFormatter.Instance.GetHairModelPath(ex.Tribe, ex.Sex, 1); // var hairSkele = PathFormatter.Instance.GetHairSkeletonPath(ex.Tribe, ex.Sex, 1); //equipment //no mainhand, met // Quad shisTest = new Quad { Value1 = 36, Value2 = 1 }; // var topMesh = InitEquipMesh(ex.Tribe, ex.Sex, shisTest, EquipSlotKey.Body); // var glvMesh = InitEquipMesh(ex.Tribe, ex.Sex, shisTest, EquipSlotKey.Hands); // var dwnMesh = InitEquipMesh(ex.Tribe, ex.Sex, shisTest, EquipSlotKey.Legs); // var shoMesh = InitEquipMesh(ex.Tribe, ex.Sex, shisTest, EquipSlotKey.Feet); // var topMesh = InitEquipMesh(ex.Tribe, ex.Sex, Quad.Zero, EquipSlotKey.Body); // var glvMesh = InitEquipMesh(ex.Tribe, ex.Sex, Quad.Zero, EquipSlotKey.Hands); // var dwnMesh = InitEquipMesh(ex.Tribe, ex.Sex, Quad.Zero, EquipSlotKey.Legs); // var shoMesh = InitEquipMesh(ex.Tribe, ex.Sex, Quad.Zero, EquipSlotKey.Feet); var topMesh = InitEquipMesh(ex.Tribe, ex.Sex, ex.Body); var dwnMesh = InitEquipMesh(ex.Tribe, ex.Sex, ex.Legs); // var topMesh = InitEquipMesh(ex.Tribe, ex.Sex, ex.Body); // Quad gaiuass = new Quad {Value1 = 9063, Value2 = 1}; // var topMesh = InitEquipMesh(ex.Tribe, ex.Sex, gaiuass, EquipSlotKey.BodyNoHeadHandsLegsFeet); // var topMesh = InitNonVariantMesh("chara/equipment/e9063/model/c0501e9063_top.mdl"); // var topMesh = InitEquipMesh(ex.Tribe, ex.Sex, ex.Body); // var glvMesh = InitEquipMesh(ex.Tribe, ex.Sex, ex.Hands); // var dwnMesh = InitEquipMesh(ex.Tribe, ex.Sex, ex.Legs); // var shoMesh = InitEquipMesh(ex.Tribe, ex.Sex, ex.Feet); // no pap // paps.Add(InitPap("chara/human/c0201/animation/a0001/bt_common/resident/move_a.pap")); // paps.Add(InitPap("chara/human/c0201/animation/a0001/bt_common/resident/idle.pap")); // paps.Add(InitPap("chara/human/c0501/animation/a0001/bt_common/resident/move_a.pap")); // meshes.Add(InitNonVariantMesh(faceMdl)); // meshes.Add(InitNonVariantMesh(bodyMdl)); // meshes.Add(InitNonVariantMesh(hairMdl)); // meshes.Add(metMesh); meshes.Add(topMesh); // meshes.Add(glvMesh); meshes.Add(dwnMesh); // meshes.Add(shoMesh); skeletons.Add(InitSklb(bodySkele)); // skeletons.Add(InitSklb(faceSkele)); // skeletons.Add(InitSklb(hairSkele)); int result = FbxExport.ExportFbx("testnew.fbx", meshes, skeletons, paps); MessageBox.Show($"Export ended with result {result}", "Export", MessageBoxButton.OK, MessageBoxImage.Information); }
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); } }); } }