You are previewing MEL Scripting a Character Rig in Maya.
O'Reilly logo
MEL Scripting a Character Rig in Maya

Book Description

Whether for big budget films and game productions or lower budget TV and Internet content, creating flexible and believable character rigs is an essential skill required to bring any 3D animation to life. As the leading software used for cutting-edge animation, Maya has an established rigging toolset for creating realistic character controls. Traditionally, however, the process of manually building custom rigs in the software interface has been time-consuming and expensive for those who want to produce high-quality 3D characters. Now for the first time and from the author of the best-seller, Maya Character Creation, comes an in-depth guide on how the pros are using MEL (Maya Embedded Language) scripting to streamline and automate the rigging process. With MEL Scripting a Character Rig in Maya, you’ll learn how you can build custom character rigs in a matter of seconds, as opposed to days or weeks.

In this detailed guide, you’ll learn:

• The techniques used to build a complex character rig in the software interface, followed by instructions for writing the equivalent MEL code for scripting the entire process.
• Fundamental concepts of creating animation controls in Maya, from the basics of creating, editing, and binding skeletons, to more complex rigs with controls that employ spline IK and channel connections.
• Important coding techniques such as using conditional statements, loops, variables, and procedures.
• How to create a character animation GUI (Graphical User Interface) that makes animating the character easy and fast.
• Important skills for building rigs using numerous hands-on exercises, all code examples and Maya files available on the companion Web site.

