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. HDFS原理分析之HA机制:avatarnode原理

    一.问题描述 由于namenode 是HDFS的大脑,而这个大脑又是单点,如果大脑出现故障,则整个分布式存储系统就瘫痪了.HA(High Available)机制就是用来解决这样一个问题的.碰到这么个 ...

  2. Django之tag标签和filter标签

    1.Django的tag常见的标签,可以做一些简单的功能 {%if%} 的使用主要用于做判断,还可以包含{%elif%} 这样的用法,最后要跟上{% endif %}.可以使用你的and,or,not ...

  3. django gunicorn 各worker class简单性能测试

    版权归作者所有,任何形式转载请联系作者.作者:petanne(来自豆瓣)来源:https://www.douban.com/note/564871723/ ====================== ...

  4. Clair:CoreOS发布的开源容器漏洞分析工具

    Clair为何而生:提升安全 软件世界里,安全漏洞会一直存在.好的安全实践意味着要对可能出现的事故未雨绸缪 - 即尽早发现不安全的软件包,并准备好快速进行升级.而Clair就是设计来帮助你找出容器中可 ...

  5. AppScan9.0.3.5漏洞扫描记录

    1.跨站点脚本编制 这个安全漏洞拿cookie做文章,而且是将前端的一些弹窗方法,要么通过脚本注入,要么通过url.encode之后注入,看几个变异的版本: 版本一: cookie  从以下位置进行控 ...

  6. [LeetCode系列] 二叉树最大深度求解问题(C++递归解法)

    问: 给定二叉树, 如何计算二叉树最大深度? 算法描述如下: 如果当前节点为空, 返回0(代表此节点下方最大节点数为0) 如果当前节点不为空, 返回(其左子树和右子树下方最大节点数中的最大值+1) 上 ...

  7. 解决Intel SSD 330i 240G在Windows 8启动慢的问题

    笔者半年前更新了一下老迈的Thinkpad T410i笔记本电脑,在美国亚马逊海购了Intel SSD 330i 240G.(PS:购入价USD 129.99 ,现在最新的335i 240G差不多要U ...

  8. 【Leetcode 167】Two Sum II - Input array is sorted

    问题描述:给出一个升序排列好的整数数组,找出2个数,它们的和等于目标数.返回这两个数的下标(从1开始),其中第1个下标比第2个下标小. Input: numbers={2, 7, 11, 15}, t ...

  9. python set集合 以及 深浅拷贝

    set集合 特点: 无序, 不重复, 元素必须可哈希(不可变) 作用: 去重复 本身是可变的数据类型. 有增删改查操作. frozenset()冻结的集合. 不可变的. 可hash的 深浅拷贝() 1 ...

  10. 一、Jetty介绍

    简介: Jetty 是一个用 Java 实现.开源.基于标准的,并且具有丰富功能的 Http 服务器和 Web 容器,可以免费的用于商业行为.Jetty 这个项目成立于 1995 年,现在已经有非常多 ...