Friday, January 11, 2013

The basics of O.O.P. in Maya/Python

I was thinking about calling this post "O.O.P. I did it again!", but then I realized that most people in 3D nowadays are too young to remember who Britanny Spears was (you bastards). . .Made this video (along with a couple of others) a few months ago, but never got around to posting it. Just got really busy and/or forgot.
For those that don't know,  OOP refers to Object Oriented Programming.This is just a basic overview of what that is and how you can start thinking about it in Maya using Python. It's something that was a bit confusing to me when I was first learning Python, some of it still is a little bit . . .
I really have no idea whether this video even makes any sense (in terms of it being a useful/illustrative thing to watch).
Here's a description of a particular type of person:
"I work in Maya and know a little about programming, probably MEL and maybe some Python, and also write enough code to care about digging deeper, but definitely not accomplished enough in Python (or any other OO language) to the point when a discussion of classes seems rudimentary."
If that describes you, then you're who I made this for! I certainly hope both of you enjoy it.

(p.s. I was going to make a venn diagram for that, but I feel like Randall Munroe/xkcd should be the only person in the world allowed to make those anymore. And while we're on the topic, this is my new favorite site. If you're even a little bit of a nerd, you must read them all.)

Here's the vid:

Maya/Python: The basics of using Classes and Obj. Oriented Progamming in Maya/Python from zeth willie on Vimeo.


  1. Hey Seth,
    Nice video. I found it very informative to some who is using mel and python but not using classes. I think when you upgrade from mel to Python you tend to go through the same emotions as mel when writing Python and not truly understand the benefits of Classes. Great suff.

  2. Fantastic video thank you for making it. You explain things in a non jargon way, do you plan to make any more ? I would certainly be willing to donate towards any more Python for Maya animators and rigging tutorial videos. Ps could they be higher resolution possibly ? cheers

  3. Hi Zeth, Thank you for this very informative video. I am new to programming / scripting and have done very little MEL scripting. I am trying to get the bigger picture with python in maya having had some experience of it in XSI and your vid has really helped. I had to watch it a couple of times to fully comprehend everything.
    Although I understood the principle of inheritance outlined towards the end, I just wanted to ask a practical question. In order to re-use code already written eg the Window Class using the "import zbw_window as win" function, where does that code need to be stored?
    Cheers, Tom