an introduction to mel scripting for animators

112
An Introduction to MEL Scripting for Animators Presented by: Paul Robbins

Upload: chaka

Post on 07-Jan-2016

60 views

Category:

Documents


2 download

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

Page 1: An Introduction to MEL  Scripting for Animators

An Introduction to MEL Scripting for Animators

Presented by: Paul Robbins

Page 2: An Introduction to MEL  Scripting for Animators

Who I am

Page 3: An Introduction to MEL  Scripting for Animators

Who I am Education

Page 4: An Introduction to MEL  Scripting for Animators

Who I am Education

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

Page 5: An Introduction to MEL  Scripting for Animators

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

Page 6: An Introduction to MEL  Scripting for Animators

Who I am Experience

Page 7: An Introduction to MEL  Scripting for Animators

Who I am Experience

- Animator at Insomniac Games

Page 8: An Introduction to MEL  Scripting for Animators

Who I am Experience

- Animator at Insomniac Games

- Animator at Activision’s Raven Software

Page 9: An Introduction to MEL  Scripting for Animators

Who I am Experience

- Animator at Insomniac Games

- Animator at Activision’s Raven Software

- Wolfenstein

Page 10: An Introduction to MEL  Scripting for Animators

Who I am Experience

- Animator at Insomniac Games

- Animator at Activision’s Raven Software

- Wolfenstein

- Singularity

Page 11: An Introduction to MEL  Scripting for Animators

Who I am Experience

- Animator at Insomniac Games

- Animator at Activision’s Raven Software

- Wolfenstein

- Singularity

Page 12: An Introduction to MEL  Scripting for Animators

Outline

Page 13: An Introduction to MEL  Scripting for Animators

Outline Basics

- What is MEL?

- How Maya Uses MEL

- Script Editor

- MEL Commands

- Variables

- Return Values

Page 14: An Introduction to MEL  Scripting for Animators

Outline Usage and How to Learn MEL

- Script Editor

- MEL Command Reference

- Other People’s Scripts

Page 15: An Introduction to MEL  Scripting for Animators

Outline Usage and How to Learn MEL

- Script Editor

- MEL Command Reference

- Other People’s Scripts

Page 16: An Introduction to MEL  Scripting for Animators

Outline Example Script

- How it Works

- The Process of Writing It

Page 17: An Introduction to MEL  Scripting for Animators

Outline Helpful Resources

Page 18: An Introduction to MEL  Scripting for Animators
Page 19: An Introduction to MEL  Scripting for Animators

MEL Basics

Page 20: An Introduction to MEL  Scripting for Animators

MEL Basics What is MEL?

Page 21: An Introduction to MEL  Scripting for Animators

MEL Basics What is MEL?

- Stands for Maya Embedded Language

Page 22: An Introduction to MEL  Scripting for Animators

MEL Basics What is MEL?

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

Page 23: An Introduction to MEL  Scripting for Animators

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++

Page 24: An Introduction to MEL  Scripting for Animators

MEL Basics How Maya Uses MEL

Page 25: An Introduction to MEL  Scripting for Animators

MEL Basics How Maya Uses MEL

- Menus- Shelf Buttons- Hotkeys- Expressions- GUI

Page 26: An Introduction to MEL  Scripting for Animators

MEL Basics Script Editor

Page 27: An Introduction to MEL  Scripting for Animators

MEL Basics Script Editor

- You get to it by hitting

Page 28: An Introduction to MEL  Scripting for Animators

MEL Basics Script Editor

- Top area displays the MEL that Maya just did

Page 29: An Introduction to MEL  Scripting for Animators

MEL Basics Script Editor

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

interactively

Page 30: An Introduction to MEL  Scripting for Animators

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

Page 31: An Introduction to MEL  Scripting for Animators

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

Page 32: An Introduction to MEL  Scripting for Animators

MEL Basics MEL Commands

Page 33: An Introduction to MEL  Scripting for Animators

MEL Basics MEL Commands

- Structure

Page 34: An Introduction to MEL  Scripting for Animators

MEL Basics MEL Commands

- Structure<command name> -flags values;

Page 35: An Introduction to MEL  Scripting for Animators

MEL Basics MEL Commands

- Structure<command name> -flags values;

Page 36: An Introduction to MEL  Scripting for Animators

