can C++ call python scripts?

123 views
Skip to first unread message

max1

unread,
Nov 23, 2014, 11:05:40 PM11/23/14
to python_in...@googlegroups.com
hello...can C++ call python scripts(or... commands python)?
example...i have this (short) Commands python:
#,,,,example:
import maya.cmds as mc
mc.polyCube() 

can C++ call my commands python?how????


Janos Hunyadi

unread,
Nov 23, 2014, 11:40:04 PM11/23/14
to python_in...@googlegroups.com
Better just calling straight up mel commands from the c++ Api. Maya converts these wrapped python commands back to mel anyway.

example:

MGlobal::executeCommand( "polyCube -sx 10 -sy 15 -sz 5 -h 20;" );
Message has been deleted

max1

unread,
Nov 24, 2014, 4:03:45 AM11/24/14
to python_in...@googlegroups.com

ok!...Thanks -:)
...

Paul Molodowitch

unread,
Nov 24, 2014, 10:24:30 AM11/24/14
to python_inside_maya
On Sun, Nov 23, 2014 at 8:40 PM, Janos Hunyadi <kidi...@gmail.com> wrote:
Better just calling straight up mel commands from the c++ Api. Maya converts these wrapped python commands back to mel anyway.

I believe this is not strictly true... I think the python bindings are made to the underlying C++ core, not mel.  However, the underlying implication is that the MEL commands are faster... which may be the case. (The python interpreter may be slower than it's MEL counterpart... would be interesting to test that, actually.)  Assuming you're just using straight maya.mcds, though, I doubt the difference is enough to be very noticeable - I would say use which-ever language you're more comfortable with.

Oh, and the command to execute code in python basically mirrors the one for mel - MGlobal::executePythonCommand(...)
 

Marcus Ottosson

unread,
Nov 24, 2014, 10:44:47 AM11/24/14
to python_in...@googlegroups.com

maya.mcds

Did you say Maya McDonalds? :O Yum!


--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAAssL7a%2BueNojccUn7F9EUFbKh4tZtYXiGN4YttQqwriyiRfQg%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.



--
Marcus Ottosson
konstr...@gmail.com

Reply all
Reply to author
Forward
0 new messages