Book Image

Maya Programming with Python Cookbook

By : Adrian Herbez
Book Image

Maya Programming with Python Cookbook

By: Adrian Herbez

Overview of this book

Maya is a 3D graphics and animation software, used to develop interactive 3D applications and games with stupendous visual effects. The Maya Programming with Python Cookbook is all about creating fast, powerful automation systems with minimum coding using Maya Python. With the help of insightful and essential recipes, this book will help you improve your modelling skills. Expand your development options and overcome scripting problems encountered whilst developing code in Maya. Right from the beginning, get solutions to complex development concerns faced when implementing as parts of build.
Table of Contents (17 chapters)
Maya Programming with Python Cookbook
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Rendering a sprite sheet


In this example, we'll be building a tool to render out multiple views of an object to a single image. This could be used to create a sprite sheet for use in an isometric game.

In the course of the example, we'll use both Maya's Python library (to render out frames) and the Python Imaging Library (PIL) to combine them into a single image.

Four views rendered out and combined into a single image

Getting ready

Make sure that you have an object in your scene and it is at the origin. Also make sure that you have some number of cameras set up. You can either do it manually, or refer to the previous example on how to create cameras from script.

You'll also want to make sure that you have PIL installed on your system. The best way to do that is to grab Pillow (a fork of PIL). More information on Pillow can be found at http://pillow.readthedocs.io/en/3.2.x/.

In order to install Pillow in a (relatively) painless way, you'll probably want to grab PIP, which is a robust package manager...