Chapter 11: MEL Script - PowerPoint PPT Presentation

About This Presentation
Title:

Chapter 11: MEL Script

Description:

Maya 8 at a Glance. Chapter 11: MEL Script. What is Scripting? 2 ... MEL exists 'inside' Maya; many of Maya's visual elements are driven by MEL ... – PowerPoint PPT presentation

Number of Views:66
Avg rating:3.0/5.0
Slides: 13
Provided by: janet65
Category:
Tags: mel | chapter | maya | script

less

Transcript and Presenter's Notes

Title: Chapter 11: MEL Script


1
Maya 8 at a Glance
  • Chapter 11 MEL Script

2
What is Scripting?
  • Scripts are a series of commands that are
    interpreted line by line, rather than being
    compiled
  • MEL exists inside Maya many of Mayas visual
    elements are driven by MEL
  • Scripts can help optimize any stage of the
    production pipeline

2
3
Creating and Running Scripts
  • The Script Editor allows you to input lines of
    MEL script in order to be executed or saved
  • Sourcing a script allows you to execute the
    contents of a saved MEL script
  • MEL scripts can be saved to shelves for easy
    access

3
4
Setting Attributes
  • An attribute is an editable property that
    describes how an object looks or behaves
  • Attributes can be set via the setAttr command

4
5
Variable Rules
  • Variable names must begin with a dollar sign
  • Variable names can only include letters,
    numbers, and underscores
  • The first character after the dollar sign cannot
    be a number
  • Variables must be declared before they can be
    used

5
6
Variable Types
Int
String
Float
Vector
Matrix
Array
6
7
Looping
  • Looping allows code to execute a specified
    number of times
  • Good for repetitive work
  • There are four types of loops
  • For Loop
  • For-In Loop
  • While Loop
  • Do-While Loop

7
8
Listing Objects
  • Often you need to list objects that are in the
    scene based on certain parameters
  • The ls command lists all objects in the scene
  • Flags such as ls selection and ls Boards can
    be specified to filter your list

8
9
Branching
  • Branching allows you to go separate paths in
    code based on an arbitrary true/false condition
  • Ifelse statements are the most common way to
    create conditional logic in MEL
  • Switch statements branches by comparing a
    control variable to cases
  • Switches are ideal for when there are many
    possibilities based on the condition of a variable

9
10
GUI Layout Options
Column
Row
Grid
Frame
Form
Scroll/Row
Tab/Form
Pane
Shelf
10
11
GUI Control Options
Button
Canvas
Checkbox
Fields
Scroll
Slider
Radio button
Separator
Label
11
12
Expressions
  • Mathematical equations, programming commands,
    and MEL commands that can precisely control an
    objects motion
  • Used in rigging and for motion that requires
    mathematical equations, such as a tire rotating
    based on the motion of a car

12
Write a Comment
User Comments (0)
About PowerShow.com