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

Combining script jobs and script nodes


One of the great things about script jobs, and script nodes, is that you can use script nodes to ensure that a given script job travels along with your scene. For example, you might want to use a script job to trigger a custom character rig UI any time the user selects a certain object in the scene.

In this example, we'll create a script that will make it really easy to set such things up. Our script will perform the following:

  • It will ask the user to point it at a Python file with one or more functions to create UI

  • It will present the user with a list of all functions defined in the file in a scroll list

  • It will allow the user to select an object in the scene and a named function from the file

  • It will embed the contents of the function into the scene as a script node, along with a script job that will run the function every time the specified object is selected

Getting ready

To use the script we'll be writing, you'll need to have a script with at least one...