The Art of Maya 3rd Edition

Download as pdf or txt
Download as pdf or txt
You are on page 1of 22

SYBEX Sample Chapter

The Art of Maya™, 3rd Edition


Alias

Chapter 3: Exploring Maya

Copyright © 2005 Alias Systems, a division of Silicon Graphics Limited. All rights reserved.

Copyright © 2005 SYBEX Inc., 1151 Marina Village Parkway, Alameda, CA 94501. World rights reserved. No part of this publication
may be stored in a retrieval system, transmitted, or reproduced in any way, including but not limited to photocopy, photograph,
magnetic or other record, without the prior agreement and written permission of the publisher.

ISBN: 1-894893-82-4

SYBEX and the SYBEX logo are either registered trademarks or trademarks of SYBEX Inc. in the USA and other countries.

TRADEMARKS: Sybex has attempted throughout this book to distinguish proprietary trademarks from descriptive terms by following
the capitalization style used by the manufacturer. Copyrights and trademarks of all products and services listed or described herein
are property of their respective owners and companies. All rules and laws pertaining to said copyrights and trademarks are inferred.

This document may contain images, text, trademarks, logos, and/or other material owned by third parties. All rights reserved. Such
material may not be copied, distributed, transmitted, or stored without the express, prior, written consent of the owner.

The author and publisher have made their best efforts to prepare this book, and the content is based upon final release software
whenever possible. Portions of the manuscript may be based upon pre-release versions supplied by software manufacturers. The
author and the publisher make no representation or warranties of any kind with regard to the completeness or accuracy of the
contents herein and accept no liability of any kind including but not limited to performance, merchantability, fitness for any particular
purpose, or any losses or damages of any kind caused or alleged to be caused directly or indirectly from this book.

Sybex Inc.
1151 Marina Village Parkway
Alameda, CA 94501
U.S.A.
Phone: 510-523-8233
www.sybex.com
Exploring Maya
Before exploring modeling and animation concepts, it is a good idea to become
familiar with the way Maya’s user interface works. The user interface is where
3D artists display and organize scenes, save and open files, and transform and
animate objects. While developing these skills 3D artists learn just how they can
make Maya do what they want it to.
Maya has a very clean user interface where many of the elements
share generic editor windows. At first, this may make it difficult to distinguish
different parts of a scene, but with experience 3D artists learn the power of this
paradigm. The generic way in which Maya presents information makes it very
easy to transfer skills from one area of Maya to another. This lets 3D artists
focus on learning Maya’s underlying concepts instead of always re-learning
how the user interface works.
Maya’s Dependency Graph concept links virtually all objects in a scene
to each other. As 3D artists learn more, they discover this underlying structure
plays a key role in how they work and animate in Maya.

Copyright © 2005 Alias Systems, a division of Silicon Graphics Limited. All rights reserved.
The Workspace

C reating an animation in Maya involves the manipulation of many


graphic elements such as curves, surfaces, colors, and textures.
Information about these elements is stored in Maya as numeric values
that can be viewed in a number of different ways. In Maya’s workspace,
you can choose how you want to view a scene and access different
tools to alter its 3D information. Maya offers several ways of accessing
and altering your scene, giving you the flexibility to build workflows
that best suit the way you work.

User Interface Elements


When you first launch Maya, the workspace is presented to you
with a number of user interface (UI) elements. Each is designed to help Many UI panels can be set up as floating
you work with your models, access tools, and edit object attributes. windows in case you need them just temp-
orarily. Menus can also be broken off from
Initially, you should learn the locations of the UI elements so you can menu bars in case you need to focus on the
easily find them while you work. menu’s contents.
setAttr "spotLightShape1.centerOfIllumination" 17.56598; setAttr "spotLight1.rotate" -type double3 0

"spotLightShape1.centerOfIllumination" 20.319657; setAttr "spotLight1.translate" -type double3 0

Menu Sets Menus Status Bar Shelf Layers


While Maya’s first Menus contain tools and The Status Bar contains The Shelf is available for you Maya has two types of
six menus are always actions for creating and shortcuts for a number to set up customized tool sets layers. Display Layers are
available, the remaining editing objects and setting of menu items as well as that can be quickly accessed used to manage a scene,
menus change depend- up scenes. There is a main tools for setting up object with a single click. You can while Render Layers are
ing on which Menu Set menu at the top of the selection and snapping. set up shelves to support used to set up render
you choose. This helps Maya window and indi- A Quick Selection field is different workflows. Press passes for compositing.
focus your work on vidual menus for the panels also available that can be Shift+Ctrl+Alt when select- In each case, there is
related tools. and option windows. set up for numeric input. ing a menu item to add it to a default layer where
10.213951 12.56598 ; setAttr "spotLightShape1.coneAngle" 65.764707; setAttr

the Shelf. objects are initially


0 0 ; setAttr "spotLight1.translate" -type double3 0 0 12.56598 ; setAttr

placed upon creation.

QWERTY Tools
The “qwerty” hotkeys
The Work Space

Channel Box
can be used to Select The Channel Box lets
(q), Move (w), Rotate you edit and key values
(e), Scale (r), and Show Panels
for selected objects.
Manipulators (t) as well The workspace can be divided into
as access the last tool multiple panels that offer different
used (y) in the scene. ways of creating and evaluating
your scenes.
Playback
The Playback controls
let you move around
time and preview your
"spotLightShape1.useDepthMapShadows" on;

Time Slider animations as defined


The Time Slider shows by the Time Slider range.
you the time range as
defined by the range
slider, the current time,
and the keys on selected Characters
objects or characters. The Character Menu
You can also use it lets you define one
to “scrub” through or more characters,
an animation. then prepare them for
being animated.
exploring maya

Range Slider Help Line Command Line


This bar lets you set up the start The Help Line gives a short description of tools This bar has an area to the left for inputting
and end time of the scene’s animation and and menu items as you scroll over them in the simple MEL commands and an area to the right for
a playback range if you want to focus on a UI. This bar also prompts you with the steps feedback. You will use these areas if you choose to
smaller portion of the timeline. required to complete a certain tool workflow. become familiar with Maya’s MEL scripting language.

23
Copyright © 2005 Alias Systems, a division of Silicon Graphics Limited. All rights reserved.
Simplifying the User Interface The Hotbox
All of the UI tools that are available when Maya is The Hotbox gives you access to all of Maya’s menu items and tools
first launched can be turned off or on as needed. right at your cursor position. When you press and hold down the Space
In fact, you can turn them all off and focus on one bar on your keyboard, after a short delay the Hotbox appears. The
single view panel if this is how you like to work. In Hotbox is fully customizable and lets you focus on the tools you feel
this case, you would use interface techniques such are most important to your workflow. The Hotbox Controls let you turn
as the Hotbox, Hotkeys, or the right mouse button to off the main menus and the panel menus in the workspace. When the
access tools and options. menus and panels are off, you can focus entirely on using the Hotbox.

