Thursday, August 21, 2008

Here there be Pythons!

I recall first hearing about Python when it was added many years ago to Blender, a cool little 3D app that I used for a stretch near the end of my days at the Art Institute. However, its inclusion in Blender was largely meant (from what I can remember, anyway) as a means to assist in the development of interactive 3D applications...namely, games. I wasn't interested in doing games, so I ignored it. I discovered Animation:Master not long before graduation, so Blender went bye-bye, and so did any thoughts of Python.

The next time I recall hearing about Python was some time in the last year or so, when I heard that we use it at Reel FX. It's becoming very popular to embed Python support into 2D and 3D production software, and number of the tools that we use are apparently making the shift to Python from their own proprietary scripting languages. I noticed its inclusion in recent versions of Maya, but didn't dig into it right away for some unknown reason. I think that part of my hesitancy was because I heard that Python was an object-oriented language, and the few times I had tried to wrap my head around object-oriented programming, something just wasn't clicking.

One of the things that was discussed in my annual review was broadening my knowledge base in the area of programming/scripting languages. It was recommended that I start with Python, so after we wrapped animation on Open Season 2 and things settled down a bit, I started digging into it. I've only been working with it for a short stretch -- less than a month, I think -- but I feel it's pretty safe to say that I've become a Python junkie.

I just can't get enough of it! I don't think I've ever found a language that was so powerful, and yet so easy to learn. While I spent a good bit of time reading about it before I sat down to start actually using it, I found that I was able to jump into real, usable programs very quickly because the core syntax is so intuitive and easy to learn, and because there are so many things you can do with the collection of modules that come packaged with it. After using it for only a couple days, I was able to start writing some fairly in-depth tools for work, and in some cases it's the kind of stuff that would be literally impossible to do with MEL (the Maya Embedded Language). The majority of what I've done with it so far has been organized in a very "structured" way, similar to how I would build a MEL script. However, I'm starting to explore classes and objects as I work on porting our existing MEL-based pose library tool into a Python-based animation library tool, and it's coming along really well.

I certainly wouldn't call myself a "Pythonista" at this point, but I'm very pleased with what I've been able to do with it so far, and I'm super excited about all the possibilities that it opens up. In addition to using it at work, I plan on using Python for a number of personal projects. One idea I'm toying with is rewriting some (or possibly all) of my tweenMachine tool in Python, which I hope would speed up some of its operation, and also would make it easier to add some of the new features that I've had in the back of my mind for a while. I also plan on using Python for a personal web project that was originally going to be driven by PHP, and might convert some existing PHP-based web stuff to Python as well.

Yeah, I now...I can see some folks making the hammer/nail comparison when I talk about it like that (i.e. when a guy gets a new hammer, all the world becomes a nail). However, Python isn't just a hammer. It's an entire toolbox, and that's what I think I like about it the most. As the Python community likes to say, it comes with "batteries included," and I'm eager to put those batteries to use!

P.S. Yes, this is one of the reasons why I haven't yet posted a link for purchasing the last few Animate a Face sets. I do hope to get that up soon, though, and I appreciate those who have written so far to express interest in it. Watch for an announcement here in the hopefully-not-too-distant future! :)

3 comments:

Mark Behm said...

Yes! This means I can ask you python questions.

Justin S Barrett said...

By all means! Hit me up any time! I can't promise I'll know the answers, but I'll do my best. :)

Jos said...

I just wanted to give you an update on the status of Python on Blender. I don't exactly know how it was used before (when you were in college), but know it's mostly used to make scripts to control Blenders UI, to automate processes like rigging, to display information like traces, ghosting, to export animation and models to other formats, etc. just like you use MEL on Maya but with the benefits of Python (which you already know). It can also be used in the Game Engine (like you remember) but it's main focus is on scripting.

Well, if you ever want to practice some Pyhton and want to check out the new features in Blender, we (the Blender Comunity) will be glad to help you in any way we can.

Cheers,

Jos