Счётчик скачек MONERO
03084
Счётчик скачек MAGNETAR
0962

Mechtley A., Trowbridge R. - Maya Python for Games and Film [2012, PDF, ENG]

Ответить на тему
 
Автор Сообщение

star21 ®

Пол: Женский

Стаж: 11 лет

Сообщений: 262214

Откуда: Екатеринбург

Создавать темы 08-Фев-2023 20:50

[Цитировать]

Maya Python for Games and Film Год издания: 2012
Автор: Adam Mechtley, Ryan Trowbridge, с участием Seth Gibson и Kristine Middlemiss
Жанр или тематика: Maya PythonИздательство: Morgan Kaufmann
ISBN: 978-0-12-378578-7
Язык: АнглийскийФормат: PDF
Качество: Издательский макет или текст (eBook)
Интерактивное оглавление: Нет
Количество страниц: 393Описание: To fully understand what can be done with Python in Maya, we must first discuss how Maya has been designed. There are several ways that users can interact with or modify Maya. The standard method is to create content using Maya’s graphical user interface (GUI). This interaction works like any other software application: Users press buttons or select menu items that create or modify their documents or workspaces. Despite how similar Maya is to other software, however, its underlying design paradigm is unique in many ways. Maya is an open product, built from the ground up to be capable of supporting new features designed by users. Any Maya user can modify or add new features, which can include a drastic redesign of the main interface or one line of code that prints the name of the selected object. In this chapter, we will explore these topics as you begin programming in Python. First, we briefly describe Maya’s different programming options and how they fit into Maya’s user interface. Next, we jump into Python by exploring different means of executing Python code in Maya. Finally, we explore some basic Maya commands, the primary means of modifying the Maya scene.

Примеры страниц

Оглавление

