2009
Table Of Contents
- Contents
- Overview
- Maya Basics
- Polygonal Modeling
- Introduction
- Preparing for the lesson
- Lesson 1: Modeling a polygonal mesh
- Introduction
- Setting modeling preferences
- Using 2D reference images
- Creating a polygon primitive
- Modeling in shaded mode
- Model symmetry
- Selecting components by painting
- Selecting edge loops
- Editing components in the orthographic views
- Editing components in the perspective view
- Drawing a polygon
- Extruding polygon components
- Bridging between edges
- Adding polygons to a mesh
- Splitting polygon faces
- Terminating edge loops
- Deleting construction history
- Mirror copying a mesh
- Working with a smoothed mesh
- Creasing and hardening edges on a mesh
- Beyond the lesson
- NURBS Modeling
- Subdivision Surfaces
- Animation
- Introduction
- Preparing for the lessons
- Lesson 1: Keyframes and the Graph Editor
- Lesson 2: Set Driven Key
- Lesson 3: Path animation
- Lesson 4: Nonlinear animation with Trax
- Introduction
- Open the first scene for the lesson
- Creating clips with Trax
- Changing the position of clips with Trax
- Editing the animation of clips
- Reusing clips within Trax
- Soloing and muting tracks
- Scaling clips within Trax
- Open the second scene for the lesson
- Creating clips from motion capture data
- Extending the length of motion capture data
- Redirecting the motion within a clip
- Beyond the lesson
- Lesson 5: Inverse kinematics
- Introduction
- Open the scene for the lesson
- Understanding hierarchies
- Viewing hierarchies using the Hypergraph
- Creating a skeleton hierarchy
- Parenting a model into a skeleton hierarchy
- Applying IK to a skeleton hierarchy
- Creating a control object for an IK system
- Constraining an IK system
- Limiting the range of motion of an IK system
- Simplifying the display of a hierarchy
- Applying parent constraints on an IK system
- Planning an animation for an IK system
- Animating an IK system
- Beyond the lesson
- Character Setup
- Polygon Texturing
- Rendering
- Introduction
- Preparing for the lessons
- Lesson 1: Rendering a scene
- Introduction
- Open the scene for the lesson
- Creating shading materials for objects
- Refining shading materials for objects
- Maya renderers
- Rendering a single frame using IPR
- Rendering using the Maya software renderer
- Batch rendering a sequence of animation frames
- Viewing a sequence of rendered frames
- Beyond the lesson
- Lesson 2: Shading surfaces
- Lesson 3: Lights, shadows, and cameras
- Lesson 4: Global Illumination
- Lesson 5: Caustics
- Dynamics
- Painting
- Introduction
- Preparing for the lessons
- Lesson 1: Painting in 2D using Paint Effects
- Lesson 2: Painting in 3D using Paint Effects
- Introduction
- Preparing for the lessons
- Brushes and strokes
- Rendering Paint Effects strokes
- Paint Effects on 3D objects
- Creating a surface to paint on
- Painting on objects
- Using turbulence with brush stroke tubes
- Using additional preset brushes
- Mesh brushes
- Converting mesh strokes to polygons
- Modifying a converted polygonal mesh
- Beyond the lesson
- Lesson 3: Painting textures on surfaces
- Expressions
- Scripting in Maya
- Index
is always prefixed by the “$” symbol, indicating to the scripting language that
the following characters name a variable.
The scope of the variable determines where the variable can be accessed from.
If a variable is declared within a block of code, it cannot be accessed from
outside the block of code.
Name and type cannot change after creation. The value of a variable can
change, but the value must be of the earlier defined type.
NOTE Variables in MEL should always have their type explicitly defined. If not
explicitly stated, the scripting language attempts to imply a data type for the
variable from the context of the first appearance of the variable. It is good practice
to explicitly declare variables as implicitly defining variables can lead to scripting
errors and slows down the execution of the script.
To store scene information as a variable
1 In the Script Editor, type the following and press enter:
float $diameter_barrel;
This command declares a variable of data type float, with the name
diameter_barrel. A floating point value is a number containing a decimal.
2 To assign a value to the variable, type the following.
$diameter_barrel = 4.2;
The diameter of the barrel is 4.2 units. This value from the scene is
assigned to the variable. A value is assigned to a variable with the
assignment operator (=).
Storing other types of data
MEL also supports other data types that are common to most other
programming languages.
To declare a string variable
1 Type the following in the Script Editor
string $testString = "this is a test";
print $testString;
The following is output to the Script Editor:
this is a test
616 | Chapter 13 Scripting in Maya