# [Maya API] Creating a GUI for my exporter

## Recommended Posts

wiegje85    151
First, my apologies if this is in the wrong forum. I made a best guess :) Second, you know how when you activate the OBJ exporter, FBX exporter and even several Collada exporters, there's suddenly all these extra options and things in the "Export all..." or "Export selection..." menus. There's a dropdown menu with the file type and when you hit Export it shows a window with options. Simply put: How do I recreate that? How do I register my plugin as being an exporter (I guess that is what I have to do). Thanks in advance!

##### Share on other sites
You really need mel script for that part of it. You can launch the options dialog from in the plugin, but it's a little easier to do it the other way around.

##### Share on other sites
wiegje85    151
Quote:
 Original post by thatguyfromthethingYou really need mel script for that part of it. You can launch the options dialog from in the plugin, but it's a little easier to do it the other way around.

Yeah I know, but all those plugins (obj, fbx, etc.) have this export dialog and I'd like to add mine to this as well. Unfortunately I indeed do need to use Mel Scripting, but I can figure that out later. I just need to know what to do in order to get my plugin registered as being an exporter.

##### Share on other sites
CornyKorn21    624
What version of Maya are you using? I know the version I have at home (2009 I think) has some really nice examples. Something like MeshExporter.cpp I believe. That one has a pretty simplified version of a mesh exporter which you should be able to get the basics. Unfortunately I won't be home for another 8 hours or I would post up some sample code.

##### Share on other sites
CornyKorn21    624

This should have the information you're looking for in terms of registering a plug-in. Look for the initializePlugin function. Although as far as the GUI, I haven't done any of that at this point.

##### Share on other sites
wiegje85    151
Quote:
 Original post by CornyKorn21http://download.autodesk.com/us/maya/2009help/API/obj_export_8cpp-example.htmlThis should have the information you're looking for in terms of registering a plug-in. Look for the initializePlugin function. Although as far as the GUI, I haven't done any of that at this point.

So I need to inherit from that MPxFileTranslator class? And it will then get registered as an exporter? Of course, after doing the things that it's doing. But inheriting from that class registers it with Maya? The plug-in itself, I mean.

[Edited by - wiegje85 on February 17, 2010 3:10:17 PM]

##### Share on other sites
CornyKorn21    624
Quote:
Original post by wiegje85
Quote:
 Original post by CornyKorn21http://download.autodesk.com/us/maya/2009help/API/obj_export_8cpp-example.htmlThis should have the information you're looking for in terms of registering a plug-in. Look for the initializePlugin function. Although as far as the GUI, I haven't done any of that at this point.

So I need to inherit from that MPxFileTranslator class? And it will then get registered as an exporter? Of course, after doing the things that it's doing. But inheriting from that class registers it with Maya? The plug-in itself, I mean.

Inheriting from that class does not automatically register it with Maya. The section of code that registers the plugin with Maya is in the initializePlugin and uninitializePlugin functions. Which are a part of MPxFileTranslator.

MStatus initializePlugin( MObject obj ){    MFnPlugin plugin( obj, PLUGIN_COMPANY, "3.0", "Any");    // Register the translator with the system    return plugin.registerFileTranslator( "OBJexport", "none",                                          ObjTranslator::creator,                                          (char *)objOptionScript,                                          (char *)objDefaultOptions );                                        }MStatus uninitializePlugin( MObject obj ){        MFnPlugin plugin( obj );        return plugin.deregisterFileTranslator( "OBJexport" );}

##### Share on other sites
wiegje85    151
I LOVE YOU! I got it all working in 3 hours! I can now click my way through to my exporter and not use the crummy command line anymore!

THANKS! Rating++++