I have started teaching a computer animation class at Mt. Ida a couple nights a week. I am very excited to get back into teaching, as I really do enjoy it a great deal.
“Those who can’t do teach”
What about those who can do and simply like teaching too? Put that in your pipe and smoke it naysayers.
Mt. Ida has a great campus, the Computer Animation program is young, but its coming along strong. I am pleased to be a part of it.
I am teaching an introduction to rigging and scripting. I think its the most technical of the classes that the 3rd year students have had so far. At least that’s what one student told me after the first lecture Monday night.
Balancing how much info is the right amount will be a challenge, as it is so easy to get lost in MEL at first. Especially if you haven’t written any scripts/programmed before.
Python is cross platform, and powerful enough to dig into the operating system. Here is a neat example of that. I use this in a lot of my scripts be they Maya, Motion Builder or standalone. It adds a little personal touch when sending messages to the users of the scripts.
#-----------------------------------------------------------------#
# SCRIPT: cmGetUser.py
# AUTHOR: Chad Moore
# DESCRIPTION: Prints the username
#-----------------------------------------------------------------#
import os
import getpass
currentUser = getpass.getuser()
print currentUser
The ‘#’ that starts a line indicates a comment, a place for you to write notes to yourself and the people looking at the code of your script. Commenting your scripts is an art unto itself, I have a post planned just for that topic which highlights my comment conventions. It is wise to include a header that shows the title, author, usage, date, version number, etc, etc.
os is the module which allows for communication with the operating system. Whichever platform you are running this on, the os module will call the specific junk you need.
getpass has the info for the currently logged in user. I haven’t explored that module much other than the .getuser component. It is pretty self explanatory. Stick that into a string variable, and you can call it wherever you’d like.
Let’s say your login name is something unfriendly like “cmoore”. Well the above script would return cmoore, which isn’t as friendly as it could be. so why not use a simple if to get more personal.
if currentUser == 'cmoore':
niceName = 'Chad'
print niceName
If you know all the names of the people on your team, you can add this functionality into your tools. It’s not “mission critical” but it helps people feel comfortable using the tools. Or people get paranoid, because they wonder how the computer knows their name. 
Brad and I are proud to present our Master Class from Siggraph 2007!

Click the image to buy at http://stores.lulu.com/animatortoolkit
You can read about this class, other training and Motion Builder related topics here …
http://motionbuildertraining.blogspot.com/
Here is what the class is about and who it is targeted for:
This Master Class will demonstrate both practical tools and ideas for creating custom character rigs and animation using Autodesk’s Motion Builder software. Our intended audience is current Motion Builder users of the beginning to intermediate level, as well as riggers and animators whom are new to Motion Builder. Our topics will include the rigging and keyframe animation of characters as well as special animation procedures often needed in production.
Course details:
- 100+ pages of course notes.
- 1.5 hour video recording of the Master Class presentation at SIGGRAPH.
- Two video walk throughs of the keyframe animation process in MotionBuilder.
- Many example videos and files for rigging our character.
- Python scripts for an alternate finger posing and keyframing methodology.
All this is included for $40.32 USD.
So lets make a python script that creates a folder on your desktop named ‘todays date’. Why you ask? Why not I say? In all seriousness this example will demonstrate some of the basic python concepts. Also I use stuff like this all the time. In fact, today, I figured out a way to spit out a .csv file from a database and compare it to another .csv. Nerd Alert! But it really helps in scheduling. Anyway I digress …
Go get python from here if you don’t already have it installed.
Here is the code, note I am writting this on a mac, so if your on windows the ‘myPath’ will look like this ‘C:\Documents and Settings\yourusername\Desktop’.
import os
from time import strftime
todaysDate = strftime('%Y_%m_%d')
myPath = '/Users/Chad/Desktop/'
myPath = myPath + todaysDate
print todaysDate
os.mkdir(myPath)
We’re going to store the path to your desktop in a variable. A variable is simply a place for you to store information. That info can be numbers or text. There are several types of variables, one of the most simple is a string. Thats what we will be dealing with in this example. A simple string of text that notes the location of your desktop in a variable.
So lets start back at the top. the import os is a call to a module. Python is efficient, it allows you to load only what you need. Each module has various commands and flags. Note the last line of the script os.mkdir(myPath) is in the form module.command(flag). It is the magic that actually makes the directory. Note that you can be very specific about the functions within modules, hence the from time import strftime.
strftime allows you to call the system time and format it in a lot of ways. Experiment and check the docs if you want to change the date format.
One last quick note. This line looks a little confusing huh? myPath = myPath + todaysDate. All that is doing is concatenating variables. Concatenation is basically just mashing things together. So you are telling python that myPath is equal to whatever myPath already is plus the todaysDate variable.
Please note I have no formal programming training, and I am learning as I go. The very fact that I am writing this is to share what I am learning, as I am learning it. Corrections, comments, better practices are most welcome.

Giant Snowman, originally uploaded by mrssmapdi.
March came in like a lion, so we decided to build a giant snowman with the 5 inches that fell this morning. Sam and Sophia and Momma Mo’ all helped out and we had a blast. That being said, if that was the last of the snow for the season, fine by me.
The hardest part was getting the mid section up onto the base. We had to roll it up.
Picture taken by Emily.
PythonGeek has been slow, I admit it. I’ll have my first post on variables up soon. There is a lot going on at work. I am currently writing a ton of Python for Motion Builder and Maya with the very generous help of John Hood, Mike G and Jason Parks as well as KxL over at the Area Forums.
On the home front, .
Sophia started preschool again today and we think shes already settling in (read: running the joint).
Sam is doing well, he’s saying a new word or two every day and he really is a little one man wrecking crew.
Emily does an outstanding job blogging about the kids and other stuff over at the cuppamo.
I have an interesting freelance gig developing, more on that when the time is appropriate.
There just isn’t enough time in the day.
At Siggraph last year myself and Brad Clark presented “The Animator Toolkit for Motion Builder”. Jason Parks presented a sister class called “Python for Motion Builder Artists”. His class is now available for purchase at lulu.com.
Jason’s class is quite well done and very informative on Python in general and also for using Python to automate repetitive tasks in Motion Builder. The lack of automation in Motion Builder was perhaps the number one complaint/request for a long while now. Autodesk partially addressed the issue with the addition of Python to Motion Builder. Jason’s thoughts on the process of scripting and usage of Motion builder are illuminating. The code he has provided with the class provides a really strong jumping off point to control and master Python and Motion Builder.
If your interested in Python and Motion Builder’s implementation of Python do check out the class!