Acknowledgments............................................................................................................ xiii
Introduction: Welcome to Maya Python .......................................................................... xvPART 1 BASICS OF PYTHON AND MAYACHAPTER 1 Maya Command Engine and User Interface............................................3
Interacting with Maya................................................................................... 4
Maya Embedded Language ................................................................... 5
Python .................................................................................................... 5
C++ Application Programming Interface .............................................. 6
Python API............................................................................................. 6
Executing Python in Maya ........................................................................... 6
Command Line ...................................................................................... 6
Script Editor ........................................................................................... 8
Maya Shelf........................................................................................... 10
Maya Commands and the Dependency Graph .......................................... 11
Introduction to Python Commands ............................................................ 15
Flag Arguments and Python Core Object Types ....................................... 19
Numbers ............................................................................................... 20
Strings .................................................................................................. 20
Lists...................................................................................................... 20
Tuples................................................................................................... 21
Booleans............................................................................................... 21
Flag = Object Type............................................................................... 21
Command Modes and Command Arguments............................................ 22
Create Mode......................................................................................... 22
Edit Mode ............................................................................................ 23
Query Mode ......................................................................................... 23
Python Command Reference ...................................................................... 24
Synopsis ............................................................................................... 25
Return Value ........................................................................................ 25
Related ................................................................................................. 25
Flags ..................................................................................................... 25
Python Examples ................................................................................. 26
Python Version ........................................................................................... 26
Python Online Documentation ................................................................... 26
Concluding Remarks................................................................................... 27CHAPTER 2 Python Data Basics .............................................................................29
Variables and Data...................................................................................... 30
Variables in MEL ................................................................................ 33
Keywords ............................................................................................. 33
Python’s Data Model ........................................................................... 34
Using Variables with Maya Commands .................................................... 37
Capturing Results................................................................................. 39
getAttr and setAttr........................................................................... 40
connectAttr and disconnectAttr ...................................................... 41
Working with Numbers .............................................................................. 43
Number Types ..................................................................................... 43
Basic Operators.................................................................................... 44
Working with Booleans .............................................................................. 45
Boolean and Bitwise Operators ........................................................... 45
Working with Sequence Types .................................................................. 46
Operators .............................................................................................. 46
String Types......................................................................................... 50
Formatting Strings ............................................................................... 52
More on Lists....................................................................................... 53
Other Container Types................................................................................ 56
Sets ....................................................................................................... 57
Dictionaries .......................................................................................... 58
Concluding Remarks................................................................................... 62CHAPTER 3 Writing Python Programs in Maya.......................................................63
Creating Python Functions ......................................................................... 64
Anatomy of a Function Definition ...................................................... 64
Function Arguments ............................................................................ 66
Return Values ...................................................................................... 74
Maya Commands ........................................................................................ 75
Listing and Selecting Nodes................................................................ 76
The file Command............................................................................. 78
Adding Attributes ................................................................................ 79
Iteration and Branching .............................................................................. 80
The for Statement ................................................................................ 80
Branching ............................................................................................. 84
List Comprehensions ........................................................................... 93
The while Statement ............................................................................ 94
Error Trapping ............................................................................................ 96
try, except, raise, and finally ............................................................... 96
Designing Practical Tools........................................................................... 99
Concluding Remarks................................................................................. 109CHAPTER 4 Modules............................................................................................111
What Is a Module? ................................................................................... 113
Modules and Scope .................................................................................. 114
Module Encapsulation and Attributes ............................................... 115
The __main__ Module ...................................................................... 116
Creating a Module .................................................................................... 118
The spike Module .............................................................................. 118
Default Attributes and help()............................................................. 120
Packages............................................................................................. 121
Importing Modules ................................................................................... 125
import versus reload()........................................................................ 125
The as Keyword................................................................................. 126
The from Keyword ............................................................................ 126
Python Path............................................................................................... 127
sys.path............................................................................................... 128
Temporarily Adding a Path ............................................................... 129
userSetup Scripts................................................................................ 131
sitecustomize Module ........................................................................ 133
Setting Up a PYTHONPATH Environment Variable ...................... 135
Using a Python IDE ................................................................................. 140
Downloading an IDE......................................................................... 140
Basic IDE Configuration ................................................................... 141
Concluding Remarks................................................................................. 145CHAPTER 5 Object-Oriented Programming in Maya..............................................147
Object-Oriented versus Procedural Programming.................................... 148
Basics of Class Implementation in Python ....................................... 150
Instantiation........................................................................................ 150
Attributes................................................................................................... 151
Data Attributes ................................................................................... 153
Methods.............................................................................................. 155
Class Attributes.................................................................................. 160
Human Class ...................................................................................... 163
Inheritance................................................................................................. 164
Procedural versus Object-Oriented Programming in Maya ..................... 168
Installing PyMEL............................................................................... 168
Introduction to PyMEL...................................................................... 168
PyNodes ............................................................................................. 169
PyMEL Features ................................................................................ 170
Advantages and Disadvantages ......................................................... 171
A PyMEL Example ........................................................................... 172
Concluding Remarks................................................................................. 175PART 2 DESIGNING MAYA TOOLS WITH PYTHONCHAPTER 6 Principles of Maya Tool Design..........................................................179
Tips When Designing for Users............................................................... 180
Communication and Observation ...................................................... 181
Ready, Set, Plan! ............................................................................... 181
Simplify and Educate......................................................................... 183
Tools in Maya........................................................................................... 183
Selection............................................................................................. 184
Marking Menus.................................................................................. 186
Options Windows .............................................................................. 190
Concluding Remarks................................................................................. 192CHAPTER 7 Basic Tools with Maya Commands .....................................................193
Maya Commands and the Maya GUI ...................................................... 194
Basic GUI Commands .............................................................................. 196
Windows ............................................................................................ 196
Building a Base Window Class................................................................ 198
Menus and Menu Items ..................................................................... 199
Executing Commands with GUI Objects.......................................... 201
Layouts and Controls......................................................................... 206
Complete AR_OptionsWindow Class ............................................... 215
Extending GUI Classes............................................................................. 218
Radio Button Groups......................................................................... 219
Frame Layouts and Float Field Groups ............................................ 220
Color Pickers...................................................................................... 222
Creating More Advanced Tools ............................................................... 224
Pose Manager Window...................................................................... 224
Separating Form and Function .......................................................... 226
Serializing Data with the cPickle Module......................................... 226
Working with File Dialogs ................................................................ 229
Concluding Remarks................................................................................. 232CHAPTER 8 Advanced Graphical User Interfaces with Qt ......................................233
Qt and Maya ............................................................................................. 234
Docking Windows ............................................................................. 236
Installing Qt Tools .................................................................................... 237
The Qt SDK....................................................................................... 237
Qt Designer ............................................................................................... 239
Widgets .............................................................................................. 240
Signals and Slots................................................................................ 241
Qt Designer Hands On ...................................................................... 241
Loading a Qt GUI in Maya...................................................................... 246
The loadUI command........................................................................ 248
Accessing Values on Controls........................................................... 250
Mapping Widgets with Signals and Slots ......................................... 251
PyQt .......................................................................................................... 254
Installing PyQt ................................................................................... 254
Using PyQt in Maya 2011+ .............................................................. 255
Using PyQt in Earlier Versions of Maya.......................................... 257
Concluding Remarks................................................................................. 257PART 3 MAYA PYTHON API FUNDAMENTALSCHAPTER 9 Understanding C++ and the API Documentation...............................261
Advanced Topics in Object-Oriented Programming................................ 264
Inheritance.......................................................................................... 264
Virtual Functions and Polymorphism................................................ 265
Structure of the Maya API ....................................................................... 265
Introducing Maya’s Core Object Class: MObject............................. 266
How Python Communicates with the Maya API .................................... 268
How to Read the API Documentation ..................................................... 270
Key Differences between the Python and C++ APIs .............................. 281
MString and MStringArray ............................................................... 281
MStatus .............................................................................................. 281
Void* Pointers ................................................................................... 281
Proxy Classes and Object Ownership ............................................... 281
Commands with Arguments .............................................................. 282
Undo................................................................................................... 282
MScriptUtil ........................................................................................ 282
Concluding Remarks................................................................................. 283CHAPTER 10 Programming a Command.................................................................285
Loading Scripted Plug-ins ........................................................................ 287
Anatomy of a Scripted Command............................................................ 289
OpenMayaMPx Module .................................................................... 290
Command Class Definition ............................................................... 290
doIt()................................................................................................... 291
Command Creator.............................................................................. 291
Initialization and Uninitialization ...................................................... 292
Adding Custom Syntax ............................................................................ 293
Mapping Rotation Orders .................................................................. 296
Class Definition ................................................................................. 297
Syntax Creator ................................................................................... 298
Initialization of Syntax ...................................................................... 301
doIt()................................................................................................... 302
doItQuery()......................................................................................... 305
Maya’s Undo/Redo Mechanism ............................................................... 308
Supporting Multiple Command Modes and Undo/Redo ......................... 313
Undo and Redo.................................................................................. 313
Command Modes............................................................................... 314
Syntax Creator ................................................................................... 317
__init__() Method .............................................................................. 318
doIt()................................................................................................... 320
redoIt()................................................................................................ 323
undoIt()............................................................................................... 325
Concluding Remarks................................................................................. 326CHAPTER 11 Data Flow in Maya ............................................................................327
Dependency Graph ................................................................................... 328
Dependency Nodes ............................................................................ 330
Connections........................................................................................ 333
Debugging the Dependency Graph ................................................... 336
The dgTimer Command..................................................................... 338
Directed Acyclic Graph ............................................................................ 339
DAG Paths and Instancing ................................................................ 344
The Underworld................................................................................. 347
Concluding Remarks................................................................................. 350CHAPTER 12 Programming a Dependency Node ....................................................351
Anatomy of a Scripted Node.................................................................... 352
The ar_averageDoubles Node ........................................................... 352
Node Class Definition ....................................................................... 354
Node Creator...................................................................................... 356
Node Initializer .................................................................................. 356
compute() ........................................................................................... 357
Initialization and Uninitialization ...................................................... 359
Attributes and Plugs ................................................................................. 360
Attribute Properties ............................................................................ 361
Readable, Writable, and Connectable ............................................... 361
Storable Attributes and Default Values............................................. 361
Cached Attributes .............................................................................. 363
Working with Arrays ......................................................................... 363
Compound Attributes......................................................................... 370
Concluding Remarks................................................................................. 375

Дополнительно

Это не оригинальный ebook, но я постарался собрать его в максимально близком к оригиналу виде. По крайней мере это не даунскейл и не отсканированные страницы, да и иллюстрации цветные.
Сайт-компаньон книги все еще жив: http://www.maya-python.com/
[Профиль] [ЛС]
Показать сообщения:    
Ответить на тему

Текущее время: 22-Ноя 05:24

Часовой пояс: UTC + 5



Вы не можете начинать темы
Вы не можете отвечать на сообщения
Вы не можете редактировать свои сообщения
Вы не можете удалять свои сообщения
Вы не можете голосовать в опросах
Вы не можете прикреплять файлы к сообщениям
Вы не можете скачивать файлы