ImageVerifierCode 换一换
格式:DOCX , 页数:13 ,大小:19.83KB ,
资源ID:9492138      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/9492138.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(MAYA MEL帮助文档中文翻译.docx)为本站会员(b****7)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

MAYA MEL帮助文档中文翻译.docx

1、MAYA MEL帮助文档中文翻译MAYA MEL帮助文档中文翻译Chapter 1 相关背景2009-12-19 19:45Chapter 1 相关背景 一,MEL概况: MEL是maya内部使用的脚本语言,maya的图形用户界面就是用MEL写成,MEL提供简单的方式来扩展maya的功能。用maya图形界面能做到的任何事情都能用MEL来自动完成,熟悉MEL能加深对maya的理解。 使用MEL有一定的优势,即使你不会编程语言。例如:在maya中利用图形用户界面来完成一些事情是很容易的事情,当你完成一些操作后,脚本编辑框里面会生成一些MEL命令,拖拽这些命令到搁板,maya会在搁板上生成一个按钮,

2、点击这个按钮便执行刚才的操作。然而,学习MEL将为你开启一个新的世界,MEL可以帮助你制作一些特殊的效果,为你节约很多的时间,这些是用maya图形用户界面很慢做到的。 下面是你可以用MEL来完成的一些例子: *绕开maya用户界面,创建快捷方式,存取一些高级特性。 *定义maya的用户界面,改变一些基础的默认设置。 *创建属于自己的程序和脚本,以完成模型、动画、动力学和渲染任务。/原文:MEL Overview MELTM is a scripting language at the heart of Maya. Mayas user interface is created using ME

3、L, and MEL provides an easy way to extend the functionality of Maya. Everything you can do using Mayas graphical interface can be automated and extended using MEL. Familiarity with MEL can deepen your understanding of and expertise with Maya.You can take advantage of MEL without learning programming

4、. For example, its easy in Maya to perform some actions with the graphical interface, then drag the commands that resulted from the Script Editor to the shelf to create a button. However, learning MEL will open up new worlds to you, allowing you produce effects and save time in ways impossible using

5、 the graphical interface.Here are some examples of things you can do with MEL:Bypass Mayas user interface, quickly create shortcuts, and access advanced features.Customize Mayas interface and change defaults on a scene-by-scene basis.Create procedures and scripts for custom modeling, animation, dyna

6、mics, and rendering tasks.-(12.19)二,关于这本MEL和表达式的书 这本书主要用来说明怎么用MEL语言来创建脚本。 maya有数千条命令,以来完成各种各样的功能需求,有一些非常特别。一些通常使用的非常重要的函数,在本书的“有用的函数”这部分中把它们单独列出来了。但是要想找到任意一个,或者全部MEL命令的话,还请查阅maya帮助文档中的MEL命令参考文档。 /原文:The MEL and expressions book This book explains how to create scripts in the MEL language. Maya has l

7、iterally thousands of commands to perform various functions, some very specific. We have highlighted the functions most useful in general programming in the “Useful functions” section of this book. However, to find out about any and all MEL commands, refer to the MEL command reference documentation

8、in Maya Help.-(12.20)三,MEL最作为程序设计语言。 作为一门语言,MEL是从UNIX的脚本语言移植而来,这意味着MEL在执行命令去完成一些事情方面是非常强大的,甚至优于其他语言中的构造数据结构、执行函数、面向对象方法。 你用来控制maya的很多命令,执行起来就像UNIX里面的命令行那样有效:短小的代码,跟着很多的选项,用来修改定制对象的行为。 心里保持着MEL来自于UNIX的SHELL脚本血统,有助你去理解它的一些怪异面貌(quirkier aspect)。*快速浏览: 赋值: 赋值运算在MEL中也是用“=”号来完成,这跟C,JAVA中一样,也有有一些快捷的操作符,例如:

9、 (+=, -=, /=, *=, +, -, etc.). MEL是强类型语言(strongly typed language,这个不明白什么意思,可能是想C+那样必先强制先定义类型,然后再使用的那种),但是在很多场合它都允许隐性声明。在声明一个变量的时候,同时可以声明变量的类型,并随意指定它的初始值。 MEL的变量名字由“$”符号为前缀(这点在开始使用MEL的时候很不习惯,有点quirkier),后面再加上字母,然后可以是字母,数字,下划线的组合。 MEL的数据类型,有平常使用的普通类型:整型(就是整数),浮点型(就是实数),字符型(就是字符了),它还有向量,数组,矩阵这些数据类型(这些类

10、型的含义后面慢慢介绍)。 int $a = 5; /定义一个整型变量“$a”,给变量“$a”指定了一个初始值为5。float $b = 3.456;/定义一个浮点型变量“$b”,给变量“$b”指定了一个初始值为3.456。vector $v = ; /定义一个向量型变量“$V”。float $ar = 1.2, 3.4, 4.5; / 定义一个元素为浮点类型数据的数组。matrix $mtx32; / 定义一个矩阵;在maya中不能定义一个由很多数组数据组成的数组;很多时候,MEL会自动进行数据类型的转换; /原文:MEL for programmers As a language, MEL

11、is descended from UNIX shell scripting. This means MEL is stronglybased on executing commands to accomplish things (like executing commands in a UNIXshell), rather than manipulating data structures, calling functions, or using objectoriented methods as in other languages.Most commands you use to con

12、trol Maya act like UNIX command-line utilities: littlestand-alone programs with many options that modify their behavior.Keeping the shell scripting origins of MEL in mind will help you understand someof its quirkier aspects.Quick overviewAssignment and valuesThe assignment operator in MEL is the equ

