API Guide > Polygon API >

# Poly exporter plug-ins

These are two new example exporter plug-ins that demonstrate how to extract polygonal data from Maya using the Poly API. The two exporters write out data in raw text and Extensible 3D (X3D) formats respectively. The functionality is split into two components, one that extracts the data from Maya and stores it in intermediate data structures, and the second that writes the data to a file in the required format. These two components are implemented as pure virtual base classes from which the user derives to implement export to a specific format. More detailed comments are in the source code.

Classes

- polyExporter – base class for code that extracts poly information from Maya.
- polyWriter – base class for code that writes data to a disk file.
- polyRawExporter, polyRawWriter – Derived classes implementing raw text output.
- polyX3DExporter, polyRawWriter – Derived classes implementing X3D output.

polyX3DExporter

Adds the ability to export polygonal meshes from a Maya scene to the Extensible 3D (X3D) file format. Once this plug-in is loaded, the new file format is listed as an output format for export.

Polygonal meshes are exported by using theFile > Export All menu item (or by selected specific meshes and using the File > Export Selection option), choosing X3D as the file type, and providing a filename. The resulting file will be in X3D compliant format.

This plug-in example demonstrates how to utilize the Maya Poly API for extracting polygonal geometry data, in conjunction with the Maya MPxFileTranslator class to create a file exporter plug-in. Currently, data that is extracted includes:

- faces and their vertex components
- vertex coordinates
- colors per vertex
- normals per vertex
- current uv set and coordinates (X3D did not support multiple UV sets when this plug-in was written.)
- component sets
- file textures (for the current UV set)

polyRawExporter

This exporter is the same as polyX3DExporter except that the output data is in raw text format rather than X3D. Also this plug-in exports all UV sets and coordinates.