Robert Galanakis - Practical Maya Programming with Python

所需积分/C币:9 2015-10-22 10:25:36 2.17MB PDF
收藏 收藏

About the Author Robert Galanakis is a technical artist cum programmer who has worked in various areas of game development. He is the Technical Director of EVE Online at CCP Games, Iceland, where he focuses on Python, Lean, and Agile training and evangelism. In 2008, Rob founded, which is the largest and the most active community focused on tech art on the Internet. He has spoken at Game Developers Conference several times and has also written many articles about tools, pipelines, and culture. His blog can be found at He lives in Reykjavík, Iceland, with his wife Casady and their son Marcus.
Table of contents Practical Maya Programming with Python Credits about the author about the reviewers Support files, eBooks discount offers and more Why Subscribe? Free Access for Packt account holders Preface What this book covers What you need for this book Who this book is for Conventions Reader feedback Customer support Downloading the example code Errata Piracy Questions 1. Introspecting Maya, Python, and PyMeL Creating your library USing the interpreter Finding a place for our library Choosing a development root Creating a function in your IDE Reloading code changes Exploring Maya and PYMEL Creating an introspection function Understanding Python and Mel types Using the method resolution order PyNodes all the way down Understanding PyMeL data and math types Leveraging the repl Building the phelp function Creating a query string for a PYMeL obiect Creating more tests Adding support for modules Adding support for types Adding support for methods Adding support for functions Adding support for non-PYMEL obiects Designing with EAFP versus LBYL Code is never complete Opening help in a web browser Summary 2. Writing Composable Code Defining composability Identifying anti-patterns of composability Avoiding the use of boolean flags Evolving legacy code into composable code Rewriting code for composability Getting the first item in a sequence Writing head and tail functions earning to use list comprehensions Implementing is exact type Saying goodbye to map and filter Writing a skeleton converter library Writing the docstring and pseudocode Understanding docstrings and reStructured Text Writing the first implementation Breaking the first implementation Understanding interface contracts Extracting the safe setparent utility function Learning how to refactor Simplifying the node to joint conversion earning how to use closures Dealing with node connections Dealing with namespaces Wrapping up the skeleton converter Writing a character creator Stubbing out the character creator Implementing convert hierarchies main Implementing convert hierarchies Decomposing into composable functions Implementing convert hierarchy Supporting inevitable modifications Improving the performance of PyMEL Defining performance Refactoring for performance Rewriting inner loops to use maya cmas Summary 3. Dealing with Errors Understanding exceptions Introducing exception types Explaining try/catch/finally flow control Explaining traceback objects Explaining the exc info tuple Living with unhandled exceptions Handling exceptions at the application level Golden rules of error handling Focus on the critical path Keep the end user in mind Only catch errors you can handle Avoid partial mutations Practical error handling in maya Dealing with expensive and mutable state Leveraging undo blocks Dealing with Maya's poor exception design Leveraging the maya application Dealing with the Maya application Leveraging Python, which is better than MEL Building a high-level error handler Understanding sys. excepthook Jsing sys. excepthook in Maya Creating an error handler Improving the error handler Inspecting Python code obiects Adding filtering based on filename Assembling the contents of an error e-mail Sending the error e-mail Installing the error handler Obeying the What If Two Programs Did This rule mproving the error handler Adding a user interface Jsing a background thread to send the e-mail Moving beyond e-mail Capturing locals Attaching log files Summary 4. Leveraging Context Managers and Decorators in Maya nverting the subroutine Introducing decorators 上 plaining decorators Wrapping an exporter with a decorator Introducing context managers Writing the undo chunk context manager Writing the undo on error context manager Contrasting decorators and context managers Context managers for changing scene state Building the set file prompt context manager Building the at time context manager Building the with unit context manager Building the set renderlaver active context manager Building the set namespace active context manager Improving on future versions of Maya Creating the denormalized skin context manager Safely swapping vertex influences Addressing performance concerns Creating a decorator to record metrics Getting a unique key Recording duration Reporting duration Handling errors Advanced decorator topics Defining decorators with arguments Decorating PyMEL attributes and methods Stacking decorators USing Python's decorator library Doing decorators the right way Summary Building Graphical User Interfaces for Maya Introducing Ot, PyOt, and PySide Introducing ot widgets Introducing Ot layouts Understanding ot main windows and sorting Introducing ot signals Establishing rules for crafting a GUI Prefer pure PySide guls where possible USe command-style ui building where necessary Avoid the use of ui files Installing pyside Supporting pyside and Pyot Creating the hierarchy converter GUI Creating the window Running a Python file as a script Introducing the Application class Understanding the event loop Running your guI Designing and building your GUI Defining control container, and window widgets Adding the rest of the widgets Hooking up the application to be effected by the gui Hooking up the gui to be effected by the application Simulating application events Considering alternative implementations Integrating the tool GUI with Maya Opening the tool GUI from Maya Getting the main maya window as a omain Window Making a ot window the child of Maya's window Using Python's reload function with GUls Emitting a signal from maya Connecting maya to a signal Verifying the hierarchy converter works Working with menus Creating a top-level menu Getting the ot obiect from a Maya path Changing the font of a widget Marking menus as new Creating a test case Adding a persistence registry Verifying the new menu marker works USing alternative methods to style widgets Working with maya shelves Summary Automating Maya from the Outside Controlling Maya through request-reply USing a python client and maya server Controlling Python through exec and eval Handling problems with IPC Installing ZeroMQ Demonstrating request-reply with ZeroMQ Explaining connection strings, ports, bind and connect Designing the automation system Pairing one client and one server Bootstrapping the server from the client The client-server handshake Defining the server loop Serializing requests and responses Choosing what the server does Handling exceptions between client and server Understanding the maya startup routine Using batch mode versus gui mode Choosing a startup configuration mechanism Using command line options sing environment variables Building the request-reply automation system Creating a Python package aunching Maya from Python automatically killing the server Creating a basic Maya server Running code at maya startup Understanding eval and exec Adding support for eval and exec Adding support for exception handling Adding support fc or timeout Adding support for the client-server handshake Practical uses and improvements Batch processing using maya