MEL Basics MEL Commands

- Structure<command name> -flags values;

Page 37: An Introduction to MEL  Scripting for Animators

MEL Basics MEL Commands

- Structure<command name> -flags values;

Page 38: An Introduction to MEL  Scripting for Animators

MEL Basics MEL Commands

- Structure<command name> -flags values;

- Example 1sphere -radius 3;

Page 39: An Introduction to MEL  Scripting for Animators

MEL Basics MEL Commands

- Structure<command name> -flags values;

- Example 1sphere -radius 3;

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

Page 40: An Introduction to MEL  Scripting for Animators

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

Page 41: An Introduction to MEL  Scripting for Animators

MEL Basics MEL Commands

- Modes

Page 42: An Introduction to MEL  Scripting for Animators

MEL Basics MEL Commands

- ModesCreationEditQuery

Page 43: An Introduction to MEL  Scripting for Animators

MEL Basics MEL Commands

- Modes- Creation

- by default

Page 44: An Introduction to MEL  Scripting for Animators

MEL Basics MEL Commands

- Modes- Creation

- by default- Edit

- Used to change values of an existing object

Page 45: An Introduction to MEL  Scripting for Animators

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

Page 46: An Introduction to MEL  Scripting for Animators

MEL Basics MEL Commands

- Examples of Modes

Page 47: An Introduction to MEL  Scripting for Animators

MEL Basics MEL Commands

- Examples of Modes- Creation

polySphere;

Page 48: An Introduction to MEL  Scripting for Animators

MEL Basics MEL Commands

- Examples of Modes- Creation

polySphere;- Edit

polySphere -edit -radius 4 “Rambo”;

Page 49: An Introduction to MEL  Scripting for Animators

MEL Basics MEL Commands

- Examples of Modes- Creation

polySphere;- Edit

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

polySphere -query -radius “Rambo”;

Page 50: An Introduction to MEL  Scripting for Animators

MEL Basics Variables

Page 51: An Introduction to MEL  Scripting for Animators

MEL Basics Variables

- Are for storing data

Page 52: An Introduction to MEL  Scripting for Animators

MEL Basics Variables

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

Page 53: An Introduction to MEL  Scripting for Animators

MEL Basics Variables

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

Page 54: An Introduction to MEL  Scripting for Animators

MEL Basics Variables

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

- Int (Stands for Integer)

Page 55: An Introduction to MEL  Scripting for Animators

MEL Basics Variables

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

- Int (Stands for Integer)4

Page 56: An Introduction to MEL  Scripting for Animators

MEL Basics Variables

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

- Int (Stands for Integer)4

- Float

Page 57: An Introduction to MEL  Scripting for Animators

MEL Basics Variables

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

- Int (Stands for Integer)4

- Float7.259

Page 58: An Introduction to MEL  Scripting for Animators

MEL Basics Variables

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

- Int (Stands for Integer)4

- Float7.259

- String

Page 59: An Introduction to MEL  Scripting for Animators

MEL Basics Variables

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

- Int (Stands for Integer)4

- Float7.259

- String“Frito Chili Pie”

Page 60: An Introduction to MEL  Scripting for Animators

MEL Basics Variables

- Declaring a variable- To MAYA!

Page 61: An Introduction to MEL  Scripting for Animators

MEL Basics Variables

- Declaring a variable- int $theNumberAwesome = 42;

Page 62: An Introduction to MEL  Scripting for Animators

MEL Basics Variables

- Declaring a variable- int $theNumberAwesome = 42;

- Equals sign assigns a value to a variable

Page 63: An Introduction to MEL  Scripting for Animators

MEL Basics Return Values

Page 64: An Introduction to MEL  Scripting for Animators

MEL Basics Return Values

- Are the result of running a command

Page 65: An Introduction to MEL  Scripting for Animators

MEL Basics Return Values

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

Page 66: An Introduction to MEL  Scripting for Animators

MEL Basics Return Values

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

Page 67: An Introduction to MEL  Scripting for Animators

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

