在写mel程序时,友好的用户界面是很重要的,因此需要掌握一些基本控件的使用方法,在学习的过程中,也留给自己作为笔记,同时也希望能对有需要的人有些帮助。

1.创建一个window,里面可以包含很多的控件,比如基本的button,checkbox,textfield等等

window;
columnLayout;text -label "My text";button -label "I'm a button";checkBox -label "Check Box";radioCollection;radioButton -label "start";radioButton -label "stop";floatField -value 3.41;textField -text "Hello";
showWindow;

2.控件触发执行相应命令

global proc Create_sphere()
{sphere -name "MySphere";
}window;columnLayout;button -label "My Sphere" -command "Create_sphere()";
showWindow;

3.界面布局,有ColumnLayout,RowLayout,FrameLayout等等

window;columnLayout -columnWidth 150;button;button;
showWindow;

4.确认对话框

$my_confirm = `confirmDialog -title "Confirm" -message "Yes or No"-button "YES" -button "NO"-defaultButton "YES"    -cancelButton "NO"-dismissString "NO"`;
if ($my_confirm == "YES"){print "User has picked YES\n";
}
else if ($my_confirm == "NO"){print "User has picked NO\n";
}

4.提示框

string $text;
string $my_prompt = `promptDialog-title "Rename An Entity"-message "Enter Name:"-button "OK" -button "Cancel"-defaultButton "OK" -cancelButton "Cancel"-dismissString "Cancel"`;//get new name of entity
if ($my_prompt == "OK") {$text = `promptDialog -query -text`;print ("New name for Entity: " + $text + "\n");
}
else if ($my_prompt == "Cancel") {print ("OK, fine don't rename....\n");
}

5.获取输入框中的数字

window intFieldTestWin;
columnLayout;
intField intergerField;
showWindow intFieldTestWin;//then declare an interger variable to store your valueint $intStorage;//now, type an interger in the window.
//Then, use the infField query mode to query the value of the window into
//the variable. You use the single quote (``) signs for this.$intStorage = `intField -q -v intergerField`;
print $intStorage;
// To do it the other way around, meaning to put the value of a variable into the field
// itself, you can try this.
// Declare a variable with a value.int $intStorage = 20;// Then use the intField edit mode to input the variable as the arguement
// for the window.intField -e -v $intStorage intergerField;
// Basically, most UI controls share the same creation/edit/query syntax.

6.取得输入框的值并进行相应的动作

