void Model::FindMeshes( KFbxNode *root ) { if( root ) { for(int i = 0; i < root->GetChildCount(); i++) { KFbxNode *pood = root->GetChild(i); int ac = pood->GetNodeAttributeCount(); for( int j = 0; j < ac; j++ ) { KFbxNodeAttribute* poody = pood->GetNodeAttributeByIndex(j); if( poody->GetAttributeType() == KFbxNodeAttribute::eMESH ) { printf( " found a mesh !\n" ); MeshNodes.push_back( pood ); KFbxGeometryConverter converter(pood->GetFbxSdkManager()); printf( " triangulating...\n" ); converter.TriangulateInPlace(pood); //return pood; } } FindMeshes(pood); //return DumbRecursiveSearch( pood ); } } }
KFbxNodeAttribute::EAttributeType GetNodeAttributeType(KFbxNode* pNode) { KFbxNodeAttribute* nodeAtt = pNode->GetNodeAttribute(); if( nodeAtt != NULL ) return nodeAtt->GetAttributeType(); return KFbxNodeAttribute::eNULL; }
// Print an attribute void FBXParser::printAttribute(KFbxNodeAttribute const & pAttribute) const{ if(!&pAttribute){ return; } KString typeName = getAttributeTypeName(pAttribute.GetAttributeType()); KString attrName = pAttribute.GetName(); printTabs(); cout << "<attribute type= " << typeName.Buffer() << " name= " << attrName.Buffer(); cout << "/>" << endl; }
void FBXLoader::PrintNode(KFbxNode* pNode, Node* node) { KFbxNodeAttribute* Patt; fbxDouble3 trans; fbxDouble3 rot; fbxDouble3 scale; const char* nodeName; int i; int j; Node* Child; Object* obj; if (pNode == NULL) return; nodeName = pNode->GetName(); trans = pNode->LclTranslation.Get(); rot = pNode->LclRotation.Get(); scale = pNode->LclScaling.Get(); node->SetName(nodeName); node->SetTrans(trans); node->SetRot(rot); node->SetScale(scale); i = 0; while (i < pNode->GetNodeAttributeCount()) { Patt = pNode->GetNodeAttributeByIndex(i); obj = GetAttributeTypeName(pNode, Patt->GetAttributeType()); this->DisplayPivotsAndLimits(pNode, node); if (obj != NULL) node->AddObject(obj); ++i; } j = 0; while (j < pNode->GetChildCount()) //fiston { Child = new Node(); Child->SetFather(node); node->AddChild(Child); this->PrintNode(pNode->GetChild(j), Child); ++j; } }