Check out my video tutorial series at CGCircuit

Introduction

This workshop is geared towards students with little to no scripting/programming experience. By the end of this workshop, you will have the knowledge to write and run Python scripts inside and outside of Maya. You will not learn everything about Python from this workshop. This workshop includes all the basic information you should know in order to be proficient in reading, writing, running, and modifying Python scripts. The purpose of this workshop is not to make you expert Python scripters, but to give you a solid foundation from which in further your Python studies.

Additional Resources

  • Learning Python, 3rd Edition by Mark Lutz
  • Dive Into Python: http://www.diveintopython.org/toc/index.html
  • The python_inside_maya Google email list: http://groups.google.com/group/python_inside_maya
  • http://www.pythonchallenge.com/

Python in the Computer Graphics Industry

Some Programs that support Python:

  • Maya
  • Modo
  • Houdini
  • XSI
  • Massive
  • Blender
  • Photoshop (indirectly)
  • 3ds max (indirectly)

What is Python used for?

Artists can

  • Automate repetitive and/or tedious tasks.
  • Reduce human error.
  • Produce more creative iterations in the feedback loop.

Engineers can

  • Create applications and tools to run studio pipelines.
  • Customize existing applications to support studio specific workflows.
  • Let artists be artists.

Contents

  1. Introduction to Python
  2. Data Types and Variables
  3. Controlling the Flow of Execution
  4. Functions
  5. Exceptions and Error Handling
  6. File Input and Output
  7. Modules
  8. Classes and Object Oriented Programming
  9. Documenting your Code
  10. Sample Script
  11. Python in Maya

Conclusion

After reading these notes, you should have a good understanding of how to write and run Python scripts inside and outside of Maya. There is still plenty to learn though. There are hundreds of Maya commands and plenty of useful modules out there to experiment with. I recommend continuing your Python education by looking through the references included with these notes, reading other peoples’ scripts, and experimenting with your own scripts. Good luck!