Common Menus Marking Menus


These are the menus that In the four quadrants
are always available on and in the center of the
the Main Menu bar. Hotbox, you can access
marking menus that are
designed to help you set
up your workspace.
Panel Menus
These are the menus
that are associated
with the active panel.

Recent Commands Hotbox Controls


Recent Commands
Menu Sets With the Hotbox Controls you can turn
display a list of the last
These are the menus associated on all menus, or pick and choose the
few tools and actions
with the various Menu Sets. menus you want in the Hotbox. You can
used. This is useful when
also turn off the workspace menus.
commands are repeated
several times.

This is a single shaded view panel with the hotbox being used to
access tools. Most likely, you will configure the workspace some-
Marking Menus
where between this minimal setup and the default setup. Marking menus are accessed by selecting a Hotkey and clicking with
your left mouse button. The menu appears in a radial form so that all
Hotkeys your options are simply a stroke away. Once you learn the location of
Hotkeys will give you quick access to many of the the menu options, you can quickly stroke in the direction of an option
tools found in Maya. To set up Hotkeys, select without having to see the menu itself. Because the menu is radial, it is
Windows > Settings/Preferences > Hotkeys. The very easy to remember the location of each menu option. It will only
Hotkey Editor lets you set up either a single key or take a short time for you to master this way of accessing tools.
a key and a modifier key such as Ctrl, Shift, or Alt, You can set up your own marking menus by building them in
to access any tool in Windows > Settings/Preferences > Marking Menus, then assigning the
Maya that is listed in new marking menu to a Hotkey.
the Editor.
It is also possible
to build custom
commands using a
MEL (Maya Embedded
Language) script.
This feature allows First Use Expert Use
When you first use a marking menu, press the As you become an expert, you can quickly press the
you to set up the UI to Hotkey and click-drag to the desired location in the
Hotkey, click and hold it with the mouse while you
The Hotkey Editor gives you access to completely reflect your view the Options, then drag to the desired location menu. The menu doesn’t appear and your selection
all of the tools in Maya. quickly flashes by.
own workflow. in the menu.

Left Mouse Button


Mouse Buttons This button is used to select tools and objects, and
Each of the three buttons on your mouse plays a access visible manipulators.
slightly different role when manipulating objects in
Middle Mouse Button
the workspace. Listed here are some of the generic
This button is used to edit objects without the
uses of the mouse buttons. When used with modi- manipulator. This button is also used for click-drag-
fiers such as the Alt key, they also aid in viewing ging. If your mouse has a wheel, it can be used to
your scene. scroll into windows.

Right Mouse Button


This button is used to invoke context-sensitive
menus and marking menus such as the one
shown here.

Copyright © 2005 Alias Systems, a division of Silicon Graphics Limited. All rights reserved.
24
File Management Maya File Types
Maya has several dedicated file
types for saving scenes, images,

W orking on a computer involves saving and retrieving files from


your hard disk. Directory structures are used to organize these
files in a hierarchical relationship.
and scripts. These formats store
files created in Maya.

A typical Maya project is made up of many files that need to be Maya Binary (.mb)
easily accessible. To organize these files, Maya uses a special directory This scene file description uses binary
structure for different file types such as 3D scenes, texture files, and code to efficiently store information about
final rendered images. You may also want to make specific directories objects, shaders, and animation. This format
is only accessible from within Maya.
for importing and exporting files. It is, therefore, important to learn
about the file types you will be working with and how they apply to
Maya ASCII (.ma)
your Maya project.
This scene file description is written with
As your production workflow becomes more sophisticated, you ASCII text and can be opened and edited
may want to begin sharing files with other users or create libraries for using any Text Editor. Its file size is larger
your own long-term use. With a few modifications, these alternative than a Maya binary file, but allows those
familiar with Maya a chance to tweak parts
workflows can easily make use of Maya’s file management capabilities. of a scene without opening the file
within Maya.
The Maya Directory
setAttr "spotLightShape1.centerOfIllumination" 17.56598; setAttr "spotLight1.rotate" -type double3 0

A new Maya directory is created for each user. This makes it possible Maya IFF (.iff)
"spotLightShape1.centerOfIllumination" 20.319657; setAttr "spotLight1.translate" -type double3 0

for multiple users on the same machine to have personalized UI setups, Maya’s bitmap file format is called IFF. It
scripts, and project files. Some of the directories found in the Maya can save RGB channels as well as mask
and depth channels. It can also be used to
directory are: Projects, Source Images, and Scripts. save rendered images and file textures used
when rendering. While other industry stan-
dard image file formats can be used, Maya
Scripts
IFF is more efficient when used within Maya,
The Scripts directory is where you
because it is a file created for Maya.
can store scripts available for any
versions of Maya, quickly accessed
10.213951 12.56598 ; setAttr "spotLightShape1.coneAngle" 65.764707; setAttr

from Maya’s Command Line. BOT Files (.bot)


0 0 ; setAttr "spotLight1.translate" -type double3 0 0 12.56598 ; setAttr

A BOT file is used for texture caching during


the rendering process. It is a rapidly
6.0 Directory accessible tiled version of a texture file
The 6.0 directory is where your
that is stored on disk rather than in memory
version 6 preferences are kept. This
during rendering. This process uses more
File Management

directory also contains a Scripts fold-


disk space but less memory.
er for Scripts specific to version 6.

MEL Scripts (.mel)


Projects
MEL scripts are ASCII text files saved using
The Projects directory is where all
a .mel extension. If written using MEL
project files are saved. Each project
syntax, the script can be used to extend
has a dedicated hierarchy that keeps
Maya’s capabilities.
a project organized.

Project Files
"spotLightShape1.useDepthMapShadows" on;

Project files are organized according


to the type of information stored
such as scenes, source images,
and textures.

Creating Projects
The Projects directory stores and organizes all the information related
to a scene. It contains sub-directories in which different scene elements,
such as textures and scene files, are located.
When you start a new production, you will want to create a new
exploring maya

project, with directories specific to that production’s needs. To create a


new project, select File > Project > New...
A window will open where you can name the project and set up
the various sub-directories that you will refer to as you work.

25
Copyright © 2005 Alias Systems, a division of Silicon Graphics Limited. All rights reserved.
The Projects Directory Setting Projects
The Projects directory is where all your Maya files are stored. The new Setting a project in Maya
project options window is divided into three separate sections: Scene allows you to specify
File Locations, Project Data Locations, and Data Transfer Locations. the location of your
You can use Maya’s default settings or enter your own in the text field. current project. This is
If you leave a field blank, a folder will not be created for that section useful when working
and the default location directory will be used. with multiple projects,
allowing you to save
and open files from the
Scene File Locations
appropriate directories.
By default, this directory saves Maya scene
files. It contains files in either Maya ASCII or To set a project, select
Maya binary format. File > Project > Set.

Project Data Locations


