Home Website Youtube GitHub

PyMel vs PyMaya vs Cmds

As many I really like the more Object Oriented aproach of Pymel vs Cmds, and has been a bit distressing and inconvenient that Pymel has fall in this fuzzy area where we don’t know if we can be confident that would be maintained for future versions of Maya so I understand the logical move to this own wrapper. One thing I found for example is that some mgear methods that I use in our postprocess are no longer working in maya 5.0 for example from rigbits module we usually make use of the very convenient method to create offset groups about another node (addNPO) where you provide the node that will receive this new offset group above, now if you invoke the method and provide the node, by string or pymel object, throutgh and error in both cases (expected in the former not in the latter) so how will be the right aproach to keep using this methods in the new versions of Mgear, a little guide to the new PyMaya would be great and probably a kind of FAQ to how to deal when sometimes PyMel or Cmds in case that are needed can coesist with this new wrapper.

David

EDIT: I just saw that something very similar was commeted in this post but is already closed

1 Like

Hi @DavidM,

PyMaya objects are not compatible with PyMEL objects.
We’ve kept the same function names and signatures where possible to make refactoring easier, but when working between PyMaya and PyMEL, you’ll need to convert objects using strings.

In the case of addNPO, it expects a PyMaya object.

Also, PyMaya is not a full replacement for PyMEL — it only includes the subset of features we needed in order to remove the PyMEL dependency, so not all functions are available.

Hope that helps clarify things! :slight_smile:
I’ll record a video soon to go over the differences in more detail — probably right after the Annecy Festival next week.

2 Likes

I totally understand the thing is that if you also pass a string if you are using maya commands doesn’t work either that is completely logical but I have the feeling that for the use of post process and things like that kind of encloser a little bit to much the use of the mgear api. Some kind of type object detector could make the system a little be more open because you could pass a common maya command string result or invoke name function if you still have some pymel dependency. I don’t know how could be something like that be implemented in a convenient way but I think could make interact with mgear api functions more open. Otherwise the obvious solution is to wrap any string to PyMaya but make this transparent to user I can see some advantages in it.