1 - Maya Programming Introduction PDF
1 - Maya Programming Introduction PDF
© 2012 Autodesk 1
Session Agenda
• Why use Programming
• Overview of Maya Languages
• Uses for Python in Maya
• Help Documentation
• Navigating the Installation Folder
• Looking at how the documentation works
• How to execute Python in Maya
• Logging Bugs and Suggestion Features
• Available Resources
© 2012 Autodesk 2
Let’s Get Started
© 2012 Autodesk 3
Welcome to Autodesk Maya 2013
© 2012 Autodesk 4
Why use Programming in Maya
• Automate repetitive, time-consuming tasks and
extend features
• Uses popular, easy-to-use Python scripting
language
• The C++ and Python API to create custom tools
and features that plug directly into Maya
• Create project-specific functionality, for specific
workflows and requirements.
© 2012 Autodesk 5
Overview of Maya Languages
© 2012 Autodesk 6
Programming In Maya Possibilities
Available programming language options in Maya:
© 2012 Autodesk 7
MEL Scripting
• MEL (Maya Embedded Language) is a scripting language
at the heart of Maya.
© 2012 Autodesk 8
Python Scripting & API
• Python is a powerful and popular object-oriented scripting
language.
© 2012 Autodesk 11
Advantages of Scripting
• Easier learning curve
• No resources needed to start developing, such as Visual
Studio
• Quick prototyping for tools
• Platform Independent
• Tons of free modules (Python)
• Easily move between API and Scripting capabilities in
Maya all with in the same plug-in or script (Python)
© 2012 Autodesk 12
Advantages of C++ API
• Compiled, no source code discloser
• Can be 10+ faster than Python
• More classes and function exposed
• More detailed manipulation of lower level core
• More devkit samples and resources
© 2012 Autodesk 13
Why Python?
Customers Requested
Object Oriented
Open Source
Mostly Interpreted no Compiler Needed
Used for Both Standalone programs and Scripting Applications
Advantages
Quicker Development Cycle
Extremely Portable
No need to recompile code every release
Disadvantages
Slower than a fully compiled language like C++
Discloser
© 2012 Autodesk 14
Others who use Python
Other Autodesk Products:
• MotionBuilder: real-time animation product.
• Showcase: Real-time viz product.
• FBX: Autodesk File Format
• Wiretap: access to media managed on Autodesk®
Stone® file systems without the need to convert files or
copy media across the network
Non-Autodesk:
• Youtube, Google, NASA and Air Canada's reservation
management system.
© 2012 Autodesk 15
Distinguishing features of Python
• White space defines scope
Class methods defined within class definition
• Python objects are references/pointers
Garbage collection
• Namespaces
© 2012 Autodesk 16
Usages for Python in Maya
1. Maya Python scripts:
access standard "Maya commands" from Python
like MEL scripts written in Python
© 2012 Autodesk 17
Documentation Structure
Maya 2013 Learning Technical
Installation Resources Documentation
Guide
© 2012 Autodesk 18
Help Documentation
API Docs are only available on the web:
www.autodesk.com/maya
o under ‘Documentation’ link, download or view
www.autodesk.com/developMaya
http://usa.autodesk.com/adsk/servlet/item?id=1670776
8&siteID=123112
o 2013 SDK Link
© 2012 Autodesk 19
Navigating the Installation Folder
with respect to programming
© 2012 Autodesk 20
Navigating Maya Install Folders
• Default installation locations:
C:\Program Files\Autodesk\Maya2013
C:\My Documents\maya\2013-x64
Python Examples:
• C:\Program Files\Autodesk\Maya2013\devkit\plug-ins\scripted
• C:\Program Files\Autodesk\Maya2013\devkit\applications\scripted
© 2012 Autodesk 22
How to Execute Python in Maya
© 2012 Autodesk 23
How to Execute Python
1. Script Editor
2. Shelf
3. Command Line
4. Plug-in Manager
5. Python modules of Maya from a standalone Python
interpreter
© 2012 Autodesk 24
Helpful Coding Standards
1. Comment your code, so that you and others can clearly
read it
© 2012 Autodesk 25
Let us know!
Let us know about Maya defects or Wish list items:
© 2012 Autodesk 26
Book Resources
• Python
• Learning Python (O’Reilly) by Mark Lutz and David Ascher
• C++
• Thinking in C++ Volume One: Introduction to Standard C++ by
Bruce Eckel
© 2012 Autodesk 27
Additional Maya API Resources
• Maya Developer Center
• http://www.autodesk.com/developmaya
• Maya
API White Paper’s
• DevTV (video)
• Questions and Problems: ADN
• http://www.autodesk.com/adn
© 2012 Autodesk 28
Autodesk
© 2012 Autodesk 29