Maya Dynamics Basics:: MEL and Expression
Maya Dynamics Basics:: MEL and Expression
Email: [email protected]
CONTENTS
Basics:
Why using MEL & expressions?
Differences between MEL and expression.
What you can do by using MEL and Expression ?
MEL Basics:
How Maya Uses MEL.
Script Editor.
MEL Commands .
Variables .
Return Values.
Expression:
Create expression.
Helpful Resources.
Expression
Do not worry !
o I know you are designers.
2) MEL Basics
2.1) How Maya Uses MEL
Menus.
Shelf Buttons.
Hotkeys.
Expressions.
GUI.
2) MEL Basics
2.2) Script Editor
You get to it by hitting.
2) MEL Basics
2.3) MEL Commands
Structure:
<command name> -flags values;
Variable type
Default value
int
float
0.0
string
""
Example 1:
sphere -radius 3;
Example 2:
polySphere -radius 2.5 -subdivisionsX 10
-subdivisionsY 30 -name "Rambo";
These flags are like the option box settings.
2) MEL Basics
2.3) 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.
2) MEL Basics
2.3) MEL Commands
Examples of Modes:
- Creation
polySphere;
- Edit
polySphere -edit -radius 4 Rambo;
- Query
polySphere -query -radius Rambo;
2) MEL Basics
2.4) Variables
- Are for storing data.
2) MEL Basics
2.5) Return Values
Are the result of running a command:
returnValue <command name> -flags values;
Use backquotes to store the return value/result of a
command in a variable:
int $variable = <command name> -flags
values;
2) MEL Basics
Example 1
MEL commands
polyCube -w 1 -h 1 -d 1 -sx 1 -sy 1 -sz 1 -ax 0 1 0 -tx 1 -ch 1;
Command options
move -r -os -wd 0 0 5.109298 ;
move -r 0 0 5 pCube2;
2) MEL Basics
Example 2
Variable declarations
int $height = 2;
polyCube -w 1 -h $height -d 1;
Variable assignments
int $width;
$width = 2;
polyCube -w $width -h $height -d 1;
$width = $width + 1;
polyCube -w $width -h $height -d 1;
2) MEL Basics
Example 3
Selective structure
int $height = 2;
int $depth;
if ($height>2)
{
$depth = $height;
polyCube -w 1 -h $height -d $depth;
}
if($depth < 1) { polySphere -r 1;
}
2) MEL Basics
Example 4
The for-construct
int $i;
for ($i = 0; $i < 20; $i++) {
sphere -pivot 0 $i 0;
}
A spiral surface
select -all;
delete;
circle -center 4 0 0;
int $i;
for($i = 0; $i < 60; $i++)
{ duplicate;
rotate -r 0 3 0;
move -r 0 .3 0;
}
select -all;
loft;
3) Expression
What is Particle expression ?
Are more complex than other types of expressions. For example, we can write an
expression to control all particles in an object the same way, or you can control each
particle differently.
3) Expression
3.1) Attributes Notes
1
3) Expression
3.1) Create expression
Step 1: Create a object.
o Example: Type "sphere" in command line and press enter. It will create a
new nurbs sphere.
3) Expression
3.1) Create expression
3) Expression
3.1) Create expression
3) Expression
Example 1 : Random Colored Particle.
3) Expression
How to create it ?
3) Expression
Example 2: Control the moon orbiting the earth
3) Expression
How to create it ?
Websites
area.autodesk.com
fundza.com
ewertb.soundlinker.com
Thanks!