PDA

View Full Version : Options callback for file translator


arunvb
02-25-2009, 02:31 AM
I have a file translator plug-in which uses a mel script to display the options UI. I've registered the mel by passing the mel script name in plugin.registerFileTranslator("myplugin", "none", myplugin::creator, "myoptions.mel"). The UI works correctly.

And in myoptions.mel, the myoptions function is defined as follows :

global proc int myoptions( string $parent,
string $action,
string $settings,
string $callback )

{

if( $action == "post" )
{
... ...
}
else if ($action == "query")
{
... ...

// Pass the options to the callback functions so that plug-in can process it
eval( $callback + "\"" + $options + "\"" );
}
}

The script has the 4th parameter - $callback, which is the callback function to be called to process the user selected options. My question is where / how do I specify the name of the callback function to be called. When I print the name of the callback in my existing script, it shows as fo_optionsCallback. If I want the have my own function - say parseOptions - in my plug, how do I do that ? or if this isn't feasible, how do I write by own version of fo_optionsCallback and pass the options to my plugin ?

Thanks
Arun

Robert Bateman
02-27-2009, 01:04 PM
My question is where / how do I specify the name of the callback function to be called.

You can't.

If I want the have my own function - say parseOptions - in my plug, how do I do that ?

You write it in C++ and call it from the writer or reader methods. Maya will call those methods for you, all you seem to be doing is trying to find a way to stop your MPxFileTranslator plug-in from working. If you don't call that callback, your plug-in will never be called. Why are you trying to break your plugin before you've written it?

or if this isn't feasible, how do I write by own version of fo_optionsCallback and pass the options to my plugin ?

You can start with main() and write your own version of Maya from scratch. It should only take you a decade or two..... ;)

CGTalk Moderation
02-27-2009, 01:04 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.