ImportExport()callsSaveScene():
To export the scene,// 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;
}
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.
ImportExport()as a parameter, andImportExport()passed it on toSaveScene():
But for the export file, ImportExport’s user interface lets the user specify the file format. The file format was passed to// 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:
\filename.fbm, a subdirectory of the directory where the FBX filefilename.fbxis stored.\filename.fbmis created if it does not already exist.
When imported by any program that uses FBX SDK, embedded media files are extracted into