An Introduction to MEL Scripting for Animators

Post on 07-Jan-2016

41 views 2 download

Tags:

description

Presented by: Paul Robbins. An Introduction to MEL Scripting for Animators. Who I am. Who I am. Education. Who I am. Education - BFA in Digital Art/Design from Henderson State University with a minor in Computer Science. Who I am. Education - PowerPoint PPT Presentation

Transcript of An Introduction to MEL Scripting for Animators

An Introduction to MEL Scripting for Animators

Presented by: Paul Robbins

Who I am

Who I am Education

Who I am Education

- BFA in Digital Art/Design from Henderson State University with a minor in Computer Science

Who I am Education

- BFA in Digital Art/Design from Henderson State University with a minor in Computer Science

- BS in Computer Animation from Full Sail

Who I am Experience

Who I am Experience

- Animator at Insomniac Games

Who I am Experience

- Animator at Insomniac Games

- Animator at Activision’s Raven Software

Who I am Experience

- Animator at Insomniac Games

- Animator at Activision’s Raven Software

- Wolfenstein

Who I am Experience

- Animator at Insomniac Games

- Animator at Activision’s Raven Software

- Wolfenstein

- Singularity

Who I am Experience

- Animator at Insomniac Games

- Animator at Activision’s Raven Software

- Wolfenstein

- Singularity

Outline

Outline Basics

- What is MEL?

- How Maya Uses MEL

- Script Editor

- MEL Commands

- Variables

- Return Values

Outline Usage and How to Learn MEL

- Script Editor

- MEL Command Reference

- Other People’s Scripts

Outline Usage and How to Learn MEL

- Script Editor

- MEL Command Reference

- Other People’s Scripts

Outline Example Script

- How it Works

- The Process of Writing It

Outline Helpful Resources

MEL Basics

MEL Basics What is MEL?

MEL Basics What is MEL?

- Stands for Maya Embedded Language

MEL Basics What is MEL?

- Stands for Maya Embedded Language- Scripting language that’s unique to Maya

MEL Basics What is MEL?

- Stands for Maya Embedded Language- Scripting language that’s unique to Maya- Easier to learn than programming languages like

C++

MEL Basics How Maya Uses MEL

MEL Basics How Maya Uses MEL

- Menus- Shelf Buttons- Hotkeys- Expressions- GUI

MEL Basics Script Editor

MEL Basics Script Editor

- You get to it by hitting

MEL Basics Script Editor

- Top area displays the MEL that Maya just did

MEL Basics Script Editor

- Top area displays the MEL that Maya just did- Bottom area is a work area where you type code

interactively

MEL Basics Script Editor

- Top area displays the MEL that Maya just did- Bottom area is a work area where you type code

interactively- Selecting text and hitting ‘ctrl + Enter’ executes

code

MEL Basics Script Editor

- Top area displays the MEL that Maya just did- Bottom area is a work area where you type code

interactively- Selecting text and hitting ‘ctrl + Enter’ executes

code- Make a shelf button by selecting text and middle

mouse dragging to the shelf

MEL Basics MEL Commands

MEL Basics MEL Commands

- Structure

MEL Basics MEL Commands

- Structure<command name> -flags values;

MEL Basics MEL Commands

- Structure<command name> -flags values;

MEL Basics MEL Commands

- Structure<command name> -flags values;

MEL Basics MEL Commands

- Structure<command name> -flags values;

MEL Basics MEL Commands

- Structure<command name> -flags values;

- Example 1sphere -radius 3;

MEL Basics MEL Commands

- Structure<command name> -flags values;

- Example 1sphere -radius 3;

- Example 2polySphere -radius 2.5 -subdivisionsX 10 -subdivisionsY 30 -name "Rambo";

MEL Basics MEL Commands

- Structure<command name> -flags values;

- Example 1sphere -radius 3;

- Example 2polySphere -radius 2.5 -subdivisionsX 10 -subdivisionsY 30 -name "Rambo";

- These flags are like the option box settings

MEL Basics MEL Commands

- Modes

MEL Basics MEL Commands

- ModesCreationEditQuery

