2007年4月17日星期二

MEL笔记 1

source命令:
Maya的文档上说:“ It is important for advanced MEL users to understand that "source" is not a MEL command.”
在文档中举的几个例子似乎对此也有暗示。根据我的体会,source不接受变量做参数。比如source "mel_file.mel"是可以的,但是如果用这种形式:
string $mfile = "mel_file.mel";
source $mfile;
就会提示语法错误。使用eval似乎也不可以trick。

$gShelfTopLevel变量:
global string $gShelfTopLevel;
这个变量似乎是工具架的默认父级部件,createNewShelf等创建shelf的命令都会将新的shelf添加到这个变量所指的部件之下。

shelf文件:
SaveAllShelves之后,各个工具架上的button都会被保存到mel文件中,里面是一个函数,函数命即为工具架的名称。函数的内容就是一些shelfButton命令。
例如:
global proc Polys () {
global string $gBuffStr;
global string $gBuffStr0;
global string $gBuffStr1;


shelfButton
-enableCommandRepeat 1
-enable 1
-width 38
-height 38
-manage 1
-visible 1
-preventOverride 0
-align "center"
-label "Sphere"
-labelOffset 0
-font "tinyBoldLabelFont"
-image "polySphere.xpm"
-image1 "polySphere.xpm"
-style "iconOnly"
-marginWidth 1
-marginHeight 1
-command "polySphere -r 1 -sx 20 -sy 20 -ax 0 1 0 -cuv 2 -ch 1; objectMoveCommand;"
-sourceType "mel"
-actionIsSubstitute 0
;
}

没有评论: