public void ExportSkeletalMeshToFbx(MESkeletalMesh mesh, string meshName, string targetdir) { FBXManager lSdkManager = new FBXManager(); FBXScene lScene = new FBXScene(); FBXHelper.InitializeSdkObjects(lSdkManager, lScene); FBXNode SceneRoot = lScene.GetRootNode(); FBXNode lSkeletonRoot = CreateFbxSkeleton(mesh.Bones, lScene); SceneRoot.AddChild(lSkeletonRoot); try { FBXNode fbxMesh = CreateFbxMesh(mesh, meshName, lScene); CreateMeshSkinning(mesh, 0, fbxMesh, lSkeletonRoot, lScene); SceneRoot.AddChild(fbxMesh); //StoreRestPose(lScene, lSkeletonRoot, skeleton); } catch (Exception e) { Console.WriteLine(e.Message); } bool lResult = FBXHelper.SaveScene(lSdkManager, lScene, targetdir); FBXHelper.DestroySdkObjects(lSdkManager, lResult); }
private bool SaveScene(String targetdir, FBXManager pSdkManager, FBXScene pScene) { bool lResult = FBXHelper.SaveScene(pSdkManager, pScene, targetdir); FBXHelper.DestroySdkObjects(pSdkManager, lResult); return(lResult); }
public void ExportMeshWithMorph(Unreal.BioMorphFace morph, int lodIndex, String targetdir) { FBXManager lSdkManager = new FBXManager(); FBXScene lScene = new FBXScene(); FBXHelper.InitializeSdkObjects(lSdkManager, lScene); FBXNode SceneRoot = lScene.GetRootNode(); MESkeletalMesh mesh = morph.Apply(); FBXNode fbxMesh = CreateFbxMesh(mesh, morph.Name, lScene); SceneRoot.AddChild(fbxMesh); if (mesh.Bones != null) { FBXNode lSkeletonRoot = CreateFbxSkeleton(mesh.Bones, lScene); CreateMeshSkinning(mesh, lodIndex, fbxMesh, lSkeletonRoot, lScene); UpdateSkeletonWithMorph(morph, lSkeletonRoot); SceneRoot.AddChild(lSkeletonRoot); //StoreBindPose(lScene, fbxMesh); } bool lResult = FBXHelper.SaveScene(lSdkManager, lScene, targetdir); FBXHelper.DestroySdkObjects(lSdkManager, lResult); }