This section is where Maya saves project- Editing Projects
related files such as textures, lights, source
images, and render scenes.
Editing the current project allows you to change the
path to where Maya looks for certain elements of a
Data Transfer Locations
scene. By editing a project, you re-assign the path
This section stores files saved in other
formats such as EPS, DXF, and OBJ. to which Maya is going to search for information.
To edit a project, select File > Project > Edit Current.

Scenes Clips Sound Particles


The Scenes folder is Exported Animation Sound files to be import- Particle cache files
where Maya binary or clips created in the Trax ed into Maya are stored are saved in the
Maya ASCII scene files Editor are stored in the in the Sound folder. Particles folder.
are stored. Clips folder.

Render Scenes Render Data Source Images Textures


Maya scene files to be IPR images, shaders, Images used to create Exported texture nodes
rendered are saved in the and depth maps are surface materials are used to add detail to sur-
Render Scenes folder. saved in the Render stored in the Source face materials are stored
Data folder. Images folder. in the Textures folder.

Data Transfer
Transferring data from one scene to another can be done in one of
two ways. Scenes can be imported to merge with your current scene
or they can be referenced into your scene.
Importing data into your present scene merges the material,
making the file size larger. When you import data, you can make any
changes needed to that file. Files that have not been created in Maya,
such as Adobe Illustrator®, and EPS files can also be imported into
a scene . This feature can be useful when creating 3D text and flying Shared Directories
logos, where the artwork is created in a 2D package and imported as When sharing a project with other people, you may
a NURBS curve. To import a scene into Maya, select File > Import. want to set up a common folder where information
Referencing a scene file allows you to share that same file with can be shared.
other scenes. The scene content is not copied into your scene, but Under the Project Data Locations menu, you
a visible reference of the scene to which changes cannot be made can specify more than one directory from which
appears. The benefit of referencing a scene file is the ability to work to retrieve information. Shared directories can be
with multiple scenes that use the same reference file. If that file useful when working on different scene files that
requires changes, all you need to do is change the original file and all share common source images.
scenes containing reference to that file will automatically be updated.
To reference a scene file, select File > Create Reference.

Copyright © 2005 Alias Systems, a division of Silicon Graphics Limited. All rights reserved.
26
Viewing 3D Scenes

W hen building a scene in Maya, you work in


three-dimensional space. Orthographic and
perspective view cameras offer several ways of
Extra Views
In addition to the default
looking at the objects in your scene as you work. views, you can also create your
There are also different display options that change own camera angles. To add
the way objects in your scene a new 2D view, select Panels
are shaded. > Orthographic > New. Also,
to add a new 3D view, select
Default Views Panels > Perspective > New.
In Maya, the default views are set as Perspective,
top, front, and side. Orthographic views Camera views
To create new orthographic views, To create a new camera, select Panels
The Perspective view is a representation of your
select Panels > Orthographic > > Perspective > New. You can also
object in 3D space allowing you to move along the New. Make a back view panel by select Create > Camera from the
X, Y, and Z-axis. The top, front, and side views are creating a new front view and change menu which offers some unique cam-
Translate Z to -100 and Rotate Y to era options.
referred to as orthographic views and allow you to
180 in the Channel Box.
setAttr "spotLightShape1.centerOfIllumination" 17.56598; setAttr "spotLight1.rotate" -type double3 0

move in two dimensions at a time.


"spotLightShape1.centerOfIllumination" 20.319657; setAttr "spotLight1.translate" -type double3 0
10.213951 12.56598 ; setAttr "spotLightShape1.coneAngle" 65.764707; setAttr
0 0 ; setAttr "spotLight1.translate" -type double3 0 0 12.56598 ; setAttr

Default Top View Default Perspective View New Back View


Viewing 3D Scenes

Default Front View Default Side View New Perspective View


"spotLightShape1.useDepthMapShadows" on;

View Tools
Tumble
By pressing the Alt key along
Press the Alt key plus the left mouse
with different mouse button button to rotate the camera around a
combinations, you can navigate 3D Perspective view.
the objects around in your scene.
While the Tumble Tool is only Track
used to rotate a 3D Perspective Press the Alt key plus the middle
mouse button to pan from left to
view, you can track and dolly in
exploring maya

right, and up, and down.


many other views
including the
Orthographic, Dolly
Hypergraph, Press the Alt key plus the right
Hypershade, mouse button to dolly in and out of
your scene. Using the mouse wheel
Visor, and also has the same effect.
Render View.

27
Copyright © 2005 Alias Systems, a division of Silicon Graphics Limited. All rights reserved.
Shading
Maya’s Shading menu offers several options for displaying objects in a
scene. Shading can be different for each view panel, allowing geometry
to be shown at different levels of complexity.
The more detailed a scene becomes, the greater the need to
simplify the objects in it. Although Maya is very good at processing Bounding Box Points Wireframe
complex levels of geometry, it is a good idea to view your objects in Bounding Box displays Points shading displays Wireframe shading is
objects as boxes. This objects as a group of the default shading
a less complex shading mode until you are ready to render or make is useful when working points that represent the quality in Maya.
adjustments to those objects. with complex scenes. shape of the object.
There are several shading display options to choose from. The
default shading in Maya is Wireframe. Other display options include:
Bounding Box, Points, Flat Shade, Smooth Shade, Hardware Lighting,
Wireframe on Shaded, and X-Ray.

Show Menu
The Show Menu allows you to show and hide different elements of
a scene. You can show all or none or specific items such as NURBS Flat Shade Smooth Shade Hardware Texturing
curves, lights, or cameras. Flat shade displays all or Smooth Shade displays Hardware Texturing
only the selected objects all or only the selected displays smooth-shaded
The Show Menu is accessible from all views and can hide items with lower resolution objects as smooth sur- surfaces with textures.
in one view while displaying them in another. faceted display. faces with surface color
and shading properties.

Hardware Lighting Hardware Fog High Quality


Hardware Lighting Hardware Fog displays Rendering
displays smooth-shaded surfaces with a user High Quality Rendering
surfaces with textures defined fog. This is displays surfaces
The Show Menu allows you to edit a NURBS curve in the Side view with NURBS surfaces and lighting. useful to simulate a with more accurate
turned off while viewing the Perspective view panel with NURBS surfaces visible. scene fog. texturing, bump
mapping, transparency
and lighting.
Isolate Select Shade Options
The Isolate Select option allows you to hide surfaces at both the object In addition to the default shading mode, there are
and component level, on a per-panel basis. To hide the Control Vertices two shading options for viewing your models:
(CVs) of an object, choose the CVs you want to modify and select Wireframe on Shaded and X-Ray modes. Both of
Show > Isolate Select > View Selected. This will hide all unselected CVs. these options can be used at the same time.
Another advantage of using Isolate Select is that it affects hardware Viewing your model in Wireframe on Shaded
rendering only, allowing hidden objects to be viewed during mode will allow you to easily view surface Isoparms
software rendering. for all objects in your view panel without viewing
through the object.
Viewing your model in X-Ray mode will allow
you to view through your model using a semi-trans-
parent shading. This is useful when you want to
see a surface that is behind other surfaces or inside
objects such as skeletons within a character.

