Practical Maya Programming with Python

Practical Maya Programming with Python

Robert Galanakis

Language: English

Pages: 321

ISBN: 1849694729

Format: PDF / Kindle (mobi) / ePub

Unleash the power of Python in Maya and unlock your creativity

About This Book

  • Create and customize UIs using standard tools and libraries
  • Understand how Maya can leverage advanced Python features
  • Make your tools, and Maya itself, fully automatable

Who This Book Is For

If you are a developer looking to build a powerful system using Python and Maya's capabilities, then this book is for you. Practical Maya Programming with Python is perfect for intermediate users with basic experience in Python and Maya who want to better their knowledge and skills.

What You Will Learn

  • Understand the architecture of Python objects, Maya nodes, and PyMEL
  • Write composable code that is modular and re-usable
  • Make Maya "Pythonic" through the use of decorators and context managers
  • Learn about different Maya UI options and libraries
  • Use PySide and PyQt to build Maya user interfaces
  • Turn Maya into a server that can be controlled remotely
  • Understand how to use Python with Maya's API
  • Conquer custom nodes using Python's dynamic type creation

In Detail

Autodesk Maya is a 3D computer graphics software. It offers a vast and flexible set of features utilizing Python. It is not difficult to get started using Python in Autodesk Maya, but it can be difficult to go from writing procedural, MEL-inspired tools to building the powerful yet simple systems that Python promises.

Practical Maya Programming with Python will help you master both Python and Maya. With thorough explanations, illustrative examples, and complete sample projects, you will learn how to use Python to charm Maya into obeying your every command. Practical Maya Programming with Python will teach you how PyMEL works as well as how to deal with errors and write composable code in Python.

Art of Computer Programming, Volume 3: Sorting and Searching

Randomized Algorithms

A Concise Introduction to Languages and Machines (Undergraduate Topics in Computer Science)

The Little Schemer (4th Edition)




















Code should go into import webbrowser # (1) HELP_ROOT_URL = ('' 'maya2013/en_us/PyMel/')# (2) def pmhelp(obj): # (3) """Gives help for a pymel or python object. If obj is not a PyMEL object, use Python's builtin 'help' function. If obj is a string, open a web browser to a search in the PyMEL help for the string. Otherwise, open a web browser to the page for the object. """ tail = pyto_helpstr(obj) if tail is None: help(obj) # (4) else:.

How Python works both under the hood and over it, how Maya integrates with Python, and how the elegant PyMEL builds on that integration. We will drill down into what makes Python code beautiful and idiomatic, and how we can use these concepts and Python's language features to make our Maya Python code expressive and elegant. We will leverage third-party solutions for networking and user interfaces, to compliment and extend what is included with Maya and Python. We will decouple Python code from.

'.join([spam()] * 5) return spams Any command line input or output is written as follows: > mayapy --version Python 2.6.4 Code meant to be entered by the Python interactive interpreter uses its familiar conventions. Input lines are prefixed with ">>>". Continuations for multiline statements are prefixed with "...". Output from the interpreter has no prefix: >>> 'This is input'.replace('in', 'out') 'This is output' >>> if True: ... print 'Hello!' Hello New terms and important words are shown.

The following is the equivalent commands on OS X or Linux: $ export PYTHONPATH=$PYTHONPATH:~/mayapybook/pylib $ mayapy >>> import sys >>> '~/mayapybook/pylib' in sys.path True >>> import minspect >>> minspect There are actually a number of ways to get your development root onto Maya's path. The option presented here (using environment variables before starting Maya or mayapy) is just one of the more.

Methods Stacking decorators Using Python's decorator library Doing decorators the right way Summary 5. Building Graphical User Interfaces for Maya Introducing Qt, PyQt, and PySide Introducing Qt widgets Introducing Qt layouts Understanding Qt main windows and sorting Introducing Qt signals Establishing rules for crafting a GUI Prefer pure PySide GUIs where possible Use command-style UI building where necessary Avoid the use of .ui files Installing PySide Supporting PySide and PyQt Creating the.

Download sample