Script Editor
MEL (Ctrl+Enter, or Enter from numeric keypad to run)
sphere
textCurves -t "Hello World"
Shelf button
To create a shelf button, just select lines of code you would like to contain in that button from history panel. Drag the code lines to the shelf and a new shelf button is created.
Execute MEL
1. Command Line
Used to write and execute simple commands that are typically one line in length. It is possible to write more than one command in the Command Line using semicolons to separate each one, though in practice this becomes cumbersome for all but the simplest set of commands.
2. Command Shell
The Command Shell is a window that operates like a Unix shell window. MEL
commands can be executed from this window. Those familiar with Unix shells
may be more comfortable using the Command Shell. To access it, select
Windows [ General Editors... I Command Shell... from the main Maya menu.
3. Script Editor
The Script Editor allows you to write multiline scripts. Once executed, the
script is listed in the History Panel. You can copy and paste the script back into
the Command Input Panel for further editing and refinement. This is the main
method of creating simple, yet functional scripts. Once they are tested and
debugged in the Script Editor, they can then be saved to a script file for later
reuse.
4. Shelf
Once you have finished writing and testing your commands, they can be
assigned to an item in the Shelf control. You can edit the commands for the
item by using the Shelf Editor.
5. Script Files
Saving your scripts to files is the main method for defining a series of commands
that you want to keep between Maya sessions. Once stored to a script file, the
commands can be used in different scenes and projects.
6. Others
There are other ways of executing MEL commands including hotkeys, expressions,
and Script Nodes.
Command line query (Creation Mode vs. Query Mode) One query for one attribute
sphere -radius 1.5 -name MySphere;
sphere -query -radius MySphere;
//Result: 1.5
Command Edit (Edit Mode) One Edit for many attributes
sphere -edit -radius 3 MySphere;
sphere -edit -radius 4 -degree 1 MySphere;
Command Modes
In conclusion, there are three modes: create, query, edit.
Different modes cannot be mixed into a single call!
Maya MEL 脚本编辑与执行
本文介绍了 Maya 中使用 MEL (Maya Embedded Language) 编写和执行脚本的方法,包括通过命令行、命令壳、脚本编辑器等不同方式执行 MEL 命令。此外还探讨了如何创建货架按钮、保存脚本文件以及 MEL 命令的不同模式。
1024

被折叠的 条评论
为什么被折叠?



