In order to build up an export list, we need to be able to store
a global set of references to the various nodes that we consider
to be important enough to export.
The code on the right provides a very basic way of storing the
references we generate.
maps between the node name and the MObject for the node are generated
for textures, materials, shapes and transforms.
By using the maps we are then able to quickly check to see if
the node is already contained in the export list.
These maps can simply be iterated through later to export each
important node.
The emphasis at this stage must be to ensure that you do not
generate large quantities of temporary data. Ideally, do not make
copies of the surface and transform data, instead output that
directly to the file. Maya is a memory heavy application on it's
own, allocating large amounts of temporary data is going to kill
the speed of the exporter (if it doesn't crash).
Note: although the code here presents the maps as global variables,
if you are deriving a plugin from MPxFileTranslator, then you
may want to add the maps as member data of your file translator
plugin.
|