Pymel vs MayaPy

[QUOTE=Theodox;29440]I think it’s like @Macaronikazoo had it: it’s great project, especially if you’re not a hardcore pythonista, but it’s got speed and ‘weight’ issues. None of that has really changed in recent years. And integrating it with other code requires some thought.

You can do OO-style coding without it if you are a 70th perceentile pythoneer or up – but if you’re not it, it’s a good start. For a smallish team or a junior/intermediate coder I’d say it’ s a good platform because it helps you think in less imperative terms; eventually you outgrow it. It’s really excellent training wheels.[/QUOTE]

I see, will pass it over then - too bad I didn’t use it when I started out :slight_smile: … not really sure if I’m ‘70th percentile’ but I do OO-style coding unless mashing up something quick and dirty for a specific task.

For me it gets about halfway to where I want to go. Code like


cmds.xform(object, t= (1,2,3))

puts a tax on my brain that


object.setTranslation((1,2,3))

does not. However my personal preference it to paper over the fact that we are passing through the C++ layer anyway, so I like



object.translation = (1,2,3)

which is not the PyMel way. I think philosophically they could defend their way of doing it as not hiding the guts from user: but I find the getter/setter way much easier to read :slight_smile:

I use pymel for most of my code. There are exceptions where some functions expect exact types (like adding blendShape targets requires you give it the mesh, whereas maya.cmds accepts transform or mesh) where I will just skip over it for the sake of simplicity. Also any time I am iterating over components I will use maya.cmds, though if I really care about speed I will be using the API anyway.

This is pretty much my workflow as well. Start with pymel until it is either to slow, or unwieldy, and then fallback to cmds or API as needed.

Also really like the idea of using properties instead of all the get/set methods.

here’s an old implementation that I have to get around to redoing some day:

I’m just beginning Rob Galanakis’ book Practical Maya Programming with Python, which favors PyMel so far.
So this thread is of interest. Can someone tell me If I have correct understanding:

[ul]
[li]mayapy : maya’s python interpreter (uses Python2.7)
[/li][li]maya.cmds : a Python wrapper of the standard Mel commands,
[/li][li]PyMel: a not-officially-supported attempt to make a more ‘Pythonic’ API
[/li][/ul]

[QUOTE=Mambo4;29596]I’m just beginning Rob Galanakis’ book Practical Maya Programming with Python, which favors PyMel so far.
So this thread is of interest. Can someone tell me If I have correct understanding:

[ul]
[li]mayapy : maya’s python interpreter (uses Python2.7)[/li][li]maya.cmds : a Python wrapper of the standard Mel commands,[/li][li]PyMel: a not-officially-supported attempt to make a more ‘Pythonic’ API[/li][/ul][/QUOTE]

You’ve got it.