Using Isolate Select allows you to hide CVs X-Ray Wireframe on Shaded
on a NURBS surface. X-Ray shading displays Wireframe on Shaded
objects with a semi- displays a wireframe on a
transparent surface. shaded surface.

Copyright © 2005 Alias Systems, a division of Silicon Graphics Limited. All rights reserved.
28
Objects and Components
Y ou can transform objects in Maya by selecting objects and their
components. Selection masks allow you the flexibility to select only
the items you want in a scene. These masks are grouped into three
categories: Hierarchy, Object type, and Component type selections.

Object Types
Scene objects are items such as Cameras, Curves, Surfaces,
Dynamics, Joints, Handles, and Deformers. Objects created in Maya
are made up of two parts: a Transform node and a Shape node. The
Transform node contains basic information about an object’s position,
orientation, and scale in space. The Shape node defines what the object
looks like.
The Outliner can be used to select
Rendering and view hierarchical relationships
Scene objects such as between the objects in your scene.
lights, cameras, and
setAttr "spotLightShape1.centerOfIllumination" 17.56598; setAttr "spotLight1.rotate" -type double3 0

textures placement are


rendering object types.
"spotLightShape1.centerOfIllumination" 20.319657; setAttr "spotLight1.translate" -type double3 0

Skeleton Joints
Curves Skeleton joints are used
Turning off the Curve to help control characters.
selection means you can
not select the curves in
the scene.

Handles
10.213951 12.56598 ; setAttr "spotLightShape1.coneAngle" 65.764707; setAttr

Surfaces
Objects and Components

IK handles are applied


0 0 ; setAttr "spotLight1.translate" -type double3 0 0 12.56598 ; setAttr

Selecting by Surfaces to joint chains for ani-


allows you to select the mation control.
surface geometry of
an object.

Dynamics Deformations
Dynamic objects such as Deformers such as cluster
particles can be separately flexors and lattices modify
selected by toggling the the shape of an object.
Dynamics button on.

Points Faces
"spotLightShape1.useDepthMapShadows" on;

Points such as CVs Faces are patches


Component Types and polygonal vertices
are used to modify the
created by inter-
secting lines.
In order to change the shape of an shape of an object.
object in Maya, you need to modify
component-type information. Hulls
There are a variety of Param Points Hulls are guides that
Param points are connect CVs. They can
component types such as points, be used to select and
points that lie directly on
isoparms, faces, hulls, pivot points, a curve or surface. transform rows of CVs
and handles. These components at once.
can be used to interactively modify
exploring maya

and reshape the appearance of Lines Pivot Points


an object. Lines such as Pivot points determine
isoparms and trim the location around which
edges define the shape transformations occur.
of an object.

29
Copyright © 2005 Alias Systems, a division of Silicon Graphics Limited. All rights reserved.
Hierarchy Object Component

hierarchy
Selecting by Hierarchy allows you to select objects at either the Root,
Selection Masks Leaf or Template node level. Unlike Object and Component selection
masks, you are not able to turn on more than one mask at a time.
Selection masks allow you to select
the specific items you want to work
on. There are three main groups of
selection masks: Hierarchy, Object,
and Component. Object
Hierarchy mode allows you to Object selection masks allow you to make selections based on the
object types you specify. Left-clicking on the arrow to the left of the
select nodes at different levels. In
pick masks displays a menu allowing you to turn all objects on or off.
this mode you can select the Root,
Leaf, and Template nodes.
Object mode allows you to select
scene elements at the Transform
node level. These include objects Component
Component selection masks offer a variety of pick masks to choose
such as surfaces, curves, and joints.
from. Right-clicking on a mask displays more selection options.
Component-type selections are
selections made to objects at the
Shape node level, such as isoparms
and CVs.
Right Mouse Button Selections
Clicking the right mouse button over an object
Selection Priority will bring up a marking menu that allows you to
Objects and Components are choose from both Object and Component selection
selected in order of priority based types, while remaining in
on an assumed production work- Component mode. The
flow. For example, if you want to menu choices are specific
select both joints and surfaces, Maya to the object selected or
Preferences
anticipates that you want to select The selection priority list can be found under
the object beneath the
joints first. To select more than one Windows > Settings/Preferences > Preferences. marking menu.
object with different priorities, select In this window, you can change the order in which
Objects and Components are selected.
the first object and shift-click on the
object of different priority. Root node selection
viewed in Hypergraph
Hierarchies
When working with a group of
objects that are arranged in a hier-
Quick Select
archy, you may want to specifically Using Quick Select, you can type in the name of an
work at the Root node or Leaf object in the text field and it will become selected
Selection of any Leaf node
node level. will select the root node in your scene.
If you choose to work at the This is particularly useful when there are
Root node level of a group, also several objects in a scene with a common name.
known as the top node in a hier- You can type in the name followed by an asterisk
archy, you can toggle on the Select (*) and all objects containing that same name will
by Hierarchy: Root mask. In this be selected.
selection mode, you can click on
any object in the hierarchy and
only the top node of the object
picked will be selected.
If you want to work at the Leaf
node level, toggle on the Select by Toggling on the Select by Hierarchy: Root mask
Hierarchy: Leaf button. In this mode, allows you to select any Leaf node in a hierarchy and
only the leaf nodes or children of a the Root node will become selected.
hierarchy will be selected.

Copyright © 2005 Alias Systems, a division of Silicon Graphics Limited. All rights reserved.
30
Dependency Graph
E verything in Maya is represented by a node with attributes that can
be connected to other node attributes. This node-based architecture
allows connections to be made between virtually everything in Maya.
Node attributes determine such things as the shape, position, construction
history and shading of an object. With this architecture, you can create
inter-object dependencies, shading group dependencies, and make your
own node connections.

Nodes with Attributes that are connected


The Dependency Graph is a collection of nodes which are connected
together. These connections allow information to move from one node Right Mouse Button
to another and can be viewed in a diagrammatic fashion through the Clicking the right mouse button over a
selected object will give you access to an
Hypergraph and Hypershade windows. object’s input and output connections.

Shading Group Dependencies


setAttr "spotLightShape1.centerOfIllumination" 17.56598; setAttr "spotLight1.rotate" -type double3 0

When a material is created in Maya, a network of


node dependencies is built. This network is referred
"spotLightShape1.centerOfIllumination" 20.319657; setAttr "spotLight1.translate" -type double3 0

to as a Shading Network.
The Hypershade window allows you to make
and break connections between shading group
Animation Curve nodes. The Hypershade displays thumbnail images
When an animation is produced in Maya, node dependencies are representing each node. The diagrams below both
created between the animation curves and the object being animated. show the same shading group dependency in the
Hypershade and Hypergraph windows.
10.213951 12.56598 ; setAttr "spotLightShape1.coneAngle" 65.764707; setAttr

Node Dependencies
0 0 ; setAttr "spotLight1.translate" -type double3 0 0 12.56598 ; setAttr

In the diagram below you can see the nodes that are
dependent on each other to make up a chess piece.
Dependency Graph

Each node plays a part in creating the final rendered


object. Here you see that the Shader node is depen-
dent on the Shape node to render the material, the
Shape node is dependent on the revolve node for
the chess piece surface, and the Revolve node is
dependent on the Curve node to make the revolve.
"spotLightShape1.useDepthMapShadows" on;

Hypershade
Using the Hypershade, you can make materials and textures and
view the node dependencies used to create them.
exploring maya

Hypergraph
The Hypergraph window can also be used to view and create
shading group dependencies. However, it does not have swatches as
the Hypershade does.

31
Copyright © 2005 Alias Systems, a division of Silicon Graphics Limited. All rights reserved.
Viewing Dependencies Making Connections
Dependencies are relationships created between nodes that are Connections made in Maya represent the flow of
connected. There are many ways to view and edit dependencies in information from one node to another. You can
Maya including the Hypergraph, Attribute Editor, and Channel Box. make your own connections between nodes as well
By selecting a node and clicking the Up and Downstream as break connections using the Connection Editor.
Connections button in the Hypergraph window, you can view node The Connection Editor offers a list of node
dependencies on a selected node. This window visually displays the attributes that can be connected to other node
connection between nodes with arrows showing the direction of their attributes. For example, you can map the scale of
dependency to one another. one object to influence the rotation of another.
The Attribute Editor is made up of several tabs allowing you to This creates a connection between the two nodes
view related nodes of a dependency group. In the Attribute Editor, you where every time you scale one, the other
can edit the attributes that affect these nodes. automatically rotates.
In the Channel Box, the selected node is shown with a listing The Connection Editor can extend the
of any keyable attributes that belong to it. Depending on the node possibilities of your production by automating tasks
selected, it will also show input, output, or shape nodes. If you select done through the connection of nodes.
more than one node with the same keyable attributes, you can modify
them at the same time using the Channel Box.

Attribute Editor Channel Box


In the Attribute Editor, In the Channel Box, you can edit any keyable
you can adust the attributes on the selected node.
attributes on the input
and output connections
of a selected node.

Hypergraph
In the Hypergraph window,
you can see the input and
output connections of a Connection Editor
selected node. The Connection Editor allows you to make connections
between nodes attributes.

Hypergraph
In the Hypergraph, you can view the result of connections
made in the Connection Editor.

Construction History
When an object is built in Maya, Input nodes can be viewed in the
Dependency Graph containing information on how the object was Construction History On
created. These Input nodes allow you to edit an object based on the
geometry used to build it. For example, if you were to create a curve
and use the Revolve Tool to make a surface from it, the curve used to
create the surface would hold information as to how the surface was
created. Using construction history, you can go back to the original Construction History Deleted
curve and alter the shape of the object.

Copyright © 2005 Alias Systems, a division of Silicon Graphics Limited. All rights reserved.
32
Transformations
T ransformations are changes made to an object’s position, orienta-
tion, and scale in space. The Transform node holds all of this infor-
mation and the Transform manipulators such as the Move, Scale and
Rotate Tools are used to transform an object along the X, Y, and Z axes.

Manipulators
Manipulators are used to move, scale, and rotate objects in ortho-
graphic and 3D space. Each of the manipulators uses red, green, Move/Rotate/Scale Tool
and blue color handles matching the colors of the X, Y, Z locator at This tool incorporates the Move, Rotate, and
the bottom left corner of the view, making it easier to distinguish Scale manipulators into one tool. Select Modify >
Transformation Tools > Move/Rotate/Scale
the direction of the transformation. These handles are designed Tool to use this Tool.
to constrain the transformation to one, two, or three axes at a time,
allowing for complete control.
Transformation Tools
To work quickly and efficiently
in Maya, the QWERTY hotkeys
setAttr "spotLightShape1.centerOfIllumination" 17.56598; setAttr "spotLight1.rotate" -type double3 0

offer a fast way to access the


transformation tools. These tools
"spotLightShape1.centerOfIllumination" 20.319657; setAttr "spotLight1.translate" -type double3 0

are located at the top left corner


of the Maya workspace. Select,
Move, Rotate, Scale, and the
Move Tool Rotate Tool Scale Tool Show Manipulators Tool, plus
The Move Tool has a handle The Rotate Tool has a ring for With the Scale Tool, you can an extra space for the last tool
for each X, Y, and Z axis and a the X, Y, and Z axes. One ring scale non-proportionally in you used, are all a part of the
center handle to move relative moves relative to the view, X, Y, or Z. You can also scale
proportionally by selecting
QWERTY toolset.
to the view. and a virtual sphere rotates in
10.213951 12.56598 ; setAttr "spotLightShape1.coneAngle" 65.764707; setAttr

all directions. the center handle.


0 0 ; setAttr "spotLight1.translate" -type double3 0 0 12.56598 ; setAttr

Setting Pivot Points for Transformations


Objects are transformed around their pivot point location. This is
important to be aware of because the position of your pivot point q w e r t y
Transformaions

affects the outcome of your transformation. To change the location of


your pivot point, select a Transform manipulator and press the Insert Use the QWERTY shortcut keys on your
key on the keyboard. Move your pivot point to the desired location and keyboard to select and transform the
press the Insert key again to set the pivot point. objects in your scene.

Reset Transformations
Once you have manipulated an
object, you may not be satisfied
"spotLightShape1.useDepthMapShadows" on;

with its new transformation. To


reset your object to its original
position, select Modify >
Reset Transformations.
Pivot point is in the wrong location.

Freeze Transformations
Select Modify > Freeze
Transformations to keep your
current position as the default
exploring maya

position. This means that your


modified position will have
values of 0 for Move and Rotate
in the X, Y, and Z axes and a
value of 1 for Scale.
Object is rotating around a properly positioned
pivot point.

33
Copyright © 2005 Alias Systems, a division of Silicon Graphics Limited. All rights reserved.
Scaling Options Rotate Options
The Scale Manipulator allows you The Rotate Tool menu offers three rotate modes to
to change the size of an object both pick from - Local, Global, and Gimbal.
proportionally and non-proportion-
ally. The default coordinate system
for scaling is local.

Move Options
Double-clicking on the Move Tool
icon brings up the following four
coordinate systems: Object, Local,
World, and Normal.
Each object has its own XYZ coordinates. To view an object’s
coordinates, select Object in the options window. Changing an object’s
coordinates to Local aligns the object’s axes to its parent’s axes, Rotation around local
axis of object
ignoring any transformations made to itself.
World is the default coordinate system for the Move Tool. When
World coordinates are selected, the object moves in World coordinate
space where the Y-axis always points up.
Normal coordinates work at a component level displaying NUV
and is useful for CV manipulation. N represents the Normal direction
of the surface. At this level, you can move across the surface in both N, Local
U, and V directions. Local is the default setting. Local allows you to rotate an object in object
space with the axis rotating along with it.

