This tutorial will walk you through creating a simple snake game in Maya using Python and Pyside, and creating object procedurally in the viewport.
Some of the content that you will be learning and real life applications:
1.- Generate widgets and Maya objects based on a coordinate.
There are so many scenarios where you will want to generate and place an object in a specific position. For instance, if you are creating your own World Space Baker, you will want to create a locator (or any object) in a specific point in space.
2.- Detect widget collisions using Python.
If you are developing your own Animation Picker and you want to do a “batch create buttons” from a bunch of selected items, you will want to check if there is a widget in certain space to make sure you don’t create a button on top of an already existing button.
3.- Timer events.
QTimers are very useful to make your script execute certain commands after some time has passed. For example, if you are working on a Render Manager, you may want to check if the image sequence that is being rendered already finished. To do this, you can use a QTimer to check every 1, 5…10 minutes, and if the image sequence exists, copy it to another location (backup) and run nuke to generate a .mov out of it. Then enable a button in your UI so that the animator can Preview this render.
4.- Keyboard Events
Keyboard events are a must if you want to enable your tool to use shortcuts. Every piece of software has them. Add Ctrl+S to save your picker, Ctrl+O to open it, check if Ctrl is pressed so you can show a different menu when right clicking… and the list goes on.