MEL Basics MEL Commands

- Modes- Creation

- by default

MEL Basics MEL Commands

- Modes- Creation

- by default- Edit

- Used to change values of an existing object

MEL Basics MEL Commands

- Modes- Creation

- by default- Edit

- Used to change values of an existing object

- Query- Used to get a value from an existing

object

MEL Basics MEL Commands

- Examples of Modes

MEL Basics MEL Commands

- Examples of Modes- Creation

polySphere;

MEL Basics MEL Commands

- Examples of Modes- Creation

polySphere;- Edit

polySphere -edit -radius 4 “Rambo”;

MEL Basics MEL Commands

- Examples of Modes- Creation

polySphere;- Edit

polySphere -edit -radius 4 “Rambo”;- Query

polySphere -query -radius “Rambo”;

MEL Basics Variables

MEL Basics Variables

- Are for storing data

MEL Basics Variables

- Are for storing data- Always start with a ‘$’

MEL Basics Variables

- Are for storing data- Always start with a ‘$’- Data Types

MEL Basics Variables

- Are for storing data- Always start with a ‘$’- Data Types

- Int (Stands for Integer)

MEL Basics Variables

- Are for storing data- Always start with a ‘$’- Data Types

- Int (Stands for Integer)4

MEL Basics Variables

- Are for storing data- Always start with a ‘$’- Data Types

- Int (Stands for Integer)4

- Float

MEL Basics Variables

- Are for storing data- Always start with a ‘$’- Data Types

- Int (Stands for Integer)4

- Float7.259

MEL Basics Variables

- Are for storing data- Always start with a ‘$’- Data Types

- Int (Stands for Integer)4

- Float7.259

- String

MEL Basics Variables

- Are for storing data- Always start with a ‘$’- Data Types

- Int (Stands for Integer)4

- Float7.259

- String“Frito Chili Pie”

MEL Basics Variables

- Declaring a variable- To MAYA!

MEL Basics Variables

- Declaring a variable- int $theNumberAwesome = 42;

MEL Basics Variables

- Declaring a variable- int $theNumberAwesome = 42;

- Equals sign assigns a value to a variable

MEL Basics Return Values

MEL Basics Return Values

- Are the result of running a command

MEL Basics Return Values

- Are the result of running a commandreturnValue <command name> -flags values;

MEL Basics Return Values

- Are the result of running a commandreturnValue <command name> -flags values;

MEL Basics Return Values

- Are the result of running a commandreturnValue <command name> -flags values;

- Use backquotes to store the return value/result of a command in a variable

MEL Basics Return Values

- Are the result of running a commandreturnValue <command name> -flags values;

- Use backquotes to store the return value/result of a command in a variable

int $variable = `<command name> -flags values`;

Usage and How to Learn MEL

Usage and How to Learn MELScript Editor

Usage and How to Learn MELScript Editor

- Echo All Commands

Usage and How to Learn MELScript Editor

- Echo All Commands- Displays commands that don’t normally display

Usage and How to Learn MELScript Editor

- Echo All Commands- Displays commands that don’t normally display

- Help

Usage and How to Learn MELScript Editor

- Echo All Commands- Displays commands that don’t normally display

- Help- help polySphere;

Usage and How to Learn MELScript Editor

- Echo All Commands- Displays commands that don’t normally display

- Help- help polySphere;- List of what flags a command uses

Usage and How to Learn MELScript Editor

- Echo All Commands- Displays commands that don’t normally display

- Help- help polySphere;- List of what flags a command uses- shows the flags short and long names

Usage and How to Learn MELScript Editor

- Echo All Commands- Displays commands that don’t normally display

- Help- help polySphere;- List of what flags a command uses- shows the flags short and long names- shows the data type of a flags value

Usage and How to Learn MELScript Editor

- Echo All Commands- Displays commands that don’t normally display

- Help- help polySphere;- List of what flags a command uses- shows the flags short and long names- shows the data type of a flags value

- whatIs?

Usage and How to Learn MELScript Editor

- Echo All Commands- Displays commands that don’t normally display

