MEL scripting for Maya animators

cover image

Where to find it

Information & Library Science Library

Call Number
TR897.7 .W555 2005
Status
Available

Summary

Trying to learn Maya programming from the documentation can be daunting whether or not you are a programmer. The first edition of MEL Scripting for Maya Animators earned the reputation as the best introductory book on MEL, Maya's scripting language. Now fully revised and updated, the second edition also includes new features, such as a discussion of global procedures, new chapters on fixing programming bottlenecks, advanced user interface techniques, and optimizing character rigs. New chapters on utility nodes and Maya's Web Panel feature provide new ideas on how to use MEL in applications.

This new edition has kept the popular style of the first edition that offered very clear explanations of programming concepts to those without programming experience. A generous collection of code examples and Maya scene files is included on the companion Web site. This is a book for animators, artists, game developers, visual effects developers, and technical directors who want to learn the fundamentals of Maya, how to automate tasks, personalize user interfaces, build custom tools, and solve problems with MEL.

Contents

  • Preface p. xvii
  • Special Acknowledgment p. xviii
  • Chapter 1 Maya Under the Hood p. 1
  • In this chapter you will learn p. 1
  • Why Look Under the Hood? p. 1
  • The Dependency Graph, Attributes, and Connections p. 2
  • Example 1 Using the Hypergraph to Explore the Dependency Graph p. 8
  • Transform Hierarchy and Parent/Child Relationships p. 13
  • Examining the Hierarchy p. 15
  • Transform and Shape Nodes p. 15
  • Example 2 Exploring Transform and Shape Nodes, Instancing, and History p. 17
  • MEL and Maya's User Interface p. 20
  • What to Remember About How Maya Works Behind the Scenes p. 20
  • Chapter 2 The Basics of MEL Commands p. 23
  • In this chapter you will learn p. 23
  • Can I Use MEL Without Scripting? p. 23
  • Command Line and Command Feedback Line p. 24
  • Command Shell p. 25
  • Script Editor p. 25
  • Script Editor Versus Command Shell p. 27
  • Script Editor's Messages as MEL Code p. 27
  • Making a Shelf Button for a MEL Script p. 29
  • Saving a MEL Script p. 29
  • Seductive Dangers of the Status Message Area p. 30
  • The whatIs Command p. 31
  • Basic Structure of MEL Commands p. 32
  • Where to Find Information About Maya and MEL on the Internet p. 33
  • Newsgroups p. 34
  • How to Use MEL Scripts Found on the Internet p. 34
  • What to Remember About How to Use MEL Without Writing Scripts p. 35
  • Chapter 3 Using Expressions p. 37
  • In this chapter you will learn p. 37
  • What Is an Expression? p. 37
  • How Does an Expression Work? p. 38
  • Equals Sign: Equality and Assignment p. 38
  • How Maya Implements Expressions p. 40
  • Is Maya's Expression Language the Same as MEL? p. 41
  • When (and When Not) to Use an Expression p. 42
  • Defining Relationships Between Attributes p. 43
  • What Is Operator Precedence? p. 44
  • Walkthrough of Maya's Expression Language p. 45
  • Definitions of Variables p. 46
  • Computing the Values of Attributes p. 49
  • Assigning Computed Values p. 49
  • Example 1 Eyes p. 50
  • Analyzing the Problem p. 51
  • Planning the Eyes' Animation Controls p. 54
  • Writing the Expression p. 54
  • What to Remember About Using Expressions p. 60
  • Chapter 4 Controlling Particles with Expressions p. 61
  • In this chapter you will learn p. 61
  • Two Kinds of Particle Object Attributes: Per Object and Per Particle p. 61
  • All About Vectors p. 62
  • Two Kinds of Expressions: Ordinary and Particle p. 68
  • Example 1 Ordinary Expressions and a Newton Field p. 68
  • Example 2 A Simple Particle Expression p. 73
  • A Few Hints for Efficient Particle Expressions p. 80
  • Example 3 Helical Particles Around a Curve p. 80
  • What to Remember About Particle Expressions in Maya p. 93
  • Chapter 5 Problem Solving with MEL Scripting p. 95
  • In this chapter you will learn p. 95
  • MEL's Role in Maya: Building Scenes p. 95
  • Strategies for Planning MEL Applications p. 97
  • The Simplest User Interface p. 98
  • Creating, Editing, and Querying Nodes in MEL p. 100
  • Adding, Setting, and Getting Values of Attributes in MEL p. 101
  • Connecting Attributes in MEL p. 102
  • Creating and Connecting Expression Nodes in MEL p. 103
  • Example 1 Using MEL to Automate Setup for Spiral Particles p. 104
  • What to Remember About Writing MEL Scripts p. 112
  • Chapter 6 Variables and Data Types p. 115
  • In this chapter you will learn p. 115
  • Declaring Variables (and Not Declaring Them) p. 115
  • Environment Variables p. 121
  • MEL Statements and Type Checking p. 121
  • Simple and Aggregate Data Types p. 122
  • What to Remember About Variables and Data Types in MEL p. 134
  • Chapter 7 Using MEL Commands p. 137
  • In this chapter you will learn p. 137
  • What Is a MEL Command? p. 137
  • Structure of a MEL Command p. 138
  • Using MEL Commands in MEL Scripts p. 141
  • Avoid Using MEL Commands in Expressions p. 143
  • What to Remember About Using MEL Commands p. 143
  • Chapter 8 Manipulating Nodes in MEL p. 145
  • In this chapter you will learn p. 145
  • Using Is Command to Find Nodes by Name or Other Properties p. 145
  • Using Select Command to Manage Object Selection p. 148
  • Creating Nodes in a Maya Scene p. 150
  • Finding a Node's Parents and Children p. 151
  • Finding Information on Node Connections p. 152
  • About Maya's Node Types and the Node and Attribute Reference p. 153
  • What to Remember About Managing Nodes in MEL p. 154
  • Chapter 9 Controlling the Flow of Execution p. 155
  • In this chapter you will learn p. 155
  • Controlling the Flow of Script Execution p. 155
  • Basic Conditional Operations: if-else and switch p. 157
  • Loops p. 167
  • What to Remember About Controlling the Flow of Execution in MEL p. 170
  • Chapter 10 Procedures and Functions p. 171
  • In this chapter you will learn p. 171
  • Top-Down Design p. 171
  • Example 1 A Trip to the Grocery Store p. 172
  • What Are Procedures and Functions? p. 174
  • Example 2 Geometry-Constrained Locators p. 178
  • Example 3 Recursive Antenna p. 182
  • What to Remember About Procedures, Functions, and Top-Down Design in MEL p. 186
  • Chapter 11 Naming Nodes, Scripts, and Variables p. 189
  • In this chapter you will learn p. 189
  • Why Naming Conventions Are Important p. 189
  • Naming Scripts p. 190
  • Naming Variables p. 191
  • Naming Nodes p. 192
  • Example 1 Adding a Name Prefix to Objects in a Hierarchy p. 195
  • Example 2 Changing Name Prefixes in a Hierarchy p. 197
  • What Are Namespaces? p. 200
  • Strategies for Using Namespaces p. 203
  • What to Remember About Naming Scripts, Variables, and Nodes p. 203
  • Chapter 12 Designing MEL User Interfaces p. 205
  • In this chapter you will learn p. 205
  • What Is a User Interface? p. 205
  • What Maya Users Expect to See from a MEL Script p. 206
  • Questions to Answer Before Designing a User Interface p. 208
  • Designing and Testing a User Interface p. 209
  • Structure of a Dialog Box p. 210
  • What to Remember About Designing User Interfaces in MEL p. 212
  • Chapter 13 Simple MEL User Interfaces p. 213
  • In this chapter you will learn p. 213
  • Collecting Information from Users p. 213
  • Validating User Input: When and Why p. 214
  • Asking for Confirmation with confirmDialog p. 216
  • Asking User for Text String with promptDialog p. 217
  • Asking User to Pick File or Directory with fileDialog p. 218
  • Handling Warnings and Errors with Warning and Error Commands p. 219
  • Using Regular Expressions and match to Validate Data p. 219
  • How Regular Expressions Work p. 220
  • Validating Integers p. 222
  • Validating Floating-Point Numbers p. 223
  • Validating Object Names (Without Namespaces) p. 224
  • Example 1 Simple Dialogs and Input Validation p. 225
  • What to Remember About Simple MEL User Interfaces and Input Validation p. 230
  • Chapter 14 Custom Dialog Boxes p. 231
  • In this chapter you will learn p. 231
  • How to Structure a Script That Uses a Custom Dialog Box for Input p. 231
  • Dialog Boxes and Their Contents p. 232
  • Example 1 Making the Example Dialog Box p. 235
  • Common Types of Controls p. 243
  • Common Types of Layouts p. 249
  • Example 2 Dialog Box for Making Geometric Primitives p. 252
  • What to Remember About Building Custom Dialog Boxes in MEL p. 256
  • Chapter 15 Making Advanced Dialog Boxes with formLayout p. 259
  • In this chapter you will learn p. 259
  • Why Use formLayout? p. 259
  • Planning a Dialog Box for formLayout p. 260
  • Using formLayout: Overview p. 261
  • Using formLayout: Defining Placement Rules for UI Objects p. 264
  • Example: Implementing a Dialog Box with formLayout p. 266
  • What to Remember About Making Dialog Boxes with formLayout p. 270
  • Chapter 16 Making Advanced Dialog Boxes with Web Panels p. 271
  • In this chapter you will learn p. 271
  • What You Need to Know Before You Proceed p. 271
  • What Are Web Panels? p. 272
  • Learning Web Authoring p. 273
  • How a Dialog Box Built with Web Panels Works p. 274
  • Planning a Dialog Box for Web Panels p. 275
  • Creating a Web-Based Dialog Box for Maya p. 275
  • Launching a Web-Based Dialog Box from MEL p. 278
  • Example 1 Implementing a Dialog Box using JavaScript p. 283
  • Ideas for Dialog Boxes Built with Web Panels p. 293
  • What to Remember about Making Dialog Boxes with Web Panels p. 294
  • Chapter 17 Improving Performance with Utility Nodes p. 295
  • In this chapter you will learn p. 295
  • What Is a Utility Node? p. 295
  • When Should You Consider Using a Utility Node? p. 296
  • How to Create and Connect a Utility Node p. 297
  • Example 1 Using the plusMinusAverage Node to Find the Midpoint Between Two Locators p. 300
  • Common Utility Nodes p. 301
  • What to Remember About Improving Performance With Utility Nodes p. 302
  • Chapter 18 Installing MEL Scripts p. 303
  • In this chapter you will learn p. 303
  • Installing a Script to Make It Available in All Scenes p. 303
  • Installing a Script to Run When Maya Starts p. 304
  • Installing a Script into a Script Node in a Scene p. 304
  • Installing Custom Menus p. 306
  • Managing Button Shelves and Creating Custom Shelf Icons p. 306
  • What to Remember About Installing MEL Scripts p. 307
  • Chapter 19 Examples Using MEL with Particle Dynamics p. 309
  • Example 1 Introduction to Particle Goals p. 309
  • Example 2 Particle Goals on a Surface p. 315
  • Example 3 Using Goals on Multiple Surfaces p. 329
  • Example 4 Using Goals on Surfaces, Part 2 p. 338
  • Chapter 20 Examples Using MEL with Solid Body Dynamics p. 351
  • Example 1 Particle Collisions p. 351
  • Example 2 Collision Events p. 361
  • Example 3 Collisions Between Objects in Solid Dynamics p. 374
  • Example 4 Solid Dynamics and Particles p. 394
  • Chapter 21 Example of a Simple Crowd System p. 409
  • Example 1 Creating a Vehicle p. 409
  • Example 2 Vehicle Interaction p. 424
  • Example 3 Vehicle Environment p. 437
  • Example 4 Fine Tuning and Completing the Script p. 449
  • Full Script Reference: crowdSystem.mel p. 473
  • Chapter 22 Examples Using MEL in Character Rigging p. 485
  • Example 1 Character Controls p. 485
  • Example 2 Building a Character User Interface p. 499

Other details