You are previewing Complete Maya Programming: An Extensive Guide to MEL and the C++ API.
O'Reilly logo
Complete Maya Programming: An Extensive Guide to MEL and the C++ API

Book Description

Learning Maya, the world's leading 3D animation and effects package, is a challenge, especially for those who want to master Maya's versatile programming features in addition to its built-in tools. Finally, here is a practical, step-by-step guide that shows how to use Maya to its fullest potential, beginning with the basics. Readers of "Complete Maya Programming" will first gain a thorough understanding of Maya's inner workings, and then learn how to customize and extend Maya with scripts and plugins that take control and productivity to new levels. Users new to programming can apply Maya's easy scripting language MEL (Maya Embedded Language), while more advanced users can work with the C++ API (Application Progamming Interface). Both a fundamental tutorial for Maya beginners and a solid reference for experienced developers, "Complete Maya Programming" is every user's guide to Maya mastery. It provides a multitude of real-world examples illustrating applications of Maya programming. It demonstrates how to use MEL to control Maya, customize its interface, automate procedures, and more.; It details how to use the C++ API to modify Maya functionality and develop tools and features to meet any need. It explains when to use MEL, when to use the C++ API, and how to use them together. It is ideal for technical directors, developers, or anyone wishing to to master Maya. It provides a storehouse of MEL scripts and C++ source code, glossary, and list of resources.

