日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪(fǎng)問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) >

我的MAXSCRIPT笔记

發(fā)布時(shí)間:2025/3/18 43 豆豆
生活随笔 收集整理的這篇文章主要介紹了 我的MAXSCRIPT笔记 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

我的MAXSCRIPT筆記

1 1 getnodebyname "circle01" 2 2 for o in objects do 3 if o.name == "circle01" then 4 3 select $Box* – select any objects with the name box at the beginning of them. 5 4 move, scale rotate 6 move obj [x,y,z] 7 scale obj [x,y,z] 8 rotate obj (eulerangles x y z) 9 rot = eulerangles x y z --建立一個(gè)四元數(shù)旋轉(zhuǎn),可以在需要地方使用 10 5 max commands in maxscript 11 n addition to controlling modeling and animation, MAXScript scripts can invoke 3ds Max menu and toolbar commands. You do this using the "max" keyword. 12 for example: 13 max file open 14 max unhide all 15 max quick render 16 help: 17 max time ? 18 max sel ? 19 max ? 20 21 6 select 22 select obj --單選,選擇當(dāng)前,之前的被釋放 23 selectmore obj --多選 24 deselect obj 25 deselectNode node 26 27 clearselection() --清空所有 28 29 max select all 30 max select child --每調(diào)用一次,選中一個(gè)節(jié)點(diǎn) 31 7 show class "*" 32 show class "box" 33 show class "box.*" 34 8 --exit 跳出循環(huán),而不是使用break 35 9 --函數(shù) 36 function myFunc x y = () --普通函數(shù),調(diào)用: myFunc 3 4 37 function myFunc x y:20 = () --帶默認(rèn)參數(shù)的函數(shù),調(diào)用:myFunc 3或 myFunc 3 y:4 38 function myFunc x:10 y:20 = () --全默認(rèn)參數(shù)函數(shù),調(diào)用: myFunc x:3 y:4或myFunc y:4 x:3 39 10 --文件操作相關(guān) 40 getFilenamePath "c:/test/abc.txt" --"c:\test\" 41 getOpenFileName 42 caption:"Render To Texture Object Presets Open" 43 filename:(getDir #renderPresets + @"") 44 types:"Object Preset(*.rtp)|*.rtp" 45 historyCategory:"RTTObjectPresets" 46 getSavePath caption:"my title" initialDir:"$scripts" 47 file="g:\\subdir1\\subdir2\\myImage.jpg" 48 49 filenameFromPath file -- returns: "myImage.jpg" 50 getFilenamePath file -- returns: "g:\subdir1\subdir2\" 51 getFilenameFile file -- returns: "myImage" 52 getFilenameType file -- returns: ".jpg" 53 pathIsNetworkPath "c:\\temp\\test.txt" --returns: false 54 pathIsNetworkPath "\\\\someserver\\temp\\test.txt" --returns: true 55 11 --string 56 findString "Thanks for all the fish!" "all" -- returns 12 57 filterString "MAX Script, is-dead-funky" ", -" --#("MAX","Script","is","dead","funky") 58 s1=replace "1234567890" 5 3 "inserted string" --"1234inserted string890" 59 60 s ="Balerofon" 61 ss = substring s 5 3-- returns "rof" 62 ss = substring s 5 -1-- returns "rofon" 63 ss = substring s 5 100-- returns "rofon" 64 65 s="text1" 66 matchPattern s pattern:"text?"-- returns true 67 matchPattern s pattern:"T*"-- returns true 68 matchPattern s pattern:"T*"ignoreCase:false-- returns false 69 matchPattern s pattern:"s*"-- returns false 70 71 trimright "MAXScript \n " --spaces and new line trimmed 72 --"MAXScript" 73 trimright "$Teapot0911" "1234567890" --remove trailing numbers 74 --"$Teapot" 75 76 12 --Working with Values 77 -------------------------------------------------------- 78 ClassOf SuperClassOf 79 -------------------------------------------------------- 80 b Box GeometryClass 81 box GeometryClass Node 82 GeometryClass Node MAXWrapper 83 Node MAXWrapper Value 84 MAXWrapper Value Value 85 Value Value Value 86 -------------------------------------------------------- 87 88 --FOR EXAMPLE 89 --either of the following will collect all objects of class box into variable allBoxes : 90 allBoxes=for obj in $* where (isKindOf obj box) collect obj 91 allBoxes=#() 92 for obj in $* do (if classOf obj == box then append allBoxes obj) 93 94 --the following function limits the choices to shape objects: 95 fn shape_filt obj = isKindOf obj Shape 96 13 --數(shù)組相關(guān)操作 97 --賦值 98 arr = #() 99 append arr 3 100 append arr "hello" 101 arr[3] = 12.2 102 103 --遍歷 104 for o in arr do print o 105 for i=1 to arr.count print arr[i] 106 107 14 --maxscript language reference -collections 108 --ObjectSets represent the main scene object categories in 3ds Max. 109 objects --all the objects 110 geometry --the standard 3ds Max categories... 111 lights 112 cameras 113 helpers 114 shapes 115 systems 116 spacewarps 117 selection --the current selection 118 119 --for example 120 for s in shapes do print s 121 for i=1 to geometry.count do print geometry[i] 122 15 --rootscene 與 rootnode 123 rootNode 124 ------------------------------------------------------------------------------------------ 125 Contains a Node value that defines the root node of the scene. 126 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. 127 The scene objects can be enumerated by accessing the children property of the root node. 128 A run-time error is generated if you try to perform other node operations on the root node. 129 130 rootScene 131 ------------------------------------------------------------------------------------------ 132 Represents the scene root in scripts and Macro Recorder output. 133 The subAnims of rootScene include the node hierarchy, the Material Editor, Track View, Scene Material Library etc 134 135 --遍歷場(chǎng)景中最頂級(jí)的物體 136 for o in rootNode.children do 137 ( 138 print o 139 print o.parent --undefined 140 ) 141 142 --注意,MAX場(chǎng)景是以樹(shù)結(jié)構(gòu)來(lái)組織的,一個(gè)場(chǎng)景可以多個(gè)不相連的子樹(shù),也就是有多個(gè)根結(jié)點(diǎn) 143 --這些子樹(shù)都以rootnode為根,但parent卻是undefined,如上 144 145 --導(dǎo)出FBX模型與動(dòng)畫(huà) 146 --1,導(dǎo)出模型和骨骼層級(jí) 147 --注意:骨骼層級(jí)必須和模型一起導(dǎo)出,否則對(duì)它設(shè)置動(dòng)畫(huà)無(wú)效果,這個(gè)很容易忽視 148 149 --等價(jià)于 select geometry 150 for o in objects do 151 ( 152 cls = classof o 153 if cls == Biped_Object or cls == BoneGeometry or cls == PolyMeshObject then 154 (--選擇所有網(wǎng)格,和所有骨骼(biped_object, boneGeometry) 155 selectmore o 156 ) 157 158 ) 159 160 --2,導(dǎo)出不帶模型的純動(dòng)畫(huà) 161 for o in objects do 162 ( 163 cls = classof o 164 if cls == Biped_Object or cls == BoneGeometry then 165 (--所有骨骼(biped_object, boneGeometry) 166 selectmore o 167 ) 168 ) 169 16 --material 170 ------------------------------------------------------------------------------------------ 171 --The following will render the diffuse map assigned to the material of object $foo 172 -- to a bitmap of size 640x480 and save it to the file "foodif.bmp" 173 ------------------------------------------------------------------------------------------ 174 rm = renderMap $foo.material.diffuseMap size:[640,480] \ 175 fileName:"foodif.bmp" 176 save rm 177 close rm 178 179 ------------------------------------------------------------------------------------------ 180 --材質(zhì),每個(gè)模型只有一個(gè)material,但這個(gè)material可以是單材質(zhì)或多重材質(zhì) 181 --每個(gè)材質(zhì)可以有多個(gè)貼圖,對(duì)應(yīng)各種顏色: 182 --diffusemap :漫反射 183 --不透明貼圖:不透明度 184 --高光貼圖:高光顏色 185 --光澤度貼圖:光澤度 186 --自發(fā)光貼圖:自發(fā)光 187 --凹凸貼圖,反射貼圖,折射貼圖,置換貼圖。。。。 188 ------------------------------------------------------------------------------------------ 189 showTextureMap $foo.material $foo.material.diffuseMap on 190 tm = checker() 191 mat = standardMaterial diffuseMap:tm 192 mm = multimaterial() --多重材質(zhì) 193 mm[1] = mat 194 $box01.material = mm 195 showTextureMap mm[1] tm on 196 197 getnumsubmtls --獲取子材質(zhì)數(shù)量 198 199 ----------------------------------------------------------- 200 --如何獲取模型上的貼圖 201 b = box() 202 b.material.diffuseMap.filename --203 b.material.diffuseMap.bitmap 204 17 --show properites 205 b = box() 206 showproperties b.material 207 18 --external command 208 --注意,DOS命令是WINDOWS網(wǎng)格的分割符,是下坡線(xiàn),maxscript是上坡線(xiàn),必須轉(zhuǎn)換 209 doscommand "copy f:\\abc.fbx f:\\test" --將 f:\abc.fbx拷貝到f:\test文件夾下 View Code

?

posted on 2018-01-31 11:13 時(shí)空觀(guān)察者9號(hào) 閱讀(...) 評(píng)論(...) 編輯 收藏

總結(jié)

以上是生活随笔為你收集整理的我的MAXSCRIPT笔记的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。