Table of Contents

  1. Copyright
    1. Dedication
  2. Acknowledgments
  3. Introduction
    1. Who Should Read This Book
    2. Why This Book?
    3. How This Book Is Organized
      1. Chapter 1: Starting to Rig a Character
      2. Chapter 2: Learning to Script in MEL
      3. Chapter 3: Scripting a Basic IK Biped Rig
      4. Chapter 4: Adding Advanced Rig Controls
      5. Chapter 5: Finishing the IK Biped Rig
      6. Chapter 6: Scripting an Advanced Character GUI
    4. How To Use This Book
    5. Note from the Author
  4. 1. Starting to Rig a Character
    1. Rigging in Computer Animation
      1. The Job of a Rigging Artist
      2. Character Rigging in a 3D Production
      3. Important Goals for a Rigging Artist
      4. How Digital Rigging Has Evolved
        1. The Trend Toward Believable Character Movement
        2. The Trend Toward Scripting Character Controls
      5. Developing Skills
        1. Being a Technical Artist
        2. Using the Power of Logic
        3. Troubleshooting Rig Problems
    2. About Maya Skeletons
      1. Preparing to Create Skeletons
      2. Drawing Joints
      3. Understanding Joint Orientation
      4. Fitting and Animating Skeletons
      5. Setting Joint Tool Options
      6. Organizing Nodes in the Hypergraph
    3. Editing Skeletons
      1. Making Basic Skeleton Edits
        1. Inserting Joints
        2. Rerooting a Skeleton
        3. Removing Joints
        4. Disconnecting Joints
        5. Connecting Joints
        6. Mirroring Joints
        7. Resetting Joint Orientation
        8. Freezing Skeletons
    4. Performing a Test Bind
      1. Introduction to Smooth Binding
      2. Introduction to Painting Skin Weights
  5. 2. Learning to Script in MEL
    1. MEL Scripting Basics
      1. Starting to Code in Maya
        1. Using the Script Editor
        2. About MEL Syntax
        3. Deciphering Error Messages
      2. Getting Basic Help on Commands
        1. Looking Up Commands in the MEL Command Reference
        2. Streamlining Your MEL Code
      3. Following Scripting Conventions
        1. Formatting Code
        2. Adding Comments
        3. Writing Print Statements
      4. Learning Essential Coding Techniques
        1. Using Variables
        2. Using Arrays
        3. Catching Return Values
        4. Querying and Editing Attributes through Flags
        5. Running List and Select Commands
        6. Getting, Setting, and Listing Attributes
        7. Adding Custom Attributes
        8. Transforming with the Xform Command
      5. Using Procedures
        1. Creating a Procedure
        2. Using Arguments and Return Statements
        3. Writing an Xform Query Global Procedure
        4. Creating an Xform Query Tool
      6. Saving MEL Code
        1. Working with Shelf Buttons
        2. Saving MEL Script Files
        3. Using a Dedicated Script Editor
        4. Saving MEL Code in a Maya Scene File
    2. Refining Your Scripts
      1. Using Conditions and Loops
        1. If, Else, and Else If Statements
        2. Warnings and Errors
        3. Switch Statements
        4. While Loops
        5. For-in and for Loops
        6. Examining Some Maya Procedures
      2. MEL Rigging Essentials
        1. Preventing Naming Conflicts
        2. Coding Hierarchies
        3. Manipulating Strings
        4. Using Matrices
        5. Writing and Reading Files
        6. MEL Scripting a Basic GUI
        7. Using a GUI to Input Data to a Procedure
  6. 3. Scripting a Basic IK Biped Rig
    1. Creating the Basic Rig Components
      1. Using IK Skeletons in the Biped Rig
        1. Adding an IK Solver to Skeletons in the Joint Tool
        2. Ensuring a Preferred Angle on IK Skeletons
        3. About Standard IK Solver Types
        4. Manipulating the Rotate Plane with a Constraint
        5. Drawing the Biped Rig Skeletons
        6. Preparing to Script the Basic Rig Skeletons
      2. Creating Icons
        1. Drawing Icon Curves
        2. Creating a Composite Sphere Icon
        3. Preparing to Script Icons
    2. Building the Basic Biped Rig
      1. Creating the Rig Hierarchy in the Hypergraph
        1. Preparing to Create the Biped Rig
        2. Creating the Lower Body Hierarchy
        3. Adding the Upper Body Hierarchy
        4. Completing Parenting of the Basic Rig Hierarchy
        5. Adding Constraints to the Eyes and Limbs
      2. Preparing to Script the Basic Rig Hierarchy
  7. 4. Adding Advanced Rig Controls
    1. Enhancing the IK Limb Controls
      1. Creating an Advanced Arm Rig
        1. Improving Bind Deformations
        2. Adding Upper Arm FK Skeletons
        3. Driving the Upper Arm Twisting
        4. Creating Forearm Twist Controls
        5. Adding FK Finger Skeletons
        6. Driving Arm Joints with SDKs
        7. Cleaning Up the Arm Icon Channels
    2. Upgrading the Legs and Feet
      1. Adding Advanced IK Feet Controls
      2. Driving and Cleaning the IK Foot Controls
      3. MEL Scripting the Advanced Controls
    3. Creating Advanced Head and Torso Controls
      1. Upgrading the Head and Face Rig
        1. Adding Skeletons to the Face
        2. Creating Muscle-Flexing with Skeletons
        3. Rotating Joints around Facial Features
      2. Building an Advanced Torso Rig
        1. Preparing to Add Spline IK to the Backbone
        2. Drawing the New Backbone Skeletons
        3. Adding Spline IK to the Skeletons
        4. Creating the Spine Icon Controls
        5. Making the Lower Spine Stretchy
        6. Setting the Advanced Spline IK Twist Attributes
        7. Completing the Advanced Torso Rig
  8. 5. Finishing the IK Biped Rig
    1. Creating a Final Bind
      1. Checking the Skin Model
      2. Smooth Binding the Advanced Rig
      3. Using Smooth Binding Options
        1. Bind To
        2. Bind Method
        3. Max Influences
        4. After Bind
        5. Dropoff Rate
        6. Remove Unused Influences
        7. Colorize Skeleton
    2. Editing the Final Bind
      1. Adding Joints as Influence Objects
      2. Using Geometry as Influence Objects
      3. Setting Keys to Facilitate Editing Weights
      4. Using the Paint Skin Weights Tool
        1. Brush
        2. Influence
        3. Paint Weights
        4. Stroke, Stylus Pressure, and Display
      5. Editing Weights in the Component Editor
      6. Editing Weights Using Menu Commands
        1. Mirroring Skin Weights
        2. Copying Skin Weights
        3. Smoothing and Pruning Skin Weights
    3. Using Indirect Deformation Techniques
      1. Binding with a Proxy Skin
        1. Copying Skin Weights from Proxy to Main Skin
        2. Saving Proxy Weights to a File
      2. Morphing Through a Proxy Head
        1. Creating Blend Shapes on the Proxy Head
        2. Using the Blend Shape Editor
        3. Adding in-between Shapes
        4. Connecting the Proxy Head to the Skin
        5. Combining Blend Shapes with Joint Deformations
  9. 6. Scripting an Advanced Character GUI
    1. Creating More GUI Controls
      1. Reviewing Basic Controls in the Setup GUI
      2. Using Alignment Flags on a Control Group
      3. Adding a Window Menu
      4. Incorporating Custom Images
      5. Creating Slider Controls
        1. Generating Decimal Values with Float Sliders
        2. Connecting Sliders to Attributes
        3. Using Slider-Button Groups
    2. Designing a Character GUI
    3. Working with Layouts
      1. Parenting Basic Layouts
      2. Using Intermediate Layouts
        1. Nesting Controls in Collapsing Frames
        2. Organizing a Window with Panels
        3. Overlapping Controls in Tabs
    4. Designing an Advanced GUI
      1. Nesting Intermediate Layouts
      2. Running Script Jobs
        1. Creating Script Jobs
        2. Managing Jobs in Memory