window -t "test";gridLayout -numberOfColumns 3 -cellWidthHeight 100 30 -w 300 -h 50;text -label "个数:";intField -min 1 -max 10 number;button -label "生成" -c "test";
showWindow;proc test()
{global string $intFieldName = "";int $value;$value = `intField -query -value number`;print($value);int $i = 0;for($i=1;$i<=$value;++$i){polyCylinder -r 1 -h 2 -sx 20 -sy 1 -sz 1 -ax 0 1 0 -rcp 0 -cuv 3 -ch 1;polyCylinder -r 1 -h 2 -sx 20 -sy 1 -sz 1 -ax 0 1 0 -rcp 0 -cuv 3 -ch 1;move -r 0 1.40901 0 ;//scale -r 0.487535 0.487535 0.487535 ;$randx = rand(0.2,2);$randy = rand(0.2,2);$randz = rand(0.2,2);scale -r $randx $randy $randz;select -r ("pCylinder"+ ($i*2-1)) ("pCylinder"+$i*2) ; move -r ($i*3) 0 0 ;  }
}

Maya Mel GUI入门相关推荐

  1. maya mel新手入门要注意的小地方

    很早以前也用过maya的mel脚本,但只限于稍微用用 最近又要写个脚本,才稍微整理的几个新手要注意的坑,也方便日后查阅 脚本之前先说几个注意点, 1 把maya环境改成英文的,虽说中文没问题,但是总觉 ...

  2. MAYA 2022基础入门学习教程

    流派:电子学习| MP4 |视频:h264,1280×720 |音频:AAC,48.0 KHz 语言:英语+中英文字幕(根据原英文字幕机译更准确)|大小解压后:3.41 GB |时长:4.5小时 包含 ...

  3. Maya游戏角色绑定入门学习教程 Game Character Rigging for Beginners in Maya

    准备好开始为游戏制作自己的角色动画了吗? 你会学到什么 了解Maya的界面 优化并准备好你的模型,为游戏做准备 了解关节以及如何使用它们来构建健壮的角色骨骼,以便在任何游戏引擎中制作动画 了解IK和F ...

  4. java gui 读取文件夹_java Swing GUI 入门-文件读写器

    java Swing GUI 入门-文件读写器 觉得有用的话,欢迎一起讨论相互学习~ 首先创建一个独立的窗口 public CoupPad(){} public static void main(St ...

  5. java gui介绍_IntelliJ IDE 开发Java GUI 入门

    原标题:IntelliJ IDE 开发Java GUI 入门 j主要对java 的GUI相关知识进行简单的介绍和总结,整个博客按照创建一个java GUI的顺序进行介绍,期间穿插讲解用到的java S ...

  6. Matlab基本的数字基带信号APP界面(GUI入门)

    Matlab基本的数字基带信号APP界面(GUI入门) 基本的数字基带信号 单极性不归零波形 双极性不归零波形 单极性归零波形 双极性归零波形 差分波形 多进制波形 界面 总代码 基本的数字基带信号 ...

  7. maya mel uf8_Maya Mel语言

    Maya Mel语言视频简介: mel是Maya Embedded Language(Maya内置语言)的缩写,是一种强大的命令和脚本语言,让你直接控制Maya的特征.进程和工作流程. mel有一个很 ...

  8. java的显示图片的控件_java Swing GUI 入门-图片和控件可视化

    java Swing GUI 入门-图片和控件可视化 觉得有用的话,欢迎一起讨论相互学习~ 加入一张图片 一个Imagelabel 设置居中,命名为logoLabel,Custom Create 打勾 ...

  9. maya mel插件中文显示乱码问题解决方法

    环境:win10 中文, maya mel 插件调用txt文本,显示中文文字时出现了乱码,后来发现,时创建文本时,自动用的utf-8, 后来改为随顺 系统默认Ansi 后,再创建的txt文本显示正常了 ...

  10. maya mel uf8_新手入门Maya mel要注意的 8个细节

    脚本之前先说几个注意点, 1 把maya环境改成英文的,虽说中文没问题,但是总觉得不习惯 如果安装后是中文的,要改成英文的 x:\Program Files\Autodesk\Maya2014\res ...

最新文章

  1. java缓存流速度与硬盘_系统学习 Java IO (九)----缓冲流 BufferedInputStream/BufferedOutputStream...
  2. c语言删除文件中的结构体_C语言插入、删除、更改文件内容
  3. webpack4.x 模块化浅析-CommonJS
  4. Node.js 文件系统流pipe到Http响应流中
  5. Go语言基础:method
  6. PHP和MySQL入门(3)
  7. 趣味编程:C#中Specification模式的实现(参考答案 - 下)
  8. 使用QT的一些小Tipster
  9. CBA Opportunity Fiori应用的getEntitySet实现
  10. 阿里巴巴下一代云分析型数据库AnalyticDB入选Forrester Wave™ 云数仓评估报告 解读
  11. 字符(串)输入输出函数
  12. HTTP Get POST方式请求数据
  13. block和代理小结
  14. 日语学习软件推荐——五十音图APP:AI纠正你的日语发音
  15. 测量员软件测试版,测量员测距尺子app
  16. 视频帧数,普清,高清,超清,分辨率
  17. 2021上海交大网络安全保研夏令营经验
  18. 移动端框架之mand-mobile
  19. office 无法正常读取打开 pptx 文件的解决办法
  20. 逾期的人真有这么多吗?

热门文章

  1. 电脑里有老版java删不掉,电脑上的一些文件老是删不掉怎么办 win7中经常出现一些文件夹删不掉...
  2. 机器学习(6)——凸优化理论(一)
  3. 很强悍的在线科学计算器
  4. 如何用定积分求椭圆的周长_怎么用微积分求椭圆的周长?
  5. update在python中是什么意思_update()与save()有什么区别
  6. 计算机学报在线阅读,ei收录的计算机类核心源:计算机研究与发展计算机学报软件.doc...
  7. 4565: [Haoi2016]字符合并 区间DP
  8. 「技术选型」Solr与ES难以抉择?且看第一回
  9. WEB自动化学习路线(转载)
  10. mysql和sqline的异同_mysql的那点事儿,你知道吗