[QUOTE=Count_Zr0;8056]The benefits of object oriented method calls on any python node or component far, FAR outweighs any performance issues PyMEL has.[/QUOTE]
Agree (man i’m just derailing threads all over the place today).
Ok so I’ve been trying to avoid getting into these Pymel vs the world discussions personally, but anymore i feel like this whole “OMG PYMEL IS TEH SLOW AND SUX0RZ” is getting out of hand and putting people off of even trying it, which i think is tragic. Sure it IS slow compared to things like cmds and built-ins, but let’s be honest, python itself isn’t really that high performance anyway, so if speed is genuinely a concern, go back to Mel and C++. In larger codebases, readability and maintainability both trump performance in many cases. If you’re working in an environment where you have a large team working in your python codebase and you’re actually on any sort of a deadline, those considerations need to be at the forefront when picking APIs. Truth is, you could write some UGLY python code that was super fast because you’re using all these cool tricks, but come back to it six months later in the middle of crunch. Voice of experience telling you that actually, you won’t be quite as proud of your “high-performance” python in that case. And trust me, being humbled by a more senior developer because your super fast python code reads like a torn up, muddy roadmap will make you feel like a n00b faster than getting owned as a first timer in Counterstrike, even worse when it’s coming from a pymel dev (“uhhh, why are you recasting all those PyNodes back to PyNodes? Why are you casting individual components to Pymel types? You know those are iterators, right?”)
At the end of the day, if Pymel’s speed hit doesn’t translate to negative user experience, then i’m not really sure what the problem is. I mean, yeah i guess it’s cool that we can all walk around talking about performance like “real engineers”, but i’ll take my slow, readable, maintainable Pymel with some of it’s really cool advanced features that actually contribute to both the aforementioned readability and maintainability vs whatever benefits you think you’re getting from maya.cmds, that like i said, at the end of the day PROBABLY don’t matter that much to the people you should be most worried about as a Tech-Artist, aka YOUR ARTISTS.
Ok ok, so my point: to my mind good code lives at the crossroad of readability, maintainability, and ability to provide good user experience. Pymel makes it happen, maya.cmds, sure, but not so much. At least not as much as people think the perf savings are worth. And trust me, i’ve built two pipelines on pymel now, haven’t had any perf issues to speak of. Use pymel where it’s best suited, use cmds where it’s best suited, use the C++ api where it’s best suited. Seriously, we CAN all just be friends.
Example: Custom nodetype
C++ for the plugin because i want it to have a custom draw and draws in Python are? Yep, slow!
Pymel/maya.cmds/api for the function set. Function set is implemented as a virtual class in Pymel that relies on both cmds and the python api at certain points. Why a pymel virtual class? I mean geez, now i’m making ls() even slower on purpose!!
-
Maintainability. Now i don’t have to go back into the C++ and recompile if i want to add to or change the function set.
-
Writing tools on top of that virtual class are nice and readable, ie they look just like any other normal python/Pymel code, but because i’ve already built out my function sets in a lower level module, i don’t have to write any special handlers/hackarounds in any of my other code.
Try doing that with just cmds or the C++ api…
</and breathe out…>