Code samples for people who take part in my Python for Maya course
Python For Maya: Artist Friendly Programming
This course will teach Python for Maya using an artist friendly approach, by breaking down concepts into small digestible pieces and giving projects with real world use.
You can also find more information about me on my website
During the course, we'll create a few different projects to both showcase how Python is useful in a real world context,and to learn new concepts
- Create and prop geometry with a simple rig (LINK)
- Rename and organize a scene (LINK)
- Automatically create Gears for modelling with a configurable amount of teeth (LINK)
- An Animation Tweener with a simple UI (LINK)
- A Library tool for Rigging Controls with a UI (LINK)
- A Light Manager (LINK)
- A command line file tool to manage image sequences (LINK)
For the course we will use the following
-
Maya 2017
This is currently the latest version of Maya and has some major changes that will be covered. Feel free to use an older version of Maya (as low as 2011), as I will cover the differences and give you the knowledge to adapt
You can download an education version of Maya 2017 here: http://www.autodesk.com/education/free-software/maya You can download a Maya 2017 trial here: http://www.autodesk.com/products/maya/free-trial
-
Python 2.7
Obviously, this course will use Python, but it is important to note we will be using Python 2.7 and not Python 3.x
If you do not already have Python installed, I recommend downloading Anaconda instead. It is a packaged version of Python that comes with a lot of great libraries prebuilt for you, and is much easier to get started with than the official Python. Please remember to download the Python 2.7 version
https://www.continuum.io/downloads
Maya 2017 uses Python 2.7 and this is also the agreed upon standard by the VFX Reference Platform www.vfxplatform.com Maya 2014-2016 also use Python 2.7, whereas Maya 2011-2013 use Python 2.6.
The latest version of Python is Python 3.5, however Python 3.x has introduced many breaking changes to Python. These changes are for the better but due to large investment into Python 2 code, Maya will continue to be on Python 2 for a while longer.
-
PyCharm
PyCharm is a very well established IDE with a lot of useful features for a beginner to both learn with and grown into a full fledged developer. It is my editor of choice today.
I would recommend downloading PyCharm Edu from here: https://www.jetbrains.com/pycharm-edu/
PyCharm Edu is a version of PyCharm with a simplified interface (optional) and coursework that will help a user learn Python in their spare time.
-
Maya DevKit
Unfortunately from Maya 2016 onwards, Autodesk stopped shipping the Maya developer kit with Maya. This isn't super necessary for our course, but it does provide some nice autocomplete features in our editors.
If you're on Maya 2016 download the zip file from here: https://github.com/autodesk-adn/Maya-devkit
If you're on Maya 2017 or higher download it from here: https://www.autodesk.com/developer-network/platform-technologies/maya
Instructions on how to set up your directories for your specific OS are here: http://help.autodesk.com/view/MAYAUL/2017/ENU//?guid=__files_Setting_up_your_build_environment_htm
-
Qt.py
For the Qt portion of our course, there are several Qt libraries we can use. If you're using Maya 2017 or above, you can use PySide2 or PyQt5. If you're using Maya 2016 or below, you can use PySide or PyQt4.
Rather than having to develop for all these options, we can use a library that can make use of whichever one it finds. This library is called Qt.py and you can download it here: https://github.com/mottosso/Qt.py
-
Other Editors
There are a lot of other editors, and I will personally not be using them for this course. However, if you have a preference for other editors, I will go over setting up some of the editors with Maya. The following editors will be covered
- Sublime Text
- Atom
- Visual Studio Code
- Eclipse
-
Operating System My preferred operating system is Windows and it will be what I will be using for the entire course. That said, I also use macOS and Linux and where anything should be treated differently, I will make mention of it.
The course will cover the following libraries
maya.cmds
pymel
Qt
PySide
/PySide2
Just a note that these links are affiliate links that will go to your local Amazon storefront.
-
Maya Python For Games And Film
This was the book that I learned Python from, and I cannot recommend it enough. It goes a lot more in depth on each topic, as only a book can do, and it's probably the resource I recommend the most.
-
Practical Maya Programming With Python
Rob Galanakis is a fantastic resource on Python, who runs the Tech-Artists forum, which is where I often went to get help when I was stuck on issues, or wanted to learn what other people were doing. His book is a great resource as well.
-
Rapid GUI Programming with Python and Qt: The Definitive Guide to PyQt Programming
If you're interested in learning more about Qt, this is the best book to have in my opinion. He goes from very basic Qt useage to very advanced concepts. The book is based around PyQt4, but if you've watched my course, it should be easy enough to switch to whichever Qt library you're using
-
Complete Maya Programming: An Extensive Guide to MEL and C++ API
This is for MEL and C++ obviously, and quite an old book, but it's one that is still incredibly useful if you're interested in those languages, and one that many developers have learned from.
- [Rigging Dojo] (http://www.riggingdojo.com/)
Rigging Dojo is the online school for rigging and technical skills. They have a ton of great mentored courses on Python, C++, Rigging etc..
-
[Python For Maya: Google Group] (https://groups.google.com/forum/?fromgroups#!forum/python_inside_maya)
A great google group run by Justin Israel, where people can ask questions about Python and get help from other Python developers.
-
A website dedicated to giving a really quick introduction to programming languages.
-
[TDsAnonymous] (http://www.tdsanonymous.com/)
A companion site for an online community I'm part of. The community is invite only, but the site is a place where we can contain resources that we find useful.
A quick introduction to using PyQt4 and PyQt5. If you're using PySide, just replace the library name. This is where I learned to use PyQt4 from when I was teaching myself Python, and it's the first place I point people to when they want to learn.
-
This is a blog run by John Hood who is a coworker of mine who's taught me a ton.