13、al sign (=). MEL also has shortcut assignment operators like C and Java (+=, -=, /=, *=, +, -, etc.). MEL is a strongly typed language, however it allows implicit declaration and typingin most instances. When you declare a variable you also declare its type and can optionallyassign an initial value.

14、Variable names start with a $, followed by a letter, then any combination of letters,numbers, and underscores. Unlike PERL, all types of variables (scalar and compound)start with $.MEL has the usual integer (int), floating point (float) and string data types. It also has a vector data type which is

15、a triple of floats (which can be useful when working with 3D data), arrays (a variable-sized list, in which all elements are of the same type), and matrices (matrix, a fixed-size two dimensional table of floats). Items in an array must all be of the same type.int $a = 5;float $b = 3.456;vector $v =

16、;float $ar = 1.2, 3.4, 4.5; / An array of floatsmatrix $mtx32; / A 3x2 matrix of floatsYou cannot make an array of arrays in MEL.MEL automatically converts types whenever possible.-(12.21)控制和循环语句的声明和操作: MEL控制语句的声明跟C非常类似: if ($a = $b) . else if ($a $b) . else . $a = ($b 10) ? $c : ($c - 10); switch (

17、$color) case blue:.break;case $c1:.break;default:.break; while ($a 0); int $i;for ($i = 10; $i 0; $i-) print($i+.n);print(Blastoff!); string $arry3 = red,green,blue;for ($k in $arry) .定义和执行函数(Defining and calling procedures,根据后面的意思,应该是定义一个函数 ):用以下的语法来自定义一个函数:global(全局) proc(自定义函数的关键词) (返回值类型) (自定义函数

18、的名称)((参数列表)) .(执行语句)return ; global proc float squareAndAdd(float $x, float $y) return $x * $x + $y;square(5.0, 2.0);27如果不加前面的“global”这个关键词的话,定义的函数只能在这个脚本文件中使用,就是说加上关键字“global”的话,此自定义函数在其他脚本文件中也可以使用。如果函数没有返回值,则可省去返回值类型,执行语句中也不需要返回语句:global proc msg() print(Hello worldn); 注释:MEL使用C+风格的注释,单行命令使用/来注释,即

19、一行代码中/后面的字符为注释,使用“/*”和*/包围起来的字符都是注释部分,可以换行; MEL风格:MEL有很多特征,会绊倒有经验的程序员:每一句声明语句,都要以符号;为结束的标志:if ($a $b)print(Hello);两个双引号是必须的! 不像其它一些脚本语言,MEL中输入一个有返回值的表达式,MEL不会自动输出返回的值,反而会提示语法错误。3 + 5;/ Error: 3 + 5; / Error: Syntax error /print(3+5);8 MEL允许你用命令语法和函数语法这两种语法来书写代码,用命令式语法来书写代码,可以省去引号,和用空格来代替逗号,如:setAttr

20、(mySphere1.translateX,10); / 函数式语法setAttr mySphere1.translateX 10; / 命令式语法函数式语法会自动返回一个值,如果用命令式语法的话,就需把命令有单引号括起来:$a = getAttr(mySphere.translateX); / Function syntax$b = getAttr mySphere.translateY; / Command syntax /原文:Control and looping statements and operatorsMELs control statements are very simi

21、lar to C and Java.if ($a = $b) . else if ($a $b) . else . $a = ($b 10) ? $c : ($c - 10); switch ($color) case blue:.break;case $c1:.break;default:.break; while ($a 0); int $i;for ($i = 10; $i 0; $i-) print($i+.n);print(Blastoff!); string $arry3 = red,green,blue;for ($k in $arry) .Defining and callin

22、g proceduresYou create user-defined procedures using the following syntax:global proc () .return ; global proc float squareAndAdd(float $x, float $y) return $x * $x + $y;square(5.0, 2.0);27If you leave out the global keyword the procedure is only available in the scriptfile in which it is defined.If

23、 the procedure does not return a value, leave out the return type keyword and donot include a return statement. global proc msg() print(Hello worldn);CommentsMEL uses C+ style single-line comments preceded by / and freeform comments surrounded by /* and */. MELismsThere are some aspects of MEL progr

24、amming that will trip up experienced programmers aswell as beginners.Every statement in MEL must end with a semi-colon (;), even at the end of a block.if ($a $b) print(Hello);/ Both semicolons are required!Unlike some scripting languages/environments (but like the Logo language), statingan expressio

25、n that returns a value does not automatically print the value in MEL. Instead it causes an error.3 + 5;/ Error: 3 + 5; / Error: Syntax error /print(3+5);8In MEL, you often use the same command to create things, edit existing things, and query information aboutexisting things. In each case, a flag co

26、ntrols what (create, edit, or query) the command does./ Create a sphere named mySphere with radius 5sphere -radius 5 -name mySphere; / Edit the radius of mySpheresphere -edit -radius mySphere; / Print the radius of mySpheresphere -query -radiusMEL allows you to type commands in command syntax(simila

27、r to UNIX shell commands) and function syntax.In command syntax you can leave off quotation marks aroundsingle-word strings and separate arguments with spaces instead of commas.setAttr(mySphere1.translateX,10); / Function syntaxsetAttr mySphere1.translateX 10; / Command syntaxFunction syntax automatically returns a value. To get a returnvalue using command syntax, you must enclose the command in backquotes.$a = getAttr(mySphere.translateX); / Function syntax$b = getAttr mySphere.translateY; / Command syntax -(12.23)

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1