Community
FBX Forum
Welcome to Autodesk’s FBX Forums. Share your knowledge, ask questions, and explore popular FBX topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

FBX SDK only returning one object from GetChildCount

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
274 Views, 3 Replies

FBX SDK only returning one object from GetChildCount

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(), Light->Color.Get(), Light->Color.Get() ));
}
}
}



What am I doing wrong?!
3 REPLIES 3
Message 2 of 4
Numerator
in reply to: Anonymous

How about doing something like this:

int lIndex, lNodeCount = KFbxGetSrcCount<KFbxNode>(pScene);

for (lIndex=0; lIndex<lNodeCount; lIndex++)
{
KFbxNode* lNode = KFbxGetSrc<KFbxNode>(pScene, lIndex);


Message 3 of 4
Anonymous
in reply to: Anonymous

That did indeed work! I have one more thing I need to know though. How do I get the position of a light? I was able to get the color but I don't see how to get the position.
Message 4 of 4
Numerator
in reply to: Anonymous

Does this get you what you need?



KFbxVector4 localT, localR, localS;


localT = pNode->LclTranslation.Get();
localR = pNode->LclRotation.Get();
localS = pNode->LclScaling.Get();

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report