[Maya API] Creating a GUI for my exporter
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!
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.
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.
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 wiegje85Quote: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" );}
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement