Maya Python for Games and Film: A Complete Reference for Maya Python and the Maya Python API

Hardcover (Print)
Used and New from Other Sellers
Used and New from Other Sellers
from $47.82
Usually ships in 1-2 business days
(Save 30%)
Other sellers (Hardcover)
  • All (14) from $47.82   
  • New (9) from $50.79   
  • Used (5) from $47.61   

More About This Textbook


Maya's incorporation of Python is one of the most important advancements for Technical Artists. There is a vast and deep network of resources available for Python in general. And there's also ample coverage of Maya. However, there is still very little focusing on how to use Python and Maya together to boost productivity. CG artists are scouring the web, mailing-lists and google to keep up. This book is an in-depth look at Maya's implementation of Python, and is an invaluable resource for all of those Technical Artists transitioning from MEL scripting to Maya-Python scripting. There will be a companion website featuring script examples from the text, scene files, additional scripts, and templates for projects.

Read More Show Less

Product Details

  • ISBN-13: 9780123785787
  • Publisher: Taylor & Francis
  • Publication date: 10/12/2011
  • Edition description: New Edition
  • Pages: 24
  • Sales rank: 491,646
  • Product dimensions: 7.70 (w) x 9.30 (h) x 1.00 (d)

Table of Contents

Introduction To Maya Python

Project: Contrast a MEL and a Python API version of a Flatten Mesh script

Goal: This introductory chapter explains what the book is about and will excite readers about the possibilities Python affords them in Maya. We provide them a simple script, both a MEL version and a Python API version, that flattens a dense mesh to show them a quick example of some of the dramatic performance boosts they will learn how to harness. Fundamentally, this chapter will help highlight why readers bought the book, what they can expect to learn, and why it is so cool!

Part 1. Command-Level Python in Maya

Chapter 1. The Maya Command Engine and User Interface

Project: Input simple commands using script editor

Goal: This chapter briefly describes the basic low-level structure of Maya by focusing on its command engine. A more detailed description of the architecture appears later in the section dealing with the API. Following this description, we briefly examine Maya's three programming interfaces and what each is best suited for. Finally, we introduce readers to Maya's script editor and command line so they can begin entering simple commands and know where to find their output.

Chapter 2. Python Basics

Project: Translating basic MEL operations into Python

Goal: This chapter provides a brief overview of the Python language for new users. We first examine the principles of Python syntax (declarations, white space, operators) and compare Python to MEL (variable typing, semicolons). We then introduce Python's core object types and explain how reference counting works in relation to mutable/immutable data types and simple/complex data types. Finally, we explain what modules are and how they differ from the source command in MEL. We explain what import does, how to load and reload modules (math and sys), and where the command looks for modules. Finally, this chapter shows the reader where to find Python's online documentation for more information.

Chapter 3. Start Programming in Maya Python

Project: Create and modify various Maya nodes

Goal: This chapter introduces the Maya cmds module and assists readers in creating basic Python programs. We compare Python to MEL examples by first explaining all of the keywords for establishing flow control in Python including conditionals, loops, and exception handling. Second, we describe what functions are and how to create them in Python. We discuss how to create arguments, assign default values, how to return data, override functions, and use lambda.

Chapter 4. Object-Oriented Programming in Maya Python

Project: Create a script that adds noise to animation using classes to store keys

Goal: This chapter shows one of the key advantages of Python over MEL by introducing the concept of object-oriented programming. We briefly explain what objects are and what the constituent parts of classes are. Readers will learn how to define a class from scratch and how to inherit from an existing class. The project is a script that stores animation key data in a custom class in order to add noise to an animation curve.

Chapter 5. Working With Files

Project: Save and load a pose using files

Goal: This chapter demonstrates the basics of writing data out to a file and reading it back in to another scene. The project saves a character's pose to a text file and reads it back in to apply it to another character. We will explain how to search hierarchies and write the position, rotation, and scale values to a file.

Chapter 6. Writing Complex Programs in Maya Python

Project: Create a script that implements step-through debugging and performs different operations on different types of objects (sphere, cube, locator)

Goal: This chapter gets the reader ready to start doing more complex work in Maya Python. We explain how to configure the Maya environment and provide suggestions for text editors that are well-suited to working with Python. Additionally, we provide tips for debugging scripts in Maya Python. Specifically, we cover the use of exception handling and status messages as well as using the pydb module to step through code.

Part 2. Designing Maya User Interfaces with Python

Chapter 1. Principles of Maya Tool Design
Project: Analyze various existing tools and interfaces that ship with Maya
Goal: This chapter centers around the theory behind designing good Maya tools and interfaces. It analyzes Maya's existing user interface to provide guidelines for making tools that work predictably and are easy to use. It also explores higher-level concepts for code organization to ensure that tools and user interfaces can be easily extended. Areas of focus include location and inclusion of common buttons and options, use of selection order and descriptive naming, as well as separation of functionality and form.

Chapter 2. Basic User Interfaces with Maya Python
Project: Align Tool
Goal: This chapter introduces readers to the basics of creating a Maya UI using the cmds module including windows, panels, controls, layouts, and menus. The project is a simple tool that allows users to align one object with another based on a set of options (position and/or rotation along one, two, or three axes).

Chapter 3. External User Interfaces and mayapy
Project: Rename Object in Files
Goal: This chapter explains how to use the mayapy application to operate in Maya without having to open its user interface. Readers will learn about the basics of creating applications that operate using Maya from the outside. Readers will walk through an example that lets them make mass changes to a large number of files without having to even open Maya's UI.

Chapter 4. Advanced User Interfaces with Maya Python and QT
Project: External batch rigging tool with UI
Goal: This chapter introduces readers to the concept of using external UI libraries to create custom user interfaces. We first discuss why some developers use external UI libraries and then shift focus onto a brief overview of the popular QT toolset (PyQT module and GUI Builder). The project has readers create an external user interface with PyQT that works with mayapy to batch rig a number of files (add IK handles to selected limbs).

Part 3. Fundamentals of the Maya Python API

Chapter 1. Understanding C++ and the API Documentation

Project: Walk through the MVector class in the API documentation
Goal: This chapter introduces the concept of the API and briefly describes what it is and how it differs from the scripts that readers have written up to this point as well as how it fits into the overall Maya architecture. The chapter walks readers through the C++ API's documentation so they are able to locate information when they need it, explains how to identify what functionality is not accessible to Python, and summarizes some of the major differences between the Python and C++ APIs including the MScriptUtil and MStatus classes.

Chapter 2. Writing Scripts that Implement the API
Project: Align Tool
Goal: This chapter has readers import the OpenMaya module and write scripts that use basic API functionality. The chapter further explains what classes are not usable from within a script (e.g. MPx classes) and how to use the MScriptUtil class to deal with pointers and references in the API. The project is a simple tool that allows users to align one object with another based on a set of options (position and/or rotation along one, two, or three axes and coordinate space).

Chapter 3. Programming a Command
Project: Select All in Frustum
Goal: This chapter revisits Maya's command engine and explains it in more detail, including its undo/redo mechanism. Readers walk through the basic parts of a command and learn how to write their own simple commands that take and parse arguments. The project is a command that lets users select all objects within the view frustum of a type specified via a command flag.

Part 4. The Maya Python API and the Dependency Graph

Chapter 1. Data Flow in Maya
Project: Multiply Utility Node
Goal: This chapter explains Maya's dependency graph architecture in great detail. It provides examples of how messages and data are propagated throughout the scenegraph, how nodes operate on the data, and what ramifications this structure has. We explain the concept of working with plugs, attributes, and datahandles by showing an example of a simple multiply utility node which uses ordinary and array attributes for input and output.

Chapter 2. Programming a Dependency Graph Node
Project: Build Rotation node
Goal: This chapter explains the anatomy of a dependency graph node. Readers will walk through an example wherein they create their own nodes and each part of the process is explained in detail. The project is a node that builds the rotation for an object from a specified aim vector and up vector in the scene. Readers will also learn how to make a custom attribute editor panel for their node.

Chapter 3. Programming Special Types of Nodes
Project: Multi-Shape Locator and Inflate Deformer
Goal: This chapter discusses special types of nodes that can be created in the API, including locators with their own custom shapes and manipulators, as well as deformers. The projects explaining the special requirements of these nodes are a locator that can render as a variety of different shapes (box, sphere, square, circle, etc.) and a deformer node that inflates an object by translating its vertices along their normals.

Chapter 4. Improving Performance of Custom Nodes
Project: Convert Python Inflate node into C++
Goal: This chapter discusses the performance limitations of custom Python nodes as compared to their C++ counterparts. It profiles the Inflate Deformer node from the previous chapter to illustrate which Python operations slow down computation and how to work around them. Finally, this chapter shows how readers can use their knowledge of the API and good coding practice to easily convert their custom Python nodes into C++ if necessary.

Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star


4 Star


3 Star


2 Star


1 Star


Your Rating:

Your Name: Create a Pen Name or

Barnes & Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation


  • - By submitting a review, you grant to Barnes & and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Terms of Use.
  • - Barnes & reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously

    If you find inappropriate content, please report it to Barnes & Noble
    Why is this product inappropriate?
    Comments (optional)