MEL写界面的基本概念

来源:互联网 发布:单声道蓝牙软件 编辑:程序博客网 时间:2024/05/16 11:19

window;//新建一个window

showWindow window1;//显示建立的window1

 

window -widthHeight 200 300 mywindow1;//设置宽和高

showWindow mywindow1;

 

window -widthHeight 200 300 mywindow2;

columnLayout myLayout;

button -label "First" mybutton;//创建一个button

showWindow mywindow2;

 

 

将图形元素添加到窗口之前,Maya必须知道你在窗口哪里旋转该元素。于是就需要添加一个布局元素(layout element)。布局控制着如何放置随后的元素。有多种方法来实现。如:

button -label "Second" -parent mywindow2|myLayout;

这样就向窗口添加了标为Second的按钮

 

下面的例子就显示了不同的column显示的结果

 

window -widthHeight 200 300 mywindow3;

columnLayout;

button -label "First";

button -label "Second";

rowLayout -numberOfColumns 2;//设置一行两个

button -label "Third";

button -label "Fourth";

setParent ..;

button -label "Fifth";

showWindow mywindow3;

 

下面就设置点击按钮然后画一个球

window -widthHeight 200 300 ;

columnLayout;

button -label "click" -command "sphere";

showWindow;

 

global proc myText(string $txt)

{

print "/n The text entered was " + $txt);

}

window -widthHeight 200 300 window1;

columnLayout -adjustableColumn true;

textField -text "Change this text" -enterCommand "myText(/"#1/")";

showWindow;