I’ve been upgrading the Maya exporter to handle the new custom Maya nodes I created. The custom node SceneNode gets exported directly to SceneNodes in the engine. So, engine-side, these SceneNodes form most of the scene graph, with meshes and whatnot as leaves. In Maya, however, SceneNodes aren’t the only heirarchical node. The standard Maya Transform node is still used to organize the scene for convenience when editing the scene. For instance, a static mesh could be made of many separate meshes, each with their own transform. The meshes can be manipulated individually easily, and when it’s time to export, they get merged into one mesh (because they aren’t separated by SceneNodes). It remains easily editable in Maya yet comes out as one optimized object in the engine.
The exporter works by propagating transformation information down the scene graph, pretty much like a standard scene graph does. The one difference is at a SceneNode. When a SceneNode is encountered the accumulated transform is stored in the SceneNode and then reset before traversing the children. This produces the correct transformation for a SceneNode relative to it’s parent SceneNode. The same is done when known leaf node types are encountered.
Right now it’s dumping the transformation information while traversing the scene. The current node is checked against a table of known types and if it is found to be exportable it is written out. This is much more flexible than the previous exporter, which had no custom nodes. Previously I had to make a lot of assumptions about what various scene structures become into when they export. Now it’s all very explicit. I should be able to drop a few hundred lines of code and add new node types with no problems.
I tried playing Bush’s Glycerine on Gavin’s guitar for about 7 minutes…my hand is now numb.