widgg
widgg

Reputation: 1428

Equivalent of maya.cmds in C++

I was wondering if there was any equivalent to maya.cmds in C++!

I would imagine it as something like:

MPxCommand *objectTypeCmd = MPxCommand::getCommand("objectType");
MArgList args;
args.add("particleShape1");
objectTypeCmd->doIt(args);

if (objectTypeCmd->currentResultType()== MPxCommand::kString)
  MGlobal::displayInfo(objectTypeCmd->currentStringResult());

Any way more direct than calling MEL or Python from C++ code ?

Note that half of the function used here for MPxCommand are improperly used or doesn't exists at all! It's just to explain what I want to do.

Upvotes: 0

Views: 904

Answers (1)

joojaa
joojaa

Reputation: 4434

No. The scripting interface and the C++ interface have different purposes. These purposes do not overlap. You can not even do half of the things available in the scripting interface with Maya C++ API. When it is possible the c equivalent code is thousands of times longer than the script code. Just keep calling the scripts.

However python itself does have a c interface, so you can call python commands with this interface (see embedding python). However its really heavy work and you will still be calling the scripting layer (with all speed and other implications).

for more info read: New To The Api? Then Read This! The article predates the python interface but its still extremely accurate.

Upvotes: 1

Related Questions