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. SGU495Kids and Prizes(数学期望||概率DP||公式)

    495. Kids and Prizes Time limit per test: 0.25 second(s) Memory limit: 262144 kilobytes input: stand ...

  2. 携程框架Apollo实现.NET Core微服务统一配置(测试环境-单机)

    Apollo实现.NET Core微服务统一配置(测试环境-单机) https://www.cnblogs.com/guolianyu/p/10065999.html 一.前言 注:此篇只是为测试环境 ...

  3. JavaScript for 循环累加 json 字符串

    var msg = {"status":1,"data":[{"id":"12","words":& ...

  4. "http://127.0.0.1:4723/wd/hub"的解释

    先补充一个内容,就是appium安装时候的环境变量配置,必须要配ANDROID_HOME这个变量,不是“要配置”,是“必须配置”,其他的那些放到系统变量的path里就可以了: # coding: ut ...

  5. WinForm窗体继承自定义的模板窗体出错

    在开发Winform程序的时候,我们往往需要根据需要做一些自定义的控件模块,这样可以给系统模块重复利用,或者实现更好的效果等功能.而今天自定义一个窗体,然后子窗体继承的时候出现了一点问题. 问题: 在 ...

  6. notepad++运行paython程序

    cmd /k C:\Python30\python.exe "$(FULL_CURRENT_PATH)" & PAUSE & EXIT 添加引用的环境变量

  7. imsl库的使用过程中遇到的问题

    1,首先是安装,用的imsl7.0的库,网址:http://www.pipipan.com/file/87076708,里边有破解,但是这个安装文件只能装32位的,装不了64位的. 2,安装后找到lm ...

  8. CentOS6.5安装Cacti统计图乱码解决

    原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 .作者信息和本声明.否则将追究法律责任.http://fengwan.blog.51cto.com/508652/1430505 这个就 ...

  9. Hadoop 2.7.4 关闭与启动

    环境说明:[root@hadp-master sbin]# hadoop versionHadoop 2.7.4 一. 脚本封装全部一起启动.关闭1.1 启动[root@hadp-master sbi ...

  10. VMware虚拟机克隆CentOS 6.5后网卡修改方法

    VMware虚拟机安装好CentOS6.5系统后,纯净的系统多克隆几份出来方便后期做试验.克隆步骤很简单,克隆后出现的问题是克隆后的网卡MAC地址和原系统MAC地址一样,在局域网内会有冲突,需要更改克 ...