Y-axis always pointing up

Local Normal

Global
Selecting Global coordinates means the object will rotate within
world space with the Y-axis always pointing up. In this mode, the
rings never change position.

Object World

2D Transformations Virtual Sphere that


allow you to move in all
directions disappears
When transforming an object using the Move Tool in the top, front
and side views, you are constrained to move only in two dimensions.
When using the Rotate and Scale Tools in an orthographic view,
you can transform an object in both two and three dimensions.

Gimbal
When Gimbal Lock is on, you can rotate your object only one
axis at a time.

Copyright © 2005 Alias Systems, a division of Silicon Graphics Limited. All rights reserved.
34
Duplication
T he Duplicate command window allows you to create copies of
the objects in your scene. This saves you from having to rebuild
identical versions of objects that have been already created.
There are many options to choose from when making a duplicate.
You can Translate, Rotate, and Scale the object you duplicate and To duplicate the surface
specify the number of copies you need. Maya also lets you choose curves of an object, select
an isoparm and choose
whether or not you want to make a geometry copy or a geometry Edit Curves > Duplicate
instance of the selected object. Surface Curves.

Translate, Rotate, Scale X, Y, Z Axes


You can enter offset values for The three columns beside
the Translation, Rotation, and Translate, Rotate, and Scale
Scale of duplicated objects in represent the X, Y, and Z axes
these fields. in order from left to right.

Number of Copies Geometry Type


setAttr "spotLightShape1.centerOfIllumination" 17.56598; setAttr "spotLight1.rotate" -type double3 0

Specify the number of copies There are two ways to duplicate


to make a selected object. The an object. You can make a copy
"spotLightShape1.centerOfIllumination" 20.319657; setAttr "spotLight1.translate" -type double3 0

range is between 1 and 1000. or an instance of the geometry.

Smart Transform Duplicate Input Graph


This applies transformations and Input Connections
to subsequent duplicates of
an object. You can copy a selected node
and all of the connections
feeding into it.
10.213951 12.56598 ; setAttr "spotLightShape1.coneAngle" 65.764707; setAttr
0 0 ; setAttr "spotLight1.translate" -type double3 0 0 12.56598 ; setAttr

Duplicate with Smart Transform Instancing


When duplicating an object using Smart Transform, Maya does not create new geometry for an
Maya takes into account the transformation made instance. An instance is essentially the same object
Transformaions

from the last duplication and applies the same displayed twice, taking up less system memory.
transformation to the new duplicate. For example, An instance of an object is given its own
if you want to create a staircase, you can select the Transform node. You can make transformations
first step and duplicate it using Smart Transform. such as Rotate and Scale on each instance as well
Move and rotate the duplicate step until you are as apply different textures and shaders without
happy with its position. Duplicate the second step affecting other instances.
using Smart Transform. This time, the third step will Although they do not share Transform nodes,
already be in the right position. instance copies share the same Shape node. If
"spotLightShape1.useDepthMapShadows" on;

you change the shape of one instance, all other


instances will take on the same shape.
exploring maya

Instances of an object share the same Shape node. Changing the


shape of one object will change the shape of all Instances.

35
Copyright © 2005 Alias Systems, a division of Silicon Graphics Limited. All rights reserved.
Radial Duplication
To create a radial duplication around the pivot point Duplicate Input Connections
of a selected object, select the Duplicate Options Objects that are duplicated using Duplicate Input
window and enter both a Rotate value and the Connections share the same Construction History.
number of copies you need. For example, to create This means if you were to edit the input attributes of
Pivot Point
the palette below, the pivot point of a single piece one object, all downstream connections inherit the
was snapped to the end vertex around which the same values.
duplication was made.

Shared Construction History Duplicated node

The above palette piece was


duplicated around the Y-axis at
a rotate value of 36 and number
of copies set to 9 to complete
the palette.

Mirror Duplication
To create a mirror image of a selected object, open the Duplicate
Options window. Depending on the axis you want to duplicate along,
type in -1 in the appropriate axis field next to the scale option.
mirrored shoe

In the above example, the sections of the selected object have


been increased, thereby changing the sections of the duplicate.

Duplicate Upstream Graph


By duplicating upstream graph connections, you
can make a copy of the selected node and all
Pivot Point connections feeding into it. The duplicates do not
share Construction History.
Duplicate Along a Path
Animated Snapshot allows you to duplicate objects along a path. This
is a very useful modeling technique that uses the Time Range as well
as the start and end time, and By Time value set in the options window
as the determining factor for the number of duplications created. To
use Animated Snapshot, select both the object and path you want to
snap to on frame 1. Select Animate > Paths > Attach to Path. This
will snap your object to the path. Pick your object and select Modify >
Animated Snapshot. Maya will duplicate your object from the start to
end points on your path.

Animated Snapshot
can be used to create
duplicates of an
object along a path
that can then be used
as a modeling guide.

Copyright © 2005 Alias Systems, a division of Silicon Graphics Limited. All rights reserved.
36
Snapping
T he snapping tools let you snap to grids, curves,
points, and view planes. These tools used in
conjunction with the transformation tools allow you
Press x – Snap to grids

to control the position of both an objects pivot point


and components as you work. Press c – Snap to curves
Snapping plays a key role in many workflows
used in Maya. In any operation where objects must
be joined, the snapping tools can be used for precise Press v – Snap to points
placement. Making an object live is also a method
of snapping, where the objects can be snapped onto
the live surface. Snapping Icons
Snapping icons are located in the Status Line of Maya’s UI. You can
toggle these on and off or use the keyboard shortcuts while you work.
Constrained Snapping
Constrained snapping can be used
to make all CVs on a curve snap to
setAttr "spotLightShape1.centerOfIllumination" 17.56598; setAttr "spotLight1.rotate" -type double3 0

a straight line along one axis.


Click dragging on the Move
"spotLightShape1.centerOfIllumination" 20.319657; setAttr "spotLight1.translate" -type double3 0

Tool handle and pressing the X


key on the keyboard will snap all
selected CVs on a curve to the
nearest grid line.
To get this snapping technique
to work, you must set the Move
Tool options to World and uncheck
Preserve Component Space.
10.213951 12.56598 ; setAttr "spotLightShape1.coneAngle" 65.764707; setAttr
0 0 ; setAttr "spotLight1.translate" -type double3 0 0 12.56598 ; setAttr

Original Curve Shape Select Curve CVs Constrain CVs to


A Grid Line

Displaying Points Grid Snapping


