protected void ExportBindPose(FbxNode meshNode, FbxScene fbxScene, List <FbxNode> boneNodes) { FbxPose fbxPose = FbxPose.Create(fbxScene, "Pose"); // set as bind pose fbxPose.SetIsBindPose(true); // assume each bone node has one weighted vertex cluster foreach (FbxNode fbxNode in boneNodes) { // EvaluateGlobalTransform returns an FbxAMatrix (affine matrix) // which has to be converted to an FbxMatrix so that it can be passed to fbxPose.Add(). // The hierarchy for FbxMatrix and FbxAMatrix is as follows: // // FbxDouble4x4 // / \ // FbxMatrix FbxAMatrix // // Therefore we can't convert directly from FbxAMatrix to FbxMatrix, // however FbxMatrix has a constructor that takes an FbxAMatrix. FbxMatrix fbxBindMatrix = new FbxMatrix(fbxNode.EvaluateGlobalTransform()); fbxPose.Add(fbxNode, fbxBindMatrix); } FbxMatrix bindMatrix = new FbxMatrix(meshNode.EvaluateGlobalTransform()); fbxPose.Add(meshNode, bindMatrix); // add the pose to the scene fbxScene.AddPose(fbxPose); }
public void TestAddPose() { using (FbxScene newScene = FbxScene.Create(Manager, "")) { FbxPose fbxPose = FbxPose.Create(Manager, "pose"); bool result = newScene.AddPose(fbxPose); Assert.IsTrue(result); Assert.AreEqual(fbxPose, newScene.GetPose(0)); // test null Assert.That(() => { newScene.AddPose(null); }, Throws.Exception.TypeOf <System.ArgumentNullException>()); // test invalid fbxPose.Destroy(); Assert.That(() => { newScene.AddPose(fbxPose); }, Throws.Exception.TypeOf <System.ArgumentNullException>()); } }