private void exportMeshToolStripMenuItem_Click(object sender, EventArgs e) { MeshTreeNode meshNode = LeftTree.SelectedNode as MeshTreeNode; if (meshNode != null) { var pccNode = meshNode.GetParentNode(); var exporter = new MEMeshMorphExporter.Exporters.MeshExporter(pccNode.pcc); SaveFileDialog sfd = new SaveFileDialog(); sfd.Title = "Save mesh as fbx..."; sfd.Filter = "*.fbx|.fbx"; sfd.FileName = meshNode.Text + ".fbx"; if (sfd.ShowDialog() == DialogResult.OK) { this.Cursor = Cursors.WaitCursor; exporter.ExportSkeletalMeshToFbx(meshNode.mesh, meshNode.Text, sfd.FileName); this.Cursor = Cursors.Default; MessageBox.Show("Done."); } } }
public TreeNode BuildPccTree(string pcc) { if (!_isPackageHandlerInitialized) { MEPackageHandler.Initialize(); _isPackageHandlerInitialized = true;; } // check first if this pcc has already been added in the tree bool IsPccAlreadyInTree = PccList.Find(ptn => ptn.pcc.FileName == pcc) != null; if (IsPccAlreadyInTree) { return(null); } var Pcc = MEPackageHandler.OpenMEPackage(pcc); /* * ME3Package me3Pcc = Pcc as ME3Package; * * if (me3Pcc == null) * { * // supports only ME3 for the time being * throw new ArgumentException("This is not a ME3 package. The tool only supports ME3 at this time."); * } * */ PccTreeNode pccRootNode = null; var MorphExpIndexes = Pcc.Exports.Select((value, index) => new { value, index }) .Where(z => z.value.ClassName == "BioMorphFace") .Select(z => z.index); if (MorphExpIndexes.Count() > 0) { pccRootNode = new PccTreeNode(Pcc); // Morphs TreeNode ParentMorphNode = new TreeNode(); ParentMorphNode.Text = "BioMorphFace"; foreach (int morphIndex in MorphExpIndexes) { var morph = new Unreal.BioMorphFace(Pcc, morphIndex); MorphTreeNode morphNode = new MorphTreeNode(morph); ParentMorphNode.Nodes.Add(morphNode); } // Meshes TreeNode ParentMeshNode = new TreeNode(); ParentMeshNode.Text = "SkeletalMesh"; var MeshExpIndexes = Pcc.Exports.Select((value, index) => new { value, index }) .Where(z => z.value.ClassName == "SkeletalMesh") .Select(z => z.index); foreach (int meshIndex in MeshExpIndexes) { IExportEntry exp = Pcc.Exports[meshIndex]; //SkeletalMesh skMesh = new SkeletalMesh((ME3Package)Pcc, meshIndex); var skMesh = new Unreal.MESkeletalMesh(Pcc, meshIndex); MeshTreeNode meshNode = new MeshTreeNode(skMesh, exp); ParentMeshNode.Nodes.Add(meshNode); } // build hierarchy pccRootNode.Nodes.Add(ParentMeshNode); pccRootNode.Nodes.Add(ParentMorphNode); // add in the list PccList.Add(pccRootNode); } else { Pcc = null; } return(pccRootNode); }