Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk® FBX® / FBX SDK / Having Problems Loading Mesh
  RSS 2.0 ATOM  

Having Problems Loading Mesh
Rate this thread
 
52887
 
Permlink of this thread  
avatar
  • Total Posts: 3
  • Joined: 23 August 2010 03:37 PM

Working through the examples and I’m having an issue.

I exported a basic teapot mesh out of 3ds Max. I than am directing the functionm below to find the mesh.

I realize this code is super simple, but no need to go more complex till i have the basics working.

I load a basic teapot mesh and everything succeeds until I try to read the mesh data

I get read access errors when I try to access ANY other data. I’m confused as to what I did wrong.

Edit: Ok the Scene isn’t even initializing the rootnode. I’m confused now if the rootnode isn’t initialized than tha means there isn’t any data thus the load should fail, but it doesn’t.

bool gl_LoadModel(const charFilePath,KFbxSdkManagerpManager,::GLTriangleBatchBatch)

 int lFileMajor
lFileMinorlFileRevision;
    
int lSDKMajor,  lSDKMinor,  lSDKRevision;
    
//int lFileFormat = -1;
    
bool lStatus;
    
char lPassword[1024];
 
KFbxScenepScene KFbxScene::Create(pManager,"");
 
// Get the file version number generate by the FBX SDK.
 
KFbxSdkManager::GetFileFormatVersion(lSDKMajorlSDKMinorlSDKRevision);

    
// Create an importer.
    
KFbxImporterlImporter KFbxImporter::Create(pManager,"");

 
// Initialize the importer by providing a filename.
    
bool lImportStatus lImporter->Initialize(FilePath, -1pManager->GetIOSettings());
    
lImporter->GetFileVersion(lFileMajorlFileMinorlFileRevision);

     if( !
lImportStatus )
    
{
#if _DEBUG
        
printf("Call to KFbxImporter::Initialize() failed.\n");
        
printf("Error returned: %s\n\n"lImporter->GetLastErrorString());

        if (
lImporter->GetLastErrorID() == KFbxIO::eFILE_VERSION_NOT_SUPPORTED_YET ||
            
lImporter->GetLastErrorID() == KFbxIO::eFILE_VERSION_NOT_SUPPORTED_ANYMORE)
        
{
            printf
("FBX version number for this FBX SDK is %d.%d.%d\n"lSDKMajorlSDKMinorlSDKRevision);
            
printf("FBX version number for file %s is %d.%d.%d\n\n"FilePathlFileMajorlFileMinorlFileRevision);
        
}
#endif
        
return false;
    
}

 
if(lImporter->IsFBX())
 
{
 
 }

 lStatus 
lImporter->Import(pScene);

 if(
lStatus == false && lImporter->GetLastErrorID() == KFbxIO::ePASSWORD_ERROR)
    
{
       
    }

 lImporter
->Destroy();

 
KFbxNodepRoot pScene->GetRootNode();
 
KFbxNodeAttribute::EAttributeType lAttributeType;
 
KFbxMeshpMesh 0;
 for(
unsigned int i 0pRoot->GetChildCount();++i)
 
{
 
if(pMesh != 0)
 break;

 
lAttributeType pRoot->GetChild(i)->GetNodeAttribute()->GetAttributeType();
 switch(
lAttributeType)
 
{
 
case KFbxNodeAttribute::eMESH:
 
pMesh = (KFbxMesh*)pRoot->GetChild(i);
 break;
 default:
 break;
 
}
 }

 
if(pMesh == 0)
 
{
 pScene
->Destroy();
 return 
false;
 
}
        
//Fail here
 
if(!pMesh->IsTriangleMesh())
 
{
 KFbxMesh
Temp;
 
KFbxGeometryConverter Geometry(pManager);
 
Temp Geometry.TriangulateMeshAdvance(pMesh,lStatus);
 if(
lStatus)
 
{
 pMesh
->Destroy();
 
pMesh Temp;
 
}
 
else
 
{
 pScene
->Destroy(false,true);
 return 
false;
 
}

 }
        
//Also fails here if I comment out the block above
 
int i,j,lPolygonCount pMesh->GetPolygonCount();

//Never can access farther code because of crash.

}


Replies: 1
/img/forum/dark/default_avatar.png

Edit: Figured it out

Author: ChaseRLewis

Replied: 02 March 2011 11:13 AM