试读 127P Robert Galanakis - Practical Maya Programming with Python
立即下载 低至0.43元/次 身份认证VIP会员低至7折
  • 签到新秀

关注 私信
Robert Galanakis - Practical Maya Programming with Python 9积分/C币 立即下载
Robert Galanakis - Practical Maya Programming with Python第1页
Robert Galanakis - Practical Maya Programming with Python第2页
Robert Galanakis - Practical Maya Programming with Python第3页
Robert Galanakis - Practical Maya Programming with Python第4页
Robert Galanakis - Practical Maya Programming with Python第5页
Robert Galanakis - Practical Maya Programming with Python第6页
Robert Galanakis - Practical Maya Programming with Python第7页
Robert Galanakis - Practical Maya Programming with Python第8页
Robert Galanakis - Practical Maya Programming with Python第9页
Robert Galanakis - Practical Maya Programming with Python第10页
Robert Galanakis - Practical Maya Programming with Python第11页
Robert Galanakis - Practical Maya Programming with Python第12页
Robert Galanakis - Practical Maya Programming with Python第13页
Robert Galanakis - Practical Maya Programming with Python第14页
Robert Galanakis - Practical Maya Programming with Python第15页
Robert Galanakis - Practical Maya Programming with Python第16页
Robert Galanakis - Practical Maya Programming with Python第17页
Robert Galanakis - Practical Maya Programming with Python第18页
Robert Galanakis - Practical Maya Programming with Python第19页
Robert Galanakis - Practical Maya Programming with Python第20页

试读结束, 可继续阅读

9积分/C币 立即下载