Saving a file using the Input-Output API

The external file loading and saving functions are exposed through the RED::IOTools class.

// The arrays containing the data to save:
//  - RED scene graphes;
//  - RED viewpoints.
//  - RED animation clip controllers.
RED::Vector< RED::Object* > dag;
RED::Vector< RED::Object* > viewpoints;
RED::Vector< RED::Object* > animations;

// Naming map used to associate the RED object ID to their loaded names.
RED::Map< unsigned int, RED::String > namingTable;

RC_TEST( RED::IOTools::Save( &dag, &viewpoints, &animations, "../resources/scene.fbx", RED::IOOT_ALL,
                             true, false, RED::IOSU_CM, RED::IOFV_DEFAULT, resmgr, 
                             &namingTable, (RED::ProgressCallback)loadingProgressCallback ) );

The RED::IOTools::Save function allows to save a list of RED::IViewpoint and a list of scenegraphes given the root (RED::IShape).

The optional naming map parameter is used to save the RED object names associated with their ID. While the loading operation fills the table, the save operation reads it.

Finally, an optional progress callback can be given. The function will be called regularly during the saving process. The function looks like this:

void savingProgressCallback( const RED::String& iMessage,
                             float              iProgress )
  // Display the message and a progress bar...