Creating a file exporter
 
 
 

To export the scene,ImportExport()callsSaveScene():

 // Save the scene.
 r = SaveScene(lSdkManager, // Use this manager...
 lScene, // to export this scene...
 ExportFileName, // to this path/filename...
 pWriteFileFormat, // using this file format.
 false); // Don't embed media files, if any.

SaveScene()follows much the same pattern asLoadScene(). It starts by using the SDK Manager to instantiate an exporter object, then gives the exporter the path and name of the file to be exported:

// Exports a scene to a file
bool SaveScene(
 KFbxSdkManager* pSdkManager,
 KFbxScene* pScene,
 const char* pFilename,
 int pFileFormat,
 bool pEmbedMedia
 )
...
 KFbxExporter* lExporter = KFbxExporter::Create(pSdkManager, "");
 if(lExporter->Initialize(pFilename) == false)
 {
 UI_Printf("Call to KFbxExporter::Initialize() failed.");
 UI_Printf("Error returned: %s", lExporter->GetLastErrorString());
 return false;
 }

Specifying the file format

ImportExport is a file conversion program, so normally the file format of the export file is going to be different from the import file.

The user interface for ImportExport doesn’t ask the user for the file format of the import file: it just asks for the path and name of the file, and then lets FBX determine the file format.

But for the export file, ImportExport’s user interface lets the user specify the file format. The file format was passed toImportExport()as a parameter, andImportExport()passed it on toSaveScene():

 // Set the file format
 lExporter->SetFileFormat(pFileFormat);

Specifying whether media are embedded

SaveScene()also has a boolean parameter, pEmbedMedia. This specifies how FBX handles anymedia(textures, sound, movies, etc.) in the scene to be exported. There are two choices: