Maya 3D - Mel Scripting.pdf
(
5150 KB
)
Pobierz
677500249 UNPDF
MEL Scripting
Modeling Heads for Animation
A
PPENDIX
A
MEL Scripting
by Jesse Andrewartha and Matt Ontiveros
Introduction to MEL Scripting,” written by Jesse Andrewartha, is
a basic introduction to some MEL concepts. Jesse has added example
scripts for you to experiment with, along with explanations of tools
and descriptions of various MEL functions.This section of the appendix
gives you an idea of how Maya Embedded Language (MEL) is orga-
nized and provides insight into the proper syntax and operations of
MEL.
The second section, “Custom Window Control Setups,” is written by
Matt Ontiveros. It takes you to the next level of MEL, in that you can
put to use the introduction material of the first section to see how
MEL works for building a custom window and controls for a character.
The main thing to realize is that this chapter is an introduction to MEL
and is by no means the only approach to the tool.You should further
your study in this area of Maya by gathering as much information and
examples as possible in MEL and scripting.The more you use MEL, the
better you will understand its potential. Soon you will be able to write
your own scripts for your own projects that not only create solutions,
but ones that are truly unique.That is the goal of MEL.
T
his appendix is divided into two parts.The first section, “An
4
maya 2 character animation
A.1 An Introduction to MEL Scripting
In a nutshell, MEL provides the foundation for Maya’s operation. It is
complementary to the base architecture of Maya. Although this might
seem a simple, singular concept, its implications are far reaching: MEL
allows unparalleled control over all aspects of the program. Incorporating
scripting into the animation workflow can greatly enhance productivity
as well as automate and create effects that are difficult and prohibitively
time consuming to complete with standard tools and workflows that are
common in Maya. From complex character animation and modeling
to special effects or rendering tools, MEL allows the user to increase
production speed and simultaneously create richer and more subtle
images and animation.With more than 600 commands and 75 functions,
MEL can be used to create custom effects, macros, custom GUIs, and
customization of Maya’s interface for particular scenes and requirements.
A.1.1 Writing MEL Scripts
There are three ways through which to write MEL scripts within the
Maya interface: the command line, the Script Editor, and the Expression
Editor.
A.1.1.1 The Command Line
The command line is visible in the UI immediately below the range
finder at the base of the screen.The command line, however, is limited to
displaying only one line of script at any given time and is therefore best
suited to single-line commands or procedures that reference larger
scripts.
appendix A: MEL scripting
5
Figure A.1
Located in the lower-left corner of the
Maya interface, the command line
allows simple execution of one-line
commands without having to open the
Script Editor window.
Command line
A typical example of a script used in the command line, to move a
primitive sphere, “Ball,” 90 degrees around the Z axis, would be written
in the command line as follows:
Rotate –r 0 0 90 Ball;
A.1.1.2 The Script Editor
In contrast, the Script Editor allows an almost limitless number of lines
and is most often preferred over the command line for writing out
complete scripts.
The Script Editor is specially designed to construct and execute MEL
scripts, and to record actions as they occur in the interface.To access
the Script Editor, select Window, General Editors, Script Editor.
6
maya 2 character animation
Figure A.2
Accessible either through the Windows
menu or by clicking the Script Editor
button, located in the lower-right side
of the Maya interface, the Script Editor
allows the execution of highly complex
scripts, and records all actions in MEL.
The Script Editor is also accessed from the UI, represented by a small
button immediately to the right of the playback controls at the base of
the screen.
The Script Editor is split into two parts.The bottom portion, or Input
Field, is used to enter MEL scripts, and the top portion, or History
Field, displays executed MEL scripts and the corresponding results or
errors.You can also use the Script Editor to save, import, and find script
files from your database.
When an action is executed using the Maya UI, the corresponding
MEL scripts used to carry out this same action are usually echoed in
the Script Editor’s History Field.To ensure that all MEL commands
are echoed to the Script Editor, click the option Echo All Commands,
which can be executed through Script Editor, Edit, Echo All
Commands.
This provides an excellent method to become familiar with MEL com-
mands; use the Maya UI to perform your work and observe the corre-
sponding MEL as it appears in the Script Editor.With the Echo All
Commands option on, the MEL commands for almost any action that
the user executes are displayed in the History Field. Note that there is
not always a one-to-one correspondence between what the user exe-
cutes and what is relayed to the Script Editor, regardless of whether the
Echo All Commands option is on or off. It is often useful to copy com-
mands out of the History Field and paste them in the Shelves or in the
Input Field (Shelves are discussed in more detail later in this chapter).
The copied script can be executed, or the information you need can be
pasted into other scripts to save time in typing.
A.1.2 The Expression Editor
You can also use the Expression Editor to execute MEL expressions.
Expressions
are MEL scripts that use more than one command to create
an effect.The Expression Editor is specialized, however, and is usually
used only when applying commands to specific objects or their
attributes. It is also used to create Creation and Runtime expressions
when dealing with particles.
The Expression Editor is divided into two main sections.The upper
section is where you select the particular object and attribute to which
the expression will be applied. If you want to edit an expression, this
area can also list all the expressions active in the scene.The lower section
Plik z chomika:
Szycha20
Inne pliki z tego folderu:
Maya Tutorial - Creating a Dragon.pdf
(3512 KB)
Autodesk Maya Tutorials Collection (ENG).pdf
(172066 KB)
Learning Autodesk Maya 2009 Foundation.pdf
(148668 KB)
Getting Started Maya 2010.pdf
(27224 KB)
LEARNING.MAYA.CHARACTER.RIGGING.AND.ANIMATION.pdf
(53635 KB)
Inne foldery tego chomika:
ANGIELSKIE
Audiobook
Autodesk 3d MAX
Zgłoś jeśli
naruszono regulamin