|
| Exporter () |
| The class constructor.
|
|
| ~Exporter () |
| The class destructor.
|
|
void | SetIOHandler (IOSystem *pIOHandler) |
|
IOSystem * | GetIOHandler () const |
|
bool | IsDefaultIOHandler () const |
|
void | SetProgressHandler (ProgressHandler *pHandler) |
|
const aiExportDataBlob * | ExportToBlob (const aiScene *pScene, const char *pFormatId, unsigned int pPreprocessing=0u, const ExportProperties *pProperties=nullptr) |
|
const aiExportDataBlob * | ExportToBlob (const aiScene *pScene, const std::string &pFormatId, unsigned int pPreprocessing=0u, const ExportProperties *pProperties=nullptr) |
|
aiReturn | Export (const aiScene *pScene, const char *pFormatId, const char *pPath, unsigned int pPreprocessing=0u, const ExportProperties *pProperties=nullptr) |
|
aiReturn | Export (const aiScene *pScene, const std::string &pFormatId, const std::string &pPath, unsigned int pPreprocessing=0u, const ExportProperties *pProperties=nullptr) |
|
const char * | GetErrorString () const |
|
const aiExportDataBlob * | GetBlob () const |
|
const aiExportDataBlob * | GetOrphanedBlob () const |
|
void | FreeBlob () |
|
size_t | GetExportFormatCount () const |
|
const aiExportFormatDesc * | GetExportFormatDescription (size_t pIndex) const |
|
aiReturn | RegisterExporter (const ExportFormatEntry &desc) |
|
void | UnregisterExporter (const char *id) |
|
◆ fpExportFunc
Function pointer type of a Export worker function
◆ Export()
aiReturn Assimp::Exporter::Export |
( |
const aiScene * |
pScene, |
|
|
const char * |
pFormatId, |
|
|
const char * |
pPath, |
|
|
unsigned int |
pPreprocessing = 0u , |
|
|
const ExportProperties * |
pProperties = nullptr |
|
) |
| |
Convenience function to export directly to a file. Use #SetIOSystem to supply a custom IOSystem to gain fine-grained control about the output data flow of the export process.
- Parameters
-
pBlob | A data blob obtained from a previous call to aiExportScene. Must not be nullptr. |
pPath | Full target file name. Target must be accessible. |
pPreprocessing | Accepts any choice of the aiPostProcessSteps enumerated flags, but in reality only a subset of them makes sense here. Specifying 'preprocessing' flags is useful if the input scene does not conform to Assimp's default conventions as specified in the Data Structures Page . In short, this means the geometry data should use a right-handed coordinate systems, face winding should be counter-clockwise and the UV coordinate origin is assumed to be in the upper left. The aiProcess_MakeLeftHanded, aiProcess_FlipUVs and aiProcess_FlipWindingOrder flags are used in the import side to allow users to have those defaults automatically adapted to their conventions. Specifying those flags for exporting has the opposite effect, respectively. Some other of the aiPostProcessSteps enumerated values may be useful as well, but you'll need to try out what their effect on the exported file is. Many formats impose their own restrictions on the structure of the geometry stored therein, so some preprocessing may have little or no effect at all, or may be redundant as exporters would apply them anyhow. A good example is triangulation - whilst you can enforce it by specifying the aiProcess_Triangulate flag, most export formats support only triangulate data so they would run the step even if it wasn't requested. |
If assimp detects that the input scene was directly taken from the importer side of the library (i.e. not copied using aiCopyScene and potentially modified afterwards), any post-processing steps already applied to the scene will not be applied again, unless they show non-idempotent behavior (aiProcess_MakeLeftHanded, aiProcess_FlipUVs and aiProcess_FlipWindingOrder).
- Returns
- AI_SUCCESS if everything was fine.
- Note
- Use aiCopyScene() to get a modifiable copy of a previously imported scene.
◆ ExportToBlob()
Exports the given scene to a chosen file format. Returns the exported data as a binary blob which you can write into a file or something. When you're done with the data, simply let the Exporter instance go out of scope to have it released automatically.
- Parameters
-
pScene | The scene to export. Stays in possession of the caller, is not changed by the function. |
pFormatId | ID string to specify to which format you want to export to. Use GetExportFormatCount / GetExportFormatDescription to learn which export formats are available. |
pPreprocessing | See the documentation for Export |
- Returns
- the exported data or nullptr in case of error.
- Note
- If the Exporter instance did already hold a blob from a previous call to ExportToBlob, it will be disposed. Any IO handlers set via SetIOHandler are ignored here.
-
Use aiCopyScene() to get a modifiable copy of a previously imported scene.
◆ FreeBlob()
void Assimp::Exporter::FreeBlob |
( |
| ) |
|
Frees the current blob.
The function does nothing if no blob has previously been previously produced via ExportToBlob. FreeBlob is called automatically by the destructor. The only reason to call it manually would be to reclaim as much storage as possible without giving up the Exporter instance yet.
◆ GetBlob()
◆ GetErrorString()
const char* Assimp::Exporter::GetErrorString |
( |
| ) |
const |
Returns an error description of an error that occurred in Export or ExportToBlob
Returns an empty string if no error occurred.
- Returns
- A description of the last error, an empty string if no error occurred. The string is never nullptr.
- Note
- The returned function remains valid until one of the following methods is called: Export, ExportToBlob, FreeBlob
◆ GetExportFormatCount()
size_t Assimp::Exporter::GetExportFormatCount |
( |
| ) |
const |
Returns the number of export file formats available in the current Assimp build. Use #Exporter::GetExportFormatDescription to retrieve infos of a specific export format.
This includes built-in exporters as well as exporters registered using RegisterExporter.
◆ GetExportFormatDescription()
const aiExportFormatDesc* Assimp::Exporter::GetExportFormatDescription |
( |
size_t |
pIndex | ) |
const |
Returns a description of the nth export file format. Use # #Exporter::GetExportFormatCount to learn how many export formats are supported.
The returned pointer is of static storage duration if the pIndex pertains to a built-in exporter (i.e. one not registered via #RegistrerExporter). It is restricted to the life-time of the Exporter instance otherwise.
- Parameters
-
pIndex | Index of the export format to retrieve information for. Valid range is 0 to #Exporter::GetExportFormatCount |
- Returns
- A description of that specific export format. NULL if pIndex is out of range.
◆ GetIOHandler()
IOSystem* Assimp::Exporter::GetIOHandler |
( |
| ) |
const |
Retrieves the IO handler that is currently set. You can use IsDefaultIOHandler() to check whether the returned interface is the default IO handler provided by ASSIMP. The default handler is active as long the application doesn't supply its own custom IO handler via SetIOHandler().
- Returns
- A valid IOSystem interface, never NULL.
◆ GetOrphanedBlob()
Orphan the blob from the last call to ExportToBlob. This means the caller takes ownership and is thus responsible for calling the C API function aiReleaseExportBlob to release it.
◆ IsDefaultIOHandler()
bool Assimp::Exporter::IsDefaultIOHandler |
( |
| ) |
const |
Checks whether a default IO handler is active A default handler is active as long the application doesn't supply its own custom IO handler via SetIOHandler().
- Returns
- true by default
◆ RegisterExporter()
Register a custom exporter. Custom export formats are limited to to the current Exporter instance and do not affect the library globally. The indexes under which the format's export format description can be queried are assigned monotonously.
- Parameters
-
- Returns
- aiReturn_SUCCESS if the export format was successfully registered. A common cause that would prevent an exporter from being registered is that its format id is already occupied by another format.
◆ SetIOHandler()
void Assimp::Exporter::SetIOHandler |
( |
IOSystem * |
pIOHandler | ) |
|
Supplies a custom IO handler to the exporter to use to open and access files.
If you need Export to use custom IO logic to access the files, you need to supply a custom implementation of IOSystem and IOFile to the exporter.
Exporter takes ownership of the object and will destroy it afterwards. The previously assigned handler will be deleted. Pass NULL to take again ownership of your IOSystem and reset Assimp to use its default implementation, which uses plain file IO.
- Parameters
-
pIOHandler | The IO handler to be used in all file accesses of the Importer. |
◆ SetProgressHandler()
Supplies a custom progress handler to the exporter. This interface exposes an #Update() callback, which is called more or less periodically (please don't sue us if it isn't as periodically as you'd like it to have ...). This can be used to implement progress bars and loading timeouts.
- Parameters
-
pHandler | Progress callback interface. Pass nullptr to disable progress reporting. |
- Note
- Progress handlers can be used to abort the loading at almost any time.
◆ UnregisterExporter()
void Assimp::Exporter::UnregisterExporter |
( |
const char * |
id | ) |
|
Remove an export format previously registered with RegisterExporter from the Exporter instance (this can also be used to drop built-in exporters because those are implicitly registered using RegisterExporter).
- Parameters
-
- Note
- Calling this method on a format description not yet registered has no effect.
The documentation for this class was generated from the following file: