Calling MEL custom global proc from C++?

Calling MEL custom global proc from C++?

Anonymous
Not applicable
287 Views
0 Replies
Message 1 of 1

Calling MEL custom global proc from C++?

Anonymous
Not applicable
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

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
0 Likes
288 Views
0 Replies
Replies (0)