Message 1 of 1
Calling MEL custom global proc from C++?

Not applicable
08-27-2012
12:06 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm having trouble calling a function defined in a mel script and loaded at run time from C++. In particular, I have a setup along these lines:
foo.mel
main.cpp
The custom function call (which works if I just plug it in the script editor) fails, even if I wrap it in an eval(). How do I do this? Also, is there a list of MEL commands somewhere which won't work from the Maya API in library mode?
Thanks,
-Nick
foo.mel
global proc fooFunc( string $bar ) {
// do stuff, don't return anything
}
main.cpp
MStatus status = MGlobal::sourceFile( "foo.mel" )
CHECK_MSTATUS(status);
// line below fails
status = MGlobal::executeCommand("fooFunc( \"howdy!\" )");
// so does this alternative
status = MGlobal::executeCommand("eval(\"fooFunc( \\\"howdy!\\\" )\");");
CHECK_MSTATUS(status);
The custom function call (which works if I just plug it in the script editor) fails, even if I wrap it in an eval(). How do I do this? Also, is there a list of MEL commands somewhere which won't work from the Maya API in library mode?
Thanks,
-Nick