- Timestamp:
- 03/19/10 21:12:19 (3 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/src/osgPlugins/fbx/ReaderWriterFBX.cpp
r11252 r11262 98 98 }; 99 99 100 //Some files don't correctly mark their skeleton nodes, so this function infers 101 //them from the nodes that skin deformers linked to. 102 void findLinkedFbxSkeletonNodes(KFbxNode* pNode, std::set<const KFbxNode*>& fbxSkeletons) 103 { 104 if (const KFbxGeometry* pMesh = dynamic_cast<const KFbxGeometry*>(pNode->GetNodeAttribute())) 105 { 106 for (int i = 0; i < pMesh->GetDeformerCount(KFbxDeformer::eSKIN); ++i) 107 { 108 const KFbxSkin* pSkin = (const KFbxSkin*)pMesh->GetDeformer(i, KFbxDeformer::eSKIN); 109 110 for (int j = 0; j < pSkin->GetClusterCount(); ++j) 111 { 112 const KFbxNode* pSkeleton = pSkin->GetCluster(j)->GetLink(); 113 fbxSkeletons.insert(pSkeleton); 114 } 115 } 116 } 117 118 for (int i = 0; i < pNode->GetChildCount(); ++i) 119 { 120 findLinkedFbxSkeletonNodes(pNode->GetChild(i), fbxSkeletons); 121 } 122 } 123 100 124 void resolveBindMatrices( 101 125 osg::Node& root, … … 142 166 143 167 osgAnimation::RigGeometry* pRigGeometry = it->first.second; 144 168 145 169 osgAnimation::VertexInfluenceMap* vertexInfluences = pRigGeometry->getInfluenceMap(); 146 170 … … 262 286 FbxMaterialToOsgStateSet fbxMaterialToOsgStateSet(filePath, localOptions.get()); 263 287 288 std::set<const KFbxNode*> fbxSkeletons; 289 findLinkedFbxSkeletonNodes(pNode, fbxSkeletons); 290 264 291 std::map<KFbxNode*, osg::Node*> nodeMap; 265 292 BindMatrixMap boneBindMatrices; … … 267 294 ReadResult res = readFbxNode(*pSdkManager, pNode, pAnimationManager, 268 295 bIsBone, nLightCount, fbxMaterialToOsgStateSet, nodeMap, 269 boneBindMatrices, skeletonMap, localOptions.get());296 boneBindMatrices, fbxSkeletons, skeletonMap, localOptions.get()); 270 297 271 298 if (res.success())