- Help- help polySphere;- List of what flags a command uses- shows the flags short and long names- shows the data type of a flags value

- whatIs?- whatIs editMenuUpdate;

Usage and How to Learn MELScript Editor

- Echo All Commands- Displays commands that don’t normally display

- Help- help polySphere;- List of what flags a command uses- shows the flags short and long names- shows the data type of a flags value

- whatIs?- whatIs editMenuUpdate;- use if you just don’t recognize something

Usage and How to Learn MELMEL Command Reference

Usage and How to Learn MELMEL Command Reference

- To the MEL Command Reference!

Usage and How to Learn MELOther People’s Scripts

Usage and How to Learn MELOther People’s Scripts

- Try to trace what’s happening

Usage and How to Learn MELOther People’s Scripts

- Try to trace what’s happening- Look up what you don’t know in the Command

Reference

Usage and How to Learn MELOther People’s Scripts

- Try to trace what’s happening- Look up what you don’t know in the Command

Reference- Write up the new commands you learn to get

comfortable with them

Example Script

Example ScriptCycle Tangent Select

Example ScriptCycle Tangent Select

- The Codestring $selectedCurve[] = `keyframe -query -selected -name`;int $firstKey = `findKeyframe -which "first" $selectedCurve[0]`;int $lastKey = `findKeyframe -which "last" $selectedCurve[0]`;

selectKey -replace -keyframe -time $firstKey $selectedCurve[0];selectKey -add -keyframe -time $lastKey $selectedCurve[0];

keyTangent -edit -inTangentType flat -outTangentType flat;

selectKey -add -outTangent -time $firstKey $selectedCurve[0];selectKey -add -outTangent -time $lastKey $selectedCurve[0];

Example ScriptCycle Tangent Select

- The Process

Example ScriptCycle Tangent Select

- The Process- Come up with the idea

Example ScriptCycle Tangent Select

- The Process- Come up with the idea- Step through it manually with Echo All Commands on

Example ScriptCycle Tangent Select

- The Process- Come up with the idea- Step through it manually with Echo All Commands on- Use Command Reference to understand all

the commands that the script editor spits out

Example ScriptCycle Tangent Select

- The Process- Come up with the idea- Step through it manually with Echo All Commands on- Use Command Reference to understand all

the commands that the script editor spits out- Grab the commands from the script editor

Helpful Resources

Helpful ResourcesBooks

Helpful ResourcesBooks

- MEL Scripting for MAYA Animatorsby Mark R. Wilkins and Chris Kazmier

Helpful ResourcesBooks

- Complete Maya Programmingby David A. D. Gould

Helpful ResourcesWebsites

Helpful ResourcesWebsites

- forums.cgsociety.org (CGTalk)

Helpful ResourcesWebsites

- forums.cgsociety.org (CGTalk) - creativecrash.com (formerly Highend3d.com)

Helpful ResourcesWebsites

- forums.cgsociety.org (CGTalk)- creativecrash.com (formerly Highend3d.com)- tech-artists.org

Helpful ResourcesWebsites

- forums.cgsociety.org (CGTalk)- creativecrash.com (formerly Highend3d.com)- tech-artists.org- area.autodesk.com

Conversational MEL Tutorial

Conclusion

ConclusionWhat we’ve covered

ConclusionWhat we’ve covered

- How Maya uses MEL

ConclusionWhat we’ve covered

- How Maya uses MEL- The Script Editor and how to see the MEL that

Maya uses

ConclusionWhat we’ve covered

- How Maya uses MEL- The Script Editor and how to see the MEL that

Maya uses- Commands

ConclusionWhat we’ve covered

- How Maya uses MEL- The Script Editor and how to see the MEL that

Maya uses- Commands- Variables

ConclusionWhat we’ve covered

- How Maya uses MEL- The Script Editor and how to see the MEL that

Maya uses- Commands- Variables- Return Values

ConclusionWhat we’ve covered

- How Maya uses MEL- The Script Editor and how to see the MEL that

Maya uses- Commands- Variables- Return Values- And an Example Script

Thank You

Background image from www.interweb.in/wallpaper