Changeset 11264 for OpenSceneGraph/branches/OpenSceneGraph-2.8/src/osgPlugins/fbx/ReaderWriterFBX.cpp
- Timestamp:
- 03/21/10 00:19:35 (3 years ago)
- Location:
- OpenSceneGraph/branches/OpenSceneGraph-2.8
- Files:
-
- 3 modified
-
. (modified) (1 prop)
-
src/osgPlugins (modified) (1 prop)
-
src/osgPlugins/fbx/ReaderWriterFBX.cpp (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/branches/OpenSceneGraph-2.8
- Property svn:mergeinfo
-
old new 1 1 /OpenSceneGraph/branches/OpenSceneGraph-2.8.2:10664 2 /OpenSceneGraph/trunk:9769,9816-9818,9826-9827,9837-9843,9847,9850,9854-9857,9860-9861,9865,9869,9879-9880,9885,9895,9906,9910,9912,9932-9933,9948,9959-9960,9965,9968-9969,9990,10010,10012-10014,10030,10040-10041,10053,10057,10076,10079-10080,10082,10084,10088,10128,10149,10161,10208,10264,10283,10340,10391-10392,10408,10414,10417,10422,10440,10456,10487,10491,10520,10538,10622-10623,10625,10671-10672,10697,10722,10753,10758,10761,10788,10805,10809,10818,10851,10853-10855,10858,10887,10891-10892,10914,10923,10925,10932-10933,10938,10941-10942,10945,10961,11019,11032-11035,11056,11111,11123,11127,11131,11159,11165,11173,11175,11177,11180,11182,11194,11203,11237 2 /OpenSceneGraph/trunk:9769,9816-9818,9826-9827,9837-9843,9847,9850,9854-9857,9860-9861,9865,9869,9879-9880,9885,9895,9906,9910,9912,9932-9933,9948,9959-9960,9965,9968-9969,9990,10010,10012-10014,10030,10040-10041,10053,10057,10076,10079-10080,10082,10084,10088,10128,10149,10161,10208,10264,10283,10340,10391-10392,10408,10414,10417,10422,10440,10456,10487,10491,10520,10538,10622-10623,10625,10671-10672,10697,10722,10753,10758,10761,10788,10805,10809,10818,10851,10853-10855,10858,10887,10891-10892,10914,10923,10925,10932-10933,10938,10941-10942,10945,10961,11019,11032-11035,11056,11111,11123,11127,11131,11159,11165,11173,11175,11177,11180,11182,11194,11203,11237,11251-11252,11262
-
- Property svn:mergeinfo
-
OpenSceneGraph/branches/OpenSceneGraph-2.8/src/osgPlugins
- Property svn:mergeinfo
-
old new 1 1 /OpenSceneGraph/branches/OpenSceneGraph-2.8.2/src/osgPlugins:10664 2 2 /OpenSceneGraph/trunk:10539 3 /OpenSceneGraph/trunk/src/osgPlugins:9769,9816-9818,9826-9827,9837-9843,9847,9850,9854-9857,9860-9861,9865,9869,9879-9880,9885,9895,9906,9910,9912,9932-9933,9948,9959-9960,9965,9968-9969,9990,10010,10012-10014,10030,10040-10041,10053,10057,10076,10079-10080,10082,10084,10088,10128,10149,10161,10208,10264,10283,10340,10391-10392,10408,10414,10417,10422,10440,10456,10487,10491,10520,10538,10622-10623,10625,10671-10672,10697,10722,10753,10758,10761,10788,10805,10809,10818,10851,10853-10855,10858,10887,10891-10892,10914,10923,10925,10932-10933,10938,10941-10942,10945,10961,11019,11032-11035,11056,11111,11123,11127,11131,11159,11165,11173,11175,11177,11180,11182,11194,11203,11237 3 /OpenSceneGraph/trunk/src/osgPlugins:9769,9816-9818,9826-9827,9837-9843,9847,9850,9854-9857,9860-9861,9865,9869,9879-9880,9885,9895,9906,9910,9912,9932-9933,9948,9959-9960,9965,9968-9969,9990,10010,10012-10014,10030,10040-10041,10053,10057,10076,10079-10080,10082,10084,10088,10128,10149,10161,10208,10264,10283,10340,10391-10392,10408,10414,10417,10422,10440,10456,10487,10491,10520,10538,10622-10623,10625,10671-10672,10697,10722,10753,10758,10761,10788,10805,10809,10818,10851,10853-10855,10858,10887,10891-10892,10914,10923,10925,10932-10933,10938,10941-10942,10945,10961,11019,11032-11035,11056,11111,11123,11127,11131,11159,11165,11173,11175,11177,11180,11182,11194,11203,11237,11251-11252,11262
-
- Property svn:mergeinfo
-
OpenSceneGraph/branches/OpenSceneGraph-2.8/src/osgPlugins/fbx/ReaderWriterFBX.cpp
r11214 r11264 1 1 #include <sstream> 2 2 #include <memory> 3 #include <cassert>4 3 5 4 #include <osg/Notify> … … 99 98 }; 100 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 101 124 void resolveBindMatrices( 102 125 osg::Node& root, … … 143 166 144 167 osgAnimation::RigGeometry* pRigGeometry = it->first.second; 145 168 146 169 osgAnimation::VertexInfluenceMap* vertexInfluences = pRigGeometry->getInfluenceMap(); 147 170 … … 158 181 else 159 182 { 160 assert(0);183 osg::notify(osg::WARN) << "No vertex influences found for \"" << osgBone.getName() << "\"" << std::endl; 161 184 } 162 185 } … … 165 188 else 166 189 { 167 assert(0); 190 osg::notify(osg::WARN) << "No bone found for \"" << fbxBone->GetName() << "\"" << std::endl; 191 ++it; 168 192 } 169 193 } … … 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()) 272 299 { 300 fbxMaterialToOsgStateSet.checkInvertTransparency(); 301 273 302 resolveBindMatrices(*res.getNode(), boneBindMatrices, nodeMap); 274 303