To snap to NURBS or polygonal vertices, display The grid is a plane that can be viewed in the ortho-
the points you want to snap to. You can display graphic and Perspective views. To snap an object to
the vertices of objects in a scene by choosing the grid, either toggle on the Snap to Grids button or
Display > Nurbs Components or Display > Polygon press the X key on the keyboard. To modify the size
Snapping

Components and select the Component type you of the grid and the grid subdivision, select Grid >
want to display. Display and change options in the options window.

Display points on
unselected objects.
"spotLightShape1.useDepthMapShadows" on;

Selected object
exploring maya

Grid Snapping can be used to snap joints in a straight line when


building a skeleton.

37
Copyright © 2005 Alias Systems, a division of Silicon Graphics Limited. All rights reserved.
Point Snapping
Toggling on Point Snapping allows you to snap
vertices or pivot points to another point.
To use Point Snapping, select the object or
component you wish to snap and select the Move
Tool. Press the V key on the keyboard and middle
mouse click on the vertex you wish to snap to.
In the example to the right, the pivot point of
the scooter has been snapped to an edit point
on a path.

Snap to Curves Live Objects and Construction Planes


Snap to curves can be used to snap along any isoparm, curve or poly Making an object live allows you to snap a curve
edge. This technique is very useful when used to snap pivot points to along the UV space of its surface as you draw.
specific areas on a curve. Since pivot point location is the determining Edit points are drawn directly on the surface of a
factor for most transformations done in Maya, the ability to precisely live object. Objects that are live are green and are
snap your pivot point to a curve is very useful. not shaded. Once a curve has been drawn, it can
be moved around and will remain constrained to
the topology of the object because it is a Curve on
Surface. Construction planes can also be assigned
as live objects. They cannot be rendered, but can be
transformed and rotated to a desired angle and used
as a guide when drawing a curve. The construction
plane behaves like the ground plane which is infinite
in size. However, making an object live limits you to
snap to the size and shape of the object.

While pressing the C key on the keyboard, hold


Using the Snap to curves Tool allows you to snap down the middle mouse button to click-drag on an
to any point along a curve. This tool is useful to isoparm. This will allow you to snap pivot points
complete a Birail operation since all curves must along existing surface lines.
be connected.

Snap Align Objects


To snap one object to another, Maya offers you several tools that
you can use.The Align Tool displays a manipulator that allows you
to choose how to snap objects based on their bounding boxes, while
the Snap Together Tool allows you to snap two objects based on their
surface orientation.
You can also snap objects together based on their components.
To do so, select a control point (CV, vertex, or surface point) on the
first object and Shift-select a point on the other. Choose Modify > Snap Construction planes can be made live and allow you to draw a curve
Align Objects > Point to Point. The first point selected will snap to the that is constrained to the plane surface.
second point taking the whole object with it.

The Align Tool displays an easy to use manipulator. The Snap Together Tool lets you pick the Select a vertex on the object you want to move and then
surfaces to snap. shift and select the vertex you want to snap to.

Copyright © 2005 Alias Systems, a division of Silicon Graphics Limited. All rights reserved.
38
Artisan
P ainting with Artisan is an intuitive way to make selections, sculpt
surfaces, and paint values on selected surfaces, as well as over
multiple surfaces at a time.

Artisan Brushes
Using an Artisan brush is much like using a real paint brush, with the
ability to paint different shapes and opacities. The advantage of using
an Artisan brush is that you can select and modify the values of select-
ed surfaces quickly, receiving visual feedback while you paint. Using Stylus
a stylus pen in conjunction with the Artisan brush allows you to apply Using a stylus pen with the Artisan brush
allows you to increase and decrease the
pressure-sensitive brush strokes while you work.
pressure while you paint, much like using a
real paint brush.

Radius Profile
setAttr "spotLightShape1.centerOfIllumination" 17.56598; setAttr "spotLight1.rotate" -type double3 0

U and L Radius settings There are several brush profiles


determine the size of a to choose from when changing
"spotLightShape1.centerOfIllumination" 20.319657; setAttr "spotLight1.translate" -type double3 0

brush stroke. the shape of your brush stamp.

Opacity
The Opacity attribute Sculpt Variables
determines the frac- Sculpt Variables allow you to
tion of the amount of change the direction in which
maximum displacement an operation will occur.
or brush value applied to
each brush stamp.
10.213951 12.56598 ; setAttr "spotLightShape1.coneAngle" 65.764707; setAttr
0 0 ; setAttr "spotLight1.translate" -type double3 0 0 12.56598 ; setAttr

Operation Flood
Operation determines the Clicking the Flood button
function of the brush. An will apply your settings to
Operation can be to Push, Pull, the entire surface of all
Smooth, or Erase a surface. selected objects.
Artisan

Sculpting
"spotLightShape1.useDepthMapShadows" on;

Both NURBS and polygonal


surfaces can be sculpted using
Artisan. Adjusting attributes
such as the Radius, Opacity, and
Operation allow you to control
the degree of influence of each
brush stroke.
Sculpting with Artisan is
a very useful technique when
building organic models. Using
exploring maya

the Sculpt Surfaces Tool is much


like building a statue in clay
where you have the ability to
intuitively mold your surface.

Artisan Sculpt Surfaces Tool allows you to intuitively mold organic models. The above
example shows a torso before and after it was sculpted in Artisan.

39
Copyright © 2005 Alias Systems, a division of Silicon Graphics Limited. All rights reserved.
Selecting Painting Values
The Paint Selection Tool allows you to select and Changing values, such as cluster weights or soft-body goal weights,
deselect CVs, polygonal vertices, edges, and faces allows you to create organic quality animations. With an Artisan brush,
using an Artisan brush. There are several selection you can directly influence the way a surface moves over time by
types to choose from when using this tool. You painting values to different areas of a surface.
can Select, Unselect, and Toggle selections. There Values applied using Artisan range between 0 and 1. These values
are also global selection options that let you Select are represented by a gradation from black to white that acts as a visual
All, Select None, and Toggle all selections. You can guide when you paint.
determine the shape of your selection by choosing
different brush shapes.

The Artisan brush allows you to Select,


Unselect, and Toggle selections as well
as add to your current selection.

Painting Goal Weights


In the above example, an Artisan brush was used to paint goal weights on a soft-body character. Both
cheeks have been weighted so that when the head moves from side to side, the cheeks move more slowly
than the rest of the face.

Texture Paint MEL Extensions


Maya’s Paint Texture Tool allows you to paint directly The Script Paint Tool allows you to paint MEL script effects directly onto
onto a 3D surface. In the settings window, you can a surface with an Artisan brush. These effects can be objects, proce-
set the color value for your brush stroke as well as dures, and values.
the brush depth. You can also create other texture To load a script into an Artisan brush, put your script into the
types such as bump maps and transparencies. Scripts directory. Select Modify > Script Paint Tool and click the Setup
tab. Type the name of your script in the Tool Setup Command field and
press the Enter key. Depending on your script, you may be prompted to
enter more paint setting instructions. Once you have done this, you are
Color texture file ready to apply the effects of your MEL script using an Artisan Brush.

