shown in other instead.
The Export System allows you to use default plugins and write custom ones to export UNIGINE's nodes to a file of different format and store it on a disk.
The structure of Export System is shown below. It includes Export Manager and a dynamic set of exporters for various external file formats.
Export Manager is used to create and manage exporters, as well as to directly export files to non-native formats, if an exporter for such files was previously registered.
Exporter is a module used by Export System to transfer UNIGINE's objects to files in various non-native formats. A single exporter can be used to export multiple nodes, but there shouldn't be two or more exporters registered for a single node type.
Each exporter has a set of parameters that control the whole export process (e.g., whether to export lights, cameras, and material normal maps, reset root node transformation, etc.). The exporter should be initialized before the use.
In order to be used, exporters must be registered in the system via Export Manager. You can manage the list of available modules dynamically by adding them to or removing from the registry. When you export a node to any external format, Export System automatically tries to find and use an appropriate exporter registered for the specified file extension.
The basic node export workflow is as follows:
- Check the extension of the specified output file and find the appropriate exporter among the registered ones.
- Extract scene data from the node, create the export scene and put the data to the corresponding export structures (e.g., FBX nodes).
- Use the appropriate exporter to generate output files on the basis of scene metadata.
You can consider the FbxExporter plugin as an example to build your own custom exporting modules. You can also modify and rebuild this plugin to use your own custom exporter in the Editor.
In general, the workflow via the C++ API may be represented as follows:
// create an exporter for the exported file ("1.fbx" in our case) Unigine::Exporter* exporter = Unigine::Export::get()->createExporterByFileName("1.fbx"); // enable the "export_material_normal_maps" parameter exporter->setParameterInt("export_material_normal_maps", 1); // initialize exporter exporter->init(); // get the node NodePtr node = World::getNodeByName("material_ball"); // export the node to the specified file path exporter->doExport(node, "1.fbx"); // exporter deinitialization exporter->deinit();
You can also export a node with default settings simply like this:
// get the node NodePtr node = World::getNodeByName("material_ball"); // export the node to the file of specified format Unigine::Export::get()->doExport(node, "../data/1/1.fbx")
Built-in Export Options#
The engine's built-in exporters (such as FbxExporter plugin) have a number of export options that customize the exporter's behavior and can also be used in custom exporters.
The following table lists the names for the parameters available out of the box that can be set via the setParameterInt("name", value) method.
- FbxExporter plugin as an a example for your custom export plugin: source/plugins/Export/FbxExporter.
Fbx Export System API:
FBX Export Functionality classes for more details on managing the Export System via code.Export System API is not available for the Community SDK edition.