MCPcopy Create free account
hub / github.com/beefytech/Beef / LoadBindPose

Method LoadBindPose

BeefySysLib/fbx/FBXReader.cpp:1112–1255  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1110}
1111
1112void FBXReader::LoadBindPose()
1113{
1114 //if (!params.useanimframebind)
1115 {
1116 int poseCount = mFBXScene->GetPoseCount();
1117 for (int poseIdx = 0; poseIdx < poseCount; poseIdx++)
1118 {
1119 FbxPose* pPose = mFBXScene->GetPose(poseIdx);
1120 if (pPose->IsBindPose())
1121 {
1122 for (int j = 0; j < pPose->GetCount(); ++j)
1123 {
1124 FbxNode *pNode = pPose->GetNode(j);
1125 if (!IsNodeVisible(pNode))
1126 {
1127 continue;
1128 }
1129 // Only export actual joints here. Otherwise meshes will create joints unnecessarily.
1130 if (pNode->GetNodeAttribute()->GetAttributeType() == FbxNodeAttribute::eSkeleton)
1131 {
1132 FbxAMatrix globalBindPose;
1133 globalBindPose = FBXConvertMatrix(pPose->GetMatrix(j));
1134
1135 int jointIndex = FBXGetJointIndex(pNode);
1136 if (-1 == jointIndex)
1137 {
1138 if (FBXIsValidMatrix(globalBindPose))
1139 {
1140 FBXLoadJoint(pNode, globalBindPose);
1141 }
1142 }
1143 else if (globalBindPose != mFBXJoints[jointIndex].globalBindPose)
1144 {
1145 //FxOgreFBXLog("Warning: Multiple bind poses found for joint %s. Setting bind pose to frame 0 and ignoring all stored bind poses.\n", pNode->GetName());
1146 //params.useanimframebind = true;
1147 break;
1148 }
1149 }
1150 }
1151 }
1152 }
1153 }
1154
1155 // Nodes to export using bind pose information calculated from the animation.
1156 std::vector<FbxNode*> time0skeletonNodes;
1157
1158 // Iterate through geometry and look for bones that were not incuded in the bind pose
1159 // but the mesh is weighted to.
1160 for (int iGeom = 0; iGeom < mFBXScene->GetGeometryCount(); ++iGeom)
1161 {
1162 FbxGeometry *pGeom = mFBXScene->GetGeometry(iGeom);
1163 if (!IsNodeVisible(pGeom->GetNode()))
1164 {
1165 continue;
1166 }
1167 bool bIsMeshWeighted = false;
1168 int lSkinCount = pGeom->GetDeformerCount(FbxDeformer::eSkin);
1169 for (int i = 0; i != lSkinCount; ++i)

Callers

nothing calls this directly

Calls 6

IsNodeVisibleFunction · 0.85
FBXConvertMatrixFunction · 0.85
FBXIsValidMatrixFunction · 0.85
GetParentMethod · 0.80
GetCountMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected