Wednesday, June 05, 2013

Some Python in Maya basics

I've been working a ton lately, so sorry for the lack of posts. Some day I'll figure out how to do smaller things a little more regularly.

Annnyyyywayyys . . . On the last job I was on (and in a rigging class I taught recently), I was demo-ing some little scripts I'd written and realized that I'd forgotten how confusing it can be to run python stuff in Maya if you don't have any experience doing it or know why things are done the way they are. In fact, I recall being able to put together a fairly competent script in python (cuz I knew a bunch of MEL already) and actually not knowing how to run it in maya! So I would just copy and paste the whole thing to the script editor each time or make a button out of the whole code. . . until I was like "What the hell am I doing? Figure this out!". Turns out it wasn't too hard, but it can be a bit confusing sometimes, certainly at the beginning and so I made a couple of quick videos walking through a few things you might want to know about how (and occasionally why) you do things in Maya with Python. Absolutely nothing fancy or tricky here, just the basics for those of you who haven't quite wrapped your heads around it.

Two videos: the first one is the really basic stuff (importing a module and running a function from it) and the second goes into a few other areas that are a bit more advanced (reloading scripts, what those .pyc files are and how they can trip you up sometimes, messing with the python path [sys.path] to load files from other folders, setting up a package in python and so on).
BTW, I've done a dump of some scripts onto the Downloads page above ^, and I'll do a quick video walkthrough of them in short order


Maya/Python: The basics of using python scripts in Maya (Pt 1) from zeth willie on Vimeo.


Maya/Python: The basics of using python scripts in Maya (Pt 2) from zeth willie on Vimeo.

1 comment:

  1. Very useful tutorial..
    Great work..

    GameYan Studio
    http://www.gameyan.com/

    ReplyDelete