MAXScript

Paradigm scripting, structural, imperative, object-oriented John Wainwright (John Wainwright), Minton Larry (Larry Minton) Kinetix, Autodesk 1997 Version 2008 dynamic Windows None BASIC

MAXScript - a built-in scripting language for a package of three-dimensional modeling Autodesk 3ds Max, designed to automate routine tasks, optimize the use of existing functionality, the creation of new editing tools, and user interface. Through scripting API allows to control and modify the three-dimensional objects of the scene: the geometry, texture, animation, and more. You can create a variety of plug-ins and utilities to speed up the implementation of specific tasks. Tools Autodesk 3ds Max MAXScript used in a variety of functions, including the original tools and interface elements.

The target audience

The language is designed for a wide range of users - from fashion designers, finishing with technical directors and programmers. It provides more than enough free syntax is similar to the language of BASIC, than C ++ or the shell UNIX (as is the case with Maya MEL script). The internal structure has much in common with the language LISP, and based on the terms. Created using MAXScript new user-defined function can be easily integrated into the 3ds Max and can then be used like any other built-in default means. The language is designed for the average user and the concept creators to use it is not necessary to have a lot of experience programming in any of the common programming languages.

Syntax

Comments are the symbols "--" (double-dash) at the beginning of the line. Block comments are allocated using a C-like syntax:

-- Your usual comment
/ * Your comment a block * /

Casemapping and string variables

Language is not case sensitive. The only exception is a comparison of string variables. Provided is also a special type of variable name , which are sensitive and commonly used as an enumerated type for the transfer function instead of strings. To declare such a variable using the symbol '#'. Also there is the built-in matchPattern , which allows you to compare the line and taking into account the case-insensitive:

 "HELLO" == "hello"
-> false
"HELLO" as name == "hello" as name --konvertiruet to the type name
-> true
#HELLO == #hello - # Declares a variable of type name
-> true
matchPattern "HELLO" pattern: "hello"
-> true
matchPattern "HELLO" pattern: "hello" ignorecase: false
-> false

Instructions

Owners do not need to end with a semicolon (;). This must be done only when they are on one line:

       a = 10
print a
--zapis similar to the following:
a = 10;
print a;
--kotoraya similar to going below:
a = 10; print a;

Declaring variables

The variables do not require explicit declaration of a type or value assignment. Uninitialized variables always return a special meaning undefined , which is equivalent to NULL. The variable type depends on the value that it stores, and can be changed dynamically:

       a = 10 - the type of variable and - integer
a = "b" - was the type of a variable and a string

Code structure

Parentheses are used to denote blocks of code and namespaces.

Arrays

Arrays are denoted using the syntax "# ()"" and are not strictly members of the type - one and the same array may comprise any type of item, including other arrays. "Array indexing begins with one (1)."'

Byte arrays

Braces are used only as part of the declaration bitmap (bitArray) as follows: # {} . Bitmaps - short lists that contain only flag (false or true) and are used to store the status of selected items, such as points or vertices of triangles, three-dimensional object.

Access by index

Square brackets are used for nominal or indexed access to parts of objects or elements of arrays:

       aBox = box () - create a cube
-> $Box: Box01 @ [0.000000,0.000000,0.000000] aBox [3] - get the third animation track -> SubAnim: Transform aBox [#Transform] --poluchaem the same animation path using the access name -> SubAnim: Transform aBox [3] [1] - we get the first element of the path of transformation -> SubAnim: Position aBox [3] [1] [2] --poluchaem second element of the track position -> SubAnim: Y_Position someArray = # (1,2,5,6, "Hello") - declare array -> # (1,2,5,6, "Hello") someArray [4] --poluchaem 4th item -> 6 someArray [5] --poluchaem 5th element -> "Hello" someArray [6] --poluchaem 6th element - it does not exist -> Undefined Access to objects in the scene Nodes scene (scene objects) can be accessed by using the prefix '$' at the beginning of the name. For example, $Box01 returns the object with the name Box01 . The same syntax can be used to access multiple objects with similar names using '*' . For example,$ Box * will return a list of all objects whose names begin with Box , such as "Box01", "Box02", "Boxer" and so on.

       showProperties $Box01 --ili shorthand: show$ Box01
theProperties = getPropNames \$ Box01