MaxScript Cheatsheet / Шпаргалка по MaxScript

Taking into account that there is no that much information about MaxScript around the world and posts like 2006 are considered to be "fresh", I decided to have this cheatsheet in English to let more people worldwide read this information. Feel free to leave comments via Facebook in the bottom of this page.

Значится так, меня запарило отсутствие нормального IDE для Максскрипта и необходимость в исходниках искать самые ходовые сниппеты. В связи с этим я захуяриваю эту страницу на своём сайте, где буду периодически добавлять часто используемые конструкции, чтобы потом отсюда же их и стянуть. Страницу я выкладываю в общий доступ, мало ли кому в Интернетах это тоже пригодится. Если это так, дайте знать.

Scene Operations


How to select none / deselect all?
1
max select none

Object Types


Check if object is geometry
1234
if SuperclassOf obj == GeometryClass then
(
...
)


Check if object is Editable Mesh
1234
if (classof obj) == Editable_Mesh then
(
...
)

Check if object is Editable Poly
1234
if (classof obj) == Editable_Poly then
(
...
)


Mesh/Poly Operations


Iterate through all faces in Editable Mesh
1234
for i=1 to meshop.getNumFaces obj do
(
...
)


Arrays


Add entry to the end of Array
1
append myArray myValue

Слепить два массива в один:
1
join myArray1 myArray2

Get a random array element
1
foo = myArray[random 1 myArray.count]

Loops


for loop:
1234
for i = 1 to 10 do
(
...
)

backwards for loop:
1234
for i = 1 to 10 by -1 do
(
...
)


Строки


Получить длину строки:
1
myString.count

Функция для проверки, начинается ли строка на что-то
1
fn startsWith checkStr beginning = return (substring checkStr 1 beginning.count) == beginning

Проверить, заканчивается ли строка на что-то
1234
if((substring matName (matName.count-9) 10) == "_Buildable") then
(
...
)

You can leave a comment with "Facebook":
Не забывайте оставлять комментарии при помощи "ВКонтакте":
Яндекс.Метрика