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.

Machine Learning and Data Mining for Computer Security: Methods and Applications (Advanced Information and Knowledge Processing)

Data Mining and Knowledge Discovery Handbook (Springer series in solid-state sciences)

Essential Software Architecture (2nd Edition)

Neural Networks for Pattern Recognition

Introduction to High Performance Computing for Scientists and Engineers (Chapman & Hall/CRC Computational Science)


















our journey. Tip The ProxyUnicode class should be treated as an implementation detail. The only important user-facing detail is that it allows PyNodes to have string methods on them (.replace, .strip, and so on). As of writing this book, I've never used the string methods on a PyNode. Maybe there are valid uses but I can't imagine them. There are always better, more explicit ways of dealing with the node. If you need to deal with its name, call a name-returning method (name(), longName(), and

confident to leave it alone. Summary In this chapter, we learned how Maya and Python work together to create PyMEL. First we learned how to use the mayapy interpreter, and how to create and use Python libraries and modules. Then we explored PyMEL via introspection: how it mirrors Maya concepts such as DAG nodes and attributes, how every Maya object is represented as a first-class PyMEL node, and PyMEL's special math data types. Finally, we built a function that can bring us to the PyMEL online

the new name. # Copy the transform and rotation. # Set the parent to rootnode's parent if parent is None, # Otherwise set it to _parent. # Convert all the children recursively, using the newly # created joint as the parent. We explicitly state that rootnode should be a PyNode object. It helps to be clear what you're expecting, and just take in what you need rather than try to convert it inside the function. That is, do not take in a string and convert it into a PyNode. The less the function

the development root folder, and inside of it create an empty file named Now, we need to get C:\mayapybook\pylib onto Python's sys.path so it can be imported. The easiest way to do this is to use the PYTHONPATH environment variable. From a Windows command line you can run the following to add the path, and ensure it worked: > set PYTHONPATH=%PYTHONPATH%;C:\mayapybook\pylib > mayapy.exe >>> import sys >>> 'C:\\mayapybook\\pylib' in sys.path True >>> import minspect >>> minspect

Using the method resolution order Even more useful than the __bases__ attribute is the __mro__ attribute. Method Resolution Order (MRO) is the order Python visits different types so it can figure out what to actually call. You generally don't need to understand the MRO mechanisms (they can be complex), but looking at the MRO will help you understand all the type information about an object. Let's look at the MRO for the Joint type: >>> type(j).__mro__ (,

Download sample