public int ExportMorphsToFbx(string targetDir) { int countMorphNotExported = 0; if (Pcc != null) { var morphExpIndexes = Pcc.Exports.Select((value, index) => new { value, index }) .Where(z => z.value.ClassName == "BioMorphFace") .Select(z => z.index); foreach (int morphIndex in morphExpIndexes) { IExportEntry morphExp = Pcc.Exports[morphIndex]; var morph = new MEMeshMorphExporter.Unreal.BioMorphFace(Pcc, morphIndex); if (morph.IsExportable) { string fileDest = System.IO.Path.Combine(targetDir, morph.Name + ".fbx"); var expMesh = morph.Apply(); ExportMeshWithMorph(morph, 0, fileDest); } else { countMorphNotExported++; } } } return(countMorphNotExported); }
public void ExportMorphsToJson(string targetDir) { if (Pcc != null) { var morphExpIndexes = Pcc.Exports.Select((value, index) => new { value, index }) .Where(z => z.value.ClassName == "BioMorphFace") .Select(z => z.index); foreach (int morphIndex in morphExpIndexes) { IExportEntry morphExp = Pcc.Exports[morphIndex]; var morph = new MEMeshMorphExporter.Unreal.BioMorphFace(Pcc, morphIndex); string fileDest = System.IO.Path.Combine(targetDir, morph.Name + ".json"); morph.ExportToJson(fileDest); } } }
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); }
public MorphTreeNode(Unreal.BioMorphFace aMorph) { morph = aMorph; Text = morph.Name; }