Sign in to follow this  
wforl

FBX Textures Problem

Recommended Posts

wforl    169
Im using th efollowing code, to try and retrieve texture data from a mesh object that definatly has a diffuse texture.
void DisplayMesh(KFbxNode* pNode)
{

 KFbxMesh* lMesh = (KFbxMesh*) pNode->GetNodeAttribute ();

    int lLayerCount = lMesh->GetLayerCount();
    if(lLayerCount){
        KFbxLayer* lLayer = lMesh->GetLayer(0);
        if(lLayer){
            KFbxLayerElementTexture* lLayerElementTexture = lLayer->GetDiffuseTextures();
            if(lLayerElementTexture){
                std::cout << lLayerElementTexture->GetDirectArray().GetAt(0)->GetFileName();
            }else cout << "No Diffuse Textures \n";
        }else cout << "No layer 0 \n";
    }else cout << "No Layers \n";
}

but the following line:
KFbxLayerElementTexture* lLayerElementTexture = lLayer->GetDiffuseTextures();

..always returns a NULL pointer. Am i doing something wrong?

Share this post


Link to post
Share on other sites
bjarnia    219
How do you know what it has a diffuse texture?
Perhaps the export went wrong?
Or it could be a path problem.

if everything fails get the fbx sdk source (assuming it's open?) and step through what GetDiffuseTextures() does.

Share this post


Link to post
Share on other sites
wforl    169
Quote:
How do you know what it has a diffuse texture?
Perhaps the export went wrong?
Or it could be a path problem.

if everything fails get the fbx sdk source (assuming it's open?) and step through what GetDiffuseTextures() does.



I know it has a diffuse texture path because using the file in a 3d app works fine. Also viewing the file in ascii mode shows there to be a texture connection and the correct path.

Its not open source, so i cant step through it. Im just wondering if anyone with experienece with FBX could take a look to see what im oing wrong

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this