[Maya API] Creating a GUI for my exporter

Started by
6 comments, last by wiegje85 14 years, 2 months ago
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!
Advertisement
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.

This is my thread. There are many threads like it, but this one is mine.

Quote:Original post by thatguyfromthething
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.


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.
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.
http://download.autodesk.com/us/maya/2009help/API/obj_export_8cpp-example.html

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.
Quote:Original post by CornyKorn21
http://download.autodesk.com/us/maya/2009help/API/obj_export_8cpp-example.html

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.


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]
Quote:Original post by wiegje85
Quote:Original post by CornyKorn21
http://download.autodesk.com/us/maya/2009help/API/obj_export_8cpp-example.html

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.


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.

I believe when Maya loads your .mll it will call initializePlugin.

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" );}
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++++

This topic is closed to new replies.

Advertisement