Tuesday, August 17, 2010

More Python/Qt posts pending

After mulling over the matter of this pesky blog a bit more, I think I finally hit on a topic that will keep me posting semi-regularly, at least for a little while. Seeing that I'm learning all kinds of fun new things as I try to rework various Maya tools at Reel FX to use the Qt framework instead of Maya's own UI framework, I will do my best to share those discoveries here in the interest of helping those who may be traveling a similar path.

In my online searches to figure out this stuff, I've seen plenty of "generic" examples of how to use the various classes available in the Qt framework (and the PyQt module used to interface with it), but haven't stumbled across many that address the specific issues faced by Maya developers. I'd like to remedy that (or at least try to) in this blog.

While Qt offers so much more flexibility than Maya's UI tools, the level of functionality that I find myself trying to achieve in my first full UI conversion (which is about 80% done as of this writing) is that of simply matching Maya's existing capabilities. As inflexible as the default Maya UI tools are compared to Qt (speaking of the original MEL-based tools that have been around for so long), the Maya developers provided fairly easy access to a number of very useful features: popup menus, drag-and-drop, grouped radio buttons, widgets with attached labels, etc. I imagine that many pre-Qt developers who have been coding Maya interfaces for a while -- in either MEL or Python -- are probably at least a little bit like me, and have reached a point where these features are taken for granted to some extent. You may look at that list and say, "What's the big deal? Widgets with labels? Pshaw! That's standard!" Yeah, well it was a bit of an interesting revelation to discover that many of these features don't come auto-attached to most (if any) widgets in the Qt framework. The ability to use these features is all there, but it takes a bit more work on the front end to set them up. Some require very little work, while others require a bit more.

That's the kind of stuff that I'd like to cover here. In short, I want to do my best to answer the "how do I replicate [insert Maya UI feature here] using Qt?" question. That's what's been running through my mind over the past couple days, and I've made some interesting discoveries in my search for the answers. Generally speaking, it's fairly easy to match what Maya can do. However, the real fun begins when you realize how much farther you can go, and I'll try to offer some of those "go farther" tips as well.

As I've said before, I don't have an official programming background -- just a deep passion for problem-solving and tinkering. Most of this stuff is coming to me through trial and error, with a little help from the Qt framework docs and various web searches, so there may be hiccups in some of the stuff I present. If your experience has led you to do things differently, or if I just flat-out get something wrong, feel free to speak up.

By the way...did you know that the official pronunciation of "Qt" is "cute"? Before digging into it, I heard tons of references to "Q-T", but not one talking about it with its real name. Is it because it's a bunch of guys who have this thing with saying "cute" in the context of programming geekiness? Is it ignorance? A bit of both, perhaps? No matter. You can say it however you wish. As for me, it's "cute" all the way. :)


David Martinez said...

Good news indeed!

I look forward to read about your experience with Python and QT.

It is nice to see that you are going to be using your blog to share the knowledge and hopefully, provoke some discussion about the techniques.

Interestingly enough, I do not have an official programming background either and I end up getting into it because of the same reasons as you.

Anyway, keep the posts coming!

Johan said...

I googled "qt python maya" and stumbeled into your blog. Interesting stuff ! I am a designer/animator also with no official programming bg other than books and tuts, but driven by curiosity. Keep the post comming !

Thanks, Johan