Think of the following situation: you want to import a model using Asset-Importer-Lib and store some values like the version of the current asset or the author / company. Or when you want to manage the models using modules for a much more efficient way for your SCM you need to store grouping information. How can you do that using the Asset-Importer-Lib?
The solution: The Metadata API:
Asset-Importer-Lib provides a meta-data API to offer a solution for these kind of use-cases. It is straight-forward to use:
// to allocated two entries aiMetadata *data = aiMetadata::Alloc( 2 ); unsigned int index( 0 ); bool success( false ); const std::string key_int = "test_int"; // to store an int-key success = data->Set( index, key_int, 1 ); // to store a string key index = 1; const std::string key = "test"; success = data->Set( index, key, aiString( std::string( "test" ) ) ); // Deallocate the data afterwards aiMetaData::dealloc( data );
You can store an arbitrary number of items, supported datatypes are
int float double aiString
The intermediate data-structure aiNode can store this data.