FBX SDK only returning one object from GetChildCount

Started by
0 comments, last by ender_341 13 years, 4 months ago
I placed a bunch of objects into the FBX file and doubled checked with the quicktime plugin to make sure they are there but when I run the code below GetChildCount only returns 1 no matter how many objects are in the scene.

	KFbxSdkManager* FBXManager;	FBXManager = KFbxSdkManager::Create();	KFbxImporter* FBXImporter;	KFbxScene* FBXScene;	FBXImporter = KFbxImporter::Create( FBXManager, "" );	FBXScene = KFbxScene::Create( FBXManager, "" );	FBXImporter->Initialize( file.c_str(), -1, FBXManager->GetIOSettings() );	FBXImporter->Import( FBXScene );	KFbxNode* Node = FBXScene->GetRootNode();	if(Node)    {        for(DWORD i = 0; i < Node->GetChildCount(); i++)        {			KFbxNodeAttribute::EAttributeType AttributeType = Node->GetChild(i)->GetNodeAttribute()->GetAttributeType();			if ( AttributeType == KFbxNodeAttribute::eLIGHT )			{				KFbxLight* Light = (KFbxLight*) Node->GetChild(i)->GetNodeAttribute();				scene->CreateLight( &AxMatrixTranslation( 0.0f, 0.0f, 0.0f ), &AxVector4Set( 1.0f, Light->Color.Get()[0], Light->Color.Get()[1], Light->Color.Get()[2] ));			}        }    }


What am I doing wrong?!
Advertisement
Are all of the nodes children of the root node or of another node, The usual way of doing this would be to use recursion.

Pseudo Code:
GetNodeLights(Scene* scene, KFbxNode* node){  KFbxNodeAttribute::EAttributeType AttributeType = Node->GetChild(i)->GetNodeAttribute()->GetAttributeType();  if(AttributeType == KFbxNodeAttribute::eLIGHT){    // Handle Creating the light here    scene->CreateLight(...)  }  for(DWORD i = 0; i < node->GetChildCount(); ++i){    GetNodeLights(scene, node->GetChild(i));  }}
-Matt S.

This topic is closed to new replies.

Advertisement