Painting Cloth Properties


Artisan can be used to create
cloth properties such as density,
thickness, and clothDamping with
the Attribute Paint Tool. To paint
cloth properties, select Simulation
> Properties > Paint Property
Tool found under the Cloth menu
set. You can apply properties to
selected portions of a cloth panel
without affecting the entire panel.
Paint attributes such as bendAngle
Assign File Textures can be used to apply creases in Painting Wrinkles
The above image shows a color file texture that has been created specified areas of a garment. You Using the bendAngle attribute, you can
by painting directly onto a cloth with the Paint Texture Tool. In the paint wrinkles on garments. This attribute
can also paint properties across is found in the Cloth Paint Property
options window, you can set the size and image format for your
texture file. more than one garment at a time. Tool window.

Copyright © 2005 Alias Systems, a division of Silicon Graphics Limited. All rights reserved.
40
MEL Scripts
M EL (Maya Embedded Language) is Maya’s own scripting language. MEL is used to
execute almost all functions found within Maya. Like most programming languages,
MEL has its own command language which can be used to make the most of Maya.

Where Is MEL Used?


Using MEL allows you to extend Maya’s own existing UI functionality. MEL can be used to
customize and speed up the process of your production workflow. Also, with MEL you can
write expressions for complex character animations, create macros to quickly perform repeti-
tive tasks, build procedures, and create your own custom UI elements.

User Interface Shelf


Most of Maya’s User Saving several MEL commands to
Interface is created using the Shelf can be a timesaver when
MEL scripts. undertaking repetitive tasks.
setAttr "spotLightShape1.centerOfIllumination" 17.56598; setAttr "spotLight1.rotate" -type double3 0

Marking Menus Custom User Interface


Marking menus (menus that MEL can be used to create
"spotLightShape1.centerOfIllumination" 20.319657; setAttr "spotLight1.translate" -type double3 0

pop up over the current mouse windows with buttons


position) can be customized and sliders that have been
to add shortcuts to your MEL customized for your scene.
scripts.

Command Line Script Editor


The Command Line is found The Script Editor can be
at the bottom left of Maya’s used to input and execute MEL
User Interface and can be scripts as well as offer feed-
used to execute MEL scripts back while you work.
10.213951 12.56598 ; setAttr "spotLightShape1.coneAngle" 65.764707; setAttr

and commands.
0 0 ; setAttr "spotLight1.translate" -type double3 0 0 12.56598 ; setAttr

MEL Commands Command Flags


Mel Script

MEL commands can be typed in the Command Line and the Script Command Flags give Maya
Editor. More than one command can be executed at a time by inserting instructions on how to execute
a semicolon (;) between commands. It is important to be consistent a command. Command Flags
with uppercase and lowercase naming conventions because MEL is are distinguished by the dashes
case sensitive. placed in front of them separating
Scripts comprising more than one MEL command can be quickly them as Flags.
"spotLightShape1.useDepthMapShadows" on;

accessed by creating Shelf buttons or hotkeys, or incorporating such Command Flags can deter-
scripts into the marking menus accessible from Maya’s Hotbox. mine attributes of an object such
as the scale, position, and name
depending on the Flags used. If
you wanted to create a NURBS
sphere with the Start Sweep
starting at 0 and the End Sweep
at 180, you would type the follow-
ing in the Command Line or Script
Editor: sphere -ssw 0 -esw 180;
exploring maya

In this case, sphere is the com-


mand and -ssw 0 -esw 180 are the
Flags giving Maya instructions
on how to execute the command.
Visit Maya’s online documentation
This simple MEL command executes the command revolve along with the Command Flag axis, for a list of Command Flags and
giving Maya instructions to revolve the selected curves around the Y-axis. their descriptions.

41
Copyright © 2005 Alias Systems, a division of Silicon Graphics Limited. All rights reserved.
The Script Editor Adding a Macro
The Script Editor can be opened by clicking on the Script Editor icon to the Shelf
to the right of the Command Line or by selecting Window > General A macro is a combination of several Maya commands
Editors > Script Editor.... This window is divided into two sections: that have been saved to the Shelf, Hotkey or marking
the History section and the Input field. menu. Macros are timesaving features that take repet-
The History section is a feedback window that displays MEL itive tasks and combine them into a single button.
functions that have been executed while working in Maya. With your Macros can be created by copying pieces of MEL code
middle mouse button, you can drag strings of code from this window from the Script Editor and creating a shortcut on the
into the Input field to help Shelf to execute several MEL commands at once.
develop your MEL scripts. The History section can be used as a learning
tool to help build upon your MEL scripting knowledge. Macro
You can directly type and execute strings of MEL code in the Input To create a macro, highlight
several commands at once and
field. In this field, you must use the Enter key on the numeric keypad to drag them to the Shelf using
execute a command; using the Enter key on the alpha-numeric keypad the middle mouse button.
takes you to the next line.
Building Procedures
A procedure is code that has been written in the
History Script Editor or a Text Editor outside of Maya and
The History section offers can be stored in memory. When writing a proce-
feedback on functions
executed in Maya. dure, it is important to write a description of what
the procedure is meant to do. The description
Input should be written with comment tags (//) in front
The Input field is used to type of it so that once the script is executed, Maya will
in and execute MEL scripts.
know to ignore these lines. The power of proce-
dures is that they do more than simply execute
commands, they are able to pass arguments from
one procedure to another, store variables, and
How to Use a MEL Script support arguments that require user input.
A MEL script is a file that contains MEL commands, procedures, or
both. MEL scripts should be saved in the scripts directory where Maya Building a Custom User Interface
will look for them. With MEL, you can build your own custom UI with
Before using any MEL script, it is important to read the header information relative to your scene. Since most user
information describing the purpose of the script. The header states the interface elements are created using MEL, you have
usage of the script and whether or not there are any variables required the power to create custom windows with buttons,
to execute it. It is also important to be aware of any reference the sliders, and other controls to modify your scene.
script may have to other scripts, which would also have to reside in
the Scripts directory to be found by Maya.
There are two ways to execute a MEL script. One way is to type
the script name in the Command Line and press the Enter key. Maya
will search the Scripts directory for a .mel file with the same name and
execute it. You can also type the script name in the Script Editor and
execute it using the Enter key on the numeric keypad. The Script Editor
can be used to review or edit the script within Maya.

Command Line

A Text Editor can also be used to write MEL scripts that can be accessed by typing the name
of the procedure in Maya’s Command Line. In this example, spiral.mel is saved under the same
name as the procedure “spiral” and is placed in the scripts directory. This script requires the
user to type in the name of the procedure with a specific height, radius, and the number of This simple MEL script creates a window with the title “Art of Maya,”
turns to create a spiral that is centered about the origin. specifying button and slider names, and slider values.

Copyright © 2005 Alias Systems, a division of Silicon Graphics Limited. All rights reserved.
42

You might also like