void ofxFBXScene::parseScene(FbxNode* pNode, FbxAnimLayer * pAnimLayer, ofxFBXNode * parentNode){ ofLogVerbose("ofxFBXScene") << "found node " << pNode->GetName() << " of type " << pNode->GetTypeName() << endl; if( pNode->GetCamera() ){ ofxFBXNode * node = parseCameraInfo(pNode,pAnimLayer); if(parentNode) node->getNode().setParent(parentNode->getNode()); parentNode = node; }else if(pNode->GetMesh()){ ofxFBXNode * node = parseMeshInfo(pNode, pAnimLayer); if(parentNode) node->getNode().setParent(parentNode->getNode()); parentNode = node; }else if(pNode->GetLight()){ ofxFBXNode * node = parseLightInfo(pNode, pAnimLayer); if(parentNode) node->getNode().setParent(parentNode->getNode()); parentNode = node; }else{ ofxFBXNode node; node.nodeName = pNode->GetName(); parsePositionCurve(node,pAnimLayer,pNode->LclTranslation); parseScaleCurve(node,pAnimLayer,pNode->LclScaling); parseRotationCurve(node,pAnimLayer,pNode,pNode->LclRotation); nullsList.push_back(node); if(parentNode) nullsList.back().getNode().setParent(parentNode->getNode()); parentNode = &nullsList.back(); } //recursively traverse each node in the scene int i, lCount = pNode->GetChildCount(); for (i = 0; i < lCount; i++) { parseScene(pNode->GetChild(i), pAnimLayer, parentNode); } }
static void parseKeyFramer( MeshModel *root ){ _log( "KeyFramer" ); enterChunk(); string file_3ds; unsigned short rev,curr_time=0; while( int id=nextChunk() ){ switch( id ){ case 0xb009: //CURR_TIME in.sgetn( (char*)&curr_time,2 ); _log( "CURR_TIME: "+itoa(curr_time) ); break; case 0xb00a: //KFHDR in.sgetn( (char*)&rev,2 ); file_3ds=parseString(); in.sgetn( (char*)&anim_len,2 ); _log( "KFHDR: revision="+itoa(rev)+" 3dsfile="+file_3ds+" anim_len="+itoa(anim_len) ); break; case 0xb002: //object keyframer data... parseMeshInfo( root,curr_time ); break; } } if( !collapse ){ root->setAnimator( d_new Animator( root,anim_len ) ); } leaveChunk(); }