Creating a file exporter
 
 
 

To export the scene, ImportExport() calls SaveScene():

    // 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 as LoadScene(), so we’ll only look at some key differences.:

bool SaveScene(
               KFbxSdkManager* pSdkManager,
               KFbxScene* pScene,
               const char* pFilename,
               int pFileFormat,
               bool pEmbedMedia
              )
 ...                               // Similar to LoadScene()

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 to ImportExport() as a parameter, and ImportExport() passed it on to SaveScene():

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

Specifying whether media are embedded

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