Table of Contents

  1. Copyright
    1. Dedication
  2. Preface
  3. Source Files
  4. 1. Introduction
    1. 1.1. Maya's Programmability
      1. 1.1.1. Customization
      2. 1.1.2. Integration
      3. 1.1.3. Automation
      4. 1.1.4. Extensions
    2. 1.2. Programming Interfaces
      1. 1.2.1. MEL
      2. 1.2.2. C++
      3. 1.2.3. MEL or C++?
        1. Ease of Use
        2. Specific Functionality
        3. Cross-Platform Portability
        4. Speed
        5. Disclosure
  5. 2. Fundamental Maya Concepts
    1. 2.1. Maya Architecture
      1. 2.1.1. Overview
    2. 2.2. The Dependency Graph
      1. 2.2.1. 3D Application Design
        1. Past Approaches
        2. Maya Approach
      2. 2.2.2. The Scene
      3. 2.2.3. Visualizing the Dependency Graph
      4. 2.2.4. Data Flow
      5. 2.2.5. Nodes
      6. 2.2.6. Attributes
      7. 2.2.7. Compute Function
        1. Dependent Attributes
        2. Time
      8. 2.2.8. Connecting Nodes
      9. 2.2.9. DAG Nodes
        1. Transforms and Shapes
        2. Parenting
        3. DAG Paths
        4. The Underworld
        5. Instances
      10. 2.2.10. Dependency Graph Updating
        1. Push-Pull Approach
        2. Updating in Practice
        3. Keyframe Animation Updating
  6. 3. MEL
    1. 3.1. Introduction
      1. 3.1.1. Behind the Scenes
    2. 3.2. The MEL Programming Language
      1. 3.2.1. Commands
        1. Issuing Commands
        2. Command Arguments
        3. Command Help
        4. Command Query
        5. Command Edit
        6. Command Modes
      2. 3.2.2. Variables
        1. Variable Types
        2. Automatic Variable Types
        3. Automatic Type Conversions
      3. 3.2.3. Comments
      4. 3.2.4. Operators
        1. Assignment Operator
        2. Arithmetic Operators
        3. Booleans
        4. Relational Operators
        5. Logical Operators
        6. Operator Precedence
      5. 3.2.5. Looping
        1. For
        2. While
        3. Do-While
        4. Infinite Loops
        5. Continue
        6. Break
      6. 3.2.6. Procedures
      7. 3.2.7. Scope
        1. Global and Local
        2. Initialization of Globals
        3. Conflicts
        4. Global Procedures
        5. Script Editor
      8. 3.2.8. Additional Execution Methods
        1. Command Results
        2. Eval Command
      9. 3.2.9. Efficiency
        1. Explicit Type Declaration
        2. Array Sizes
      10. 3.2.10. Additional Constructs
        1. Assignment Chaining
        2. In-Place Arithmetic Operators
        3. Increment and Decrement Operators
        4. Conditional Operator
        5. Switch Statement
        6. For-In Statement
    3. 3.3. Scripting
      1. 3.3.1. Text Editor
      2. 3.3.2. Storing Scripts
        1. Default Script Directories
        2. Custom Script Directories
        3. Automatic Startup
      3. 3.3.3. Development Preparation
      4. 3.3.4. Sourcing
      5. 3.3.5. Debugging and Testing
        1. Save Before Executing!
        2. Showing Line Numbers
        3. Tracing Script Execution
        4. Displaying Warnings and Errors
        5. Runtime Checking
        6. Determining Types
      6. 3.3.6. Versioning
      7. 3.3.7. Deployment
        1. Updating
    4. 3.4. Objects
      1. 3.4.1. Basics
        1. Listall Script
      2. 3.4.2. Hierarchies
      3. 3.4.3. Transforms
        1. Transformation Matrices
        2. Spaces
        3. ObjToWorld Script
        4. SpaceToSpace Script
      4. 3.4.4. Attributes
        1. Dynamic Attributes
        2. Attribute Information
    5. 3.5. Animation
      1. 3.5.1. Time
      2. 3.5.2. Playback
      3. 3.5.3. Animation Curves
        1. Functions
        2. Keyframing
        3. Evaluation
        4. Infinity
        5. Keys
        6. Examples
      4. 3.5.4. Skeletons
        1. OutputJoints Script
        2. ScaleSkeleton Script
        3. CopySkeletonMotion Script
      5. 3.5.5. Motion Paths
    6. 3.6. Graphical User Interfaces
      1. 3.6.1. Introduction
      2. 3.6.2. Fundamental Concepts
      3. 3.6.3. Windows
      4. 3.6.4. Layouts
        1. ColumnLayout
        2. RowLayout
        3. GridLayout
        4. FormLayout
        5. FrameLayout
        6. TabLayout
        7. ScrollLayout
        8. MenuBarLayout
      5. 3.6.5. Controls
        1. Menus
        2. Buttons
        3. Check Boxes
        4. Radio Buttons
        5. Text
        6. Lists
        7. Groups
        8. Images
        9. Panels
        10. Tools
      6. 3.6.6. Connecting Controls
        1. Attribute Groups
        2. NameField
        3. Other Elements
      7. 3.6.7. User Feedback
        1. Help
        2. Displaying Progress
    7. 3.7. Expressions
      1. 3.7.1. Learning Expressions
        1. Wiggle
        2. Flash
        3. Magnet
      2. 3.7.2. Expression Guidelines
        1. Attribute Assignment Only
        2. Supported Attribute Types
        3. Avoid setAttr and getAttr Commands
        4. Connected Attributes
        5. Automatic Deletion
      3. 3.7.3. Debugging Expressions
        1. Error Checking
        2. Tracing
        3. Disabling
        4. Broken Connections
        5. Object Renaming
      4. 3.7.4. Particle Expressions
        1. Creation and Runtime Expression Evaluation
        2. Per Object and Per Particle Attributes
        3. Vector Components
      5. 3.7.5. Advanced Expressions
        1. Combining Expressions with Keyframe Animation
  7. 4. C++ API
    1. 4.1. Introduction
    2. 4.2. Fundamental Concepts
      1. 4.2.1. Abstracted Layer
      2. 4.2.2. Classes
        1. Naming Convention
        2. Design
      3. 4.2.3. MObject
      4. 4.2.4. MFn Function Sets
        1. Custom Function Sets
    3. 4.3. Developing Plugins
      1. 4.3.1. Plugin Development under Windows
        1. Setup
        2. Execution
        3. Editing
        4. Debugging
        5. Release
      2. 4.3.2. Initialization and Uninitialization
        1. Helloworld2 Plugin
      3. 4.3.3. Errors
        1. Checking
        2. Reporting
        3. Integration
      4. 4.3.4. Loading and Unloading
      5. 4.3.5. Deployment
        1. Updating
    4. 4.4. Commands
      1. 4.4.1. Creating Commands
      2. 4.4.2. Posts1 Plugin
      3. 4.4.3. Adding Arguments
      4. 4.4.4. Posts2 Plugin
      5. 4.4.5. Posts3 Plugin
      6. 4.4.6. Providing Help
        1. Automatic Help
        2. Posts4 Plugin
      7. 4.4.7. Undo and Redo
        1. Maya's Undo/Redo Mechanism
        2. Mpxcommand Support for Undo/Redo
        3. Undoable and Nonundoable Commands
        4. Posts5 Plugin
      8. 4.4.8. Edit and Query
        1. Clock Plugin
    5. 4.5. Nodes
      1. 4.5.1. GoRolling Plugin
      2. 4.5.2. Melt Plugin
      3. 4.5.3. GroundShadow Plugin
      4. 4.5.4. Attributes
        1. Creating Attributes
        2. Compound Attributes
        3. Default Values
        4. Attribute Properties
        5. Dynamic Attributes
      5. 4.5.5. Compute Function
      6. 4.5.6. Plugs
      7. 4.5.7. Datablocks
      8. 4.5.8. Node Design Guidelines
        1. Simplicity
        2. Context
        3. Locality
        4. Networks of Nodes
    6. 4.6. Locators
      1. 4.6.1. BasicLocator Plugin
    7. 4.7. Manipulators
      1. 4.7.1. BasicLocator2 Plugin
    8. 4.8. Deformers
      1. 4.8.1. SwirlDeformer Plugin
      2. 4.8.2. Dependency Graph Changes
      3. 4.8.3. Accessories
      4. 4.8.4. SwirlDeformer2 Plugin
    9. 4.9. Advanced C++ API
      1. 4.9.1. General
        1. Referencing Nodes
        2. Proxies
        3. Networked and Nonnetworked Plugs
      2. 4.9.2. Dependency Graph
        1. Contexts
        2. Datablocks
        3. Propagation Flags
        4. Handling Pass-Through
        5. Cyclic Dependencies
  8. A. Additional Resources
    1. Online Resources
      1. Companion Website
      2. Additional Websites
        1. Alias | Wavefront
        2. Highend3D
        3. Bryan Ewert
    2. Maya Application
      1. Documentation
        1. Learning MEL
        2. Learning C++ API
        3. MEL Reference
        4. C++ API Reference
      2. Examples
        1. MEL Examples
        2. C++ API Examples
  9. B. MEL for C Programmers
  10. C. Further Reading
    1. Mathematics
    2. Programming
      1. General
      2. C++ Language
    3. Computer Graphics
      1. General
      2. Modeling
      3. Animation
      4. Image Synthesis
  11. Glossary
  12. About the Author