getnodebyname "circle01"
for o in objects do
if o.name == "circle01" then
select $Box* – select any objects with the name box at the beginning of them.
move, scale rotate
move obj [x,y,z]
scale obj [x,y,z]
rotate obj (eulerangles x y z)
rot = eulerangles x y z --建立一个四元数旋转,可以在需要地方使用
max commands in maxscript
n addition to controlling modeling and animation, MAXScript scripts can invoke 3ds Max menu and toolbar commands. You do this using the "max" keyword.
for example:
max file open
max unhide all
max quick render
help:
max time ?
max sel ?
max ? select
select obj --单选,选择当前,之前的被释放
selectmore obj --多选
deselect obj
deselectNode node clearselection() --清空所有 max select all
max select child --每调用一次,选中一个节点
show class "*"
show class "box"
show class "box.*"
--exit 跳出循环,而不是使用break
--函数
function myFunc x y = () --普通函数,调用: myFunc
function myFunc x y: = () --带默认参数的函数,调用:myFunc 3或 myFunc y:
function myFunc x: y: = () --全默认参数函数,调用: myFunc x: y:4或myFunc y: x:
--文件操作相关
getFilenamePath "c:/test/abc.txt" --"c:\test\"
getOpenFileName
caption:"Render To Texture Object Presets Open"
filename:(getDir #renderPresets + @"")
types:"Object Preset(*.rtp)|*.rtp"
historyCategory:"RTTObjectPresets"
getSavePath caption:"my title" initialDir:"$scripts"
file="g:\\subdir1\\subdir2\\myImage.jpg" filenameFromPath file -- returns: "myImage.jpg"
getFilenamePath file -- returns: "g:\subdir1\subdir2\"
getFilenameFile file -- returns: "myImage"
getFilenameType file -- returns: ".jpg"
pathIsNetworkPath "c:\\temp\\test.txt" --returns: false
pathIsNetworkPath "\\\\someserver\\temp\\test.txt" --returns: true
--string
findString "Thanks for all the fish!" "all" -- returns
filterString "MAX Script, is-dead-funky" ", -" --#("MAX","Script","is","dead","funky")
s1=replace "" "inserted string" --"1234inserted string890" s ="Balerofon"
ss = substring s -- returns "rof"
ss = substring s --- returns "rofon"
ss = substring s -- returns "rofon" s="text1"
matchPattern s pattern:"text?"-- returns true
matchPattern s pattern:"T*"-- returns true
matchPattern s pattern:"T*"ignoreCase:false-- returns false
matchPattern s pattern:"s*"-- returns false trimright "MAXScript \n " --spaces and new line trimmed
--"MAXScript"
trimright "$Teapot0911" "" --remove trailing numbers
--"$Teapot" --Working with Values
--------------------------------------------------------
ClassOf SuperClassOf
--------------------------------------------------------
b Box GeometryClass
box GeometryClass Node
GeometryClass Node MAXWrapper
Node MAXWrapper Value
MAXWrapper Value Value
Value Value Value
-------------------------------------------------------- --FOR EXAMPLE
--either of the following will collect all objects of class box into variable allBoxes :
allBoxes=for obj in $* where (isKindOf obj box) collect obj
allBoxes=#()
for obj in $* do (if classOf obj == box then append allBoxes obj) --the following function limits the choices to shape objects:
fn shape_filt obj = isKindOf obj Shape
--数组相关操作
--赋值
arr = #()
append arr
append arr "hello"
arr[] = 12.2 --遍历
for o in arr do print o
for i= to arr.count print arr[i] --maxscript language reference -collections
--ObjectSets represent the main scene object categories in 3ds Max.
objects --all the objects
geometry --the standard 3ds Max categories...
lights
cameras
helpers
shapes
systems
spacewarps
selection --the current selection --for example
for s in shapes do print s
for i= to geometry.count do print geometry[i]
--rootscene 与 rootnode
rootNode
------------------------------------------------------------------------------------------
Contains a Node value that defines the root node of the scene.
The root node does not physically exist in the scene, rather it is a special node that is the parent node of all nodes that are not linked to another node.
The scene objects can be enumerated by accessing the children property of the root node.
A run-time error is generated if you try to perform other node operations on the root node. rootScene
------------------------------------------------------------------------------------------
Represents the scene root in scripts and Macro Recorder output.
The subAnims of rootScene include the node hierarchy, the Material Editor, Track View, Scene Material Library etc --遍历场景中最顶级的物体
for o in rootNode.children do
(
print o
print o.parent --undefined
) --注意,MAX场景是以树结构来组织的,一个场景可以多个不相连的子树,也就是有多个根结点
--这些子树都以rootnode为根,但parent却是undefined,如上 --导出FBX模型与动画
--,导出模型和骨骼层级
--注意:骨骼层级必须和模型一起导出,否则对它设置动画无效果,这个很容易忽视 --等价于 select geometry
for o in objects do
(
cls = classof o
if cls == Biped_Object or cls == BoneGeometry or cls == PolyMeshObject then
(--选择所有网格,和所有骨骼(biped_object, boneGeometry)
selectmore o
) ) --,导出不带模型的纯动画
for o in objects do
(
cls = classof o
if cls == Biped_Object or cls == BoneGeometry then
(--所有骨骼(biped_object, boneGeometry)
selectmore o
)
)
--material
------------------------------------------------------------------------------------------
--The following will render the diffuse map assigned to the material of object $foo
-- to a bitmap of size 640x480 and save it to the file "foodif.bmp"
------------------------------------------------------------------------------------------
rm = renderMap $foo.material.diffuseMap size:[,] \
fileName:"foodif.bmp"
save rm
close rm ------------------------------------------------------------------------------------------
--材质,每个模型只有一个material,但这个material可以是单材质或多重材质
--每个材质可以有多个贴图,对应各种颜色:
--diffusemap :漫反射
--不透明贴图:不透明度
--高光贴图:高光颜色
--光泽度贴图:光泽度
--自发光贴图:自发光
--凹凸贴图,反射贴图,折射贴图,置换贴图。。。。
------------------------------------------------------------------------------------------
showTextureMap $foo.material $foo.material.diffuseMap on
tm = checker()
mat = standardMaterial diffuseMap:tm
mm = multimaterial() --多重材质
mm[] = mat
$box01.material = mm
showTextureMap mm[] tm on getnumsubmtls --获取子材质数量 -----------------------------------------------------------
--如何获取模型上的贴图
b = box()
b.material.diffuseMap.filename --或
b.material.diffuseMap.bitmap
--show properites
b = box()
showproperties b.material
--external command
--注意,DOS命令是WINDOWS网格的分割符,是下坡线,maxscript是上坡线,必须转换
doscommand "copy f:\\abc.fbx f:\\test" --将 f:\abc.fbx拷贝到f:\test文件夹下

我的MAXSCRIPT笔记的更多相关文章

  1. MaxScript 学习笔记【有转载】

    1. string string类型的变量是一个数组,下列操作合法:strName = $.name -- output: "Shemmy_03" strName[1] --得到字 ...

  2. git-简单流程(学习笔记)

    这是阅读廖雪峰的官方网站的笔记,用于自己以后回看 1.进入项目文件夹 初始化一个Git仓库,使用git init命令. 添加文件到Git仓库,分两步: 第一步,使用命令git add <file ...

  3. js学习笔记:webpack基础入门(一)

    之前听说过webpack,今天想正式的接触一下,先跟着webpack的官方用户指南走: 在这里有: 如何安装webpack 如何使用webpack 如何使用loader 如何使用webpack的开发者 ...

  4. SQL Server技术内幕笔记合集

    SQL Server技术内幕笔记合集 发这一篇文章主要是方便大家找到我的笔记入口,方便大家o(∩_∩)o Microsoft SQL Server 6.5 技术内幕 笔记http://www.cnbl ...

  5. PHP-自定义模板-学习笔记

    1.  开始 这几天,看了李炎恢老师的<PHP第二季度视频>中的“章节7:创建TPL自定义模板”,做一个学习笔记,通过绘制架构图.UML类图和思维导图,来对加深理解. 2.  整体架构图 ...

  6. PHP-会员登录与注册例子解析-学习笔记

    1.开始 最近开始学习李炎恢老师的<PHP第二季度视频>中的“章节5:使用OOP注册会员”,做一个学习笔记,通过绘制基本页面流程和UML类图,来对加深理解. 2.基本页面流程 3.通过UM ...

  7. NET Core-学习笔记(三)

    这里将要和大家分享的是学习总结第三篇:首先感慨一下这周跟随netcore官网学习是遇到的一些问题: a.官网的英文版教程使用的部分nuget包和我当时安装的最新包版本不一致,所以没法按照教材上给出的列 ...

  8. springMVC学习笔记--知识点总结1

    以下是学习springmvc框架时的笔记整理: 结果跳转方式 1.设置ModelAndView,根据view的名称,和视图渲染器跳转到指定的页面. 比如jsp的视图渲染器是如下配置的: <!-- ...

  9. 读书笔记汇总 - SQL必知必会(第4版)

    本系列记录并分享学习SQL的过程,主要内容为SQL的基础概念及练习过程. 书目信息 中文名:<SQL必知必会(第4版)> 英文名:<Sams Teach Yourself SQL i ...

随机推荐

  1. Python 实现汉诺塔问题(递归)

    有三根柱子一次为A,B,C 现在A柱子上有3个块,按照汉诺塔规则移动到C柱子上去,打印步骤? 我们这样理解:A为原始柱,C为目标柱,B为缓冲柱 1.定义一个函数move(n,a,b,c),n为原始柱上 ...

  2. Jacoco在eclipse上的集成使用

    随着敏捷开发的流行,编写单元测试已经成为业界共识.但如何来衡量单元测试的质量呢?有些管理者片面追求单元测试的数量,导致底下的开发人员投机取巧,编写出大量的重复测试,数量上去了,质量却依然原地踏步.相比 ...

  3. phpMyAdmin“缺少 mcrypt 扩展。请检查 PHP 配置。”解决办法

    在ecmall二次开发中因php版本要求低于5.3,而如下更新要求升级PHP,所以以下方式不适合于ecmall商城项目. 解决办法:安装php-mcrypt libmcrypt libmcrypt-d ...

  4. angularJS控制器之间的相互通信方式、$broadcast、$emit、$on

    在项目中,我们可能会很经常性的利用到控制器之间的相互通信,在angular中的控制器之间的相互通信有以下几种方式: 1)通过本地数据的存储localstorage,sessionstorage, 2) ...

  5. Python——基础数据类型(补充)

    1.基础数据类型汇总补充 (1)小数据池:   为了节省空间,数字和字符串有,其他的没有[了解]   数字:-5---256之间的数字共用一个内存地址 #(1)i1 = i2 id(i1) == id ...

  6. [Java.Web]Tomcat 常用配置

    1. web.xml 文件最下方内容 (X:\apache-tomcat-7.0.77\conf\ 目录下) <welcome-file-list> <welcome-file> ...

  7. Python GUI编程(Tkinter) windows界面开发

    Python实现GUI简单的来说可以调用Tkinter库,这样一般的需求都可以实现,显示简单的windows窗口代码如下: python_gui.py 1 #!C:\Python27\python.e ...

  8. 用命令行方式关闭CentOS防火墙

    #/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT #/sbin/iptables -I INPUT -p tcp --dport 22 -j A ...

  9. ECMAScript有6种继承方式(实现继承)

    本人对于ECMAScript继承机制有些见解,如果说的不对,敬请赐教~~~~ 继承是OO语言(面向对象)挺好的概念,许多OO语言都支持两种继承方式(接口只继承方法签名.实际继承则继承实际的方法),但是 ...

  10. Hadoop Map/Reduce的工作流

    问题描述 我们的数据分析平台是单一的Map/Reduce过程,由于半年来不断地增加需求,导致了问题已经不是那么地简单,特别是在Reduce阶段,一些大对象会常驻内存.因此越来越顶不住压力了,当前内存问 ...