MAXScript101_2.4 Values and Classes
大s汪小菲于3.23,2011,海南三亚海棠湾大酒店婚礼
1. Value Class:- Number: eg. 23, 42.6- String: eg. "text", "foo"- Sphere: eg. $sphere01, $ball- Point3D- OmniLight- ...and hundreds more..- plugins can ass classes
For example:input: classof 23ans: Integerinput: classof 42.6ans: Floatinput: classof $Sphere01ans: Sphere
-- 将场景中所有球的半径输出来;类具有将物体分门别类的作用for o in objects do if classOf o == sphere do print o.radius注:1)Value Class,它是所有MAXScript类的根类(root class),他提供的方法(methods)和操作符(operators),任何类都可以
使用。
2. Class-based Operations & Properties1)数字(number)和字符(string)串可以相加2 + 2"cam1" + ".avi"2)材质和相机不可加$box01.mat + $box02.mat -- wrong$camera1 + $camera2 -- wrong3) 相机与灯光可用于move函数move $cam1 [10, 0, 0]move $omni2 [0,0,-1]4)但是数字和字符串不适用于move函数move 23 [1, 1, 1] -- wrongmove "foo" [0, 2, 2] -- wrong
3. Class HierachyInteger 和 Float 合称为 Number, 即Number是前两者的父类,子类可以继承父类的操作。Integer(whole numbers): +, -, sin, cos,...Float(real numbers): +, -, sin, cos,...
注:有关Number类的操作,请查阅MAXScript Reference, 输入关键字number, float。
4. MAX Objects Class Hierachy
MAXWrapper- Material - StandardMaterial, Blend, MultiMaterial, RaytraceMaterial- Controller- Modifier- Atmospheric- ...- Node - GeometryClass, Camera, Light, Helper, Spacewarp,...注意:1) 这里MAXWrapper是父类,下面几项是它的子类;其中每一个子类又有子类,如Material类还可以有子类
StandardMaterial, Blend, MultiMaterial, RaytraceMaterial2) Node类,它的子类有:GeometryClass, Camera, Light, Helper, Spacewarp,... ; 其中GeometryClass拥有子类:Box,
Sphere, Cylinder...; Camera拥有子类:FreeCamera, TargetCamera注:有关node的一般属性,请参阅MAXScript Reference, 输入关键字general node properties3) 用showClass命令查询所属类--仅仅查询sphere所属类showClass "sphere"Sphere : GeometryClass {11,0}OK
--查询sphere所属类,showClass "sphere*" -- name pattern, 查询以sphere开头的名字的类别Sphere : GeometryClass {11,0}SphereGizmo : helper {3bc31904,67d74ec7}OK
--查询sphere及其属性的所属类showClass "sphere*.*"Sphere : GeometryClass {11,0} .smooth : boolean .radius : float .segs : integer .mapcoords : boolean .slice : boolean .hemisphere : float .sliceFrom : angle .sliceTo : angle .chop : integer .recenter : booleanSphereGizmo : helper {3bc31904,67d74ec7} .radius : float .seed : integer .hemisphere : booleanOK
-- 查询材质的属性showClass "checker"showClass "checker*"showClass "checker*.*"showClass "*checker*.*"
4)在MAXScript Reference中,在See also下面,显示的是当前物体父类的相关信息。
5. Interface--调用menu函数MenuMan.loadMenuFile "myMenus.mnu"--调用材质纹理函数$sphere.material.diffuseMap.reload()showInterfaces $sphere.material.diffuseMap
showInterface <interface> [ to:<stream> ] : 显示<interface>参数的interface信息。该信息包括三部分:Properties, Methods, and Actions;
showInterfaces {<maxwrapper> | <maxclass> | node} [ to:<stream> ]:Do not show the Interfaces of the transform controllers, modifiers, or materials applied to the object.
注: 更多有关showInterface() 及 showInterfaces() 函数的信息,请查阅MAXScript Reference。
6. Generic Functions - 父类的方法及操作符子类都可以用+ Number, String, Vectormove Box, Sphere, Light, Camera --查阅MAXScript Reference, Node Common Properties, Operators and Methods
教程地址:http://vimeo.com/19300699