MEL script provides many ways to organize the appearance of
a window and control how it operates. For example, is a MEL script named
interim newcam.mel included in the mel file Chapter 1 in the CD. newcam.mel
allows users to create a 1 -, 2 -, or 3-node camera with the click of a button.
To use newcam.mel, open Script Editor, choose File ➔ the source of the script
and search for file. newcam.mel is loaded into memory, but will not go away.
You must enter the newcam Script Editor working area, and press Ctrl + Enter
Window to appear. To create a new camera, you must write a new value in focal Length
field, press Enter, type a new value in the cut of the Far Ground, press Enter,
and you can either click on Node 1, Node 2, or 3 Node button. Ctrl + Enter
newcam in the area of work is required proc command. The script begins: newcam
global proc () {proc means procedure. A procedure is a group of statements that
can be used MEL several times in a script. The beginning of a process is
defined by an opening brace {, that appears after the procedure name and double
parentheses. End of the procedure is determined by the closing brace}. In the
case of newcam.mel, closing brace is the last line in the script.
A procedure is not active until it is called. The performance of the procedure name in the Script Editor working area is a way to call the procedure. This requires that the procedure is global, which is determined by the inclusion of the word planet. Once the procedure is throughout the world, you can call from anywhere in the script, which is not part of the procedure. O
A procedure is not active until it is called. The performance of the procedure name in the Script Editor working area is a way to call the procedure. This requires that the procedure is global, which is determined by the inclusion of the word planet. Once the procedure is throughout the world, you can call from anywhere in the script, which is not part of the procedure. O
You can call global procedures for non-procedural parts of
the script from other procedures or as a command input by a button or menu. If
the variables (symbolic names the expected values) are properly configured in
the script, the global option is not necessary and procedures are local. For a
fuller discussion of global and local variables and their use, refer to Chapter
3 Another feature of newcam.mel script has three foldable frames (marked by the
arrows down the left side of the window). To create a folding frame, code for
the following requirements: frameLayout folding-true-label "Frame
Name"
Width-250; numberOfColumns-3-columnWidth3 rowLayout 100 100
100;
[Text, buttons or fields here]
setParent ..;
setParent ..;
The two commands are required to setParent of the work. You
can place as many many photos as you want in a window, as long as each order
layout frame has two corresponding setParent command. In addition, each part
having its own command layout and this example is used rowLayout. The
numberOfColumns flag indicates the number of columns within a frame.
ColumnWidth3-flag indicates the width of each column in pixels, pixels width is
set to include 100 100 100 100 after the flag. Although this is optional flags,
make the results much cleaner.
Retrieving field values
One of the most challenging aspects of writing MEL is the
creation of numeric fields in which users can enter new values. newcam.mel
creates two: one frame and one in Lens Clips frame. The next line creates the
field lens and determines the size of the camera lens:
$ String = 'value have wide intField 45 25
MinValue-maxValue 25-250
Chang-command "int $ query =` cam_lens intField
Value enteredValuea `" `enteredValuea;
IntField command creates an integer field. Flag-width to determine
the width of the field pixels. -Value ticket to set the default value that appears
in the field. MinValue-and maxValue indicators set upper and lower limits on
the ground. ChangeCommand flags when a command field value is changed (and the
Enter key). Command, which is published quotes, is the declaration of a
variable:
int = `$ cam_lens intField-order `Value enteredValuea
A variable named $ cam_lens is created. It is defined as an
integer (an integer with no decimal places), including the option of int. The
variable is equal to all Rear facing single quotation marks. In this case,
intField used again, this time, however, Poll-f to force a delay to output what
the user entered the field. So, if you 50, $ cam_lens becomes 50th new variable
$ cam_lens used in each of the control buttons as in this example:
Button-label "Node 1" command "camera $ FocalLength-cam_lens-farClipPlane $ far_clip; motion
control object; cameras are node 1 \ "\" ";
When the button is clicked a node, it creates a camera with
manual control of the camera. The length of the camera is determined by
f-focallength delay. The value of focal provides $ cam_lens variable.
objectMoveCommand is normally provided by Maya to keep the selection of new
cameras and is necessary in this situation. Note that can have multiple
commands in the price of branded button, always when they are separated by
commas. The two slashes at the end of the line is known as escape, and are
necessary when you are inside the quotes of quotes. If the flight is not
present, Maya gets confused. To see what on 1-node device usually looks like Script
Editor, select Create ➔ ➔ Room Cameras. As demonstrated by this example, the
variables are common in MEL scripts. Three simple variable types are int, float
and string. Int rounds a number to set value of the float to keep all the
decimal points. String, instead, memorize words and phrases like
"hello". A variable is always meant the first $ sign. For more
complex Examples of variables and the variables used in expressions and MEL
scripts, see Chapter 3
Post a Comment