I would agree with Paul 110% Based on your desire to develop plug-ins, it sounds like you are more or less where I was when I started using Python in Maya. I skipped cmds and pymel altogether and just went straight to the API since it is what I needed at the time (with the caveat though that I had some familiarity with the C++ API already). I have also since then ceased using MEL altogether since Python can do everything it can do, just a lot better (even if you don't use pymel, the string slicing alone will be a huge saver over MEL).
As for parsing XML, Python has modules for doing this, which you could import into a scripted plug-in if you desire. Generally speaking, the biggest obstacle for me in the whole process was just getting used to the API's object/function set paradigm in the first place, since it's not really how I've programmed (games) in the past. In this respect, pymel's design approach is a little more what I would have expected, but as Paul indicated, it was not really designed for the purpose of writing plug-ins. If you haven't used the API before, David Gould's Complete Maya Programming vol. I is a great starting point. Ryan Trowbridge and I are also working on a book for MK on using the API with Python, but it won't be out for awhile. On Mon, Apr 19, 2010 at 8:54 PM, wannAPI <[email protected]> wrote: > Perfect answer Paul, I'm set now... my turn to give some. > > Yes I'm looking after scripted plugins creation, for a featured > exporter using XML scene description. > > Plugins will involve new shaders, utilities and new DAG nodes in > general. I want AE support for these nodes and specific HyperShade > tabs, off course :) > > How much API is this ? > > Parsing XML with MEL is... sick ? > > My take was that there must be better than just MEL to parse DAG and > stuff, plus achieving deep UI integration, question mark. > > Thanks so far. > > Adam > > On 20 avr, 00:38, Paul Molodowitch <[email protected]> wrote: > > Ditto what Judah said - if you want to use the api, you're gonna > > either need to know python or C++... and if you don't want to > > compile... > > > > However, regarding pymel + maya API... first, you need to ask yourself > > a question: what do you want to use the API for? Are you looking to > > gain access to all of the API methods / functions to use when writing > > scripts? Or do you want to write plugins - which allows the creation > > of custom node types, manipulators, locators, etc, as Count Zero > > pointed out? > > > > It's a very important distinction, because, depending on which you > > intend to do, there are very different restrictions on what methods / > > etc you can safely use. If you're doing script-level programming, you > > can use... pretty much everything. There are dangers associated with > > mixing in some of the API functions in in scripts (mainly due to > > issues with undo), but there are ways around these (the simplest / > > most brute force being just disabling undo, for instance). If this is > > your goal, then pymel may be a good option for you - it will enable > > you to get at a lot of the API functionality without the extra hassle > > that dealing directly with the API can involve. > > > > If, on the other hand, you want to do api-level programming - ie, > > plugins - there are a lot more restrictions on what you can use: > > essentially, you're stuck with only using what the API provides, and > > none of the script level stuff - ie, maya.cmds, which has all the > > mel-like functions you're probably used to. In this context, pymel is > > less useful, for the simple reason that it's never really been > > designed to be used in this context. While it does have a fair amount > > of internal workings for dealing with the api, they're not really > > easily accessible, and would probably just make things even more > > confusing for someone new to the API. (We do have plans to eventually > > provide more API-level support, but that's another discussion > > entirely...) > > > > In either case, though, if your goal is really to LEARN the maya API, > > pymel is probably NOT the best option. While it provides access to a > > lot of the API functionality, it's also essentially trying to protect > > you from it. The goal with pymel is that you shouldn't need to know > > the details of the api - which is great if you just want to use it, > > but not if you want to learn it. If you want to learn about the API, > > then either check out MRV or just use the standard python API... (or, > > bite the bullet and learn it in C++... the python API is just a crude > > wrap over the top of the C++ api, and introduces a number of other > > complications, so in many ways the API only really makes sense when > > you view it through a C++ lens...) > > > > - Paul > > > > --http://groups.google.com/group/python_inside_maya > > -- > http://groups.google.com/group/python_inside_maya > -- http://groups.google.com/group/python_inside_maya
