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

Setting up inverse kinematics (IK) with script


While it is very likely that any given model will require at least some custom rigging work, it can often be helpful to automate the setup of common subcomponents that occur frequently in many different rigs. In this example, we'll be doing just that and setting up a simple inverse kinematics (IK) system with code.

Although our example will be simple, it will still demonstrate a common issue—the need to accurately position joints to match the specific proportions of a model. As such, the script will have the following two distinct parts:

  • A preliminary step, where we create locators representing where the various joints will be created.

  • A secondary step, where we build a skeleton and set up its attributes based on the position of the locators.

By breaking the script into two parts, we allow the user to alter the positions of the locators after they've been created, but before the actual skeleton has been set up. This tends to be a much more effective...