Page 68: An Introduction to MEL  Scripting for Animators

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`;

Page 69: An Introduction to MEL  Scripting for Animators

Usage and How to Learn MEL

Page 70: An Introduction to MEL  Scripting for Animators

Usage and How to Learn MELScript Editor

Page 71: An Introduction to MEL  Scripting for Animators

Usage and How to Learn MELScript Editor

- Echo All Commands

Page 72: An Introduction to MEL  Scripting for Animators

Usage and How to Learn MELScript Editor

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

Page 73: An Introduction to MEL  Scripting for Animators

Usage and How to Learn MELScript Editor

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

- Help

Page 74: An Introduction to MEL  Scripting for Animators

Usage and How to Learn MELScript Editor

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

- Help- help polySphere;

Page 75: An Introduction to MEL  Scripting for Animators

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

Page 76: An Introduction to MEL  Scripting for Animators

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

Page 77: An Introduction to MEL  Scripting for Animators

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

Page 78: An Introduction to MEL  Scripting for Animators

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?

Page 79: An Introduction to MEL  Scripting for Animators

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;

Page 80: An Introduction to MEL  Scripting for Animators

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

Page 81: An Introduction to MEL  Scripting for Animators

Usage and How to Learn MELMEL Command Reference

Page 82: An Introduction to MEL  Scripting for Animators

Usage and How to Learn MELMEL Command Reference

- To the MEL Command Reference!

Page 83: An Introduction to MEL  Scripting for Animators

Usage and How to Learn MELOther People’s Scripts

Page 84: An Introduction to MEL  Scripting for Animators

Usage and How to Learn MELOther People’s Scripts

- Try to trace what’s happening

Page 85: An Introduction to MEL  Scripting for Animators

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

Page 86: An Introduction to MEL  Scripting for Animators

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

Page 87: An Introduction to MEL  Scripting for Animators

Example Script

Page 88: An Introduction to MEL  Scripting for Animators

Example ScriptCycle Tangent Select

Page 89: An Introduction to MEL  Scripting for Animators

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];

Page 90: An Introduction to MEL  Scripting for Animators

Example ScriptCycle Tangent Select

- The Process

Page 91: An Introduction to MEL  Scripting for Animators

Example ScriptCycle Tangent Select

- The Process- Come up with the idea

Page 92: An Introduction to MEL  Scripting for Animators

Example ScriptCycle Tangent Select

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

Page 93: An Introduction to MEL  Scripting for Animators

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

Page 94: An Introduction to MEL  Scripting for Animators

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

Page 95: An Introduction to MEL  Scripting for Animators

Helpful Resources

Page 96: An Introduction to MEL  Scripting for Animators

Helpful ResourcesBooks

Page 97: An Introduction to MEL  Scripting for Animators

Helpful ResourcesBooks

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

Page 98: An Introduction to MEL  Scripting for Animators

Helpful ResourcesBooks

- Complete Maya Programmingby David A. D. Gould

Page 99: An Introduction to MEL  Scripting for Animators

Helpful ResourcesWebsites

Page 100: An Introduction to MEL  Scripting for Animators

Helpful ResourcesWebsites

- forums.cgsociety.org (CGTalk)

Page 101: An Introduction to MEL  Scripting for Animators

Helpful ResourcesWebsites

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

Page 102: An Introduction to MEL  Scripting for Animators

Helpful ResourcesWebsites

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

Page 103: An Introduction to MEL  Scripting for Animators

Helpful ResourcesWebsites

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

Conversational MEL Tutorial

Page 104: An Introduction to MEL  Scripting for Animators

Conclusion

Page 105: An Introduction to MEL  Scripting for Animators

ConclusionWhat we’ve covered

Page 106: An Introduction to MEL  Scripting for Animators

ConclusionWhat we’ve covered

- How Maya uses MEL

Page 107: An Introduction to MEL  Scripting for Animators

ConclusionWhat we’ve covered

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

Maya uses

Page 108: An Introduction to MEL  Scripting for Animators

ConclusionWhat we’ve covered

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

Maya uses- Commands

Page 109: An Introduction to MEL  Scripting for Animators

ConclusionWhat we’ve covered

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

Maya uses- Commands- Variables

Page 110: An Introduction to MEL  Scripting for Animators

ConclusionWhat we’ve covered

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

Maya uses- Commands- Variables- Return Values

Page 111: An Introduction to MEL  Scripting for Animators

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

Page 112: An Introduction to MEL  Scripting for Animators

Thank You

Background image from www.interweb.in/wallpaper