Beruflich Dokumente
Kultur Dokumente
www.discreet.com 4
MAXSCRIPT REFERENCE
January 2001
Copyright © 2001 Autodesk, Inc.
All Rights Reserved
This publication, or parts thereof, may not be reproduced in any form, by any method, for any purpose.
AUTODESK, INC. MAKES NO WARRANTY, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY IMPLIED
WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, REGARDING THESE MATERIALS AND MAKES
SUCH MATERIALS AVAILABLE SOLELY ON AN "AS-IS" BASIS.
IN NO EVENT SHALL AUTODESK, INC. BE LIABLE TO ANYONE FOR SPECIAL, COLLATERAL, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES IN CONNECTION WITH OR ARISING OUT OF PURCHASE OR USE OF THESE MATERIALS. THE SOLE AND EXCLUSIVE
LIABILITY TO AUTODESK, INC., REGARDLESS OF THE FORM OF ACTION, SHALL NOT EXCEED THE PURCHASE PRICE OF THE
MATERIALS DESCRIBED HEREIN.
Autodesk, Inc. reserves the right to revise and improve its products as it sees fit. This publication describes the state of this product at
the time of its publication, and may not reflect the product at all times in the future.
Autodesk Trademarks
The following are registered trademarks of Autodesk, Inc., in the USA and/or other countries: 3D Plan, 3D Props, 3D Studio, 3D Studio
MAX, 3D Studio VIZ, 3DSurfer, ActiveShapes, ActiveShapes (logo), Actrix, ADE, ADI, Advanced Modeling Extension, AEC Authority
(logo), AEC-X, AME, Animator Pro, Animator Studio, ATC, AUGI, AutoCAD, AutoCAD Data Extension, AutoCAD Development System,
AutoCAD LT, AutoCAD Map, Autodesk, Autodesk Animator, Autodesk (logo), Autodesk MapGuide, Autodesk University, Autodesk View,
Autodesk WalkThrough, Autodesk World, AutoLISP, AutoShade, AutoSketch, AutoSurf, AutoVision, Biped, bringing information down
to earth, CAD Overlay, Character Studio, Design Companion, Drafix, Education by Design, Generic, Generic 3D Drafting, Generic
CADD, Generic Software, Geodyssey, Heidi, HOOPS, Hyperwire, Inside Track, Kinetix, MaterialSpec, Mechanical Desktop, Multimedia
Explorer, NAAUG, ObjectARX, Office Series, Opus, PeopleTracker, Physique, Planix, Powered with Autodesk Technology, Powered with
Autodesk Technology (logo), RadioRay, Rastation, Softdesk, Softdesk (logo), Solution 3000, Tech Talk, Texture Universe, The AEC
Authority, The Auto Architect, TinkerTech, VISION*, WHIP!, WHIP! (logo), Woodbourne, WorkCenter, and World-Creating Toolkit.
The following are trademarks of Autodesk, Inc., in the USA and/or other countries: 3D on the PC, 3ds max, ACAD, Advanced User
Interface, AEC Office, AME Link, Animation Partner, Animation Player, Animation Pro Player, A Studio in Every Computer, ATLAST, Auto-
Architect, AutoCAD Architectural Desktop, AutoCAD Architectural Desktop Learning Assistance, AutoCAD Learning Assistance, AutoCAD
LT Learning Assistance, AutoCAD Simulator, AutoCAD SQL Extension, AutoCAD SQL Interface, Autodesk Animator Clips, Autodesk
Animator Theatre, Autodesk Device Interface, Autodesk Inventor, Autodesk PhotoEDIT, Autodesk Point A (logo), Autodesk Software
Developer's Kit, Autodesk View DwgX, AutoFlix, AutoPAD, AutoSnap, AutoTrack, Built with ObjectARX (logo), ClearScale, Colour
Warper, Combustion, Concept Studio, Content Explorer, cornerStone Toolkit, Dancing Baby (image), Design 2000 (logo),
DesignCenter, Design Doctor, Designer's Toolkit, DesignProf, DesignServer, Design Your World, Design Your World (logo), Discreet,
DWG Linking, DWG Unplugged, DXF, Extending the Design Team, FLI, FLIC, GDX Driver, Generic 3D, Heads-up Design, Home Series,
i-drop, Jobnet, Kinetix (logo), Lightscape, ObjectDBX, onscreen onair online, Ooga-Chaka, Photo Landscape, Photoscape, Plugs and
Sockets, PolarSnap, Pro Landscape, QuickCAD, Real-Time Roto, Render Queue, SchoolBox, Simply Smarter Diagramming, SketchTools,
Sparks, Suddenly Everything Clicks, Supportdesk, The Dancing Baby, Transform Ideas Into Reality, Visual LISP, Visual Syllabus, VIZable,
Volo, Where Design Connects, and Whereware.
Third-Party Trademarks
All other brand names, product names, or trademarks belong to their respective holders.
Use, duplication, or disclosure by the U.S. Government is subject to restrictions as set forth in FAR 12.212 (Commercial Computer
Software-Restricted Rights) and DFAR 227.7202 (Rights in Technical Data and Computer Software), as applicable.
Contents
Introduction........................................................................................................xxxi
3ds max 4 MAXScript Online Reference ................................................................................. xxxi
MAXScript Overview .............................................................................................................. xxxii
Using the MAXScript Documentation .................................................................................. xxxiii
The MAXScript Utility Panel ...................................................................................................... xxxiv
The MAXScript Listener Window ......................................................................................... xxxvi
Using the MAXScript Listener .............................................................................................. xxxvii
Listener Commands ............................................................................................................ xxxviii
Using the ‘?’ Symbol................................................................................................................... xli
Turning On the Listener Log...................................................................................................... xli
Controlling the Listener Contents and the Insertion Point ..................................................... xlii
The MAXScript Editor Windows .............................................................................................. xliv
MAXScript Editor Commands.................................................................................................. xlvi
Running Scripts ........................................................................................................................ xlix
Accessing Scripted Utilities............................................................................................................ l
The Macro Recorder....................................................................................................................... l
General MAXScript Topics...............................................................................................................lii
Error Messages ............................................................................................................................ liii
Aborting Execution with the ESC Key ........................................................................................ lv
MAXScript Desktop State ........................................................................................................... lvi
Startup Scripts............................................................................................................................. lvi
Running Scripts from the Command Line................................................................................ lvii
Source Code Layout and Continuation Lines ........................................................................... lvii
Including Scripts Within Scripts ................................................................................................ lix
Encrypting Script Files ................................................................................................................. lx
Syntax Definitions in This Document ..............................................................................................lx
Objects and Classes in Object-Oriented Programming ................................................................lxii
Inheritance and Polymorphism ............................................................................................... lxiii
Properties, Methods, Operators, and Literals ........................................................................... lxiv
iv Contents
Mesher ........................................................................................................................................... 82
Network Render Interface ............................................................................................................. 82
Node Handles................................................................................................................................. 83
Node vertexColorType................................................................................................................... 83
OLE Automation............................................................................................................................. 84
MAXScript.reg - Registery file..................................................................................................... 84
Parameter Wiring........................................................................................................................... 85
Plug-In Manager ............................................................................................................................ 86
Portable Licence Manager ............................................................................................................. 87
maxOps....................................................................................................................................... 87
Quad Menu .................................................................................................................................... 90
Reactors.......................................................................................................................................... 91
Reactor controller ....................................................................................................................... 91
Render Element Manager .............................................................................................................. 92
Scripted Plug-Ins ............................................................................................................................ 93
type:#integer parameters in scripted plug-in parameter blocks ................................................ 93
Scripted Plug-in Events............................................................................................................... 93
Scripted Cameras ........................................................................................................................... 94
Scripted Controllers ....................................................................................................................... 95
dependsOn For Scripted Controllers .......................................................................................... 95
Matrix3 Scripted Controller ....................................................................................................... 96
Scripted Manipulators ................................................................................................................... 97
Scripted Objects........................................................................................................................... 106
on detachedFromNode For Object Scripted Plug-ins ............................................................... 106
Scripted RenderEffects................................................................................................................. 107
RenderEffects Progress Callback Mechanism .......................................................................... 107
Scripted Rollouts .......................................................................................................................... 108
Multi-line editText UI items in Scripted Rollouts .................................................................... 108
Skin............................................................................................................................................... 109
Joint Angle Morph ....................................................................................................................... 109
Spring Controller ......................................................................................................................... 109
SubObject Mode .......................................................................................................................... 112
System Tools ................................................................................................................................ 112
Trackbar Interface ........................................................................................................................ 113
Trackviews.................................................................................................................................... 114
Visual MAXScript ......................................................................................................................... 117
Xref Objects ................................................................................................................................. 120
Zip-file Script Packages ................................................................................................................ 122
version 4 MAXScript Language Improvements .......................................................................... 127
Additional Keyword Parameter On pickObject() forceListenerFocus: ..................................... 127
Affect Region Function............................................................................................................. 127
“Apropos” and “ShowProperties” and now “Help” and “Show” ............................................ 128
BinStream for Binary Reading and Writing ............................................................................. 128
By Reference Parameter Passing ............................................................................................... 129
C++-style bracketing comments ............................................................................................... 131
Coercion of bitArray to array and integer arrays to bitArrays ................................................. 132
Command line -U MAXScript startup scripts .......................................................................... 133
vi Contents
See also
MAXScript Overview (p. xxxii)
Using the MAXScript Documentation (p. xxxiii)
The MAXScript Utility Panel (p. xxxiv)
General MAXScript Topics (p. lii)
Learning MAXScript (p. 577)
Syntax Definitions in This Document (p. lx)
Objects and Classes in Object-Oriented Programming (p. lxii)
What’s New in MAXScript (p. 1)
3ds max 4 MAXScript Online Reference (p. xxxi)
MAXScript Overview
The MAXScript language is specifically designed to complement 3ds max. It has many special
features and constructs such as coordinate system contexts, object primitives and materials that
mirror high-level concepts in the 3ds max user-interface. It has an animation mode with automatic
keyframing and access to scene objects using hierarchical path names that match the 3ds max object
hierarchy.
The language syntax is simple enough for non-programmers, as it includes minimal punctuation
and formatting rules. Coupled with the use of the command-line Listener window, the ability to
install scripts as toolbar buttons, and the recording of user actions as MAXScript commands,
MAXScript can be employed casually by the user while working in the 3ds max point-and-click user
interface.
MAXScript is also rich enough to enable sophisticated programming tasks, with capabilities such as
3D vector, matrix, and quaternion algebra. MAXScript is well suited to working with large
collections of objects; for example, making complex procedural selections, constructing random star
fields, or placing objects in numerically precise patterns.
MAXScript allows scripts to be packaged as Utility panel rollouts, as modeless windows, and as
3ds max toolbar buttons. MAXScript can also be used to extend or replace the user interface for
objects, modifiers, materials, textures, render effects, and atmospheric effects; or to create custom
mesh objects, modifiers, and render effects. This allows job-specific tools to be scripted by the
technical department and made available to artists and animators through standard 3ds max
point-and-click user interfaces.
MAXScript supports formatted text I/O, so it is possible to produce asset reports directly from
3ds max scene files and read files containing scene layout, naming, texture details, and so on,
exported from other project management software.
MAXScript can also be used as a high-level scene import utility. By outputting MAXScript scripts
containing object creation commands, it is possible for other programs and packages to export
directly using any of the high-level 3ds max constructs.
Using the MAXScript Documentation xxxiii
Open Listener
Opens the MAXScript Listener window, or restores and brings it to the front if it is minimized or is
behind other 3ds max windows. The Listener window can also be opened by right-clicking in the
Mini Listener in the 3ds max status bar and choosing Open Listener Window, by choosing
MAXScript > MAXScript Listener in the 3ds max menu bar, or by pressing F11.
For Listener window features and commands, see The MAXScript Listener Window (p. xxxvi) topic.
New Script
Opens a new MAXScript Editor window used for writing a new script. A new Editor window is also
opened by choosing MAXScript > New Script in the 3ds max menu bar, or File > New Script in the
Listener window menu bar.
For Editor window features and commands, see The MAXScript Editor Windows (p. xliv) topic.
Open Script
Opens a common File Open dialog for choosing an existing script. A new MAXScript Editor window
then displays the selected script. A script file can also be opened by choosing MAXScript > Open
Script in the 3ds max menu bar, or File > Open Script in the Listener window menu bar.
For Editor window features and commands, see The MAXScript Editor Windows (p. xliv) topic.
Run Script
Opens a common File Open dialog for choosing an existing script. MAXScript then reads and
executes the selected script. Any output is printed to the Listener window. A script file can also be
run by choosing MAXScript > Run Script in the 3ds max menu bar, or File > Run Script in the Listener
window menu bar.
For more information, see the Running Scripts (p. xlix) topic.
Utilities
Displays a list of available scripted utilities. A MAXScript defining a scripted utility must be executed
before the scripted utility name appears in the Utilities list.
For more information, see the Accessing Scripted Utilities (p. l) topic.
Close
Closes the MAXScript Utility rollout. Any scripted Utilities panel rollouts are also closed.
xxxvi Chapter | Introduction
You can open only one instance of the MAXScript Listener window at a time. To open Listener,
choose the MAXScript utility on the Utilities panel and click Open Listener. Other methods for
opening Listener are described in The MAXScript Utility Panel (p. xxxiv) topic.
The Listener window is a resizable, modeless window. You can switch between it and 3ds max as you
work. If you close the Listener window and then reopen it, the text in the window before it was
Using the MAXScript Listener xxxvii
closed reappears. If Auto Open Listener on Output is checked in Customize > Preferences >
MAXScript, the Listener window opens automatically when a script outputs to it.
Listener is divided into two panes. The top (pink) pane is the Macro Recorder pane, and the bottom
(white) pane is the output pane. When the Macro Recorder is enabled, everything recorded is
displayed in the Macro Recorder pane. The output of results from scripts are displayed in the output
pane. The output of code executed in the Macro Recorder pane is always directed to the output pane
so as not to clutter the recordings. Both panes allow you to cut-and-paste, drag-and-drop, edit, select,
and execute code. You can resize the panes by dragging on the split bar between them.
The left-end of the 3ds max status panel contains a resizable Mini Listener. If the Mini Listener is not
visible, drag on the vertical split bar at the left edge of the status panel to reveal the Mini Listener.
The Mini Listener panes act as single-line sliding windows for the current line in the corresponding
Listener panes. The Mini Listener panes always show what you are typing or where the edit cursor
is placed in the Listener panes. Conversely, anything you type into a Mini Listener pane is entered
into the corresponding Listener pane at the current edit cursor position.
You can install Listener into a 3ds max viewport by right-clicking the viewport label, choosing
Extended, and then MAXScript Listener.
See also
Using the MAXScript Listener (p. xxxvii)
• Color-coding for distinguishing between input text, output text, and error message text. Three
MAXScript system global variables control these colors, and you can assign them new colors to
customize your Listener.
For commands within the Listener window, see the Listener Commands (p. xxxviii) topic.
See also
Using the ‘?’ Symbol (p. xli)
Turning on the Listener Log (p. xli)
Controlling the Listener Contents and the Insertion Point (p. xlii)
Including Scripts Within Scripts (p. lix)
Aborting Execution with the ESC Key (p. lv)
Listener Commands
Menu Bar Commands and Keyboard Shortcuts
The following menu bar commands and keyboard shortcuts are available in Listener. The edit
commands listed are also available in the Listener right-click menu. The menu bar commands for
Macro Recorder are described in The Macro Recorder (p. l) topic.
CTRL+B
Selects the text in the current bracket. Bracket balancer lets you check bracket balancing in long
pieces of code. The balancer works with any of the following: (), [], and {}. To use it, place the cursor
anywhere in the script text and press CTRL+B. If the cursor is next to a bracket, the code bracketed
by it and its matching bracket will be selected and highlighted. If the cursor is not next to a bracket,
the closest bracketed code containing the cursor will be selected. If you press CTRL+B again, the next
outer bracketed fragment is selected, and so on. You can keep pressing CTRL+B to move out through
bracket nestings. If at any point there is a bracket mismatch, the balancer will beep and not select
any text.
End-Of-Text Commands
The simplest way to use the MAXScript Listener is to enter commands at the end of the existing text
and press ENTER. This is called the end-of-text compilation. After each command is executed and any
results are printed to the output pane, you can enter another command and press ENTER, and so on.
When you write new commands at the end of the text in Listener, pressing ENTER executes the last
line and inserts a new line.
See also
Using the MAXScript Listener (p. xxxvii)
or:
logfile=”my_log.txt”
openLog logfile
xlii Chapter | Introduction
The default mode (mode:”w”) creates a new file or overwrites an existing file. To append
the log results to an existing file; specify mode:”a”. If the specified file does not exist, an
error message will be generated. Both input and output are logged by default; specify
outputOnly:true to log only MAXScript output. For example:
openLog “my_log.txt” mode:”a” outputOnly:true
would append only the MAXScript output to file my_log.txt.
If a log file is already open, the openlog() method will close that log file.
MAXScript echoes Listener activity as it occurs to the log file until you stop logging. The log file data
is not continuously written to the file, rather the log data is written to a buffer in memory, and when
the buffer is full the data in the buffer is written to the file. You can use the flushLog() method to
ensure the log’s buffer is flushed so that all output is written to the file:
flushLog()
You can stop logging, flush the log’s buffer, and close the log file using the closeLog() method:
closeLog()
No error message is generated if the flushLog() or closeLog() methods are called and no log file
is open.
while the following would select all of the text in the Listener output pane text:
setListenerSel #(0,-1)
selections set using the setListenerSel() method are recognized by this method. If no
selection has been set using the setListenerSel() method, the start and end values
returned are the offset to the end of the Listener output pane text.
getListenerSelText()
Returns the currently selected text, or an empty string if no text is selected and only the
insertion point is showing. Only the selections set using the setListenerSel() method
are recognized by this method. If no selection has been set using the setListenerSel()
method, an empty string is returned. For example, the following lines would capture the
entire contents of the Listener output pane to variable ListenerText:
( global ListenerText -- declare variable so its scope is higher
-- than inside just the following block
-- expression
( setListenerSel #(0,-1) -- select all the text
ListenerText=getListenerSelText() -- get selected text
setListenerSel #(-1,-1) -- set insertion point at
-- end of output pane
)
)
setListenerSelText <replacement_string>
Replaces the currently selected text with the replacement string. If no text is selected and
only the insertion point is showing, setListenerSelText() inserts the replacement
string at the insertion point. Only the selections set using the setListenerSel()
method are recognized by this method. If no selection has been set using the
setListenerSel() method, the insertion point is the end of the Listener output pane
text. <replacement_string> is a string literal or an expression that evaluates to a string.
include <filename_string>
Inserts the specified file’s content into the Listener output pane. The inserted text is not
evaluated. You can use this method to load a script and then step through it, executing
any selected text with SHIFT+ENTER. <filename_string> is a string literal or an
expression that evaluates to a string, and specifies the name of the file to insert. Example
uses are:
include “my_script.ms”
or:
scriptfile=”c:\\my_scripts\\my_script.ms”
include scriptfile
If you don’t explicitly specify a directory in the file name, the file will be searched for in
the following directories, in the order listed:
xliv Chapter | Introduction
To create a fresh script, press New Script on the MAXScript rollout, File > New Script in the Listener
menu bar, or MAXScript > New Script in the 3ds max menu bar to open a new, empty MAXScript
Editor window. You can write and edit text, including drag-and-drop editing, in the MAXScript
Editor as you would in other editors like WordPad. The menus are similar to those in many standard
Windows text editors. You may have any number of MAXScript Editor windows open at the
same time.
The MAXScript Editor Windows xlv
MAXScript Editor is suited to developing longer scripts or code fragments you want to keep. You can
edit and test parts of them until they are complete, then save your code in a script file for later use.
This is a common method for developing large scripts, utilities, and function libraries.
You can select one or more text lines and drag them to a 3ds max toolbar to create a Macro Script
containing the selected lines. For more information, see the Defining Macro Scripts (p. 1521) topic.
You can open a MAXScript Editor window from within the Listener or from other running scripts
by calling the edit() method. The syntax for the edit() method is:
edit <filename_string>
where <filename_string> is a string literal or an expression that evaluates to a string,
and specifies the name of the file whose contents are to be loaded into the new MAXScript
Editor window. Example uses are:
edit “my_script.ms”
or:
scriptfile=”my_script.ms”
edit scriptfile
The file will be searched for in the following directories, in the order listed:
• The current MAXScsript directory
• The 3ds max executable main directory
• The Windows NT 32-bit system directory (system32)
• The Windows 16-bit system directory (system)
• The Windows directory
• The directories that are listed in the PATH environment variable
You can create an empty MAXScript Editor window from within the Listener or from other running
scripts by calling the newScript() method. The syntax for the newScript() method is:
newScript()
Opens an empty MAXScript Editor window and returns a WindowStream value that may
be used as the target for print and format operations. This is useful for directing output to
a separate window for ease of inspection or editing, or later saving to a file. Output to a
WindowStream is inserted at the current cursor position in that window. For example:
debug = newScript()
...
print $foo to:debug
...
format “name is %\n” obj.name to:debug
If you need to locate the source of a scripted function, you can use the showSource() method. It
displays a MAXScript Editor window containing the source file in which the function was defined,
positioned at the function’s definition. The form is:
showSource <fn>
xlvi Chapter | Introduction
TAB, CTRL+I
Indents selected lines of text by one tab width.
SHIFT+TAB, SHIFT+CTRL+I
Unindents selected lines of text by one tab width.
xlviii Chapter | Introduction
SHIFT+ENTER
A MAXScript Editor can send code selections to Listener for evaluation. Select some text in
MAXScript Editor and press SHIFT+ENTER to send the selected text to Listener. Listener compiles
and evaluates it and prints out the result at the end of the current text in Listener. If you press
SHIFT+ENTER with no text selected, the line containing the cursor is sent to Listener for evaluation.
This behavior is similar to using SHIFT+ENTER in Listener, except that the results of the evaluations
are printed in the Listener, not inserted into the MAXScript Editor text.
If you have a number pad on your keyboard, the Number-Pad ENTER key is an alternative to
SHIFT+ENTER and can be used to execute commands. You may find the Number-Pad ENTER key
faster and easier to use.
CTRL+Right-Click
Displays a pop-up menu of all the utility, structure, user-interface item, function, handler, plug-in,
tool, Macro Script, and rcmenu definitions that exist in the current script. Select one of the items in
the pop-up menu to position that definition at the top of the MAXScript Editor window. This
simplifies large script navigation.
Running Scripts xlix
CTRL+B
Selects the text in the current bracket. Bracket balancer lets you check bracket balancing in long bits
of code. The balancer works with any of the following: (), [], and {}. To use it, place the cursor
anywhere in the script text and press CTRL+B. If the cursor is next to a bracket, the code bracketed
by it and its matching bracket will be selected and highlighted. If the cursor is not next to a bracket,
the closest bracketed code containing the cursor will be selected. If you press CTRL+B again, the next
outer bracketed fragment is selected, and so on. You can keep pressing CTRL+B to move out through
bracket nestings. If at any point there is a bracket mismatch, the balancer will beep and not select
any text.
CTRL+D
Performs a simple syntax coloring scheme in the MAXScript Editor. Each time you press CTRL+D, the
window is redrawn with comments in green, MAXScript reserved words in blue, and string literals
in light red. This often helps in reading large, complex programs. New text is always colored black
and you have to press CTRL+D at some point to recolor the script. Syntax coloring is a programming
aid and does not effect script execution.
CTRL+R
Places the cursor at the location where it was previously placed with a mouse click or a find
operation. Consecutive uses of CTRL+R cycle through the last eight cursor positions. This feature is
useful if you edit at one location, move the cursor elsewhere with find or scroll operations, and then
want to return to the edit location. This feature allows you to quickly review the code pieces you
recently worked on.
Running Scripts
To run an existing script file, press Run Script on the MAXScript rollout, File > Run Script in the
Listener menu bar, or MAXScript > Run Script in the 3ds max menu bar. This opens a common File
Open dialog for choosing the script. MAXScript then reads and executes the selected script. Any
output is printed to the Listener output pane.
You can also run a script from Listener or from within other scripts using the fileIn() method:
fileIn <filename_string> [ quiet:<boolean> ]
where <filename_string> is a string literal or an expression that evaluates to a string,
and specifies the name of the script file whose content is executed. The script file content
is executed one expression at a time, and halts processing if an error is encountered at any
point. By default, the file is not listed as it is loaded; use quiet:false to get a running
listing to the Listener. Example uses are:
fileIn “my_script.ms”
or:
scriptfile=”my_script.ms”
fileIn scriptfile
l Chapter | Introduction
The script file content is compiled in a global scope context, as opposed to the scope in effect when
the filein() method is executed. For more information, see the Scope of Variables (p. 646) topic.
make a button that does the sequence of events just recorded. For more information, see the Defining
Macro Scripts (p. 1521) topic.
The following Macro Recorder menu commands are available in Listener:
Enable
When Enable is selected the Macro Recorder will generate MAXScript commands.
If Selection-Relative Scene Object Names is enabled, a typical generated command would be:
move $ [0,-47.8044,0]
By using Selection-Relative Scene Object Names, you can apply the recorded script to a different
selection, thereby making it somewhat general. Use Explicit Scene Object Names if you want the
script to always work on the same objects regardless of the current scene selection.
When the Absolute Transform Assignments option is selected, absolute transform assignments are
output only if a single object is transformed. If multiple objects are selected, relative transform
operations are output.
By using Selection-Relative Sub-object Sets, you can apply the recorded script to a different selection,
thereby making it somewhat general. Use Explicit Sub-object Sets if you want the script to always
work on the same sub-objects regardless of the current sub-object selection.
Tool Selections
When Tool Selections is selected, the Macro Recorder will generate MAXScript commands for the
selection of tools in the 3ds max toolbar. In most cases, recording the selection of tools is superfluous
as most scripts are not dependent on the tool selection to work.
Error Messages
When MAXScript detects a runtime error in your script, it displays an error message and prints
diagnostic information to the Listener output pane. If the error occurs in a controller script or rollout
panel script, the error message is displayed in an Alert Box window, otherwise it is printed in the
Listener output pane.
The diagnostic information is in the form of a call stack trace-back which can help determine the
cause and location of the error in your code. The call stack trace-back shows the nesting of called
MAXScript functions at the point of error, deepest ones first to outermost ones last. The call stack
trace-back also displays the values in all the local variables and function parameters at the levels they
are declared or first used. Note that for loops produce separate entries in the call stack trace-back
and include a variable dump for the loop variable and any locals in the loop body.
As a further aid in locating the error, MAXScript shows the line in which the error occurred in an
MAXScript Editor window if the running code was compiled from a source file (any code not entered
directly in the Listener). If the source file is not currently open in a window, MAXScript opens the
file in a new MAXScript Editor window. The line containing the code in which the error occurred is
highlighted and scrolled into view. The error message is either displayed in a Alert Box window or
the Listener window. In both cases, the Alert Box or Listener window is brought to the front and the
MAXScript Editor window containing the code causing the error is immediately behind.
All compile and runtime error messages reported in the Listener output pane are preceded by the
comment symbol “--”, so you can reselect and evaluate code in Listener that might have embedded
error messages and not have them cause syntax errors.
In the following figure, an Editor and a Listener window are shown where an error was detected
while running the script. The error occurred in the highlighted line in the Editor window. Looking
at the call stack trace-back, we see the error occurred when the for loop variable i is equal to 6. In
the line in error, the position of the object specified by the sixth element of array b is being set. After
further investigation, it was found the array b only had five elements defined. Thus element b[i]
contained the value undefined, which resulted in the error as there is no position property
associated with undefined.
liv Chapter | Introduction
In the following figure, an error dialog and script controller dialog are shown. An error was detected
while running the script assigned to a script controller. This error was caused by the deletion of
object box02, whose position was used in the script.
Aborting Execution with the ESC Key lv
Startup Scripts
When the 3ds max is first started, MAXScript searches for any startup script files that it then
automatically loads and runs. This feature is useful if you have function libraries you always use and
want preloaded, or if you want to establish custom UI settings, define scripted plug-ins, or load
scripted utility rollouts.
The automatic loading of startup script files can be deactivated by turning off the Auto Start
MAXScript option in the MAXScript page of the 3ds max Preferences dialog, as described in the
MAXScript Preferences Settings topic in the 3ds max online help.
MAXScript first searches for a file named startup.ms in the following directories, in the order listed:
• The Scripts directory (defined in the 3ds max Configure Paths dialog)
• The Startup Scripts directory (defined in the 3ds max Configure Paths dialog)
• The 3DS executable main directory
• The Windows NT 32-bit system directory (system32)
• The Windows 16-bit system directory (system)
• The Windows directory
• The directories that are listed in the PATH environment variable
MAXScript stops searching when it finds the first occurrence of startup.ms.
MAXScript then recursively scans the 3ds max plug-ins and Startup Scripts directories (both defined
in the 3ds max Configure Paths dialog) and directories nested within them for .ms and .mse script
files and loads them. In this pass, any script files with the name startup.ms are ignored. This allows
you to place your scripted plug-in scripts in the 3ds max plug-in folders for automatic loading. They
can be managed like DLL plug-ins, and used to organize your startup scripts into groups in their own
directories for easier management. You can prevent a nested directory from being scanned by
placing its name in parentheses, for example “(old-versions)”, allowing you to enable and disable
scripts in handy directory-based groupings.
Running Scripts from the Command Line lvii
This example command line would launch the 3ds max executable in c:\3dsmax, start MAXScript,
and then have it run the launch script rendercams.ms.
The following example launch script loads two scenes, renders frames from each of the cameras in
them, and then quits 3ds max:
loadMaxFile “foo.max”
for c in cameras do render camera:c outputfile:(”foo_”+c.name+”.bmp”)
loadMaxFile “baz.max”
for c in cameras do render camera:c outputfile:(”baz_”+c.name+”.bmp”)
quitMax #noPrompt
This example makes use of the quitMax() method to exit 3ds max (see Exiting and Resetting
3ds max (p. 1669) ) when the script is finished. Launch scripts need not be batch scripts as in this
example, but may be used to condition 3ds max for interactive use, for example by loading a scene
file and setting some user-interface options.
The normal startup scripts, startup.ms and those in the Startup Scripts directory, are run before the
launch script.
It is also possible to install scripts into individual scene files that run automatically when that scene
is open or closed or at certain other events (see General Event Callback Mechanism (p. 29)).
This line can be broken after any of the operators. MAXScript continues to read the next line,
because an operator needs another argument. For example:
a + b * c / d - e +
f * g / h
You cannot break the example line as shown next and get the same result, because the expression
on the first line is a complete expression. MAXScript considers the two lines as separate expressions,
and the second line is now syntactically wrong, because it starts with an operator.
a + b * c / d - e
+ f * g / h
This scheme allows you to write the following forms of the same statement without using periods
or semicolons, as you might in other freeform languages. For example, a if/then/else construct could
be written as:
if a < b then print c else print d
or,
if a < b then print c
else print d
or,
if
a < b
then
print c
else
print d
If you do want to break a line at the end of a sub-expression, you can use the backslash line
continuation character: ‘\’. The previous example above of an invalid break can be made valid using
the line continuation character after the ‘e’:
a + b * c / d - e \
+ f * g / h
Whenever MAXScript encounters a ‘\’ as the last character on a line, except for spaces, tabs, or
comments, it continues to read the next line as though the line break were not present.
Line continuations are often used to break up function calls with many arguments, as shown in
many of the Expressions (p. 667) topics.
MAXScript also lets you combine multiple statements and expressions in a single line. The
statements or expressions are separated with a ‘;’.
Including Scripts Within Scripts lix
Examples:
print “End of input data reached” to:f ; close f ; f = undefined
if a < 0 do (print “value out of range”;a=0)
Comments in MAXScript begin with a double-hyphen (‘--’) and extend to the end of the current
line. Many code examples in this help file use comments in this style.
Example:
-- special cases...
if first do
subanims[6]=undefined -- subanims[6] is #Image_Motion_Blur_Multiplier
The include <file> construct is effectively replaced in the source code at that point with the
contents of the named file.
You can nest included files as deeply as needed; included files can include other files, and so on.
Because include is a compile-time construct, the current MAXScript scope is maintained within the
included file. This is opposed to the fileIn() method described in the Running Scripts (p. xlix) topic,
whose script file content is compiled in a global scope context. For more information, see the Scope
of Variables (p. 646) topic.
lx Chapter | Introduction
The include <file> can appear at any point a new token is expected, such as a name, literal, or
punctuation. This means that you could complete a partial expression with an included file. For
example:
include “op1.ms” + include “op2.ms”
if include “test2.ms” then print a else print b
You cannot place an include <file> within a token. For example, the following is not valid:
timeval = 2:include “framenum.ms”.0
or:
scriptfile=”my_script.ms”
encryptScript scriptfile
The encrypted script file from the previous examples would be named my_script.mse.
The Run Script button in the MAXScript rollout and the fileIn() method described in the Running
Scripts (p. xlix) topic automatically support .mse encrypted scripts.
You can couple this script source code encryption with the hardwareLockID variable and the
encrypted file I/O functions to provide authorization-based protection for your scripts.
Syntax Definition
[-]{<digit>} an optional minus sign (the sign), followed by 0 or more digits (the integer part),
followed by
[.{<digit>}] an optional sequence (the fraction part) comprised of:
a period character, followed by 0 or more digits, followed by
[(e | E)[+ | -]{<digit>}+] an optional sequence (the exponent part) comprised of:
either an ‘e’ or ‘E’, followed by an optional plus or minus sign, followed by one or
more digits.
The syntax definitions in the MAXScript Grammar (p. 1681) topic are in the form of named rule
definitions. For example:
number ::= [-]{<digit>}[.{<digit>}](e | E)[+ | -]{<digit>}+]
allowing the rule to be referred to by name in other rules in the grammar. An example of such a
rule is:
mod <number1> <number2>
modulo arithmetic, the remainder when <number1> is divided by <number2>
Some definitions throughout this document also use the convention of showing alternative
definitions for a rule on consecutive lines instead of separating them with the ‘|’ symbol.
lxii Chapter | Introduction
See also
Inheritance and Polymorphism (p. lxiii)
Properties, Methods, Operators, and Literals (p. lxiv)
Inheritance and Polymorphism lxiii
Various characteristics are defined for a class, and each lower class inherits those characteristics. For
example, the classOf() method is defined for class Value, and class Box inherits this method
through its hierarchy. Thus you can specify a Box object as a parameter to the classOf() method.
In the MAXScript Class Hierarchy (p. 1688) topic, all the built-in classes in MAXScript are laid out in
their place in the hierarchy so you can see for each class the classes it inherits characteristics from.
Some of the hierarchy comes from within 3ds max itself which is internally object-oriented. All of
its objects, modifiers, controllers, and so on are arranged in a well-defined inheritance hierarchy.
Once the objects have been grouped into classes, the symbology for the operations that can be
performed on objects of each class can be simplified. The classic example of this comes from
mathematics. The symbolic operators ‘+’, ‘-’, ‘*’, and ‘/’ are shared among many types of values
(integers, reals, complex, vectors, matrices, and so on), and perform the correct action on the types
they are applied to. This capability for a single-named operation to work on different types is called
polymorphism. Object-oriented languages let you use the same name for different methods or
operators across different classes, and the correct method to apply is automatically determined based
on the class of the value it is used with.
lxiv Chapter | Introduction
In MAXScript, all math operators and methods are polymorphic in this sense and reflect the
standard mathematical conventions. An interesting example for 3ds max use is the random()
method. It takes two arguments and generates a random value between them. So, if you give it floats
it gives you a float back; if you give it 3D points, it gives you a random point in the box they define
the corners of; if you give it quaternions, it gives you back a random rotation between them, and
so on.
Further, all the methods that work on 3ds max objects are polymorphic within their hierarchies. So
move, hide, and select work on all types of scene objects; time scaling and insertion work on all the
types of controllers, and so on.
Note:
ParamBlock2s make it possible for plug-ins to host all of their user visible parameters in one or more
parameter blocks, including complex parameters such as ReferenceTargets, Sub-Anims, dynamic
parameter tables (Tabs<>), and class parameters. The parameter blocks handle old-version loading
and reference management automatic. They augment the Parameter Map mechanism to provide
automatic UI for the new parameter types including common MAX controls such as node pickers,
texmap selectors, etc. as well as listboxes for tabular parameters and, further, to automate the
construction of ParamMaps and ParamDlgs in common situations. Additionally, ParamBlock2’s
provide a system that describes all the parameter blocks and parameters of a plug-in along with a
metadata ‘reflection’ API so that systems like the MAXScript, the Macro Recorder, Schematic View,
and custom exporters can access plug-in data automatically. This metadata includes version and
position-independent parameter IDs and both localized and fixed machine-parsable names for all
classes and parameters. This helps to address version compatibility and scripter/exporter
localization issues.
For design details see the 3ds max sdk help file topic “Parameter Blocks and Maps in Release 3”.
Note:
The MAXScript SDK is a set of Visual C++ headers and import libraries that C++ programmers can
use to extend MAXScript. These extensions can be in the form of new built-in functions, new system
globals or descriptors for new MAX plug-in class properties. This is useful for 3rd-party plug-in
developers to write custom scripting interfaces for their plug-ins, and for programmers to do custom
C++ performance code and drive it with scripts for hybrid tools.
2 Chapter 1 | What’s New in 3ds max 4 MAXScript
The scripter SDK allows extensions to be added either incrementally through a MAXScript-specific
DLL file type that is loaded by MAXScript or by runtime calls directly to MAXScript from within an
existing plug-in.
For design details see the 3ds max sdk help file topic “MAXScript SDK”.
Note:
The areas in this documentation exposed by Function Publishing will document the interface
information provided by the “showInterfaces” function (p. 159), in three sections: Properties,
Methods, and Actions. In the Properties section, each property exposed by the interface is
listed along with its data type or enumeration values and whether the property can be read and
written to. In the Methods section, each method is listed along with its return type and its argument
list. The value type for each argument is shown. If the return type is shown as <void>, the method
returns a value of ‘ok’. Methods that are used by Actions are commented as such. These methods
typically require that the object be selected and active in the appropriate command panel. In the
Actions section, each Action is listed along with its category and action description as shown in
the Customize User Interface dialog, and the shortcut keys, if any, assigned to the Action.
The following topics are new to MAXScript:
• Learning MAXScript (p. 577): Walkthrough tutorial for beginning MAXScript users.
Additional Note:
The name of the atmosphere in releases prior to 3ds max 4 known as the “Combustion effect” is now
called “Fire Effect”.
The following are new MAXScript features in 3ds max 4:
Action Manager:
Action Manager (p. 9)
ActiveX Controls in MAXScript Rollouts:
ActiveX Controls in MAXScript Rollouts (p. 10)
Asset Browser:
Asset Browser enhancements (p. 22)
Bones:
Access to the new node bone properties and methods (p. 23)
Bone Creation (p. 25)
Cache Modifiers:
Point Cache Modifier (p. 26)
CallBack Notification Codes:
RenderEffect Progress Callback Mechanism (p. 28): You can control the main RenderEffects
dialog progress bar using several callbacks.
Notify Callbacks for Animate button on and off Transitions (p. 27)
Color Manager:
Color Manager (p. 35)
What’s New in 3ds max 4 MAXScript 3
Combustion:
Combustion (p. 38)
Constraints:
Path Constraint (p. 39)
LookAt Constraint (p. 40)
Orientation Constraint Controller (p. 40)
Position Constraint (p. 41)
Link Controller for Constraints (p. 42)
Controller Functions for use with Constraint Assignments (p. 42)
Context Filters:
Context Filters (p. 43)
Custom Attributes:
Scripted Custom Attributes (p. 45)
Depth of Field:
Depth of Field (p. 54)
Edit Mesh:
ApplyOperation function (p. 54)
Editable Patch:
Patches (p. 55)
Filters:
class id filter (p. 59)
Selection Filter (p. 61)
iDrop - drag and drop:
iDrop - drag and drop (p. 62)
Interfaces:
Interfaces (p. 67)
Core Interfaces (p. 70)
Other Interfaces (p. 71)
Inverse Kinematics:
HD IK controller chains can be assigned to existing hierarchies (p. 73)
IKLimb Solver (p. 74)
Materials:
Multi/Sub Material (p. 75)
Menu Manager:
Menu Manager (p. 75)
Mesher:
Mesher (p. 82)
Network Render Interface:
Network Render Interface (p. 82)
4 Chapter 1 | What’s New in 3ds max 4 MAXScript
Node Handles:
Node Handles (p. 83)
Node vertexColorType:
Node vertexColorType (p. 83)
OLE Automation:
MAXScript.reg - Registery file (p. 84)
Parameter Wiring:
Parameter Wiring (p. 85)
Plug-In Manager:
Plug-In Manager (p. 86)
Portable Licence Manager:
maxOps (p. 87)
Quad Menu:
Quad Menu (p. 90)
Reactors:
Reactor controller (p. 91)
Render Elements Manager:
Render Element Manager (p. 92)
Scripted Plug-In:
type:#integer parameters in scripted plug-in parameter blocks (p. 93)
Scripted Plug-in Events (p. 93)
Scripted Cameras:
Scripted Cameras (p. 94)
Scripted Controllers:
dependsOn For Scripted Controllers (p. 95)
Matrix3 Scripted Controller (p. 96)
Scripted Manipulators:
Scripted Manipulators (p. 97)
Scripted Objects:
on detachedFromNode For Object Scripted Plug-ins (p. 106)
Scripted RenderEffects:
RenderEffect Progress Callback Mechanism (p. 28)
Scripted Rollouts:
Multi-line editText UI items in Scripted Rollouts (p. 108)
Spring Controller:
Spring Controller (p. 109)
System Tools:
System Tools (p. 112)
TrackBar:
Trackbar Interface (p. 113)
What’s New in 3ds max 4 MAXScript 5
Trackviews:
Trackviews (p. 114)
Visual MAXScript:
Visual MAXScript (p. 117)
Xref Objects:
Xref Objects (p. 120)
Zip-file Script Packages:
Zip-file Script Packages (p. 122)
MAXScript Language Improvements in 3ds max 4:
The following are new MAXScript methods for 3ds max 4:
IsValidNode (p. 136)
getTextExtent (p. 175)
isActive <atmos> (p. 1338)
isActive <renderEffect> (p. 1348)
affectRegionVal (p. 1104)
getMAXSaveFileName & getMAXOpenFileName (p. 1640)
Language Improvements:
Affect Region Function (p. 127)
BinStream for Binary Reading and Writing (p. 128)
By Reference Parameter Passing (p. 129)
C++-style bracketing comments (p. 131)
Coercion of bitArray to array and integer arrays to bitArrays (p. 132)
Detecting Deleted Nodes (p. 133)
Dereferencing Operator (p. 133)
forceUpdate Function added to UVWUnwrap (p. 134)
hasProperty() function (p. 135)
Improved the Performance of Iterating and Indexing the ‘selection’ and ‘$’ Object Sets (p. 135)
isValidNode (p. 136)
Readable/Writable Checks (p. 135)
RubberBanding in pickObject() Function (p. 136)
SetDir (p. 136)
Shortcut system replaced (p. 137)
startObjectCreation() (p. 138)
Subanim Indexing Operator, [], on MAX Objects Now Takes Subanim Names (p. 139)
superclasses read-only global variable (p. 139)
Symbolic Pathnames (p. 140)
System Information (p. 141)
validModifier() function (p. 142)
Visible Class For ‘&’ Reference Values (p. 142)
6 Chapter 1 | What’s New in 3ds max 4 MAXScript
Controllers:
List Controller (p. 143)
mapKeys() method (p. 144)
moveKeys function (p. 145)
Keys:
Bezier Keys inTangentLength and outTangentLength (p. 158)
Object Inspector Functions:
Class and Object Inspector Functions Enhanced (p. 159)
Renderer:
render() Function Re-entrant (p. 160)
SuperClasses:
Bitmap Manager - Function Published BMM control (p. 161)
Utilities, Global Utilities and Render Element plug-ins (p. 161)
Renderer (p. 162)
2 New Scripted Pug-in Superclasses (p. 162)
Globals and Locals:
Definition Constructs Can Include Global Variable Declarations At Top Level (p. 162)
Changes to Undeclared Implicit Global Variables (p. 163)
Material Editor, Material and Textures:
Accessing The Material Editor Active Slot (p. 163)
BitmapTex Reload and viewImage (p. 164)
BMP, PNG, JPEG and TGA I/O Interfaces (p. 164)
Material Editor Access (p. 165)
Material Level Show-in-viewport State (p. 166)
Maxops:
maxOps (p. 87)
User Interface:
Angle UI element (p. 168)
CreateDialog (p. 169)
Curve Control (p. 170)
isActive (p. 176)
keyboard.escPressed (p. 176)
MAX Open & Save Dialogs (p. 177)
Menu and CUI Loading (p. 178)
mtlBrowser (p. 180)
SetBackground Method (p. 180)
mouseTrack() Function (p. 180)
snapMode (p. 182)
Spinner UI Item setKeyBrackets (p. 182)
Timer UI element (p. 183)
TimeSlider on/off toggle (p. 183)
What’s New in 3ds max 4 MAXScript 7
The MAXScript Interface: actionMan (p. 353) has a function called “executeAction”. It takes as
parameters the ID of the action table and the “persistent id” of the action. A comment string
that includes the category and tooltip for the action follows it. Some action items have custom code
emitters that emit better looking code.
This interface is currently intended only for running macro recorded actions.
Note:
There is no way currently to query the action manager for all the available action items.
actionMan.loadKeyboardFile “KbdFile.kbd”
This loads the named keyboard file from the current UI directory.
actionMan.saveKeyboardFile “KbdFile.kbd”
Saves the current keyboard configuration into the given file name in the UI directory.
actionMan.getKeyboardFile()
Returns the full path to the current keyboard file.
See Also
Interface: actionMan (p. 353)
The Macro Recorder (p. l)
Defining Macro Scripts (p. 1521)
The MAXScript Listener Window (p. xxxvi)
Turning On the Listener Log (p. xli)
Listener Commands (p. xxxviii)
10 Chapter 1 | What’s New in 3ds max 4 MAXScript
Compound controls
Microsoft Excel,
Microsoft Internet Explorer
Adobe Acrobat
…
This provides numerous possibilities in MAXScript which include:
• Embed a web browser into a rollout and then navigate the user to a web site.
• Embed an Excel spreadsheet into a rollout, extract the user entered values from cells and then
create animation in Max.
• Create an ActiveMovie player through MAXScript, load an Avi file and then synchronize the
animation between the rendered Avi in ActiveMovie player to animation in Max.
The technology behind this feature is a MAXScript extension plug-in (MxsActiveX.dlx) making it
MAXScript capable. It does not use ParamBlock2.
The plug-in adds a new type of rollout control. The syntax is:
activeXControl <name> [ <control_type> ] [ prop1:<value> ] [ prop2:<value> ] …
Parameters:
<control_type>
A string to create the control. The string must be formatted in one of the following ways:
• A Program ID such as “MSCAL.Calendar.7”
• A Class ID such as “{8E27C92B-1264-101C-8A2F-040224009C02}”
• A URL such as “http://www.microsoft.com”
• A reference to an Active document such as “file://\\Documents\MyDoc.doc”
• A fragment of HTML such as “MSHTML:<HTML><BODY>This is a line of text</BODY></
HTML>”
What’s New in 3ds max 4 MAXScript 11
Note:
“MSHTML:” must precede the HTML fragment so that it is designated as being a
MSHTML stream.
prop1:<value>
prop2:<value>
…
These are control specific keyword arguments. You can get a list of properties and their
types by calling showProperties on the control.
Examples:
activeXControl ax “{05589FA1-C356-11CE-BF01-00AA0055595A}” height:200 \
width:300 align:#left
Examples:
----------------------------------------------------------------------
-- Creates a Windows media player in a rollout.
-- Load an avi file by clicking the “Pick Avi” button and choosing an Avi file.
-- When the play button is hit the “on timer...” is called
-- This synchronizes the time slider with the active frame in the media player
-- Clicking show properties to get all the properties listed in the listbox
-- You can also set a property by picking a property from the listbox and entering
the new value in the text below
--------------------------------------------------------------------
rollout rActiveX “Creates a Windows media player in a rollout”
(
local val
activeXControl ax “{05589FA1-C356-11CE-BF01-00AA0055595A}” height:200 width:300
align:#left
on btnPick pressed do
(
local f = getOpenFileName caption:”Pick Any Avi File” types:”*.avi”
if f != undefined then
ax.FileName = f
)
on btnProps pressed do
(
showProperties ax
lbProps.items = getPropNames ax
)
on lbProps selected sel do
(
if lbProps.items.count > 0 then
(
try ( val = getProperty ax lbProps.items[sel] )
12 Chapter 1 | What’s New in 3ds max 4 MAXScript
format “----Application----”
showProperties rExcel.ax.application
format “----Parent----”
showProperties rExcel.ax.parent
format “----Container----”
showProperties rExcel.ax.container
-- In case of MS Excel .document points to the msexcel.workbook
workbook = rExcel.ax.document
format “----Document----”
showProperties workbook showHidden:true
showMethods workbook showHidden:false
props = getPropNames workbook
sort props
for prop in props do
(
try
(
format “\t%=%\n” (prop as string) (getProperty workbook prop)
) catch ()
)
14 Chapter 1 | What’s New in 3ds max 4 MAXScript
Properties
There are 2 common properties for ActiveX controls, .pos and .size. Other ActiveX properties are
control specific and vary from one control to another.
Properties can be set like:
ax.filename = true
where ax is the control name.
Additionally, there is support for color properties. The internal representation of colors for ActiveX
controls is COLORREF(unsigned integer) so you’ll always get them in integers but you can set them
as follows:
ax.forecolor = red -- if a .forecolor property exists
Methods
All methods of ActiveX controls are control specific and vary from one control to another. Methods
can be called like:
ax.AboutBox()
ax.loadURL “www.discreet.com”
Events
Events are notifications sent by the ActiveX controls to the rollout, whenever an action is performed
on the control, e.g.: clicking a button, browsing to a webpage. If supporting event handler is
implemented for the event, in the rollout context, the handler is called with supporting arguments.
Supporting Functions
showAllActiveXControls [ to:<stream> ]
Prints a list of ActiveX controls with their progID and classID, registered on your system.
showMethods <axControl> [ to:<stream> ] [showHidden:<false>]
Prints a list of methods and their arguments that can be invoked on the control
showEvents <axControl> [ to:<stream> ]
Prints a list of events and their arguments that are sent by the control
showProperties <axControl> [ to:<stream> ] [showHidden:<false>]
Prints a list of the properties and their types, supported by the control. Some properties are
marked read-only
getPropNames <axControl> [showHidden:<false>]
Returns an array of the properties supported by the control
What’s New in 3ds max 4 MAXScript 15
Common Parameters
to:<stream>
is the output stringstream.
showHidden:<boolean>
controls whether hidden properties/methods should be included in the enumeration. The
default value is false.
All supported COM datatypes are converted to an appropriate MAXScript wrapper when passed to
and from a COM object. Here are the supported types and their mapping
undefined - VT_EMPTY
boolean - VT_BOOL
integer - VT_UI1
integer - VT_UI2
integer - VT_UI4
integer - VT_UI8
integer - VT_I1
integer - VT_I2
integer - VT_I4
integer - VT_I8
float - VT_R4
float - VT_R8
string - VT_BSTR
float - VT_CY
date - VT_DATE
error - VT_ERROR
color - VT_COLOR
MSDispatch - VT_DISPATCH
font - VT_FONT
undefined - VT_UNKNOWN
ComArray - VT_SAFEARRAY
ComArray - VT_CARRAY
ComArray - VT_ARRAY
Valid string handling for property sets and method call arguments, you can safely do
ax.Navigate “beta.discreet.com”
where: ax is the Microsoft Web Browser Control
16 Chapter 1 | What’s New in 3ds max 4 MAXScript
Note:
Restricted functions like QueryInterface, AddRef, Release are displayed by showMethods() function.
Examples:
---------------------------------------------------------
-- creates a IE browser control in a rollout as registers it an extended
-- viewport. Pick “Web Page” from the Extended Views
-- menu to display the rollout in the webpage. Also click various hypertext links
-- to see the text change in the viewports
---------------------------------------------------------
rollout rWebpage “Web page”
(
local txtObj
local vpsz = getViewSize()
activeXControl ax “www.yahoo.com” height:(vpsz.y-50) width:(vpsz.x-50)
align:#center
fn checkTextObject =
(
if $text01 == undefined then
(
txtObj = text text:”“ name:”text01”
addModifier txtObj (extrude amount:10)
txtObj.wirecolor = red
)
else ( txtObj = $text01 )
)
on rWebpage open do ( checkTextObject() )
on ax TitleChange txt do
(
checkTextObject()
if not (matchPattern txt pattern:”http:”) then
(
if txtObj.text != text then
(
print txt
txtObj.text = txt
max tool zoomextents all
)
)
)
)
fWebPage = newRolloutFloater “Web page” rWebpage.vpsz.x rWebpage.vpsz.y
addRollout rWebPage fWebPage
registerViewWindow fWebPage
showProperties rWebpage.ax
What’s New in 3ds max 4 MAXScript 17
(
accelState.text = if (enableAccelerators) then “Enabled” else “Disabled”
accelState.checked = enableAccelerators
)
on accelState changed state do
(
enableAccelerators = state
accelState.text = if (enableAccelerators) then “Enabled” else “Disabled”
)
)
nf = newRolloutFloater ““ 100 100
addRollout rAccelState nf
)
on rFlash open do
(
axFlash.movie = “e:\\Movie1.swf”
axFlash.movie = “e:\\Movie1.swf” -- need to load 2nd time sometimes
checkTextObject();
)
)
flashFloater = newRolloutFloater “Shockwave Flash Object” 350 300 10 10
addRollout rFlash flashFloater
or:
ax.listItems[1].text = “foo”
.description property
on any activeX control returns a description string of the format
<TypeLib name> (TypeLib info) ? <Help file name if any> - <help context id>
MAXScript sample
rollout controlR92 “Microsoft ListView Control, version 6.0”
(
activeXControl ax “{BDD1F04B-858B-11D1-B16A-00C0F0283628}” height:200 width:300
align:#left
--on ax Click do format “handler: Click\n”
--on ax DblClick do format “handler: DblClick\n”
on controlR92 open do
(
showProperties ax
ax.MousePointer = #ccArrow
ax.GridLines = true
ax.AllowColumnReorder = true
ax.BorderStyle = #ccFixedSingle
ax.view = #lvwReport
chs = ax.columnHeaders
--showProperties chs
--showMethods chs
hTargets = chs.Add()
What’s New in 3ds max 4 MAXScript 21
hWeights = chs.Add()
hTargets.text = “Node”
hWeights.text = “Weights”
lis = ax.listItems
for i=0 to 10 do
(
local li
li = lis.Add()
li.text = “Item “ + i as string
)
for li in ax.listItems do li.bold = true
li = ax.HitTest 100 1500
if li != undefined do
(
showProperties li
li.text = “Just Hit Tested”
showEvents controlR92.ax
showMethods controlR92.ax
)
)
)
nr92 = newRolloutFloater “Microsoft ListView Control, version 6.0” 350 300 10 10
addRollout ControlR92 nr92
See Also
i-drop - drag and drop (p. 62)
Visual MAXScript (p. 117)
MAXScript Dialogs and Rollout Floaters as Extended viewports (p. 186)
22 Chapter 1 | What’s New in 3ds max 4 MAXScript
Asset Browser
Asset Browser enhancements
Topic: version 4 MAXScript New Features/Asset Browser
The Asset Browser provides access from your desktop to design content on the World Wide Web.
From within the program you can browse the Internet for texture samples and product models. This
includes bitmap textures (BMP, JPG, GIF, TIF, and TGA), or geometry files (MAX, DWG, and so on).
You can drag these samples and models into your scene for immediate visualization and
presentation. You can use the CTRL key to drag geometry into predefined locations. You can also use
the Asset Browser to browse thumbnail displays of bitmap textures and geometry files on your hard
disk or shared network drives. Then you can either view them or drag them into your sceneor into
valid map buttons or slots.
• Several special new icons are now used in Thumbnail view to represent script files (.ms, .mcr,
.mse), dropScripts (.ds), and script zip packages (.mzp).
• Now viewing or double-clicking script source files (.ms, .mcr, .ds) will open them in a MAXScript
editor window, ready for editing and evaluation. You can also double-click .mzp script zip
package files to open them in WinZip or some other zip utility if the type .mzp has been
associated with that utility.
• Executable script files (.ms, .mcr, .mse, .mzp) now have a Run... menu item available in the
right-click menu on their thumbnail icons in the thumbnail view, allowing you to launch them
directly from within the asset browser.
• The home page for web views is now <max-directory>\web\maxindex.html.
Properties:
assetBrowser.open ()
Return Value:
Opens the asset browser if it is not already open.
Properties:
assetBrowser.gotoURL <URL_string>
Parameters:
<URL_string>
Opens the given URL in the asset browser.
Remarks:
This can be a web URL or a local or network disc directory path name.
See Also
Interface: browserMgr (p. 355)
i-drop - drag and drop (p. 62)
Zip-file Script Packages (p. 122)
Access to the node bone properties and methods 23
Bones
Note:
Changing the state of this check box will not have an immediate visual effect on the skeleton. It
only affects future behavior when bones are moved. This option is only available if Bone is off.
<node>.boneFreezeLength
boolean
When turned on, the bone maintains its length. When turned off, the bone’s length is based on
the translation of its child bone. This option is available only if Auto-Align is on.
<node>.boneScaleType
one of #scale, #squash, or #none
None: No stretch takes place.
Scale: Lets the bone scale. The stretch happens along one axis.
Squash: Lets the bone squash. The bone gets fatter as it gets shorter, and thinner as it gets
longer.
<node>.stretchTM
matrix3, read-only
The new methods are:
Prototype:
<node>.setBoneEnable <onOff_boolean> <initial-time_time>
Remarks:
Sets the Bone enable on or off.
24 Chapter 1 | What’s New in 3ds max 4 MAXScript
Parameters:
<onOff boolean>
When turned on, the bone or object behaves as a bone. Turning this option off causes
the node to stop behaving like a bone. There is no auto alignment or stretching. Note
that turning this option on will not cause the object to immediately align or stretch.
However future translations of children may cause rotation and stretching.
Default=on for bone objects, off for other kinds of objects.
<initial-time time>
Specifies the time at which to calculate and store initial child position. This is usually
user with the current time slider position. The time associated with the time slider can
be queried and set using the sliderTime global variable. Time Control (p. 1580)
Note:
A very good macroscript example to review, which uses .setBoneEnable, can be found at
..\ui\macroscripts\Macro_Bones.mcr.
Prototype:
<node>.realignBoneToChild ()
Remarks:
When turned on, the bone or object behaves as a bone. Turning this option off causes the node to
stop behaving like a bone. There is no auto alignment or stretching. Note that turning this option
on will not cause the object to immediately align or stretch. However future translations of children
may cause rotation and stretching. Default=on for bone objects, off for other kinds of objects.
Prototype:
<node>.resetBoneStretch ()
Remarks:
Resets the initial child position used to compute the stretch factor to the current child position. This
will cause the stretch factor to become equal to one. If it was previously not equal to one then the
object would snap to its original unstretched state.
See Also
Node Common Properties, Operators, and Methods (p. 820)
Bone Creation (p. 25)
Bone : Helper (p. 978)
Skin : Modifier (p. 1157)
Bones : System (p. 991)
Interface: BoneSys (p. 354)
Bone Creation 25
Bone Creation
Topic: version 4 MAXScript New Features/Bones
Interface: BoneSys (p. 354)
There is a function published interface to create bone links.
Prototype:
BoneSys.createBone <startPosition> <endPosition> <zAxis>
Parameters:
<startPosition>
The location of the new bone as point3
<endPosition>
The direction (X axis) of the bone and the bone length as point3
<zAxis>
The direction of the Z axis for the new bone node as point3
Return Value:
It returns the new bone node that was created.
Note:
If the Z axis is not perpendicular to the X axis, the Z axis will be made perpendicular. To create a
bone chain, call createBone repeatedly with the startPosition set to the value of the previous
endPosition. Note that newly created bones are not linked to any parent. So to create a bone chain,
the script would also need to link each newly created bone segment to the previous.
See Also
Bones : System (p. 991)
Core Interfaces (p. 70)
Node Common Properties, Operators, and Methods (p. 820)
Bone Creation (p. 25)
Bone : Helper (p. 978)
Skin : Modifier (p. 1157)
Access to the new node bone properties and methods (p. 23) Bones_System
26 Chapter 1 | What’s New in 3ds max 4 MAXScript
Cache Modifiers
Point Cache Modifier
Topic: version 4 MAXScript New Features/Cache Modifiers/Point Cache Modifier
Point Cache - superclass: modifier (p. 314)
This is a simple point caching system. It lets you store modifier animation to a disk file that records
only changes in vertex positions, and then play back the animation using the information in the
disk file instead of the modifier keyframes. It caches the points of an object across time and then
reads them from the disk on play back. It is useful when you have large intricate stacks that you want
to speed up or modifiers such as flex that you want to bake.
This modifier sacrifices memory for speed, it stores three caches of the points to allow for fast reading
from the disk. You can instance this modifier but the instances must have the same number of
points, otherwise the results will be inconsistent. This also only record point position it does not
store mapping, topology changes etc. It also cannot deal with animated topology changes.
Four MAXScript interface methods have been exposed to allow pressing the Record, Set Cache,
EnableMods, and DisableMods buttons.
Methods
Prototype:
<void>record()
Remarks:
Stores the vertex animation to a disk file. Call Record to activate the Save Points dialog, which lets
you specify a path and file name for the cache file. Click OK to record the file, and then load it into
the Point Cache modifier, ready for playback.
Prototype:
<void>setCache()
Remarks:
Loads a vertex animation from a cache file on disk into the Point Cache modifier. If number of
vertices in the cache file does not match the number of vertices in the object, a warning appears, but
no error occurs.
Prototype:
<void>enableMods()
Remarks:
Turns on all stack modifiers below the Point Cache modifier. Use this when you want to change
modifier settings.
Notify Callbacks for Animate button on and off Transitions 27
Prototype:
<void>disableMods()
Remarks:
Turns off all the object’s stack modifiers below Point Cache so that only the cached vertex animation
appears when you play back the animation.
Note:
The WSM is identical to the local space version except it records points in World Space and exist
higher in the stack.
See Also
PointCache interfaces: (p. 486)
PointCache - superclass: modifier (p. 316)
See Also
General Event Callback Mechanism (p. 29)
28 Chapter 1 | What’s New in 3ds max 4 MAXScript
The first argument is the bitmap value to be modified by the effect, and progressCB is a progress
callback interface object. This interface has several methods you can call during the course of
processing the bitmap that control the progress bar and check for user cancellation.
Methods
progressCB.setTitle <string>
Sets the title on the progress bar.
progressCB.progress <done> <total>
Indicates the progress of the rendering. Both arguments are integers; done indicates how
much of the rendering has been completed, and total indicates how much there is
to do.
When this is called, the main render effects progress bar is updated to reflect this progress.
This function also returns a boolean, which if true indicates that the user has hit the
escape key to cancel the effect rendering.
progressCB.check()
Indicates whether the user has hit the escape key to cancel the effect rendering. This
function returns a boolean; false if processing should continue, and true if the user has
cancelled the rendering.
Example:
on apply bm progressCB: do
(
…
progressCB.setTitle “My Effect Pass1”
…
escapeEnable = false -- turn on scripter escape processing
for i in …
(
<the effect rendering loop>
…
if progressCB.progress completed total then exit
)
…
escapeEnable = true
…
)
The progress bar update is done inside the main processing loop and the check for user cancel is
done on the same call, causing the loop to exit prematurely in this example.
General Event Callback Mechanism 29
See Also
RenderEffect : MAXWrapper (p. 1347)
Scripted RenderEffect Plug-ins (p. 1566)
Render Effects Common Properties, Operators, and Methods (p. 1347)
For example:
callbacks.addScript #preRender “setUpRenderGeom()” \
id:#jbwRender
registers a new callback script that will be called just before a render is performed. The
script invokes a function (that has presumably already been set up). An unique ID has
been assigned to the script for later selective removal.
callbacks.removeScripts [ <callback_type_name> ] [ id:<name> ]
This method is used to unregister and remove one or more callback scripts. Specifying
just a callback event type name removes all the callback scripts for that event.
Specifying just an id:<name> removes all callback scripts in all events with that ID.
Specifying both limits the ID-based removal to the specified event type.
callbacks.show ()
This method lists out the current callback scripts in the Listener window.
callbacks.broadcastCallback <callback_type_name>
This method provides a way for you to simulate one of the events and have all the
callback scripts for it executed. Within 3ds max, the #preRenderFrame and
#preRenderFrame callbacks can only be called by the renderer. These callbacks can
not be called by using this method.
The following is a list of valid callback event type names:
#unitsChange
Sent if the user changes the unit setting.
#timeunitsChange
Sent if the user changes the time format setting.
#viewportChange
Sent if the user changes the viewport layout.
#spacemodeChange
Sent if the user changes the reference coordinate system.
#modPanelSelChanged
Sent whenever the Modify panel opens on a new selection, either because the Modify
panel was just selected or because a new selection is made in the scene. The notify occurs
at a point just prior to panel redraw but after the selection has been established, so that
callback functions can modify the panel state without it being overwritten.
System Notifications
#systemPreReset
Sent before 3ds max is reset.
#systemPostReset
Sent after 3ds max is reset.
#postSystemStartup
Sent when the software goes live.
#pluginLoa\ded
Sent whenever a plug-in is loaded.
General Event Callback Mechanism 31
#systemPreNew
Sent just before 3ds max is reset.
#systemPostNew
Sent just after 3ds max is reset.
#preSystemShutdown
Sent just before the software enters the shutdown process.
#postSystemShutdown
Sent just before the software finishes the shutdown process.
#colorChanged
Sent when the system is updating it’s custom colors.
File Notifications
#filePreOpen
Sent before a new file is opened.
#filePostOpen
Sent after a new file is opened successfully.
#filePreMerge
Sent before a file is merged.
#filePostMerge
Sent after a file is merged successfully.
#filePreSave
Sent before a file is saved.
#filePostSave
Sent after a file is saved.
Renderer Notifications
#preRender
Sent before rendering is started. This notification is sent out before the renderer creates the
render instance objects, which means that you can create nodes and other objects as a
response to this event. When rendering multiple frames, this event is sent only once at the
beginning of the rendering phase, and not on a per-frame basis. In the #preRender
callback, you can’t change any of the render parameters (height, width, aliasing, etc) and
effect the current render sessions. Those parameters have already been set up internally in
3ds max, and so changes to them won’t occur until the next render session occurs.
#postRender
Sent after rendering has finished. This notification is sent out after the renderer destroys
the render instance objects, which means that you can create nodes and other objects as a
response to this event. When rendering multiple frames, this event is sent only once at the
end of the rendering phase, and not on a per-frame basis.
#preRenderEval
Sent just before the renderer starts evaluating objects.
32 Chapter 1 | What’s New in 3ds max 4 MAXScript
#preRenderFrame
Sent just before each frame is rendered by the renderer. This notification is sent out after
the renderer has taken a snapshot of the scene geometry. At the time of this call the scene
cannot be modified. The renderer has already called GetRenderMesh() on all the object
instances, and the materials and lights are already updated. If you don’t modify anything
that is rendered, then it is okay to use this callback. The current frame being rendered is set
into the MAXScript currentTime context and system global, so any references to other
scene object properties will automatically be resolved at the currently rendering frame’s
time. This notification is not sent out when the renderer is called to update the Material
Editor sample spheres, only during output rendering.
#postRenderFrame
Sent just after each frame is rendered by the renderer. The current frame being rendered is
set into the MAXScript currentTime context and system global, so any references to other
scene object properties will automatically be resolved at the currently rendering frame’s
time. This notification is not sent out when the renderer is called to update the Material
Editor sample spheres, only during output rendering.
#renderParamsChanged
Sent whenever the common renderer parameters have changed.
Import/Export Notifications
#preImport
Sent before a file is imported.
#postImport
Sent after a file is imported successfully.
#importFailed
Sent if import fails.
#preExport
Sent before a file is exported.
#postExport
Sent after a file is exported successfully.
#exportFailed
Sent if export fails.
#nodeFreeze
Sent when a node is frozen.
#nodeUnfreeze
Sent when a node is unfrozen.
#nodeLinked
Sent when a new parent-child link is made.
#nodeUnlinked
Sent when a parent-child link is broken.
#nodePreMaterial
Sent just before a node gets a new material
#nodePostMaterial
Sent just after a node gets a new material
#sceneNodeAdded
Sent just after a node is added to the scene.
#selNodesPreDelete
Sent just before selected nodes are deleted.
#selNodesPostDelete
Sent just after selected nodes are deleted.
#nodeMaterialChanged
Sent after the material is changed for the selected nodes.
#nodeWSCacheUpdated
Sent whenever the modifier stack display is reevaluated.
VIZ-Only Notifications
#heightMenuChanged
Sent when a user operated the height menu.
#fileLinkPreBind
Sent just before a file link bind.
#fileLinkPostBind
Sent just after a file link bind.
#fileLinkPreDetach
Sent just before a file link detach.
#fileLinkPostDetach
Sent just after a file link detach.
#fileLinkPreReload
Sent just before a file link reload.
#fileLinkPostReload
Sent just after a file link reload.
#fileLinkPreAttach
Sent just before a file link attach.
#fileLinkPostAttach
Sent just after a file link attach.
Other Notifications
#wmEnable
Sent when main window gets an wm_enable (BOOL enabled).
#selectionSetChanged
Sent after the selection set has changed.
#bitmapChanged
Sent after a bitmap is reloaded.
General Event Callback Mechanism 35
Color Manager
Topic: version 4 MAXScript New Features/Color Manager
There is a Function Published interface in MAXScript called “colorMan (p. 356)” that exports the
color manager interface.
All colors are represented as Point3 values of the form [red, green,blue], where each value runs from
0.0 to 1.0.
colorMan.useStandardWindowsColors()
Returns true if the standard windows colors are used and false if custom colors are used.
colorMan.setUseStandardWindowsColors onOff
Sets the value of “useStandardWindowsColors”. Passing in “true” tells the system to use
the standard windows colors, and false tells the system to use the custom colors.
colorMan.registerColor color name category defaultColor
This registers a new color with the system. This adds a color to the color manager database
that is then accessible from the color customization UI.
Example:
colorMan.registerColor #myNewColor “My Own Color” “Ugly Colors” [1,0,0]
This registers a new color, with the name #myNewColor, with a default value of red.
The category in the customization UI will be “Ugly Colors” and the name will be “My
Own Color”.
In other scripts you can access this color using:
colorMan.getColor #myNewColor
Note:
colorMan.registerColor should be called from a script in the “.\stdplugs\stdscripts” folder. These
scripts are run when MAX starts, so the color will be available in the customization UI immediately.
If the user customizes this color, its value will be saved in the MaxColors.clr file.
colorMan.loadColorFile()
This method will load the specified color file from the current UI directory.
colorMan.saveColorFile()
This brings up the file save dialog and lets the user save a new color file.
colorMan.setColor color colorValue
This sets the value of the given color to the given value. Besides the colors that you register
using registerColor, there is a set of built-in colors that you can set and get:
#background -- The background for all controls and buttons
#text -- The text for all controls and buttons
#activeCommand -- The color command mode buttons turn when pressed
#hilight -- The hilight color for 3d controls
#shadow -- The shadow color for 3d controls
#window -- The background color for edit boxes, list boxes and other
windows
#activeCaption --
#appWorkspace --
36 Chapter 1 | What’s New in 3ds max 4 MAXScript
These two are currently unused, but would be used if a 3rd party developer uses the
Windows colors in C++ code:
GetCustSysColor(COLOR_APPWORKSPACE)
or:
GetCustSysColor(COLOR_ACTIVECAPTION)
These were put in for completeness with the windows API.
#toolTipBackground -- The background for viewport tool tips
#toolTipText -- The text color for viewport tool tips
#hilightText -- The hilight color in the stack view drop-down list
#windowText -- The color used in edit boxes, list boxes and other windows
#itemHilight -- Used as the highlight color on the stack-view drop down list
of modifiers.
#subObjectColor -- The color used to hilight sub-object levels in StackView
#3dDarkShadow -- the dark shadow color on 3d controls
#3dLight -- the light color on 3d controls
#trackbarBg -- trackbar background
#trackbarBgSel -- trackbar background for selected keys
#trackbarText -- trackbar text
#trackbarTicks -- trackbar ticks
#trackbarKeys -- trackbar keys
#trackbarSelKeys -- track bar selected keys
#trackbarCursor -- track bar cursor
#pressedButton -- background color for pressed buttons, like the transform
constraints
#timeSliderBg -- The background for the time slider bar.
#viewportBorder -- The viewport border color
#activeViewportBorder -- The active viewport border color
#rollupTitleFace -- Rollout title background
#rollupTitleText -- rollout title text
#rollupTitleHilight-- rollout title 3d highlight
#rollupTitleShadow -- rollout title 3d shadow
#selectionRubberBand -- the selection marquee color
#stackViewSelection -- the color of a selected item in stack view
colorMan.getColor color
Gets the value of the given color.
colorMan.getName color
Gets the name of the given color.
colorMan.getCategory color
Gets the category of the given color.
colorMan.getIconColorScale type which
Gets the value of the icon image processing value.
type enums: {#disabledIcon|#enabledIcon}
which enums: {#saturationScale|#valueScale|#alphaScale}
Returns a floating point value (in the range 0.0f to 1.0f) that is one of the scale factors
applied to the specified icon type. These scale values used to do image processing on the
icons at start-up time.
General Event Callback Mechanism 37
Here is a macroScript that turns the time slider and trackbar backgrounds blue:
Example:
macroScript BlueBar
category: “Color”
tooltip: “Blue Bar”
(
on execute do
(
colorMan.setColor #timeSliderBg [0, 0, .6]
colorMan.repaintUI #repaintTimeBar
colorMan.setColor #trackbarBg [0, 0, .6]
colorMan.repaintUI #repaintTrackBar
)
)
MAXScript calls that let you load, save and query color files.
colorMan.loadColorFile “MyColors.clr”
Loads the given color file from the current UI directory.
Returns true if it succeeds, and false otherwise.
colorMan.saveColorFIle “MyColors.clr”
Saves the current color scheme into the named file in the current UI directory.
Returns true if it succeeds, and false otherwise.
colorMan.getColorFile()
Returns the full path to the current color file.
38 Chapter 1 | What’s New in 3ds max 4 MAXScript
Example:
To set the selected object color to red, you would use:
SetUIColor 0 red
colorMan.repaintUI #repaintall
See Also
Interface: colorMan (p. 356)
3ds max User Interface Colors (p. 1604)
Combustion
Topic: version 4 MAXScript New Features/Combustion
With the Combustion map, you can create maps interactively using the Discreet combustion
product and 3ds max at the same time. You use combustion software to paint on a bitmap, and the
material updates automatically in the 3ds max Material Editor and in shaded viewports.
Important: The combustion map works only if Discreet combustion is installed on your system.
You can use combustion as a material map in 3ds max. With a Combustion map, you can create a
material from a Paint or composite operator, and in turn apply that material to objects in a 3ds max
scene. The Combustion map can include combustion effects, and it can be animated.
In addition, with combustion you can import 3ds max scenes that have been rendered to a rich pixel
file (RPF or RLA file). The imported rich pixel rendering becomes an element of your composite. You
can adjust its 3D position relative to video elements of the composite, and you can apply
combustion 3D Post effects to objects within it. See the combustion User’s Guide for more information.
Note: Because 3ds max runs only on Windows, you cannot use combustion to create material maps
on a Macintosh.
Note: The environmental atmospheric effect known as “Combustion” in versions prior to 3ds max 4
is now known as the Fire effect.
A Combustion map is a 2D map (p. 274). It is a combustion project used by the 3ds max Material
Editor, so like any combustion project, it is vector-based, animatable, and fully editable. From within
the Material Editor, you can have combustion create a new project from scratch, or use an existing
composite or Paint branch. You can synchronize the combustion Timeline with the 3ds max time
slider so animated materials synchronize with your 3D scene.
A macroScript has been added that gets called by the render management system to output render
element info to the combustion(tm) .cws file format.
../UI/MacroScripts/Macro_CombustionOutput.mcr
Associated files include:
RenderElements-fns.ms
CombustionExport-fns.ms
CombustionExport.ini
Path Constraint 39
Example:
C = combustion()
See Also
Combustion.coordinates - superclass: MAXObject (p. 274)
Render Element Manager (p. 92)
Material Common Properties, Operators, and Methods (p. 1203)
Constraints
Path Constraint
Topic: version 4 MAXScript New Features/Constraints
Path Constraint - superclass: PositionController (p. 307)
Path Constraint interfaces: (p. 468)
A path constraint restricts an objects movement along a spline or at an averaged distance between
multiple splines.
See Also
path interfaces: (p. 462)
LookAt Constraint (p. 40)
Orientation Constraint Controller (p. 40)
Link Controller for Constraints (p. 42)
Controller Functions for use with Constraint Assignments (p. 42)
40 Chapter 1 | What’s New in 3ds max 4 MAXScript
LookAt Constraint
Topic: version 4 MAXScript New Features/Constraints
LookAt Constraint - superclass: RotationController (p. 297)
LookAt Constraint interfaces: (p. 455)
Look-At Constraint constrains an object’s orientation so that it’s always looking at another object.
Note:
The old Look At Controller, which is a full transform controller, will be invisible to the user unless
an old file is loaded. The new LookAt Constraint Controller is a rotation controller and NOT a TM
controller which the old LookAt was. The old LookAt will be phased out.
At this time, old LookAt.IsPublic returns zero, so that the users won’t see the old LookAt. However,
the old MAX files will still load the old LookAt and the camera and the light will continue to use the
old LookAt.
See Also
Path Constraint (p. 39)
Position Constraint (p. 41)
Orientation Constraint Controller (p. 40)
Link Controller for Constraints (p. 42)
Controller Functions for use with Constraint Assignments (p. 42)
See Also
Path Constraint (p. 39)
Position Constraint (p. 41)
LookAt Constraint (p. 40)
Link Controller for Constraints (p. 42)
Controller Functions for use with Constraint Assignments (p. 42)
Position Constraint
Topic: version 4 MAXScript New Features/Constraints
Position Constraint - superclass: PositionController (p. 320)
Position Constraint interfaces: (p. 488)
A position constraint causes an object to follow the position of an object or the averaged position
of several objects.
In order to activate, a position constraint requires an object and a target object. Once assigned the
object becomes constrained to the target objects position. Animating the target’s position causes the
constrained object to follow
Each target has a weight value defining its influence. A value of 0 is equal to off. Any value greater
than 0 will cause the target to influence the constrained object. Weight values may be animated to
create effects such a ball being picked up from a table.
Multiple targets can be used to influence a constrained object. When using multiple targets, each
target’s weight value defines how much it influences the constrained object. For example if a sphere
is Position constrained between 2 targets and each target’s weight value is 100. Then the sphere will
maintain an equal distance between both targets even when they are in motion. If one of the weight
values is 0 and the other is 50, then the Sphere is only influenced by the target with the higher value.
Example:
posCtrl = Position_Constraint()
posConstraintInterface = posCtrl.constraints
appendNode <node>
Adds a node to the node list with a default weight of 50
appendWeightedNode <node> <weight>
Adds a node to the node list with the specified weight
getNode <index>
Returns the node specified by the index. Index is a 1 based array
setNode <node> <index>
Replaces the node with the given index with a new node
getWeight <index> <time>
Returns the weight at the time for the node specified by the index.
setWeight <weight> <index> <time>
Sets the weight for the node specified by the index at the given time.
42 Chapter 1 | What’s New in 3ds max 4 MAXScript
Use:
posConstraintInterface.appendNode $box01
posConstraintInterface.appendWeightedNode $box02 200
node1 = posConstraintInterface.getNode 1
posConstraintInterface.setNode $box03 2
weight = posConstraintInterface.getWeight 1 50
posConstraintInterface.setWeight 250 1 0
See Also
Path Constraint (p. 39)
LookAt Constraint (p. 40)
Orientation Constraint Controller (p. 40)
Link Controller for Constraints (p. 42) Controller Functions for use with Constraint Assignments (p. 42)
See Also
Path Constraint (p. 39)
LookAt Constraint (p. 40)
Position Constraint (p. 41)
Orientation Constraint Controller (p. 40)
Link Controller for Constraints (p. 42)
Controller Functions for use with Constraint Assignments (p. 42)
Prototype:
AddListController OBJ Trans ListType
Remarks:
Checks to see if a list controller is assigned. If not, it will assign to the designated Trans using the
ListType, This way it can be used for all list controllers.
Controller Functions for use with Constraint Assignments 43
Example:
Foo = Selection as array
AddListController “Foo[1]” “Pos” “Position_List”
Prototype:
AddConstraint OBJ Trans Constraint List
Prototype:
SetActiveController OBJ Trans Controller
Prototype:
AddConstraintTargets OBJ Trans Array Target
See Also
Path Constraint (p. 39)
LookAt Constraint (p. 40)
Position Constraint (p. 41)
Orientation Constraint Controller (p. 40)
Context Filters
Topic: version 4 MAXScript New Features/Context Filters
Filter functions for context sensitive menus:
Use this for .IsEnabled or .IsVisible handlers in macrocripts. isEnabled and isChecked handlers have
been added to many of the existingmacroScripts. All of the modifier, creation and polygon toolbox
macroScripts have these two handlers.
These handlers allow object creation CUI buttons to turn green while creating objects, and modifier
buttons are only enabled if they apply to the current selection. The polygon toolbox buttons also
only enable when applicable, and the selection level buttons stay pressed while in the sub-object
level.
This structure is defined in .\stdplugs\stdscripts\FilterFunctions.ms.
An example use of the filter functions can be found in the Selection and Display Callbacks Script
File, .\stdplugs\stdscripts\Selection_Display_Filters.ms
#Struct:Filters(
Is_EditMesh:<fn>,
Is_NURBS:<fn>,
Is_EditPoly:<fn>,
Is_EditPatch:<fn>,
Is_EditSpline:<fn>,
Is_MeshSelect:<fn>,
Is_PolySelect:<fn>,
Is_SplineSelect:<fn>,
Is_PatchSelect:<fn>,
Is_PosXYZ:<fn>,
Is_RotationXYZ:<fn>,
44 Chapter 1 | What’s New in 3ds max 4 MAXScript
Is_ScaleXYZ:<fn>,
is_Child:<fn>,
This is used for the new IK assignments.
is_Parent:<fn>,
This is used for the new IK assignments.
CanSwitchTo_XXXX for SubObject levels
CanSwitchTo_Vertex:<fn>,
CanSwitchTo_Edge:<fn>,
CanSwitchTo_Face:<fn>,
CanSwitchTo_Polygon:<fn>,
CanSwitchTo_Element:<fn>,
CanSwitchTo_Border:<fn>,
CanSwitchTo_Patch:<fn>,
CanSwitchTo_Segment:<fn>,
CanSwitchTo_Spline:<fn>,
Return Value:
They return true if the selected object’s function name condition is met.
See Also
Macro Scripts (p. 1624)
Defining Macro Scripts (p. 1521)
macros const StructDef (p. 239)
Scripted Custom Attributes 45
Custom Attributes
Note:
You cannot use Custom Attributes for per-face-data. The face-data channels store objects of a user
defined type and the scripter cannot create objects of types other than those known by MAXScript.
The new syntax has the following form:
attributes <varname>
[version:n]
[silentErrors:t/f]
[initialRollupState:0xnnnnn]
(
<locals>
<globals>
<parameters>
<rollouts>
<handlers>
)
Remarks:
The name is now simply a descriptive name for the definition and can be either a <name> or a
<string>.
Example:
attributes “Game Data”
(
...
)
or
attributes gameData
(
...
)
46 Chapter 1 | What’s New in 3ds max 4 MAXScript
The attribute header keyword parameters and main clauses are basically identical to the same
keyword parameters and clauses in Scripted Plug-ins (p. 1538). The ‘custom attributes’ are effectively
the parameters defined in any parameter clauses in the body of the attributes definition. The UI for
them is defined by the rollout clauses, which will be automatically displayed in the Command Panel
and Material Editor when an object containing custom attributes is selected.
Example:
attributes weaponData
(
parameters main rollout:params
(
hitPoints type:#float ui:hits default:10
cost type:#float ui:cost default:100
sound type:#string
)
Remarks:
This defines three new attributes, say for weapon objects in a game level editor set up. The attributes,
hitPoints, cost and sound, are defined as parameters and the UI for them in a rollout.
Note:
The auto-UI connection between the parameters and rollout items via the ui and keyword is the
same as the support in Scripted Plug-ins (p. 1538). You can treat attribute scripting as basically
identical to scripting plug-ins, in terms of parameter, rollout setup and handler programming.
Remarks:
Adds a set of attributes to an object or a collection. You can only add one custom attribute set of a
particular attributes definition to an object, but you can have as many different attribute sets from
different definitions as needed.
Parameters:
#unique
Scripted Custom Attributes 47
When adding custom attributes to an object using the custAttributes.add() function, you
can now supply an optional #unique keyword as the third argument. If you do this, each
object being added to will have custom attributes added that have their own private copy
of the definition and do *not* share the original definition. Any later redefinitions of the
original attributes definition will not update these custom attributes. To update the
individual object’s attributes, you would get the unique definition from the object using
custAttributes.getDef, and redefine it in one of the two ways described.
Note:
If you extract the uniquely-added definition, and use it directly in another non-unique
custAttributes.add() on some other object, a definition sharing will be set up. Using #unique
when adding a global definition will make the added custom attributes non-global, they will
have their own private definition which starts out being identical to the original global
definition.
Example:
custAttributes.add $weapon01 weaponData
Opening $weapon01 in the Modify panel will now display the “Weapon Parameters”
rollout and allow them to be edited as can normal object parameters. You can use
attribute definitions to add their defined sets of attributes to any object at any time.
Any appropriate type of parameter can be animated, also, exactly as with scripted
plug-ins.
The custAttributes.add() function can be applied to an object collection to add sets of attributes to
a group of objects in one go.
Example:
custAttributes.add $weapon* weaponData
Adds a separate set of these custom attributes to all objects whose names begin
“weapon” in the scene.
Note:
Further, an object can have any number of separate sets of custom attributes added from different
attribute definitions.
As with Scripted plug-ins (p. 1538), an attributes definition can have any number of sets of parameter
and rollout clauses, to allow you to organize added attributes into multiple rollouts as needed.
Scripted custom attributes added to an object or modifier can be accessed in MAXScript. They turn
up directly as properties on the objects they are added to. If the names of any of the custom
attributes are the same as existing properties on the host object, the custom attributes are
effectively hidden when accessed directly. As an alternative, you can access each added block
of custom attributes by their attributes definition name and then access individual
attributes as properties within that block.
48 Chapter 1 | What’s New in 3ds max 4 MAXScript
• scripted custom attributes are properly saved to and loaded from scene files.
• you can assign a fixed, global definition ID to an attributes definition.
This acts in a similar way to class IDs in scripted plug-ins. Such definitions are global across
any number of scenes that custom attributes may be present in and all instances of custom
attributes of a global definition will have the same shape. The ID is specified with a new
header parameter, ‘attribID:’
attributes <name>
attribID:#(<number>, <number>)
(
...
)
Remarks:
The ID number pair is chosen to be unique, perhaps generated with the genClassID (p. 141) ()
function in MAXScript. Attribute definitions without attribID’s are private to the current MAX
session.
genClassID()
This method generates a random class ID similar to #(0x9b7ea231, 0xb6db86ef), and prints it
to Listener. You can just cut and paste this class ID into your script to use the generated ID.
Scripted Custom Attributes 49
This example adds a separate set of the defined custom attributes to box01 and box02. The
definition is shared between the two boxes. Now this is a private definition, it has no attribID:, so if
you evaluated the ‘def = attributes (...)’ again, it would *not* automatically update box01’s and
box02’s attributes, as used to happen in prior builds, but create a new definition. In order to redefine
a specific attribute definition so that all objects will be updated that had attributes added using it,
you use one of two schemes that operate on the actual definition value (as it sits in the ‘def’ variable
in the above, for example). First, you can use the new ‘redefine:’ attributes definition parameter.
Example:
attributes “Game Data”
redefine:def
(
parameters ...
rollout ...
)
This expects an existing attributes definition as the value given in the redefine: parameter and will
update it to the definition that follows, and update any custom attributes made from that particular
definition value. In the example, this would update $box01 and $box02.
Alternatively, you can use the new custAttributes.redefine method:
custAttributes.redefine <def> <definition_string>
50 Chapter 1 | What’s New in 3ds max 4 MAXScript
Example:
local new_def = “attributes \“Game Data\“ ( ... )”
custAttributes.redefine def new_def
This is particularly useful in situations where you are generating the attributes definition
automatically as a string. You can use this function to compile and apply the redefinition to a
particular definition object in one go, without having to construct a name for the object, as you
would if you used the redefine: parameter scheme.
To redefine the attributes on some object, say based on the defData in that object’s custom attributes,
you might use this sequence:
old_def = custAttributes.getDef $box03 1 -- get existing def
old_def_data = custAttributes.getDefData old_def -- get my defData from it
new_def_string = generate_new_def old_def_data ... -- make new def string
custAttributes.redefine old_def new_def_string -- redefine it
These redefinition techniques can be used with global definitions (with explicit attribID:), but are
strictly unnecessary since the particular definition value is specified uniquely by the attribID:
parameter. In any situation that you evaluate a global definition, all custom attributes in the current
scene made from that definition will be updated.
Note:
The custom attribute set values, returned by the custAttributes. are effectively holder
values for the object’s custom parameters in that attribute set. You can get at these
parameter values as simple properties on the attribute set value.
Example:
gp = custAttributes.get $ gameParams
gp.hitPoints = 50
this is equivalent to accessing the custom attribute parameters directly on the object:
$.gameParams.hitPoints = 50
Return Values:
Returns an array containing a runtime readable encoding of all of the parameter block
definitions in the custAttributes definition. in the following form:
#(<paramblock>, <paramblock2>, ...)
52 Chapter 1 | What’s New in 3ds max 4 MAXScript
Parameters:
<paramblock>
An array of details for one parameter block in this form:
#(<name>, <id>, <refno>, <keyword_params>, <parameter1>, <parameter2>,
<parameter3>, ....)
<id>
The parameter block’s internal ID number
<refno>
The reference number of the parameter block in the owning plug-in instance
<keyword_params>
An array of the keyword parameters given on the parameter block definition in
the form:
#(<keyword>, <value>, <keyword2_name>, <value2>, ...)
<Parameter1 to ParameterN
Definition details for each parameter in the block in the following form:
#(<param_name> <keyword_params>)
<keyword_params>
An array containing all of the keyword parameters specified on that parameter’s
definition in the cust attrib definition, in the same form as the
<keyword_params> above.
Example:
Here is a function that will extract pBlock data from a custom attribute.
mapped fn custAttribute_showPBlockDefs obj =
(
format “%\n” obj.name
for objDef in (custAttributes.getDefs obj) do
(
format “\t%\n” objDef
format “\tname: %\n” objDef.name
format “\tattribute id: %\n” objDef.attribID
format “\tParameter Blocks:”
pbArray = custAttributes.getPBlockDefs objdef
for a = 1 to pbArray.count do
(
itms = pbArray[a]
format “\n\t\tname = %\n” itms[1]
format “\t\tid = %\n” itms[2]
format “\t\towners reference number = %\n” itms[3]
keywordParams = itms[4]
format “\t\tparameter block keywords:\n”
for x = 1 to keywordParams.Count/2 do
(
format “\t\t\t% = %\n” keywordParams[x] keywordParams[x+1]
x = x+1
)
format “\t\tparameters:”
Scripted Custom Attributes 53
for y = 5 to itms.Count do
(
format “\n\t\t\t#name = %\n” itms[y][1]
for z = 1 to itms[y][2].Count by 2 do
(
format “\t\t\t% = %\n” itms[y][2][z] itms[y][2][z+1]
)
)
)
)
)
custAttributes.getSceneDefs ()
Returns an array of all the attribute definitions in the current scene.
custAttributes.deleteDef <attrib_def>
Deletes the given attribute definiton from the current scene and the current running MAX
session. There must be no objects in the scene containing custom attributes added using this
definition.
Note:
Its name can be gotten via the .name property.
Note:
Typing CAT_Debug = True in the MAXScript listener window will expose the code in the listener
when you add a custom attribute through the User Interface.
See Also
custAttributes const StructDef (p. 234)
54 Chapter 1 | What’s New in 3ds max 4 MAXScript
Depth of Field
Topic: version 4 MAXScript New Features/
Depth of field is available for any renderer plug-in via a published function publishing interface. No
ui has been added. Functionality can be tested by enabling various parameters via MAXScript, and
performing a normal render.
The settable dof parameters can be seen by typing ‘apropos “dof”’ in the MAXScript listener window
or here (p. 234).
To create a DOF display in a camera viewport, simply call
maxops.DisplayActiveCameraViewWithMultiPassEffect
Note that if the active view is not a camera view, or if DOF is not turned on in the camera’s
properties, then this call does nothing. Additionally, note that this method works with general
multi-pass effects and not just DOF.
See Also
DOF const StructDef (p. 234)
Depth of Field : RenderEffect (p. 1354)
Interface: maxOps (p. 368)
Edit Mesh
ApplyOperation function
Topic: version 4 MAXScript New Features/Edit Mesh
The ApplyOperation function is used by the Quad menu for activating object functions.
fn ApplyOperation ctype oper =
(
If (Modpanel.getcurrentObject () == $.baseobject) then oper $
If Classof (Modpanel.getcurrentObject ()) == ctype then
(oper $.modifiers[modPanel.getModifierIndex $
Modpanel.getcurrentObject))])
)
Example:
ApplyOperation Edit_Mesh meshops.StartExtrude
Remarks:
Starts the extrude function on EditMesh if it is either the currently selected modifier or baseobject.
Patches 55
See Also
Quad Menu (p. 90)
MAXScriptFunction List (p. 190)
Editable Patch
Patches
Topic: version 4 MAXScript New Features/Editable Patch
There is a patch function package containing a large number of functions for creating, modifying
and accessing patch objects. The sub-object selection system in MAXScript has also been extended
to cover patch objects.
• The Editable Patch object in MAX was called ‘Patch’ in MAXScript. It has been renamed to
‘Editable_Patch’ to be consistent with Editable_Mesh and Editable_Poly, and to allow the new
patch function package to be named ‘patch’.
• The MAXScript sub-object selection system has been extended to work with Editable Patch
objects. This means that all the MAXScript VertexSelection, FaceSelection, and EdgeSelection
properties and operations now work with patch objects. The ‘face’ sub-object selections in this
system correspond to the ‘patch’ sub-object level when applied to patches.
• The Patch functions. All the functions in this package take either a scene node containing an
Editable Patch object or an Editable Patch base object as the first argument. QuadPatch and
TriPatch objects need to be converted to Editable Patches for the Patch functions to be
applicable. For example, when using the convertTo $foo Editable_Patch.
• To create a patch object from scratch, create an Editable_Patch scene object to create an empty
patch object and use the geometry & topology creations functions below to fill the patch out,
then use the patch.update() function to complete construction.
Note:
Any set of changes to a patch object using the following functions do not fully take effect until the
patch.update() function is called on it. This makes construction substantially more efficient, but can
leave a patch in an unstable state if the script that contains the changing code finishes before calling
patch.update on it, which may result in a MAX crash.
Functions:
The following functions are used to get and set the overall geometry of the patch. Supply keep:true
to the setNumXXX functions for them to retain existing vertex/vector/patch/edge data, defaults to
false, which cleans out the geometry.
The functions are largely direct calls to the methods of the same name on the MAX SDK class
PatchMesh. See the SDK Help file Advanced Topic “Working with Patches,” and the documentation
for the main Patch system classes for more detailed info.
56 Chapter 1 | What’s New in 3ds max 4 MAXScript
The following functions get and set individual vertex and vector handle locations.
The vertex and vector coordinates are interpreted in MAXScript’s current working coordinate
context.
Consistent with the rest of MAXScript, all vertex/patch/vector/edge indexes start numbering at 1.
<point3> patch.getVert <obj> <index>
patch.setVert <obj> <index> <point3>
<point3> patch.getVec <obj> <index>
patch.setVec <obj> <index> <point3>
The following two functions are the main mechanism for creating individual patches in the
patch mesh.
patch.makeQuadPatch <obj> <index> <va> <vab> <vba> <vb> <vbc> <vcb> <vc> <vcd>
<vdc> <vd> <vda> <vad> <i1> <i2> <i3> <i4> <sm>
where:
index = The index of the patch to create (0> = index < numPatches).
va = The first vertex.
vab = Vector ab.
vba = Vector ba.
vb = The second vertex.
vbc = Vector bc.
vcb = Vector cb.
vc = The third vertex.
vcd = Vector cd.
vdc = Vector dc.
vd = The fourth vertex.
vda = Vector da.
vad = Vector ad.
i1 = Interior 1.
i2 = Interior 2.
i3 = Interior 3.
i4 = Interior 4.
sm = The smoothing group mask
patch.makeTriPatch <obj> <index> <va> <vab> <vba> <vb> <vbc> <vcb> <vc> <vca> <vac>
<i1> <i2> <i3> <sm>
Patches 57
where:
index = The index of the patch to create (0> = index < numPatches).
va = The first vertex.
vab = Vector ab.
vba = Vector ba.
vb = The second vertex.
vbc = Vector bc.
vcb = Vector cb.
vc = The third vertex.
vca = Vector ca.
vac = Vector ac.
i1 = Interior 1.
i2 = Interior 2.
i3 = Interior 3.
sm = The smoothing group mask
The following function forces all the geometry and topology caches to be rebuilt, change
notifications to be sent and a screen redraw request to be flagged.
You must call this function after making any changes to a path object before exiting the script
making the changes otherwise and invalid patch may bepassed to MAX possibly causing a crash. The
patch.update() function is similar in function and purpose to the update() function in mesh object
scripting.
patch.update <obj>
The following functions give access to the topology of an existing patch object. They return either
indexes or arrays of indexes of the sub-objects requested.
Example:
getVertVecs() returns an array of the vectors coming out of the specified vertex.
<integer_array> patch.getVertVecs <obj> <index>
<integer_array> patch.getVertPatches <obj> <index>
<integer_array> patch.getVertEdges <obj> <index>
<integer> patch.getVecVert <obj> <index>
<integer_array> patch.getVecPatches <obj> <index>
<integer> patch.getEdgeVert1 <obj> <index>
<integer> patch.getEdgeVert2 <obj> <index>
<integer> patch.getEdgeVec12 <obj> <index>
<integer> patch.getEdgeVec21 <obj> <index>
The following functions access and manipulate the texture mapping information in the
patch object.
patch.setNumMaps <obj> <num> [keep:<bool>]
<integer> patch.getNumMaps <obj>
patch.setMapSupport <obj> <map_chan> [init:<boolean>]
<boolean> patch.getMapSupport <obj> <map_chan>
patch.maxMapChannels <obj>
patch.setNumMapVerts <obj> <map_chan> <num> [keep:<boolean>]
<integer> patch.getNumMapVerts <obj> <map_index>
58 Chapter 1 | What’s New in 3ds max 4 MAXScript
The following functions get and set the material ID for the patch object as a whole or for individual
patches.
<integer> patch.getMtlID <obj>
patch.setMtlID <obj> <mtl_id>
<integer> patch.getPatchMtlID <obj> <index>
patch.setPatchMtlID <obj> <patch_index> <mtl_id>
The following functions access and control viewport and renderer tessellation and visibility.
patch.setMeshSteps <obj> <steps>
patch.getMeshSteps <obj>
patch.setMeshStepsRender <obj> <steps>
patch.getMeshStepsRender <obj>
patch.setShowInterior <obj> <bool>
patch.getShowInterior <obj>
patch.setAdaptive <obj> <bool>
patch.getAdaptive <obj>
The following functions access topology info for the specified sub-object.
<integer_array> patch.getEdges <obj> <v1> [<v2>]
<integer_array> patch.getPatches <obj> <v1> [<v2>]
<integer_array> patch.getVectors <obj> <vert>
The following function transforms all the vertices and vectors in the patch object by the given
matrix. This transform happens in object local space.
patch.transform <obj> <matrix3>
The following functions get and manipulate surface normal information. Again, normal vectors are
given in MAXScript’s current working coordinate context.
patch.patchNormal <obj> <patch>
patch.edgeNormal <obj> <edge>
patch.updatePatchNormals <obj>
class id filter 59
The following functions access and change the vertex and interior vertex types:
patch.changeVertType <obj> <vert> #corner|#coplanar
patch.getVertType <obj> <vert> -> #corner or #coplanar
patch.changePatchInteriorType <obj> <patch> #automatic|#manual
patch.getPatchInteriorType <obj> <patch> -> #automatic or #manual
The following function returns the current mesh tessellation for the patch object:
<mesh value> patch.getMesh <obj>
The following functions are used to interpolate individual patch surfaces. A tri-patch interpolation
takes u,v,w barycentric coordinates. A quad-patch takes u and c parameters. In both cases, the point
returns is given in the current MAXScript working coordinate context.
<point3> patch.interpTriPatch <obj> <patch> <u> <v> <w>
<point3> patch.interpQuadPatch <obj> <patch> <u> <v>
See Also
patch const StructDef (p. 245)
patchOps const StructDef (p. 247)
Patch Select - superclass: modifier (p. 307)
Patch : GeometryClass (p. 1088)
Filters
class id filter
Topic: version 4 MAXScript New Features/Filters
In the Selection filters/combos filter you can, in addition to registering super classid filters, add
class id filters. The bottom left list box displays a list of all helper and geom class ids. To add a
filter select one and hit the add button below the list box. It will then appear in the lower right list
box. This list displays all of the current class id filters. Once OK is pressed then the select filter drop
down contains those class ids that were added.
You can also register filters through a callback in MAXScript.
fn selectfilter_cb node =
(
print currentTime
true
)
registerSelectFilterCallback selectfilter_cb “MAXScript”
60 Chapter 1 | What’s New in 3ds max 4 MAXScript
The above example filter prints out the current time and filters nothing. The selectfilter_cb will
return TRUE if the node is to be selectable else false.
Prototype:
registerSelectFilterCallback <filterFunction> <name>
Parameters:
<filterFunction>
The filter function
<name>
The string which appears in the filter drop down list
Remarks:
The registerSelectFilterCallback takes 2 parameters. The filter function expects one parameter, which
is the node to be checked.
Prototype:
unregisterSelectFilterCallback <filterFunction>
Parameters:
<filterFunction>
The filter function
Remarks:
There is also an unregisterSelectFilterCallback which removes the callback.
Example:
unregisterSelectFilterCallback selectfilter_cb
See Also
Selection Filter (p. 61)
Main Toolbar (p. 1574)
toolMode const StructDef (p. 257)
Selection Filter 61
Selection Filter
Topic: version 4 MAXScript Language Improvements/User Interface
The Selection Filter list lets you restrict to specific types and combinations of objects that can be
selected by the selection tools. For example, if Cameras is selected, you can select only cameras with
the selection tools. Other objects do not respond.
Prototype:
<int>GetSelectFilter
Return Value:
Returns your current selected select filter in the toolbar.
Prototype:
<void >SetSelectFilter <int_index>
<int_index>
The index of the display filter that you want to check.
Return Value:
Sets your current select filter in the toolbar.
Prototype:
<int >GetNumberSelectFilters
Return Value:
Returns the number select filters in the drop down.
Prototype:
<BOOL>GetDisplayFilter <int_index>
Parameters:
<int_index>
The index of the display filter that you want to check.
Return Value:
Returns whether a display filter is on or not in the display panel.
Prototype:
<void>SetDisplayFilter <int_index> <bool_on>
Parameters:
<int_index>
The index of the display filter that you want to check.
<bool_on>
The state that you want to set the display filter to.
62 Chapter 1 | What’s New in 3ds max 4 MAXScript
Remarks:
Sets the state of a display filter.
Prototype:
<int>GetNumberDisplayFilters
Return Value:
Returns the number of display filters in the display panel.
Prototype:
<string>GetSelectFilterName <int_index>
Parameters:
<int_index>
The index of the display filter that you want to check.
Return Value:
These just return the name that appears in the interface for the appropriate filter.
Prototype:
<string>GetDisplayFilterName <int_index>
Parameters:
<int_index>
The index of the display filter that you want to check.
Return Value:
These just return the name that appears in the interface for the appropriate filter.
See Also
class id filter (p. 59)
Main Toolbar (p. 1574)
toolMode const StructDef (p. 257)
HTML:
<!doctype html public “-//w3c//dtd html 4.0 transitional//en”>
<html>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1”>
<meta name=”Author” content=”Your Name”>
<meta name=”GENERATOR” content=”Mozilla/4.7 [en] (WinNT; U) [Netscape]”>
<title>example</title>
</head>
<body>
Here is an i-drop activeX control ....
<p>
<object name=”idrop” width=”64” height=”80” classid=”clsid:AF2880B4-B183-11D2-
ADE7-00A0245D8F3F”>
<param name=”package” value=”file:///G:/iDrop/example.xml”>
</object>
</body>
</html>
The XML package file:
<?xml version=”1.0”?>
<package xmlns=”x-schema:http://vizdevel/idrop/idrop-schema.xml”>
<proxy defaultsrc=”file:///G:/iDrop/blob.gif”>
<caption>i-Drop it!</caption>
<img src=”file:///G:/iDrop/blob.gif”/>
</proxy>
<dataset>
<datasrc clipformat=”CF_IDROP.MAX”>
<datafile src=”file:///G:/iDrop/foo.max”/>
</datasrc>
</dataset>
</package>
Drag-and-Drop Manager
Interface: dragAndDrop (p. 362)
A new type of datasrc file in an i-drop XML file can be specified that contains a macroScript with
drag-and-drop handlers that will be run when you drag and drop the i-drop control onto a MAX
viewport. These new kinds of files are called ‘drop scripts’ and have the suffix .ds. Such files
should contain a single macroScript definition with handlers for one or more of the special
dropscript events. If there is more than just a single macroScript in the .ds file, all other text is
ignored.
Here is a sample XML specifying a dropScript file called “foo.ds”:
<?xml version=”1.0”?>
<package xmlns=”x-schema:http://vizdevel/idrop/idrop-schema.xml”>
<proxy defaultsrc=”file:///G:/iDrop/blob.gif”>
<caption>i-Drop Script!</caption>
<img src=”file:///G:/iDrop/blob.gif”/>
</proxy>
64 Chapter 1 | What’s New in 3ds max 4 MAXScript
<dataset>
<datasrc clipformat=”CF_IDROP.MAX”>
<datafile src=”file:///G:/iDrop/foo.ds”/>
</datasrc>
</dataset>
</package>
dropScript Events
The current dropScript events are delivered as a mixture of positional and keyword parameters. The
first parameter is positional and is always the code name for the window on which the drop is
currently occurring. Subsequent parameters are keyword parameters that vary in name and number
depending on the window being currently dragged over or dropped on.
on droppable <window> node: point: do ...
on drop <window> node: point: do ...
Parameters:
<window>
a window identifier
node:
any item (scene node) currently under the mouse pointer
point:
Remarks:
If supplied, the ‘droppable‘ handler is called continuously while the i-drop control is dragged over
the MAX viewport, and should return true or false depending on whether the item is droppable at
that position. If the mouse is not over a scene node, the <item> argument value is undefined. You
implement the ‘droppable’ filter if the dropScript wants to limit droppability in any way.
The ‘drop’ handler is called when the user finally drops the i-drop control over a viewport and is
given the same parameters as ‘droppable’.
For example, currently for viewport windows, the full signatures are:
on droppable window node: point: do ...
on drop window node: point: do ...
but since keyword arguments are optional, you can choose any subset of the keyword arguments you
need, such as:
on drop window node: do ...
or:
on drop window do ...
Remarks:
Passing by keyword like this allows different context windows to supply a variable and large range
of context info without requiring an unwieldy and fixed set of positional args.
Selection Filter 65
Example:
Here is a sample ‘foo.ds’ file.
macroScript foo
(
on droppable window item return
window == #viewport and
item != undefined and
classOf item == sphere
Example Remarks:
The droppable handle only allows dropping when the mouse is over a sphere scene node. When
dropped, that sphere will be scaled up by 1.2 and be assigned the material currently in slot 1 in the
material editor.
Note:
Dropping .max scene file anywhere onto the MAX UI outside viewport will automatically perform
a scene open.
Remarks:
Note the use of the newly-added ‘showInViewport’ property on materials.
From an i-drop, the .mzp file is first downloaded to the <max>\downloads directory, along with any
other files specified in the i-drop XML file, overwriting any files currently there. If the .mzp file is
the first file in the i-drop file set, it is the prime dropped file and the following .mzp processing
continues. The .mzp file is then extracted to a new temp directory, in the system’s main TEMP
directory, and the mzp.run control file is run. If there is no mzp.run file in the package, the first
file in the .mzp package is dropped, causing whatever drop protocol is appropriate for that file type.
If supplied, a typical mzp.run control file will contain extract to, move and copy commands
to control the disposition of the files extracted from the package, say placing any texture files in
$maps & scene files in $scenes, etc.
During this execution of the mzp.run file after initial load, all copies and moves are performed, and
a ‘drop’ command is looked for. The file specified on the drop command is remembered for later
drop processing. Any ‘run’ commands are ignored.
At this point, the drop file is known, either because it was supplied on a ‘drop’ command in the
mzp.run file or because it is the first file in the .mzp package if there was no mzp.run file or drop
command. If the drop file is anything other than .ds dropScript file, the drop protocol
appropriate to that file is engaged. If it is a .ds dropScript, and the drop is from an i-drop, any
‘on droppable’ handler in the dropscript is repeatedly run as the mouse is moved off MAX’s
windows, and the cursor changes to show valid drop targets. If the drag-and-drop is from a file
directory, the arrow+ cursor shows, but the ‘on droppable’ handler is NOT called. This is a
consequence of the limitations of simple file drag-and-drop in Windows. When the mouse-click is
released, the ‘on droppable’ handler is called on the target window and object and if it returns
OK or is not supplied, the ‘on drop’ handler is called. This protocol is identical to dropping .ds
dropScript files directly, as if they were not inside a .mzp package.
Note:
You can specify a file type other than a dropScript on the ‘drop’ command, such as an image or scene
file. This allows the .mzp drag-and-drop to be used for dropping any kind of package, not just scripts.
See Also
Interface: dragAndDrop (p. 362)
Zip-file Script Packages (p. 122)
Interfaces
Topic: version 4 MAXScript New Features/Interfaces
The Function Publishing System, new to 3ds max version 4, is a system that allows plug-ins to
publish their major functions and operations in such a way that code outside the plug-in can
discover and make inquiries about these functions and is thus able to call them though a common
calling mechanism. The whole system is very similar to Window’s COM and OLE Automation
systems and share many similar concepts in the architecture. However, the Function Publishing
System is not based on COM and OLE but instead is a custom architecture more suited and
optimized for MAX. The Function Publishing API serves a number of purposes, which allow 3rd
68 Chapter 1 | What’s New in 3ds max 4 MAXScript
party developers to open up important portions of their plug-ins for use by external sources,
allowing for users to extend and control these directly.
Note:
For complete details on the Function Publishing System, please see the 3ds max sdk help file topic
“Function Publishing System”.
Interfaces
Core Interfaces (p. 70)
Other Interfaces (p. 71)
Functions are published in one or more Interfaces by a plug-in. Action functions must be published
in their own set of interfaces. Each interface is represented by an instance of a class derived from the
base class FPInterface. An external system can find out about the interfaces published by calling
various query methods on ClassDesc that access these interface definition objects. As well as these
enquiry or ‘reflection’ methods, an FPInterface also has the calling methods for actually invoking a
particular function in the interface, so that if something has hold of one of your interfaces, it can
call any of its published functions.
Action Interfaces
Action Manager (p. 9)
A special kind of interface is the Action Interface. These interfaces only contain UI Action Functions
that provide a programmatic way of “pressing” buttons and keys in the UI for a plug-in.
This is true for all the types of FP interfaces that turn up in MAXScript, static, mixin and core. As a
further optimization, MAXScript now effectively promotes all interface methods and properties to
the level of the interface, so if individual methods and properties have unique names within all the
interfaces of an object or class, you can elide the interface name. The above examples could now be
written
Example:
r = $cyl01.getRadius()
$cyl01.setRadius 23
Selection Filter 69
and:
r = $cyl01.radius
$cyl01.radius = 23
If there is a naming conflict, you can always include the interface name level to resolve this.
Associated Method:
getCoreInterfaces()
Returns an array of core interface values.
See Also
Core Interfaces (p. 70)
Other Interfaces (p. 71)
By Reference Parameter Passing (p. 129)
Dereferencing Operator (p. 133)
Visible Class For ‘&’ Reference Values (p. 142)
Action Manager (p. 9)
Class and Object Inspector Functions Enhanced (p. 159)
Class and Object Inspector Functions (p. 799)
70 Chapter 1 | What’s New in 3ds max 4 MAXScript
Core Interfaces
Topic: version 4 MAXScript New Features/Interfaces
Interfaces (p. 67)
actionMan (p. 353)
BoneSys (p. 354)
browserMgr (p. 355)
cmdPanel (p. 356)
colorMan (p. 356)
dragAndDrop (p. 362)
HDIKSys (p. 365)
IKSys (p. 365)
manip (p. 366)
maxOps (p. 368)
medit (p. 371)
menuMan (p. 372)
msZip (p. 378)
netrender (p. 379)
NullInterface (p. 409)
objXRefs (p. 409)
paramWire (p. 410)
pluginManager (p. 414)
quadMenuSettings (p. 414)
rollup (p. 427)
SceneExposureControl (p. 427)
SceneRadiosity (p. 428)
timeSlider (p. 428)
trackviews (p. 429)
See Also
Other Interfaces (p. 71)
Class and Object Inspector Functions (p. 799)
Class and Object Inspector Functions Enhanced (p. 159)
Other Interfaces 71
Other Interfaces
Topic: version 4 MAXScript New Features/Interfaces
Interfaces (p. 67)
bitmapTex (p. 434)
Block Control (p. 435)
BMP (p. 437)
Flex interfaces: (p. 438)
float list (p. 441)
Float Reactor (p. 443)
Float Wire interfaces: (p. 448)
FloatList (p. 450)
FloatReactor (p. 452)
HSDS Modifier (p. 453)
HSDS Object (p. 453)
IKChainControl (p. 453)
imageMotionBlur (p. 454)
JPEG (p. 454)
Link (p. 455)
Link Constraint (p. 455)
LookAt Constraint (p. 455)
Motion Blur (p. 462)
Orientation Constraint (p. 462)
Path (p. 462)
Path Constraint (p. 468)
Plugin Manager (p. 473)
Portable Network Graphics (p. 473)
Point3 list (p. 475)
Point3 Reactor (p. 477)
Point3 Wire (p. 477)
Point3List (p. 479)
Point3Reactor (p. 481)
Point3Spring (p. 482)
Point Cache (p. 484)
Point CacheSpacewarpModifier (p. 485)
72 Chapter 1 | What’s New in 3ds max 4 MAXScript
See Also
Core Interfaces (p. 70)
Class and Object Inspector Functions (p. 799)
Class and Object Inspector Functions Enhanced (p. 159)
Inverse Kinematics
Prototype:
HDIKSys.ikChain <startJoint> <endJoint> <assignEE>
Parameters
<startJoint>
The first node in the new chain, called the ancestor.
<endJoint>
The last node in the chain, called the decendent.
<assignEE>
A boolean parameter: when TRUE, a position end effector is created at the endJoint.
Example:
If 4 boxes existed in the scene and Box02 was a child of Box01, Box03 was a child of Box02, and
Box04 was a child of Box03:
HDIKSys.ikChain $Box01 $Box04 TRUE
would assign HD IK controllers and create an end effector at Box04.
Note:
Both IKControl and IKChainControl can not be instanced.
See Also
IKChainControl interfaces: (p. 453)
Interface: HDIKSys (p. 365)
Interface: IKSys (p. 365)
IKLimb Solver (p. 74)
IKLimb Solver
Topic: version 4 MAXScript New Features/IK
The IK Limb Solver is specifically meant for animating the limbs of human characters; for example,
the hip to the ankle, or the shoulder to the wrist. It affects only two bones in a chain. It is an
analytical solver that is very fast and accurate in viewports.
Note: To use with the IK Limb solver, a bones system must have three bones in the chain. The goal
is placed at the pivot point of the third bone, and the IK solution is calculated for the first and second
bones.
The IK Limb solver works not only with bone hierarchies, but with any linked hierarchy that has
three elements, and is set up to model a human limb. The additional requirements are:
• The first joint is “spherical.” That is, it has 3 degrees of freedom.
• The second joint is “revolute.” That is, it has 1 degree of freedom.
If you attempt to put an IK Limb solver on an inappropriate chain, a warning message informs you
that your IK Limb solver assignment has no effect.
The IK Limb solver uses the same controls as the HI IK solver, so it follows the model of setting
preference angles for joints, and allows for mixing periods of forward and inverse kinematics in the
same animation period. It does not use the HD IK Solver methods of damping, precedence, and
setting joint limits.
The IK Limb solver is provided as part of the Discreet Open Source initiative, so it can be exported
directly to a game engine.
The joint angles are obtained by computing the transformation (rotation) between the initial
chain plane and the target chain plane. The initial chain plane is defined by three unit vectors:
1. shoulder-to-elbow unit vector (at the initial pose)
2. projection of end-effector-axis on a plane perpendicular to the shoulder-to-elbow unit vector
(at the initial pose)
3. cross product of the above two.
Similarly, the target plane is defined by three analogous vectors at the target pose.
IKLimb Solver 75
See Also
Interface: IKSys (p. 365)
Interface: HDIKSys (p. 365)
HD IK controller chains can be assigned to existing hierarchies (p. 73)
IKChainControl interfaces: (p. 453)
Materials
Multi/Sub Material
Topic: version 4 MAXScript New Features/Material/Multi/Sub Material
Each entry in the Multi/Sub matl interface now has an associated ID. The previous version had the
ID being the same as the number of the sub-material in the list.
This can be seen here: MultiMaterial : Material (p. 1210)
Menu Manager
Topic: version 4 MAXScript New Features/Menu Manager
MAXScript has full access to the menu manager and menu creation system.
Note:
Be very careful when using or testing this API. It makes permanent changes to the menu database,
and it is very easy to mess things up quite badly. For example, if you “unRegister” the main menu
bar, 3ds max won’t start.
Anyone using this API should make a copy of the “..\UI\MaxMenus.mnu” file before running any
of the scripts. If anything messes up, just copy the backup version back on to MaxMenu.mnu.
There are 4 exposed interfaces to MAXScript: the menu manager, menu objects, quad menu objects
and menu items.
• The menu manager is a database of menus and quad menus.
• The main menubar and all sub-menus are menu objects.
• A quad menu object holds 4 menu objects, one for each quad.
• A menu object is a container for menu items.
• A menu item can be a separator, an action that invokes a macroScript or a sub-menu that pops
up a cascading menu.
Menu Manager
menuMan.loadMenuFile “file.mnu”
This loads a new menu file with the given name. It looks in the current “UI” directory for
the file. It return true if successful, and false if not.
menuMan.saveMenuFile “file.mnu”
This saves a new menu file with the given name. It saves it in the current “UI” directory.
76 Chapter 1 | What’s New in 3ds max 4 MAXScript
menuMan.getMenuFile()
Returns the full path to the current menu file.
menuMan.updateMenuBar()
This updates the main menu bar with any changes that have been made. This MUST be
called after changing anything on the main menu bar.
menuMan.registerMenuContext contextId
This call is used to register menu extensions. The “contextId” is a random 32-bit integer. It
can be generated using the “genclassid()” (p. 141). This function registers an extension with
the menu manager that is remembered permanently. It returns true the first time the
extension is registered, and false every time thereafter. This is saved in the MaxMenu.mnu
file, so it is sticky from session to session. This is used so that scripts can add items and
sub-menus MAX’s main menu bar and quad menus. See the sample scripts below for the
proper usage.
menuMan.findMenu “menuName”
This function returns the menu with the given name. It returns “undefined” if no menu
exists in the menu manager with the given name. This requires the full name of the menu,
including and “&” characters that might be in the name.
Example:
helpMenu = menuMan.findMenu “&Help”
Retrieve 3ds max’s help menu.
menuMan.findQuadMenu “qhadMenuName”
This works like “findMenu” but it gets quad menus instead of menus.
menuMan.unRegisterMenu menu
This removes a menu from the menu manager. Use extreme caution with this method! If
you unregister a menu that is used as a sub-menu, or in a quad menu, or the main menu
bar, bad things will result.
menuMan.unRegisterQuadMenu quadMenu
This is like “unregisterMenu” but for quad menus.
menuMan.createMenu “name”
This creates a new, empty menu with the given name.
menuMan.createQuadMenu “name” “quad1Name” “quad2Name” “quad3Name” “quad4Name”
This creates a new, empty quad menu. It contains, 4 empty menus, one for each quad.
menuMan.createSubMenuItem “name” subMenu
This creates a new sub-menu item that can be added to a menu. It uses the given “name”
and it displays the given sub-menu.
menuMan.createSeparatorItem()
This creates a new menu separator that can be added to a menu.
menuMan.createActionItem “macroScriptName” “macroScriptCategory”
This creates a new menu item that can be added to a menu. The item is an action that
executes the macro script with the given name and category. This returns “undefined” if
there is no macroScript with the given name and category.
IKLimb Solver 77
Example:
menuMan.setViewportRightClickMenu #nonePressed “Modeling 2”
That sets the default (no keys pressed) quad menu to “Modeling 2”. The menu name must be a
quad menu that is listed in the “Quads” customization dialog, and the name must match
exactly, including capitalization.
menuMan.SetViewportRightClickMenu returns FALSE if you try to set the viewport right-click
menu to a menu that is not allowed.
menuMan.getViewportRightClickMenu which
Retrieves the quad menu used for right-clicking in the viewport. The “which” parameter
can be one of the following:
#nonePressed
#shiftPressed
#altPressed
#controlPressed
#shiftAndAltPressed
#shiftAndControlPressed
#controlAndAltPressed
#shiftAndAltAndControlPressed
menuMan.getMainMenuBar()
Returns the menu being used as MAX’s main menu bar.
menuMan.setMainMenuBar menu
Sets the menu being used as MAX’s main menu bar. You must call
“menuMan.updateMenuBar()” in order to see the result.
menuMan.getShowAllQuads quadMenu
Gets the “show all quads” setting for the given quad menu.
menuMan.setShowAllQuads quadMenu value
This sets the “show all quads” flag for the given quad menu. “Value” can be true or false.
menuMan.getQuadMenuName quadMenu
This returns the name of the given quad menu.
menuMan.setQuadMenuName quadMenu “name”
This sets the name of the give quad menu.
78 Chapter 1 | What’s New in 3ds max 4 MAXScript
menuMan.numMenus()
Returns the total number of menus in registered with the menu manager.
menuMan.getMenu index
Retrieves the “index” th menu in the menu manager. This is a 1-based index.
menuMan.numQuadMenus()
Returns the total number of quad menus registered with the menu manager.
menuMan.getQuadMenu index
Retrieves the “index” th quad menu in the menu manager. This is a 1-based index.
Menu Objects
Menus are containers for menu items, and have the following functions:
menu.setTitle “title”
Sets the title of the menu to the give string.
menu.getTitle()
Returns the current title of the menu.
menu.numItems()
Returns the number of items the menu holds.
menu.getItem index
Retrieves the menu item at the given index. The index is 0-based.
menu.addItem menuItem position
This inserts an item in the menu at the given position, which is 0-based. If the position is
-1, then the item is appended to the end of the menu.
menu.removeItemByPosition position
This removes the item at the given position.
menu.removeItem menuItem
This removes the given item from the menu, if it is in the menu.
IKLimb Solver 79
Example:
-- This example adds a new entry to MAX’s main “Help” menu.
-- Register a menu context. This returns true the first time it
-- is registered, and we can add things to the menu. If
-- it returns false, then the context is already registered,
-- and the items are already in the menu.
-- The number 0x246c6dbe is random, and can be generated
-- using the genClassID() function (p. 141).
80 Chapter 1 | What’s New in 3ds max 4 MAXScript
Example:
-- This example adds a new command to MAX’s default right-click quad menu
if menuMan.registerMenuContext 0x36690115 then
(
-- Get the default viewport right-click quad menu
local quadMenu = menuMan.getViewportRightClickMenu #nonePressed
-- Get the lower-left menu from the quad
local menu = quadMenu.getMenu 3
-- create a menu item that calls the sample macroScript
local testItem = menuMan.createActionItem “MyTest” “Menu Test”
-- Add the item to the menu
menu.addItem testItem -1
)
Example:
Here are two macroScripts that set and reset two of the right-click menus:
macroScript SetQuads
category:”Custom UI”
tooltip:”Set Quad”
(
on execute do
(
quadmenu = menuMan.findQuadMenu “Modeling 2”
if quadmenu != undefined do menuMan.setViewportRightClickMenu
#nonePressed quadmenu
quadmenu = menuMan.findQuadMenu “Sample 4x1”
menuMan.setViewportRightClickMenu #controlPressed quadmenu
)
)
macroScript ResetQuads
category:”Custom UI”
tooltip:”Reset Quads”
(
on execute do
(
quadmenu = menuMan.findQuadMenu “Default Viewport Quad”
if quadmenu != undefined do menuMan.setViewportRightClickMenu
#nonePressed quadmenu
quadmenu = menuMan.findQuadMenu “Modeling 1 [Cntrl+RMB]”
if quadmenu != undefined do menuMan.setViewportRightClickMenu
#controlPressed quadmenu
)
)
82 Chapter 1 | What’s New in 3ds max 4 MAXScript
The menu name must be a quad menu that is listed in the “Quads” customization dialog,
and the name must match exactly, including capitalization.
See Also
Quad Menu (p. 90)
Menu and CUI Loading (p. 178)
maxOps (p. 87)
Interface: quadMenuSettings (p. 414)
Interface: menuMan (p. 372)
Interface: maxOps (p. 368)
Mesher
Topic: version 4 MAXScript New Features/Mesher
The Mesher compound object converts procedural objects to mesh objects on a per-frame basis so
that you can apply modifiers such as Bend or UVW Map. It can be used with any type of object, but
is designed primarily to work with particle systems. Mesher is also useful for low-overhead
instancing of objects with complex modifier stacks.
See Also
Mesher - superclass: GeometryClass (p. 298)
particleMesher - superclass: GeometryClass (p. 306)
Note:
For additional details regarding network rendering, please see the topic “Network Rendering” in
the 3ds max online reference.
See Also
3D Studio MAX System Globals (p. 630)
IKLimb Solver 83
Node Handles
Topic: version 4 MAXScript New Features/Node Handles
A property has been added to a node’s interface called .handle. This can be used to get the unique
node handle ID from the node.
Usage:
id = $Box01.handle-- returns the unique id associated with the node
A method in the maxOps interface (p. 368) will return a node associated with a given handle.
Usage:
node = maxOps.getNodeByHandle <number>-- returns the node associated with the id passed in.
Note:
It is safer to say $box01.inode.handle than $box01.handle. This is to prevent cases where the
baseobject has property called handle, like a teapot, and you get that object’s handle instead of the
node handle.
See Also
maxOps (p. 87)
Node vertexColorType
Topic: version 4 MAXScript New Features/Node vertexColorType
In the node interface, the vertexColorType property has been changed to take a symbolic enum. This
is the assigned vertex color displayed in viewports.
.vertexColorType : enum : Read|Write
vertexColorType enums: {#color|#illum|#alpha|#color_plus_illum}
Example:
$Sphere01.vertexColorType = #illum
See Also
Node : MAXWrapper (p. 820)
Node Common Properties, Operators, and Methods (p. 820)
Node Handles (p. 83)
Class and Object Inspector Functions Enhanced (p. 159)
Access to the node bone properties and methods (p. 23)
84 Chapter 1 | What’s New in 3ds max 4 MAXScript
OLE Automation
See Also
Setting Up MAXScript OLE Automation (p. 1673)
OLE Automation (p. 1671)
Running the OLE Demo (p. 1674)
Exposing MAXScript Functions (p. 1673)
3ds max Specific Errors (p. 1674)
MAXScript.reg - Registery file 85
Parameter Wiring
Topic: version 4 MAXScript New Features/Parameter Wiring
The Parameter Wire manager is described in the core interface ‘paramWire’.
In the general case, a wire controller can be wired to any number of other wire controllers in
two-way relationships. Each wire has a set of information that defines it, accessible using the
indexed accessor functions.
Example:
The following will demonstrate a way to query a wire controller and determine what parameters
it is referencing.
local wc = $foo.pos.controller -- get pos controller
if classOf wc == WirePosition then
(
-- list out its connections
for i in 1 to wc.numWires do
(
local parent = wc.getWireParent i,
parent_owner = (refs.dependents parent)[1], -- hack!
param_name = getSubAnimName parent wc.getWireSubnum
format “wire %: % in %\n” i param_name parent_owner
)
)
Additionally, you can use the subAnim indexing operator as a way to scan down through an
object for wire controllers:
for i in 1 to $foo.numSubs do
if classOf $foo[i].controller == ...
Also, you might also find the exprForMAXObject() (p. 809) method useful here to get a scripter
expression for the parent or parent owner.
See Also
Interface: paramWire (p. 410)
Float Wire interfaces: (p. 448)
Position Wire interfaces: (p. 492)
Rotation Wire interfaces: (p. 508)
Scale Wire interfaces: (p. 515)
86 Chapter 1 | What’s New in 3ds max 4 MAXScript
Plug-In Manager
Topic: version 4 MAXScript New Features/Plug In Manager
The Plug-in Manager lets you manage plug-ins dynamically without any initialization required. The
Plug-in Manager provides a list of all plug-ins found in the 3ds max plug-in directories, including
the plug-in description, type (object, helper, modifier, and so on), status (loaded or deferred), size,
and path. The Plug-in Manager provides options to load or tag as deferred, any particular plug-in,
regardless where they reside on disk.
When you start the Plug-in Manager, it scans through all the plug-in paths specified in the plug-in.ini
file and lists them in the Plug-in Manager dialog.
Actually there are two different FP interfaces in the plug-in manager, one is a action interface
accessed through Plug-in_manager and the other one is a static interface called plug-inManager.
You can access the static interface like
plug-inManager.show = true
or:
plug-inManager.loadClass Flex
Currently there is no way to integrate these into one so.
Properties:
plug-inManager.visible = true --show
plug-inManager.visible = false –hide
Remarks:
Show and hide the plug-in manager.
maxOps 87
Prototype:
plug-inManager.loadClass <class>
Remarks:
Will ensure that the given class is loaded, in the event that it is a deferred loading class, and so any
MAXScript methods or Function Published interfaces it publishes will be available.
Example:
plug-inManager.loadClass Flex
After this code is executed, all the Flex modifier MAXScript methods are installed and callable.
Note this is only needed in situations where a plug-in loading may be deferred and it does not
have any instances already in the current scene.
See Also
Interface: plug-inManager (p. 414)
Plug-in Manager interfaces: (p. 473)
maxOps
Topic: version 4 MAXScript Language Improvements/maxops
There are many new MAXScript functions exposed in maxops (p. 368):
maxOps.setActiveViewportTransparencyDisplay takes a single integer argument.
0 turns off transparency in the active viewport
1 sets it to screendoor
2 sets it to blended transparency.
maxOps.productVersion
the enum values returned are as follows:
#productVersionDevel- debug build, or licensed in-house
#productVersionTrial - trial license
#productVersionOrdinary - commercial license
#productVersionNFR - not for resale
#productVersionEdu - educational or student license
88 Chapter 1 | What’s New in 3ds max 4 MAXScript
maxOps.licenseBehavior
the enum values returned are as follows:
#licenseBehaviorPermanent - permanent license, or hardware lock
#licenseBehaviorExtendable - term license, can be extended
#licenseBehaviorNonextendable - term license, cannot be extended
maxOps.licenseDaysLeft
Its return value is an integer indicating the number of full days left in the term of the license. A
value of 0 means that today is the last day of validity. For permanent licenses, a fixed value is
returned indicating greater than 10 years are left.
Note:
It should be noted that the all copies of 3ds max return a hardwarelockid (p. 630) of “-1” while under
the grace period and until they have been authorized. You can check for that number and initiate
your own demo mode.
maxOps.getNodeByHandleNode_Handles
Returns the node associated with the id passed in.
maxOps.setSelectionType <auto> <method>
<auto>
True or False
<method>
Valid values or method are #window, #crossing, #leftToRight, #rightToLeft.
#window or #crossing is to be used if the first argument (auto) is false. #leftToRight or
#rightToLeft is to be used when auto is true.
maxOps.trackBar
maxOps.getTrackBarItrackBar()
maxOps.trackBar.visible
maxOps.trackBar.filter
maxOps.trackBar.showFrames
maxOps.trackBar.showAudio
maxOps.trackBar.showSelectionRange
maxOps.trackBar.showSnapToFrames
maxOps.trackBar.keyTransparency
maxOps.trackBar.selKeyTransparency
maxOps.trackBar.cursorTransparency
maxOps.trackBar.redraw()
maxOps.trackBar.getNextKeyTime()
maxOps.trackBar.getPreviousKeyTime()
maxOps.cloneNodes
Prototype:
<boolean>CloneNodes <&node array>nodes <&point3>offset expandHierarchy:<boolean>
cloneType:<enum> actualNodeList:<node array> newNodes:<node array>
maxOps 89
Arguments:
nodes is In parameter
This is the list of nodes that you want to clone.
offset is In parameter
The positional offset that will be applied to the cloned nodes.
Keyword arguments:
expandHierarchy default value: false
Indicates if children will be cloned in hierarchies. Default is false.
cloneType enums: {#copy|#instance|#reference}
default value: #copy
actualNodeList default value: #()
This node array will be filled in with the original nodes to be cloned. The reason for
this is that there can be dependencies between nodes that causes other nodes to be
added to the list. For example light/camera targets, nodes part of systems, part of
groups or expanded hierarchies etc.
newNodes default value: #()
This node array will be filled in with the new cloned nodes. There is a one to one
relationship between the nodes in the resultSource and the resultTraget.
Return Value:
If successful true, otherwise false.
maxOps.CollapseNode node noWarnings
maxOps.CollapseNodeTo node modIndex noWarnings
See Also
Interface: maxOps (p. 368)
ItrackBar (p. 113)
Node Handles (p. 83)
3D Studio MAX System Globals (p. 630)
90 Chapter 1 | What’s New in 3ds max 4 MAXScript
Quad Menu
Topic: version 4 MAXScript New Features/Quad Menu
When you click the right mouse button anywhere in an active viewport, except on the viewport
label, the program displays a Quad menu at the mouse cursor. The quad menu can display up to four
quadrant areas with various commands.
In the MAXScript listener window, type apropos “quadmenusettings” to see the list of functions
available.
The Quad menu is set in the startup scripts directory called QuadOptions_Startup.ms.
The two right quadrants of the default quad menu display generic commands, which are shared
between all objects. The two left quadrants contain context-specific commands, such as mesh tools
and light commands. Each of these menus provides convenient access to functions found in the
command panel.
The quad menu contents depend on what is selected, as well as any customization options you may
have selected in the Quads panel of the Customize UI dialog. The menus are set up to display only
the commands that are available for the current selection, therefore selecting different types of
objects displays different commands in the quadrants. Consequently, if no object is selected, all of
the object-specific commands will be hidden. If all of the commands for one quadrant are hidden,
the quadrant will not be displayed.
Note:
PickObject() does not pick objects when launched from a Quad Menu. It will hang and refuses to
pick any object. Hit ‘escape’ for emergency exit. PickObject works correctly from a shortcut and
toolbar.
See also
Interface: quadMenuSettings (p. 414)
ApplyOperation function (p. 54)
Menu Manager (p. 75)
Interface: menuMan (p. 372)
Menu and CUI Loading (p. 178)
Reactor controller 91
Reactors
Reactor controller
Topic: version 4 MAXScript New Features/Reactors
The Reactor controller is a procedural controller that reacts to changes in any other controller within
the software. Reactor comes in five different forms: Position Reactor, Rotation Reactor, Point3
Reactor, Scale Reactor, and Float Reactor. Any animatable parameter in the software can react to
changes in any other animatable parameter. Reactor is not based on time, but is based on other
variables in your scene.
Example:
-- Setup a scene
ball = sphere name:”ball” pos:[-40,0,50] radius:10
ball.pos.controller = position_XYZ()
-- create some keys
key = addNewKey ball.pos.Zposition.controller 0
key.outTangentType = #slow
key.value = 50
key = addNewKey ball.pos.Xposition.controller 0
key.value = -40
key = addNewKey ball.pos.Zposition.controller 25
key.InTangentType = #fast
key.outTangentType = #fast
key.value = 4
key = addNewKey ball.pos.Xposition.controller 25
key.value = -10
key = addNewKey ball.pos.Zposition.controller 50
key.InTangentType = #slow
key.value = 50
key = addNewKey ball.pos.Xposition.controller 50
key.value = 20
ball.showtrajectory = true
-- assign a reactor controller to the scale of the ball
reactor = Scale_Reactor()
ball.scale.controller = reactor
-- Pick the react to object, and create reactions
reactor.reactions.reactTo ball.pos.ZPosition.controller 0
reactor.reactions.setName 0 “UnSquashed”
reactor.reactions.setVectorState 0 [1,1,1]
reactor.reactions.create “squashed” 25
reactor.reactions.setVectorState 1 [2.5,2.5,.4]
reactor.reactions.setValueAsFloat 0 10
reactor.reactions.setInfluence 0 6
reactor.reactions.setInfluence 1 5.5
reactor.reactions.setStrength 1 1.5
reactor.reactions.setFalloff 0 1.75
ss = StringStream ““
reactor.reactions.getType()
92 Chapter 1 | What’s New in 3ds max 4 MAXScript
ct = reactor.reactions.getCount()
format “Reactor Statistics: \n------------------------------\n \n” to:ss
format “Count : %\n” ct to:ss
format “\n” to:ss
for i = 0 to ct-1 do
(
format “Reaction #: % \n------------------------------------------------
Name : %
State: %
Value: %
Strength: %
Influence : %
Falloff: % \n\n” (i) (reactor.reactions.getName i)
(getReactionState reactor (i+1)) (getReactionValue reactor (i+1))
(reactor.reactions.getStrength i) (reactor.reactions.getInfluence i )
(reactor.reactions.getFalloff i ) to:ss
)
print ss
See Also
Reactor Controllers (p. 1326)
Float Reactor interfaces: (p. 443)
Point3 Reactor interfaces: (p. 477)
Scale Reactor interfaces: (p. 515)
Position Reactor interfaces: (p. 492)
See Also
Interface: maxOps (p. 368)
Combustion (p. 38)
type:#integer parameters in scripted plug-in parameter blocks 93
Scripted Plug-Ins
See Also
Scripted Plug-ins (p. 1538)
Scripted Plug-in Events (p. 93)
Scripted Cameras (p. 94)
See Also
Scripted Plug-ins (p. 1538)
type:#integer parameters in scripted plug-in parameter blocks (p. 93)
Scripted Cameras (p. 94)
Scripted Cameras
Topic: version 4 MAXScript New Features/Scripted Plug-In/Scripted Cameras
Scripted camera plug-ins can now be written in MAXScript. At present, you can write either
extending camera plug-ins that extend existing MAX cameras or temporary camera plug-ins that can
be used to host create tools for a custom camera system.
The plug-in superclass for cameras is ‘camera’.
An event handler is available to scripted cameras that gives access to the
CameraObject::renderApertureChanged callbacks made by the rendering dialog to a camera
when the user adjusts parameters that affect render aperture. The new handler is optional.
on renderApertureChanged val do ....
The ‘val’ parameter contains the new render aperture value. This typically gets called
when you select a new apeture in the Output Size dropdown in the render dialog or adjust
a spinner when in Custom mode.
There are several cases where this handler is called:
• In the Render Scene dialog, if Image Aspect is unlocked and you change Width, Height, or
Pixel Aspect
• In the Render Scene dialog, if you click on one of the output size preset buttons
• In the Render Scene dialog, if Image Aspect is locked and you change Width, Height, or Pixel
Aspect, or if you change Aperture Width, and then click on either Render or Close
The value being passed into handler is the aperture width. You can get the remaining values via:
renderWidth, renderHeight, and RenderPixelAspect global variables. However, what you get for
these values are typically the old value, with the exception of the Aperture Width value. The call to
the handler is coming from a “InvalidateCameras” method, which is called right before setting the
new values. Doesn’t look like any broadcasts are made after the new values are set, and if safe frames
isn’t turned on in any viewport, none of the viewports are redrawn.
We recommend that if a scripted camera uses this handler, it should cache the old Aperture Width
value and test the incoming value against the cached value before proceeding.
dependsOn For Scripted Controllers 95
Example:
plug-in Camera CamTest
name:”CamTest”
classID:#(0x47db14ff, 0x4e9b5f90)
category:”Standard”
( on renderApertureChanged val do format “renderApertureChanged: %\n” val
tool create
( on mousePoint click do #stop
)
)
See Also
Scripted Plug-ins (p. 1538)
Scripted Plug-in Events (p. 93)
type:#integer parameters in scripted plug-in parameter blocks (p. 93)
Scripted Cameras (p. 94)
Scripted Controllers
will always keep $foo centered between $foo1 and $foo2. The objects given to the dependsOn()
function can be any MAX object, controllers, base object, nodes, materials, etc. They must be
individual, explicit objects, not wild-card path names or arrays of objects. The object can be the
exact controller you want to depend on or any containing object. The strict dependency for the
above script would be,
Example:
dependsOn $foo2.pos.controller $foo3.pos.controller
The simpler $foo2 $foo3 will catch *any* kind of changes to those nodes or components in them
like base objects, modifiers, or materials and update the script-controlled object. The dependency is
96 Chapter 1 | What’s New in 3ds max 4 MAXScript
established the first time the controller is evaluated after any script change or recompile. This can
be when editing in a controller property box, or after a scene load.
You can programmatically force a recompile and reset of the dependents by setting the control script
to itself:
$foo.pos.controller.script = $foo.pos.controller.script
See Also
script controllers (p. 162)
See Also
transform_script - superclass: Matrix3Controller (p. 339)
Script Controllers (p. 1329)
Scripted Manipulators
Topic: version 4 MAXScript New Features/Scripted Plug-In/Scripted Manipulators
Manipulators are a new type of helper object. They are designed to support direct manipulation of
parameters in the3D viewports. They can be set up to manipulate parameters on objects, modifiers,
controllers and nodes.
There is a “Manipulate” button on the main toolbar. When pressed, the system will show all the
manipulators for selected objects. As the mouse passes over a manipulator, it turns red, and a tool
tip pops up with the name of the current value of the parameter that is affected by that manipulator.
To manipulate the value, you click down on the gizmo with the left mouse button and drag it. Most
manipulators are designed so that the gizmo will track under the current mouse position, if possible.
Note that “Manipulate” is not a separate mode. It modifies whatever mode you are currently in
(select, move, create, etc.) to show manipulators and allow manipulation. If you are in move mode,
for example, you can still move things around as usual. The only difference is that if you click down
on a manipulator, you will manipulate, instead of move.
There are two flavors of manipulators. The first are manipulators that are automatically created
when you enter “Manipulate” mode. The hotspot manipulator is like that. The second kind is
stand-alone objects, like the slider manipulator. These are usually used in conjunction with
parameter wiring to get make them useful.
To create a stand-alone manipulator, you go to the “Helpers” section of the create panel, and select
“Manipulators” in the drop-down list.
Stand-alone manipulators do not need to be selected in order to be manipulated. However, the
automatically created manipulators, like the hotspot manipulator, are only displayed for selected
objects.
Manipulators support both 3d gizmos and 2d (screen space) gizmos. The hotspot manipulator is an
example of a 3d gizmo, and the slider is an example of a 2d gizmo.
Manipulators can be created either as standard MAX plug-ins in C++, or they can be implemented
in MAXScript. In MAXScript, they are a type of Scripted Plug-in object (p. 1538), so if you want to write
your own manipulator, it would be a good idea to read about Scripted Plug-ins (p. 1538) first. They are
very similar to scripted geometry objects.
Three scripted manipulators that you can use as sample code can be found in the
“..\stdplugs\stdscripts” folder.
• RadiusManip.ms: Generic “radius” manipulator
• SliderManip.ms: A 2d viewport slider. A stand-alone manipulator
• UVWManip.ms: A set of manipulators for the UVW modifier
98 Chapter 1 | What’s New in 3ds max 4 MAXScript
Radius Manipulator
The radius manipulator is fairly simple, so it makes a good example to describe the scripted
manipulator system.
The code for the manipulator is included below, followed by a detailed description of how it works.
--------------------------------------------------------------------
-- Generic radius manipulator
-- Written by Scott Morrison
-- This manipulator sets the radius on any object or modifier with
-- a parameter named “radius”. It creates a circle gizmo of the appropriate
-- radius centered at the origin in the XY plane.
plug-in simpleManipulator radiusManip
name:”RadiusManip”
invisible:true
(
-- Create the green and red colors for the gizmo
local g = [0, 1, 0], r = [1, 0, 0]
-- This manipulator manipulates any node with a “radius” property
on canManipulate target return (findItem (getPropNames target) #radius) != 0
-- Create the manipulator gizmo.
-- This is called initially and whenever the manipulator target changes
on updateGizmos do
(
-- Clear the current gizmo cache
this.clearGizmos()
-- Set the radius of circle gizmo a little bigger than the target radius
giz = manip.makeCircle [0,0,0] (target.radius * 1.01) 28
-- Add the circle to the manipulator
this.addGizmoShape giz 0 g r
-- return the ToolTip string
return node.name + “ radius = “ + target.radius as string
)
-- mouseMove is called on every mouse move when dragging the manip
-- It needs to convert the mouse position ‘m’ into a new value for the
radius
on mouseMove m which do
(
-- Create the XY plane.
-- manip.makePlaneFromNormal takes a normal vector and a point
-- and creates a plane passing through the point with the given normal
local pl = manip.makePlaneFromNormal z_axis [0, 0, 0],
projectedPoint = [0,0,0]
-- Compute the hit-ray in local coordinates
viewRay = this.getLocalViewRay m
-- Intersect the plane with the view ray
res = pl.intersect viewRay &projectedPoint
Matrix3 Scripted Controller 99
The header:
plug-in simpleManipulator radiusManip
name:”RadiusManip”
invisible:true
Indicates to MAXScript that this is a scripted manipulator plug-in called “RadiusManip”. The
“invisible:true” tells the system not to make a creation button for the manipulator in the
create panel.
The body:
A set of handlers for various events.
on canManipulate target return (findItem (getPropNames target) #radius) != 0
“canManipulate” is called on every manipulator, for every node that is selected when the
“Manipulate” button is pressed. The “target” parameter is the object that we might potentially
manipulate. It is called on the base object, all the modifiers on the object, and transform controllers
on the object’s node. Also, if the transform controller is a PRS controller, it calls “canManipulate”
on the position, rotation and scale controllers.
In the case of the radius manipulator, it can manipulate any object that has a property named
“radius”.
If you want to create a manipulator that works on a specific object type, say a sphere, you can say:
on canManipulate target return classOf target == sphere
There is an alternative handler that may be needed in some cases called “canManipulateNode n”.
This is called passing in the each selected node to the handler. This is not normally needed, but
available if your manipulator wants to manipulate property of a node other than the ones that are
passed as the “target” to “canManipulate”.
Note:
A Scripted Plug-in should only implement one of these handlers, not both.
The next handler is called “updateGizmos,” and this is called whenever a manipulator need to build
its gizmos. This happens when the manipulator is created, and whenever the target that it is
manipulating changes.
When MAXScript creates a manipulator, it sets up some variables that are available inside the calls
to its handlers. One of these is called “target” and it is the object, modifier or controller that is
being manipulated. Another is called “this” and it is the manipulator itself. It also sets up some
constant values that can be used as flags on gizmos. These will be described later. There is also a
“node” value available which is the node that owns the target.
100 Chapter 1 | What’s New in 3ds max 4 MAXScript
The first thing every manipulator must to in the “updateGizmos” handler is call
“this.clearGizmos()”. This clears any currently cached gizmos.
Next it creates a set of gizmos that will be displayed in the viewport. In the case of the radius
manipulator, it creates a single circle that represents the radius being manipulated.
giz = manip.makeCircle [0,0,0] (target.radius * 1.01) 28
“manip” is a exported set of utility interface functions that manipulators can use. See the
“Reference” section below for full details. In this case we are creating a circle, centered at the
origin, with radius 1.01 times the radius we are manipulating, and 28 segments. The “1.01” factor
was added so that the gizmo will stick out a little bit from the object it is manipulating. If we used
the radius directly, then it might not be visible in the viewport, because it co-exists with the object
it is manipulating.
Note that 3d gizmos are defined in the local coordinate system of the node that owns the
manipulator target. The system will automatically compensate if the node is moved, rotated or
scaled when displaying or hit-testing the manipulator.
Next, we add the gizmo to the manipulator:
this.addGizmoShape giz 0 g r
This tells the manipulator to add the shape gizmo to the manipulator, with no special flags values
ie. the “0”. All of the the flags will be decribed below. Additionally, the command indicates to use
green (“g”) as the unselected color and red (“r”) as the selected color. The selected color is used when
the mouse passes over it, and the unselected color is used when the mouse isn’t over it.
Finally, this method returns a string value that will be used as the tool tip when the mouse passes
over the gizmo.
In general, gizmos can be made from meshes, shapes (wire frame), text and markers. The details are
covered in the reference section below.
The next handler is called “mouseMove m which”. This is called on every mouse movement when
the target is being manipulated. The “m” parameter holds the screen coordinates of the mouse
location, and the “which” parameter is an index that indicates which gizmo is being dragged. The
gizmos are numbered in the order of their creation in “updateGizmos,” starting at 0.
The mouseMove handler is usually the trickiest part of the manipulator to implement. It needs to
update the value of the parameter being manipulated in such a way that the manipulator gizmo
tracks under themouse, if possible.
For manipulators that exist in 3d space, this is normally done by computing a “hit-ray,” which is
a ray in 3d space that passes through the mouse position, and travels in the direction of the view.
This is computed as follows:
viewRay = this.getLocalViewRay m
This view ray is then intersected with some plane, and the new parameter value is computed using
the intersection point.
Matrix3 Scripted Controller 101
In the case of the radius manipulator, the plane we use is the XY plane, because the radius circle lies
on the XY plane, in local coordinate space.
This plane is computed as follows:
local pl = manip.makePlaneFromNormal z_axis [0, 0, 0],
This create “pl” which is a plane whose normal is the Z axis, and which passes through the origin
([0,0,0]).
To intersect this with the view ray, we use the “intersect” operation on planes:
projectedPoint = [0,0,0]
We set up “projectedPoint” first at the holder of the result of the intersection. The return value
“res” is a boolean value that tells us if the intersection worked or not. If it returns true, the
intersection worked, if it returns false, it failed. It can fail if the plane is parallel to the view ray.
Once we have the intersection point, in “projectedPoint,” then we use that to determine a new
value for the radius. In this case we use the distance from the origin (“length projectedPoint”)
as the new radius. We scale it by dividing by 1.01 to compensate for the fact that we made the gizmo
1.01 time bigger than the actual radius being manipulated.
That’s it! Generally, you will need to use some trigonometry and linear algebra in your
“mouseMove” handler. The idea behind direct manipulation is that the gizmo should track directly
under the mouse.
For a more complicated example of a 3d manipulator, check the code in UVWManip.ms.
Stand-alone Manipulators
Stand-alone manipulators, like the 2d slider, require a bit more work.
The code in SliderManip.ms will be used for this discussion.
The header has a bit more information:
plug-in simpleManipulator sliderManipulator
name:”Slider”
classID:#(0x47db14ef, 0x4e9b5990)
category:”Manipulators”
Since stand-alone manipulators can be saved in the MAX file, it needs a class ID (p. 141). See the
MAXScript reference for more information about that. It also does not include the
“invisible:true” line, which means that the system will create a button for it in the “Create”
panel. It will be placed in the “Manipulators” section of the helper create panel.
We also need to define a parameter block and rollout UI for the object. This is done in the same way
as other scripted plug-ins.
Stand-alone manipulators manipulate themselves, so the “canManipulate” handler looks like this:
on canManipulate target return (classOf target) == sliderManipulator
102 Chapter 1 | What’s New in 3ds max 4 MAXScript
We also need to provide a creation tool that handles mouse interaction when creating the
manipulator. This is handle exactly like other scripted plug-ins.
A stand-alone manipulator also needs some special code in its “updateGizmos” handler. For the
slider this looks like:
-- If this is not a stand-alone manip, get values from the manip target
if (target != undefined) then
(
this.value = target.value
this.minVal = target.minVal
this.maxVal = target.maxVal
this.xPos = target.xPos
this.yPos = target.yPos
this.width = target.width
this.hide = target.hide
this.sldName = target.sldName
this.snapToggle = target.snapToggle
this.snapVal = target.snapVal
unselColor = greenColor
)
else
(
unselColor = yellowColor
)
The test of “target != undefined” is to see if this if this is a manipulator, or stand-alone object.
When the object is stand-alone, the value of “target” is undefined, and it uses the value of the
parameters from its own parameter block. It target is defined, then this means it is manipulating. In
that case, we want to copy the values of the parameters from the target that we are manipulating.
Reference
Scripted manipulators can have the following handlers:
on canManipulate target
This returns a value that says whether this manipulator manipulate the given target.
on canManipulateNode n
This returns a value that says whether this manipulator manipulate the given node.
Note:
A manipulator should only implement one of these handlers.
on updateGizmos
This is called whenever the manipulator needs to build its gizmos. It returns a string value
that is used for the tool tip. If it returns an empty string, no tool tip is displayed.
on mouseMove m which
This is called when the user has grabbed a gizmo and is dragging it.
Matrix3 Scripted Controller 103
The “m” parameter hold the current screen coordinates of the mouse, and the “which”
parameter indicates the 0-based index of the gizmo that is being dragged. This is what
handles that actual manipulation.
Note:
Normally this will set a value of a parameter of the manipulation target based on the mouse location.
on mouseDown m which
Called when the user first clicks the mouse down on the gizmo.
on mouseUp m which
Called when the user releases the mouse after manipulation is done.
Helper Functions
There are some built-in functions that manipulators support, and a couple of helper packages with
utility functions.
The simpleManipulator type itself has these functions available:
this.clearGizmos()
This must be called at the beginning of the “updateGizmos” handler in order to clear the
current gizmo cache.
this.addGizmoMesh mesh flags unselColor selColor
This creates a gizmo from a mesh (or geometry in MAX lingo). The mesh can be any
arbitrary MAX mesh, and created with the tools in MAXScript for creating meshes. One
convenient way to do this is to create an instance of a primitive and get the mesh from it.
The flags can be 0, or one or more of these value. If you want more than one flag to apply,
then you add the values together. Here are all the flags, and whether that can be used with
addGizmoText, addGizmoMarker, addGizmoShape and addGizmoMesh:
gizmoDontDisplay
Tells the system to not display the gizmo. It will be hit-tested, but not displayed,
applies to all.
gizmoDontHitTest
Tells the system to not hit-test the gizmo. It will be displayed, but not hit-tested,
applies to all.
gizmoActiveViewportOnly
Tells the system to only display and hit-test this gizmo in the active viewport, applies
to all.
this.addGizmoShape gizmoShape flags unselColor selColor
This creates a gizmo from a shape object. The gizmoShape can be created using functions
from the “manip” package, described below.
The flags can take on the same value as for “addGizmoMesh,” with two new values
supported:
gizmoUseScreenSpace
104 Chapter 1 | What’s New in 3ds max 4 MAXScript
This tells the system to interpret the coordinates of the shape as device coordinates in
the viewport, not as 3d values. The values are still specified as 3d points, but the “Z”
coordinate is ignored, applies to all but addGizmoMesh.
gizmoUseRelativeScreenSpace
This is like gizmoUseScreenSpace, but the coordinates are specified as values from 0.0
to 1.0, and interpreted in each viewport as a percentage of the width or height of the
viewport, applies to all but addGizmoMesh.
addGizmoMarker markerType position flags unselColor selColor
The creates a gizmo using a marker. The value of the “markerType” parameter can be:
#point
#hollowBox
#plusSign
#asterisk
#xMarker
#bigBox
#circle
#triangle
#diamond
#smallHollowBox
#smallCircle
#smallTriangle
#smallDiamond
#dot
#smallDot
The position is a point in 3d space, or 2d screen space. The flags are the same ones
supported by addGizmoShape.
addGizmoText text position flags unselColor selColor
This creates a gizmo that is text on the screen. Note that text cannot be hit-tested or
grabbed by the mouse. It is used for display purposes only.
getLocalViewRay m
This function takes a mouse position and returns the ray that passes through that mouse
position in the direction of the view. It is returned in the local coordinates of the node that
owns the manipulator target.
Plane objects
The plane objects returned from “manip.makePlaneFromNormal” have the following functions
available:
projectedPoint = [0,0,0]
plane.intersect ray &intersectionPoint
This intersects the given ray with the plane. It returns true if it succeeds, and false if it
doesn’t. If it works, then the intersection point is set in the “intersectionPoint” value,
which must be initialized to a Point3 value in advance.
plane.mostOrthogonal ray otherPlane
This returns the plane that is most orthogonal to the given ray. This means the plane that
is most “square” to the view direction.
Sometimes a manipulator might choose between two different planes on which to project a ray. It
is usually best to project it to the plane which faces the view ray most directly, and this function
determines that. See “UVWManip.ms” for an example of how to use this.
plane.getNormal()
Returns the normal of a plane.
plane.getPoint()
Return the point that the plane passes through.
plane.getPlaneConstant()
Return the value of the plane constant. This is the value of “D” in the equation that
defines the plane:
Ax + By +Cz + D = 0
GizmoShape objects.
A GizmoShape is a shape object that you can use to construct wire-frame gizmos. You can get an
empty GizmoShape as follows:
local giz = manip.makeGizmoShape()
giz.startNewLine()
This begins a new line segment in the shape.
giz.transform matrix
This transforms the gizmo by the given Matrix3 transform.
Note:
See the UVWManip.ms for an example of creating 3d gizmos with GizmoShape.
See Also
Interface: manip (p. 366)
sliderManipulator interfaces: (p. 520)
radiusManip interfaces: (p. 500)
uvwMappingHeightManip interfaces: (p. 551)
uvwMappingLengthManip interfaces: (p. 555)
uvwMappingUTileManip interfaces: (p. 558)
uvwMappingVTileManip interfaces: (p. 562)
uvwMappingWidthManip interfaces: (p. 565)
ConeAngleManip - superclass: helper (p. 277)
PlaneAngleManip - superclass: helper (p. 311)
Scripted Plug-ins (p. 1538)
sliderManipulator - superclass: helper (p. 333)
Scripted Objects
See Also
Scripted Plug-ins (p. 1538)
RenderEffects Progress Callback Mechanism 107
Scripted RenderEffects
The first argument is the bitmap value to be modified by the effect, and progressCB is a progress
callback interface object. This interface has several methods you can call during the course of
processing the bitmap that control the progress bar and check for user cancellation.
Methods
progressCB.setTitle <string>
Sets the title on the progress bar.
progressCB.progress <done> <total>
Indicates the progress of the rendering. Both arguments are integers; done indicates how
much of the rendering has been completed, and total indicates how much there is
to do.
When this is called, the main render effects progress bar is updated to reflect this progress.
This function also returns a boolean, which if true indicates that the user has hit the
escape key to cancel the effect rendering.
progressCB.check()
Indicates whether the user has hit the escape key to cancel the effect rendering. This
function returns a boolean; false if processing should continue, and true if the user has
cancelled the rendering.
Example:
on apply bm progressCB: do
(
…
progressCB.setTitle “My Effect Pass1”
…
escapeEnable = false -- turn on scripter escape processing
for i in …
(
<the effect rendering loop>
…
if progressCB.progress completed total then exit
)
…
escapeEnable = true
…
)
108 Chapter 1 | What’s New in 3ds max 4 MAXScript
The progress bar update is done inside the main processing loop and the check for user cancel is
done on the same call, causing the loop to exit prematurely in this example.
See Also
RenderEffect : MAXWrapper (p. 1347)
Scripted RenderEffect Plug-ins (p. 1566)
Render Effects Common Properties, Operators, and Methods (p. 1347)
Scripted Rollouts
See Also
Edittext (p. 1496)
Rollout Floater Windows (p. 1477)
Multi-line editText UI items in Scripted Rollouts 109
Skin
Joint Angle Morph
Spring Controller
Topic: version 4 MAXScript New Features/Spring Controller
The Spring controller adds secondary dynamics effects to any point or object position. The end
result is secondary mass/spring dynamics similar to Flex. This constraint adds realism to generally
static animations.
When you apply Spring to an animated object, its original motion is preserved and secondary,
velocity-based dynamics are applied. When you first apply the controller, it constructs a virtual
spring between the object’s original position and where it would end up after forces are applied to
it. You can adjust spring tension and dampening. Increasing the tension creates a tighter spring,
while increasing the dampening smoothes out jitters in the motion.
Users have control over the point’s Mass and Drag, the spring’s Tension and Dampening, and other
world space constraints. These include being able to add external forces like Wind and Gravity
(spacewarps), and being able to constrain the spring effects along a given axis. This way you can add
vertical dynamics while controlling the about of effect it has in the horizontal directions.
The solution is calculated using a start time and a step size. Solutions are cached once for the last
tick calculated, and once per frame. Performance should be the same one each frame as you step
forward, and significantly faster after the first pass if nothing changes. Cached values will be used if
going backwards in time.
The biggest slowdown occurs when animating an object that the controller uses as a force way down
the time line since this is a history dependant solver. If a lot of animation is going to occur along a
long timeline you can shut off the spring solver by setting steps to 0. Set this back to the desired
value when you want the solution recalculated.
Methods
Prototype:
<float>getMass()
Return Value:
Returns the mass.
Prototype:
<void>setMass <float>mass
Parameters:
<float>mass
110 Chapter 1 | What’s New in 3ds max 4 MAXScript
Remarks:
Sets the mass. The mass of the object to which the Spring controller is applied. Increasing the mass
causes the “bouncing” spring motion to become more exaggerated.
Prototype:
<float>getDrag()
Return Value:
Returns the drag.
Prototype:
<void>setDrag <float>drag
Parameters:
<float>drag
Remarks:
Sets the drag. Acts as air friction on the spring motion. A low Drag setting results in a greater
“bouncing” effect, while a high Drag results in subdued bouncing. Default=1. Range=0 to 10.
Prototype:
<float>getTension <index>springIndex
Parameters:
<index>springIndex
Return Value:
Gets the tension for the spring corresponding to the index.
Prototype:
<void>setTension <index>springIndex <float>tension
Parameters:
<index>springIndex
<float>tension
Remarks:
Sets the tension for the spring corresponding to the index. The “stiffness” of the virtual spring
between the controlled object and the highlighted spring object(s).
Prototype:
<float>getDampening <index>springIndex
Parameters:
<index>springIndex
Return Value:
Gets the dampening for the spring corresponding to the index.
Multi-line editText UI items in Scripted Rollouts 111
Prototype:
<void>setDampening <index>springIndex <float>dampening
Parameters:
<index>springIndex
<float>dampening
Remarks:
Sets the dampening for the spring corresponding to the index. : Acts as a multiplier of an internal
factor that determines how quickly the object comes to rest. With the Self Influence spring,
changing Dampening has the same effect as changing Drag. With other springs, Dampening affects
only the movement caused by that spring. Internally, the dampening value is proportional to the
tension, so as you increase the tension and make the solution more stiff, the dampening is increased
to maintain system stability.
Prototype:
<boolean>addSpring <node>node
Parameters:
<node>node
Remarks:
Adds the node to the spring list.
Return Value:
Returns true if successful, false otherwise
Prototype:
<integer>getSpringCount()
Return Value:
Returns the number of springs in the spring system.
Prototype:
<void>removeSpringByIndex <index>springIndex
Parameters:
<index>springIndex
Remarks:
Removes the spring corresponding to the index.
Prototype:
<void>removeSpring <node>node
Parameters:
<node>node
Remarks:
Removes the spring if the node is in the spring list.
112 Chapter 1 | What’s New in 3ds max 4 MAXScript
See Also
PositionSpring interfaces: (p. 497)
Point3Spring interfaces: (p. 482)
SpringPoint3Controller interfaces: (p. 523)
SpringPoint3Controller - superclass: Point3Controller (p. 336)
SpringPositionController interfaces: (p. 526)
SpringPositionController - superclass: PositionController (p. 337)
Flex : Modifier (p. 1128)
Flex interfaces: (p. 438)
flexOps const StructDef (p. 235)
SubObject Mode
System Tools
Topic: version 4 MAXScript New Features/System Tools
A new global struct called “systemTools” has been added to MAXScript.
This group of functions lets you gather various pieces of information about the system that you
are using.
systemTools.NumberOfProcessors()
Returns the number of processors
systemTools.GetScreenWidth()
Returns the screen width including multiple monitors.
systemTools.GetScreenHeight()
Returns the screen height including multiple monitors.
systemTools.IsWindows98or2000()
Returns true if the OS is Windows98 or Win2000
systemTools.IsWindows9x()
Returns true if the OS is a Win9x flavor
systemTools.IsDebugging()
Returns true if running in a debugger
See Also
systemTools const StructDef (p. 256)
System Information (p. 141)
sysInfo const StructDef (p. 255)
Multi-line editText UI items in Scripted Rollouts 113
Trackbar Interface
Topic: version 4 MAXScript New Features/TrackBar
An interface has been added to access properties and methods of the trackbar. The trackbar interface
can be retrieved using a function or property in maxOps. (p. 368)
trackBar_Interface = maxOps.trackBar
or:
trackBar_Interface = maxOps.getTrackBar()
The following methods and properties are available for the trackbar.
Properties:
.visible : boolean : Read|Write
Displays or hides the trackbar
.filter : enum : Read|Write
filter enums: {#all|#TMOnly|#currentTM|#cbject|#mat}
Sets and gets the filter that determines which keys are displayed in the trackbar
.showFrames : bool : Read|Write
Sets/gets whether or not frames are displayed in the trackbar
.showAudio : bool : Read|Write
Sets/gets whether or not the audio track is displayed in the trackbar
.showSelectionRange : bool : Read|Write
Sets/gets whether or not selection ranges are displayed in the trackbar
.showSnapToFrames : bool : Read|Write
Sets/gets whether or not keys are snapped to frames when moved
.keyTransparency : integer : Read|Write
Sets/gets the key transparency value. Acceptable values range 0-255
.selKeyTransparency : integer : Read|Write
Sets/gets the selected key transparency value. Acceptable values range 0-255
.cursorTransparency : integer : Read|Write
Sets/gets the cursor transparency value. Acceptable values range 0-255
114 Chapter 1 | What’s New in 3ds max 4 MAXScript
Methods:
<void>redraw forceRedraw:<bool>
forceRedraw default value: false
Indicates if the redraw should be forced
Redraws the trackbar.
<time>getNextKeyTime()
Gets the next key time. The “at time” context can be used to determine the starting point.
<time>getPreviousKeyTime()
Gets the previous key time. The “at time” context can be used to determine the
starting point.
See Also
maxOps (p. 87)
Interface: maxOps (p. 368)
Trackviews
Topic: version 4 MAXScript New Features/Trackviews
The methods and properties are:
trackviews.isOpen <fpvalue>name or index
Returns a boolean value indicating if the specified trackview is open.
trackviews.isCurrent <fpvalue>name or index
Returns a boolean value indicating if the trackview is the last one used or not.
trackviews.setCurrent <fpvalue>name or index
Sets the specified trackview to be the current one. Returns true if successful.
trackviews.currentTrackView
Read only property that returns the interface for the currently used trackview. Returns
undefined if the trackview is closed.
trackviews.lastUsedTrackViewName
Read only property that returns the name of the current trackview.
trackviews.openLastUsedTrackView()
Opens the current trackview if it has been closed.
trackviews.delete <fpvalue>name or index
Deletes the specified trackview.
trackviews.close <fpvalue>name or index
You can now close a trackview based on it’s index or name.
trackviews.open <fpvalue>name or index
You can now open a trackview based on it’s index or name.
trackviews.getTrackView <fpvalue>name or index
This method will get a trackview based on it’s index or name.
Multi-line editText UI items in Scripted Rollouts 115
Example:
showInterface (trackviews.getTrackView 1)
trackviews.getAllTrackViews()
Returns an array of trackviews.
trackviews.numTrackViews()
Returns the number of trackviews.
trackviews.getTrackViewName <index>index
Returns the name of the trackview window based on the index.
<void>setName <string>name
Sets the name of the trackview window
<integer>getNumTracks()
Gets the number of tracks currently displayed in trackview
<integer>numSelTracks()
Gets the number of selected tracks
<boolean>canAssignController()
Tests to see if all selected tracks are of the same type
<void>assignControllerDialog
Invokes the assign controller dialog if canAssignController()
<boolean>assignController <maxObject>controller
Assigns the controller to the selected tracks if canAssignController() is true and the
controller is the appropriate type
<void>showControllerTypes <boolean>state
Sets the ShowControllerType property
<void>expandTracks()
Expands all tracks
<void>zoomSelected()
Zooms to the selected object’s track
<void>zoomOnTrack <maxObject>parent <index>subNum
Zooms to the track defined by the parent and the subNum
<maxObject>getTrack <index>index
Returns the object belonging to the indexed track
<maxObject>getParent <index>index
Gets the parent of the object belonging to the index track. If the object is a position
controller, the parent is the Transform controller
<maxObject>getSelected <index>index
Gets the objects belonging to the selected, indexed track
<maxObject>getParentOfSelected <index>index
Gets the indexed selected tracks parent object
<index>getSelectedSubNum <index>index
Gets the subNum of the selected track
<index>getIndex <maxObject>object
Gets the index for the animatable object
116 Chapter 1 | What’s New in 3ds max 4 MAXScript
trackviews.getAllTrackViews()
Once you have an instance of the trackview interface you can call the following new methods on it.
getEditMode()
Gets the current edit mode as an symbolic enum.
setEditMode <type as symbolic enum>
Sets the current edit mode
editMode
Property to do the same as the above two methods
valid symbolic enum values are:
#editKeys
#editTime
#editFCurves
#editRanges
#positionRanges
See Also
trackView const StructDef (p. 257)
Interface: trackviews (p. 429)
Track View (p. 1609)
Multi-line editText UI items in Scripted Rollouts 117
Visual MAXScript
Topic: version 4 MAXScript New Features/Visual MAXScript
“Visual MAXScript is a direct-manipulation, multithreaded, forms-based editor that you can use to
layout and edit MAXScript rollouts. Rollout scripts can be created from scratch in the forms editor,
or use it to interactively edit and add to an existing rollout definition in a script editor window.”
The layout editor can be accessed in two ways:
• as a stand-alone Utility plug-in named “Visual MAXScript”
When accessed as a Utility through the Utility command panel, the layout editor operates in a
“stand-alone” mode. Any forms created can either be exported as separate script files containing
the rollout definition script or saved in a special .vms binary layout file that can be opened again
by the Visual MAXScript utility. When used in this mode, any script files exported can be
opened in script editor windows for further editing in MAXScript or merging with other
script files.
118 Chapter 1 | What’s New in 3ds max 4 MAXScript
• through 2 new menu items in the Edit menu in script editor windows
When accessed through the new script editor Edit menu items, the layout editor is designed for
application to rollout definition sections in the active script editor. The “New Rollout” menu
item is used to create a rollout definition from scratch. You place the cursor in the edit window
where you want the newly-generated rollout code to be inserted and choose Edit>New Rollout.
This opens the editor on a blank form to which you can add and arrange and edit rollout items.
Choosing File>Save or hitting the Save icon in the layout editor window will cause the script for
the rollout to be inserted at that point in the editor window. Subsequent edits and saves while
the layout editor is still open cause that inserted code to be updated.
The “Edit Rollout” item (hotkey F2), is used to edit an existing rollout definition in the active script
editor. You place the cursor anywhere inside a rollout or utility definition, choose Edit>Edit Rollout
(F2), and the layout editor is opened showing that rollout. You can edit and add to the rollout in the
layout editor and when you choose File>Save or click the Save icon in the layout editor, the original
definition is replaced with new code corresponding to the edited rollout. Subsequent changes and
saves while the layout editor is still open cause that code to be updated each time.
Features:
• You can have more than one layout editor open at a time This allows you to cut and paste
operations between them. Also, note that cutting and pasting in VMS also copies event code.
• When opened from a script editor window, the text in that editor window becomes ‘frozen’
while the layout editor is open. The editor window can be brought to the front and scrolled and
saved, but any other operation will be ignored and a beep will sound. The editor will ‘unfreeze’
as soon as you close the layout editor.
• The Edit>Edit Rollout function can be applied to any existing rollout definition. It attempts to
parse the definition and open an equivalent editable version in the layout editor. This is a
somewhat tricky heuristic and may well fail for certain rollouts until we get the bugs out.
MAXScript preserves all the code in the rollout and updates only those parts that correspond to
the things you can edit in the layout editor, namely, UI items and their handlers.
• Code generated by the layout editor always specifies explicit pos: width: and height:
parameters for UI items, it does not use align:, offset:, or any of the other
auto-layout parameters. This means that any rollout that you edit that uses automatic
layout will be transformed into an explicitly-positioned layout when you do the first File>Save.
It is quite difficult to preserve the auto-layout parameters under arbitrary edits in the editor and
the assumption is that once you start editing a rollout using the layout editor you will continue
to do so.
Note:
An extreme example of this is the group ( ) construct which is used to nest a set of items in a group
box. Nested group ( ) constructs are removed completely by the layout editor and replaced with new
groupBox UI items that define an explicitly-sized box around the original items. You can edit and
add and nest groupBoxes as needed in the editor.
Multi-line editText UI items in Scripted Rollouts 119
• If there is a syntax error in a rollout definition being opened by Edit>Edit Rollout, the syntax
error is reported and highlighted and the layout editor does not open - it can only be opened
on error free source.
• When you first edit or create a rollout in the layout editor, it defaults to the standard width for
Command Panel rollouts. You can adjust this width in the editor by resizing the outer gray
rectangle and the editor emits width: and height: parameters on the generated rollout
header. You can edit these numbers in the script editor and they will be honored by the layout
editor when you next edit that rollout.
For command panel rollouts and other scripted plug-ins, there are now symbolic
constants provided that produce the correct width automatically. These are:
#cmdPanel
#effectsDlg
#mtlEditor
so, to set up the rollout for a scripted material (p. 1565), you’d add a width: parameter to
the rollout header like this:
rollout foo “Frabulation” width:#mtlEditor
(
...
• You add new UI items by clicking its button in the item toolbar at the bottom and then dragging
out a rectangle for it in the main form. You can select an existing item and edit its paramters in
the property list on the right. You can select multiple items by fence-dragging or ctrl-clicking
and perform various alignments operations, see the Layout menu. A selected item can be deleted
by clicking the red X toolbar button. The various panes can be resized or even torn off if you
want to customize the editor layout.
• Axis restriction works by holding the shift down while moving objects. This will restrict
movement to the X or Y axis based on the angle of the mouse from its initial position.
• editText boxes in the editor can now be multi-line, consistent with the mulit-line editText in
MAXScript (p. 108).
• Editing in the Array editor dialog has been rationalized and improved. Clicking on an item in
the list box toggles the selection state of it. When items are selected in the list box, changing
text in the edit field and hitting enter changes all the selected items to what was in the edit box,
this allows for editing of entries in the middle of the list.
• A new custom item type has been added to the item type toolbar at the bottom of the VisualMS
dialog, allowing custom items to be created from scratch in the editor. Its icon appears in the
toolbar as a face in profile. When first created, the item class parameter in the parameter list
shows as ‘???’ and must be edited to contain the desired custom item type.
• An ActiveX control rollout item type is available in MAXScript. The icon for it appears in the UI
item toolbar at the bottom of the VisualMS dialog, as a dot array with the word OLE
superimposed. ActiveX Controls in MAXScript Rollouts (p. 10)
120 Chapter 1 | What’s New in 3ds max 4 MAXScript
• Editing an existing rollout source that contains any unrecognized UI item types, such as those
added from 3rd-party .dlx MAXScript extensions appear in the VisualMS rollout window as new
‘custom’ items, displaying as a rectangle containing the new ‘custom’ type icon. Any definition
parameters on are displayed and editable in the parameter list, and overall position and size of
the bounding rectangle of the custom type can be edited in the rollout pane.
• You can de-select everything by clicking in the white space around the main form.
• The main form always has a black rectangle drawn around it even when deselected. This allows
you to see the form if both the background of the application and the form are the same color.
• Resizing of the main form now snaps to the grid if it is on.
• The paste command now works much better. Pasted objects are offset by [10,10] pixels,
maintain unique names, and then pasting everything is de-selected and the pasted objects get
selected.
• When editing an existing rollout definition that makes use of autmatic layout in VMS for the
first time, it is highly recommended that you add a ‘width:n’ parameter to the rollout header
first so that the editor can position items correctly.If no width: parameter is supplied, it
defaults to Command Panel width which may be too small for floating window rollouts or
scripted materials or effects.
For rollouts that will appear in a rolloutFloater, you should set the rollout width: equal to
the floater window width minus 30.
Example:
rollout foo “Frabulation” width:#270
(
...
)
...
rf = newRolloutFloater “Frabo” 300 220
addRollout foo rf
Xref Objects
Topic: version 4 MAXScript New Features/Xref Objects
An updated function published interface for Xref Objects.
Interface: objXRefs (p. 409)
Explicit References
A file being xref’d that has a script controller whose script has explicit references ($sphere01, etc.)
to objects in the incoming xref file have a potential problem for the script writer. The problem is,
the objects in the xref file are invisible to the scripter, and so a script will fail. This is actually a
general problem with xrefs, you cannot have scripts of any kind in the file (scripts controllers, param
wires, callback scripts, etc.) that depend on explicit scene object references.
Multi-line editText UI items in Scripted Rollouts 121
The persistent global solution is the only one that is viable at this time. There are two general
solutions: 1) associate an owning-scene context with controller scripts, etc., when they come in via
xref and use that to anchor pathname searches and other scene-relative references, and 2) have an
accessible ‘evaluation context’ for controllers sent as part of the GetValue() call, so we can know
what object’s parameter the current GetValue() call is being made for and can therefore get rid of
many of the uses of explicit pathnames in the scripts.
Currently, MAXScript now fully loads any persistent globals in xref’d and merged files, but does NOT
make them persistent in the current scene. As an example of a setup showing how this can be used,
imagine a file with 3 spheres that will be xref’d. You need to establish persistent globals for all the
scene objects to be referrenced in controller scripts, like this:
persistent global s1 = $sphere01, s2 = $sphere02, s3 = $sphere03
this has to be run sometime while the to-be-xrefed scene is the currently open scene. Then
in the controller scripts, you’d say something like:
global s1, s2
dependsOn s1 s2
(s1.pos + s2.pos) / 2
Note this uses ‘global’ not ‘persistent global’, so you don’t go making them persistent
again when they get xref’d into some other scene.
See Also
XRef Files (p. 1643)
XRefScene Values (p. 1038)
XRefObject : Node (p. 1037)
xrefs const StructDef (p. 259)
xrefPaths const StructDef (p. 259)
Interface: objXRefs (p. 409)
122 Chapter 1 | What’s New in 3ds max 4 MAXScript
Example:
name “test package”
version 3
treeCopy flobber to $scripts
copy *.ms to $scripts\flobber\dobber
move foo.max $scenes
drop $scenes\foo.max
The zip package is a text file that contains one or more of the following commands. All are optional.
name “<package_name>“
Names the package.
description “<text>“
Describes the package. Normally, a readme file in the package would give extended
operating instructions, if they are provided.
version <number>
Returns the version number of the package.
extract to “<directory>“
Specifies the location in which to extract the contained files. This can be an absolute path
name (starting with a drive letter or \) or a relative name. Relative names are taken as
being relative to the default temp directory. The special prefix $max can be used to specify
the main MAX executable directory
run “<script_file_name>“
If the package is launched from a MAXScript run menu item or via a fileIn() function, run
the named script file. There can be more than one run command and they are run in
order. These are ignored if the package is launched via a fileIn() call that is supplied with
an explicit script file to run.
drop “<dropScript_file_name>“
If the package is launched by drag-and-drop into MAX, run the named dropScript file.
There can only be one of these per msp.startup file.
copy “<files>“ to “<directory>“
Copies the named file or files (if the <files> string contains wild-cards) to the given
directory. The special $max prefix can be used here.
clear temp
Cause the temporarily-extracted files to be deleted once all the nominated scripts are run
or dropped.
clear temp on MAX exit
Cause the temporarily-extracted files to be deleted when the currently running MAX
session exits.
clear temp on reset
Cause the temporarily-extracted files to be deleted when a file open or reset is performed.
keep temp
Prevents any deletion of the extracted files.
124 Chapter 1 | What’s New in 3ds max 4 MAXScript
File Searches:
The following functions will perform searches for files given as relative file names in the current
package file:
fileIn <filename> (p. xlix)
include <filename> (p. lix)
openBitmap <filename> (p. 755)
editScript <filename>
Note:
Any saves will not go back into the package, but into the temp extracted file.
loadMAXFile <filename>
mergeMAXFile <filename> ...
getMAXFileObjectNames <filename>
importFile <filename> ...
loadMaterialLibrary <filename>
Bitmap Searches:
The following UI items will search for named bitmap .bmp files in the package:
bitmap <name> fileName:<filename>
button <name> images:<image_spec_array>
checkButton <name> images:<image_spec_array>
These cause files from within the package to be copied or moved as specified. The treeCopy &
treeMove variants move whole nested directories of files. By default, any existing files in the
destination location are replaced with the newly extracted ones, add the ‘noReplace’ keyword to
prevent this.
The <to> spec must always be a directory. Any treeCopy/Move replicates the source sub-directories
into the <to> directory, making new directories as needed. The <from> spec for copy & move may
be any relative or fully specified file name or wild-card pattern. Relatively named files are looked for
in that relative position in the package. Fully specified names are looked for in the main file-system.
The <from> spec for treeCopy/Move may be just a directory path, in which case the whole directory
and its subdirectories are copied/moved, or it can be a wild-card path name in which case just the
matching files or directory trees are copied/moved.
Multi-line editText UI items in Scripted Rollouts 125
The file path names you can specify in the various commands (extract to, run, copy, move, etc.) can
have a starting path that is one of several special names beginning with $. These name useful
locations in the currently running MAX installation.
The $ names recognized are:
$max - main MAX executable directory
$maps - first directory in Maps directory config
$scenes - scenes directory
$fonts - fonts directory
$imports - imports directory
$sounds - sounds directory
$matlibs - matlibs directory
$scripts - scripts
$startupScripts - auto-load startup scripts
$plug-ins - first in the Plug-ins directory config
$plugcfg - plugcfg
$images - images
$ui - UI
$macroScripts - macroScripts in UI directory
$web - web directory
$temp - system temp directory
These directories reflect any customization the user has set up in the various preference dialogs.
Example:
If you had set up a package with several scenes, plug-ins & map files in several directories in the
package, you could install them with some move commands in the mzp.run file, something like this:
move “plug-ins\*.*” to “$plug-ins”
move “*.max” to “$scenes”
move “texmaps\*.bmp” to “$maps”
Note:
As an added feature, if the scripts run from within a package define any functions, macroScripts,
plug-ins, rollouts, or any major MAXScript value or construct that might live longer that the
running script, then the package is ‘associated’ with that defined value or construct and will again
become the initial search location whenever the functions or handlers in the rollouts/plug-ins/
macroScripts/etc. are later run.
Winzip:
You can initially create a .mzp with a zip utility such as WinZip. You can then associate that utility
with the .mzp type, so simple double-clicking a .mzp file will open it in that editor. You only need
to set up this association once, and you can do this in the Windows Explorer by selecting a .mzp file,
shift-right-clicking on the selected file and choosing “Open with...” in the popup menu that
appears. Scroll the application list that appears to find you desired zip utility and check the “Always
use this program ...” checkbox at the bottom of the dialog.
msZip Interface:
The MAXScript zip package interface (p. 378) has exposed 2 scripter-callable functions:
msZip.fileInPackage <mzpFilename> &<exractDirVar>
and will return true if success or false if there is a failure, or a missing or invalid .mzp file, and it will
also return the directory that the package file were extracted to in the pass-by-reference
<extractDirVar> argument.
Example:
local extractDir = ““
if msZip.fileInPackage “foo.mzp” &extractDir then
(
-- extractDir contains the extracted-to directory name
...
)
The ‘unloadPackage’ function performs an extract and executes all the file copying and moving
commands in any enclosed mzp.run file, but will not execute any scripts in the package. The
extractTo directory and any ‘drop’ command file found will be returned in the pass-by-reference
arguments.
Example:
local extractDir = ““, dropFile = ““
if msZip.unloadPackage’ “foo.mzp” &extractDir &dropFile then
(
-- extractDir contains the extracted-to directory name
-- dropFile contains any found drop file name (the path to extracted
location )
...
)
See Also
i-drop - drag and drop (p. 62)
Additional Keyword Parameter On pickObject() forceListenerFocus: 127
See Also
Picking Scene Nodes By Hit (p. 1618)
RubberBanding in pickObject() Function (p. 136)
See Also
Affect Region : Modifier (p. 1103)
128 Chapter 1 | What’s New in 3ds max 4 MAXScript
See Also
Class and Object Inspector Functions (p. 799)
Class and Object Inspector Functions Enhanced (p. 159)
See Also
FileStream Values (p. 763)
Example:
function foo x y &z =
(
...
z = x * y
...
return true
)
Declares a function taking three parameters, x, y and z. The &z in the parameter list indicates
the z parameter is to be passed by-reference. To call this function, you provide a reference value
for the z parameter using the new ‘&‘ reference operator.
Example:
local var1, var2
...
var1 = foo 2 3 &var2
Calls the foo function with the arguments 2, 3 and &var2. The &var2 is a reference to
the var2 local variable. When the function is called, the z parameter in the body is a
reference to var2 local in the caller, and the
z = x * y
assignment in the body of foo will cause x * y to be assigned to the var2 local in the
caller. After
var1 = foo 2 3 &var2
var1 will contain true and var2 will contain x * y or 6.
Any number of by-reference parameters can be used and they can be keyword parameters if needed:
fn foo x y &z: = ...
called like this:
var1 = foo 2 3 z:&var2
The ‘&’ reference operator used to supply references in a call can be applied to any
<accessor> construct in MAXScript. These are:
variables (locals, globals, rollout locals, plug-in locals, etc.)
property access
array index
parameter (of a scripted plug-in)
Example:
p = [1, 2, 3]
foo 2 3 &p.x
would cause the x coordinate in the point to be passed by-reference and so after the call,
the value in p would be
[6, 2, 3]
C++-style bracketing comments 131
Example:
a = #(1, 2, 3, 4, 5)
foo 2 3 &a[3]
would cause the 3rd element in the array to be passed by-reference and so after the
call, the value in a would be #(1, 2, 6, 4, 5)
Note:
This mechanism is used by the Function Publishing interface in MAXScript to support BY-REF
interface method parameters and results. Any parameter defined as by-ref (or with a type code
suffix _BR) in the published interface, requires an ‘&’ reference value.
See Also
Dereferencing Operator (p. 133)
Visible Class For ‘&’ Reference Values (p. 142)
You can also use this within a line to comment out a script fragment:
for i in 1 to 10 do ( /* messageBox “in loop”; */ frabulate i )
Note:
The /* and */ have to be adjacent characters. If you leave out the closing */ or make it * /, the rest of
the file will be commented out.
See Also
MAXScript Editor Commands (p. xlvi)
Source Code Layout (p. 580)
Source Code Layout and Continuation Lines (p. lvii)
132 Chapter 1 | What’s New in 3ds max 4 MAXScript
Example:
a=#{1..5,10)
b=a as array
c=b as bitarray
Return Value:
Returns the number of bits set
.isEmpty
Return Value:
Returns true if no bits are set and false if one or more bits are set.
Example:
a=#{1..5,10..20}
a.numberset --> 16
a.isEmpty --> false
a=#{}
a.numberset --> 0
a.isEmpty --> true
The ‘*’ operator has been added to bitArrays which performs an ‘AND’ operation:
<bitarray> * <bitarray> -- intersection (”AND” operation)
See Also
BitArray Values (p. 791)
Value Common Properties, Operators, and Methods (p. 714)
Command line -U MAXScript startup scripts 133
See Also
Running Scripts from the Command Line (p. lvii)
See Also
Node Common Properties, Operators, and Methods (p. 820)
Dereferencing Operator
Topic: version 4 MAXScript Language Improvements/Language Improvements
Visible Class For ‘&’ Reference Values (p. 142)
A Function Published dereferencing prefix operator, *, has been added to MAXScript. This can be
used in conjunction with the new ‘&’ reference operator that was added to support pass-by-reference
arguments to functions and interface methods.
The ‘&’ operator is used to get a ‘reference’ to a variable or property or array element slot in
MAXScript. You can pass this reference in to a function that accepts by-reference arguments,
allowing its code to directly assign values to the referenced variable or property or array element,
thus supporting a kind of multiple-value return.
The new ‘*’ operator allows you to work with ‘&’ reference values anywhere in MAXScript code.
Therefore ‘dereference’ the reference and get the value in the slot or variable it is referring to and to
assign it to the referenced slot.
Examples:
ref = &$foo.pos
this puts a value into ref which is a reference to the .pos property in the scene object $foo.
Elsewhere in the code, you could use the new ‘*’ dereferencing operator to say:
$baz.pos = *ref
the ‘*’ dereferences the reference value in ref, essentially making this equivalent to:
$baz.pos = $foo.pos
you can also use this construct as a destination for an assignment:
134 Chapter 1 | What’s New in 3ds max 4 MAXScript
*ref = [10,0,0]
first dereferences the reference in ‘ref’ to $foo.pos and then assigns to that, effectively
setting $foo’s position.
In order to avoid ambiguity with the ‘*’ multiply operator, the precedence of the ‘*‘ dereferencing
operator is set at just lower than the function call and just higher than the ‘as’ coercion operator.
This means that if you want to send a dereferenced value into a function as an argument, you must
surround the dereferencing with parentheses, as in:
foo (*ref) x y z
Remember that reference values can be generated for variables, properties and array elements, as
Example:
&foo
&$box.position.x
&valArray[23]
The ‘*’ dereferencing operator is a moderately advanced feature in MAXScript that is often used to
allow very general purpose code to be written that uses references instead of actual objects so that it
can be applied to different kinds of objects and properties at different times.
Nested property access allowed in ‘&’ reference values in MAXScript. This allows constructs like:
r = &$foo.pos, and later *r.controller to mean $foo.pos.controller.
See Also
By Reference Parameter Passing (p. 129)
See Also
UVWUnwrap interfaces: (p. 568)
Unwrap UVW interfaces: (p. 530)
hasProperty() function 135
hasProperty() function
Topic: version 4 MAXScript Language Improvements/Language Improvements
Prototype:
hasProperty <obj> <prop_name_or_pattern_string>
Return Value:
Returns true if the object has the given property.
See Also
Properties, Methods, Operators, and Literals (p. lxiv)
See Also
Node Common Properties, Operators, and Methods (p. 820)
Readable/Writable Checks
Topic: version 4 MAXScript Language Improvements/Language Improvements
MAXScript now does readable/writable checks and throws an error if you try to read from a
write-only file and vice versa. Some modes are read/write, such as “a+” “w+” and “r+”.
See Also
FileStream Values (p. 763)
136 Chapter 1 | What’s New in 3ds max 4 MAXScript
isValidNode
Topic: version 4 MAXScript Language Improvements/Language Improvements
isValidNode <var>
Returns true if <var> is a node value, and the node has not been deleted. False otherwise.
See Also
Detecting Deleted Nodes (p. 133)
Node Common Properties, Operators, and Methods (p. 820)
If rubberBand: is supplied on the pickObject() call, it enables rubberbanding, with the given
<point3> as world-space coordinates for the start point of the rubber band. You can use the
rubberBandColor: argument to override the default line color of gray (color 128 128 128).
Example:
obj2 = pickObject rubberBand:obj1.pos rubberBandColor:yellow
See Also
Picking Scene Nodes By Hit (p. 1618)
Additional Keyword Parameter On pickObject() (p. 127)
SetDir
Topic: version 4 MAXScript Language Improvements/Language Improvements
SetDir <filetype_name> <string>
Sets the directory specified in string. Replicated in the Customize > Configure Paths dialog
for the specified file type.
Shortcut system replaced 137
Returns true if successful, false if not. Does not check to see if <string> is a valid path. Any change
made through this function is immediately reflected in the 3dsmax.ini file and so is persistent. Use
with caution.
See Also
3ds max System Directories (p. 1625)
from, and the “persistent id” if the action. Actions exported from core all have persistent
ids that are fixed integers as a string.
Actions are accessible, all that you need to know are the ActionTableId and the persistent ID in order
to invoke the operation.
Note:
Certain actions emit much better code. If an action is exported using a function published action
table, then the code it emits calls that function. For example, if you bring up the “Plug-in Manager”
from the customize menu, the code emitted is:
Plug-in_Manager.Plug-inMgrAction.show ()
If the action comes from a macro script, which many of our actions do, the code looks like:
macros.run “Modifiers” “Bend”
See Also
Action Manager (p. 9)
Interface: actionMan (p. 353)
startObjectCreation()
Topic: version 4 MAXScript Language Improvements/Language Improvements
The startObjectCreation() function has been enhanced.
startObjectCreation <maxobjclass> [returnNewNodes:<flag>] [newNodeCallback:<fn>]
The values that can now be supplied to the optional ‘returnNewNodes:’ keyword argument are true,
false (the default) or #first. If ‘true’ is supplied, all of the nodes created, up until the current create
mode is exited, will be returned in an array. If #first is supplied, only the first node created is
returned, immediately after it is created. The function doesn’t wait for the create mode to be exited
by the user.
The optional ‘newNodeCallback:’ keyword argument can supply a scripted function of one
argument to the create mode that is started, such that the function will be called each time a node
is created with the new node as its argument. This is similar to supplying pickObject() filter
functions, although the return value of the newNodeCallback: function is ignored. Note that the
callback function is invoked immediately upon new node creation, *before* any base object is
installed in it, so *only* node-related properties can be accessed and changed during this callback.
Example:
fn setColor n = n.wireColor = red
startObjectCreation box newNodeCallback:setColor
would cause all new boxes created in the started create mode to have red wire color.
The ‘returnNewNodes:’ and ‘newNodeCallback:’ can both be supplied on the same call; the callback
will be called on each node, and they will be returned in an array as the result of the
startObjectCreation() function.
Subanim Indexing Operator, [], on MAX Objects Now Takes Subanim Names 139
See Also
Create Panel (p. 1572)
Defining Macro Scripts (p. 1521)
Change Handlers and Callbacks (p. 1649)
callbacks const StructDef (p. 233)
The names you can use are those seen in the track view or retrieved with the functions
getSubAnimName() or getSubAnimNames().
See Also
Indexed Access to Animatable Properties in 3D Studio MAX Objects (p. 806)
See Also
Utilities, Global Utilities and Render Element plug-ins (p. 161)
Scripted Plug-ins (p. 1538)
140 Chapter 1 | What’s New in 3ds max 4 MAXScript
Symbolic Pathnames
Topic: version 4 MAXScript Language Improvements/Language Improvements
Support for $<name> symbolic pathnames to all the places that filenames can be supplied for
opening things in MAXScript. Any filename you give to MAXScript in the following situations can
begin with a ‘$’ followed by one of the symbolic directory names below.
Example:
fileIn “$scripts\foo.ms”
will open the file “foo.ms” in the current MAX scripts directory. The situations in which
MAXScript honors ‘$’ symbolic directories are as follows:
Functions:
fileIn()
openBitmap()
createBitmap() in the fileName: parameter
render() in the outputFile: parameter
Compiler directives:
include <filename_string>
Rollouts:
any bitmap image file names for buttons, checkbuttons, bitmap
The following symbolic names are recognized:
$max - main MAX executable directory
$maps - first directory in Maps directory config
$scenes - scenes directory
$fonts - fonts directory
$imports - imports directory
$sounds - sounds directory
$matlibs - matlibs directory
$scripts - scripts
$startupScripts - auto-load startup scripts
$plug-ins - first in the Plug-ins directory config
$plugcfg - plugcfg
$images - images
$ui - UI
$macroScripts - macroScripts in UI directory
$web - web directory
$temp - system temp directory
Please note that these are similar to the 3D Studio MAX System Globals (p. 630) filetype names which
start with a “#”.
See Also
Zip-file Script Packages (p. 122)
3D Studio MAX System Globals (p. 630)
System Information 141
System Information
Topic: version 4 MAXScript Language Improvements/Language Improvements
sysInfo const StructDef (p. 255)
sysInfo.windowsdir
A read only variable to get the Windows directory as a <string> value.
sysInfo.systemdir
A read only variable to get the Windows System directory as a <string> value.
sysInfo.windowsdir
A read only variable to get the Temp directory as a <string> value.
sysInfo.windowsdir
Variable to get/set the current directory as a <string> value.
sysInfo.username
A read only variable to get the user name as a <string> value.
sysInfo.computername
A read only variable to get the computer name as a <string> value.
sysInfo.cpucount
A read only variable to get the number of CPUs as a <integer> value.
See Also
System Tools (p. 112)
This method generates a random class ID similar to #(0x9b7ea231, 0xb6db86ef), and prints it to
Listener. You can just cut and paste this class ID into your script to use the generated ID.
MAX, and each plug-in falls into one of these predefined categories define the Super Class IDs. For
instance, all Texture Map plug-ins share the same Super Class ID of TEXMAP_CLASS_ID. Each
individual texture map plug-in has its own unique Class ID however. Thus, the Super Class ID
defines which kind of object it is, the Class ID uniquely identifies a specific plug-in class.
142 Chapter 1 | What’s New in 3ds max 4 MAXScript
See Also
Scripted Plug-ins (p. 1538)
Scripted Custom Attributes (p. 45)
Menu Manager (p. 75)
validModifier() function
Topic: version 4 MAXScript Language Improvements/Language Improvements
The validModifier() function improved so that it will take a modifier class in place of a modifier to
preclude the need to create a modifier to do the test.
Prototype:
validModifier <node_or_node_collection> <mod_or_mod_class>
It is recommended that classes be used in RCMenus and macroScripts using validModifier() to reduce
resource usage.
Example:
if validModifier $ Edit_Mesh then ...
instead of:
if validModifier $ (Edit_Mesh()) then ...
The MAXScript isValidModifier function will check if it has been passed a modifier that doesn’t exist
at runtime. It returns false in this case. It uses the ClassEntry to determine the InputType() of the
modifier.
See Also
Node Common Properties, Operators, and Methods (p. 820)
Modifier Common Properties, Operators, and Methods (p. 1096)
See Also
By Reference Parameter Passing (p. 129)
Dereferencing Operator (p. 133)
Controllers
List Controller
Topic: version 4 MAXScript Language Improvements/Controllers
The List controller combines multiple controllers into a single effect. It is a compound controller
with tools for managing the order in which its internal controllers are calculated. Controllers are
evaluated in a top to bottom order; the controller at the top of the list is evaluated first.
When you assign a List controller to a parameter, the current controller is moved one level below
the List controller; it becomes the first controller in the list. A second parameter is added below the
List controller and is named Available. This is an empty placeholder for the next controller you add
to the list.
ListCtrl const StructDef (p. 238)
Example:
lst = $.pos.controller -- if this is a list controller
showInterfaces lst -- interface name is “list”
Methods:
lst.getCount()
Returns the count function.
lst.count
Returns count property (read only).
lst.SetActive <index>
Set active function
lst.GetActive()
Get active function
lst.active
Get/set active property.
lst.cut <index>
Cut the indexed sub-controller
lst.paste <index>
Paste clip to index location.
lst.delete <index>
Delete the indexed sub-controller.
lst.setName <index> <string>
Sets the name of the indexed sub-controller.
144 Chapter 1 | What’s New in 3ds max 4 MAXScript
lst.getName <index>
Gets the name of the indexed sub-controller.
Example:
b = Box lengthsegs:1 widthsegs:1 heightsegs:1 length:65.7611 width:32.0211
height:39.8261 pos:[-15.6972,-84.9615,0] isSelected:on
b.pos.controller = position_list ()
b.pos.controller.Available.controller = Position_XYZ ()
b.pos.controller.Available.controller = tcb_position ()
b.pos.controller.Available.controller = bezier_position ()
lst = b.pos.controller -- the list controller
showInterfaces lst-- interface name is “list”
lst.getCount() -- count function
lst.count-- count property (read only)
lst.SetActive 3 -- set active function
lst.GetActive() -- get active function
lst.active-- active property
lst.cut 2-- cut the second sub-controller
lst.paste 1-- paste it to the top of the list
lst.delete lst.count -- delete the second to last sub-controller
lst.setName 2 “My Bezier” -- sets the name of the second sub-controller
lst.getName 2-- gets the name of the sub-controller
See Also
List Controllers (p. 1317)
mapKeys() method
Topic: version 4 MAXScript Language Improvements/Controllers
The mapKeys() method gives access to the SDK function Control::MapKeys().
The form is:
mapKeys <max_object> (<map_struct> | <fn> <arg>) [#allKeys] [#selection] *
[#slide] [#rightToLeft]
This is like other recursive controller key functions (p. 1294) in MAXScript, such as moveKeys,
deleteKeys, etc., which operate on all the keys in nested controllers in the object you supply. The
thing to be mapped is either a scripted function and argument pair or a struct instance. If a function
is supplied, it should take two arguments, the time value to be mapped and the <arg> from the
mapKeys() call, and pass back the mapped time.
Example:
fn bumpTime t delta = t + delta
mapKeys $foo bumpTime 23 #selection
will add 23 to all the selected keys in controllers within $foo.
If a struct is supplied, it should have at least a ‘map’ member function that takes a time to be mapped
and returns the mapped time. The advantage of a struct is that it is a way to set up complex
parameterized mapping by having as many data members as needed to hold the parameters.
moveKeys function 145
Example:
struct mapper
(
scale,
offset,
fn map t = return t * scale * offset
)
mapKeys $foo (mapper scale:0.5 offset:10)
See Also
Time and Key Functions on Object Hierarchies (p. 1299)
Nested Object Controller Functions (p. 814)
Controller Time Functions (p. 1292)
Controller Key Functions (p. 1294)
MAXKeyArray Values (p. 793)
moveKeys function
Topic: version 4 MAXScript Language Improvements/Controllers
moveKeys <key_array> <time> [ #selection ]
Moves all keys by the time given. If #selection is specified, move the current selection otherwise
move all keys.
moveKeys function only works on track properties, .controller and .track. It is not defined on the
keys virtual array.
Example:
moveKeys $box01.pos.controller 5
or:
moveKeys $box01.pos.track 5
See Also
Time and Key Functions on Object Hierarchies (p. 1299)
Nested Object Controller Functions (p. 814)
Controller Time Functions (p. 1292)
Controller Key Functions (p. 1294)
MAXKeyArray Values (p. 793)
146 Chapter 1 | What’s New in 3ds max 4 MAXScript
Properties:
<Hose>.End_Placement_Method Integer default: 1 -- integer
<Hose>.Generate_Mapping_Coordinates Integer default: 0 -- integer
Sets up required coordinates for applying mapped materials to the hose. Default=off.
<Hose>.Hose_Height Float default: 1.0 -- animatable;
float
Use this field/spinner to set the straight-line height or length of the hose when it is not
bound. This is not the actual length of the hose. Available only when Free Hose is chosen.
<Hose>.Segments_Along_Hose Integer default: 45 -- animatable;
integer
The total number of segments in the hose’s length. Increase this setting for a smooth
profile when the hose is curved. Default=16.
<Hose>.Smooth_Spring Integer default: 0 -- integer
Choose one of the following smoothing options:
All: The entire hose is smoothed.
Sides: Smoothing is applied along the length of the hose but not around its circumference.
None: No smoothing is applied.
Segments: Smoothing is applied only on the inner section of the hose.
<Hose>.Renderable_Hose Integer default: 1 -- integer
When on, the hose is rendered using the specified settings. When off, the hose is not
rendered. Default=on.
<Hose>.Hose_Cross_Section_Type Integer default: 0 -- integer
Sets a circular cross-section.
Lets you specify different settings for width and depth.
Similar to Rectangular Hose, but rounds one side for a D-shaped cross-section.
<Hose>.Round_Hose_Diameter Float default: 0.2 -- animatable;
float
The maximum width of the hose at the ends.
Hose - superclass: GeometryClass 147
See Also
GeometryClass Common Properties, Operators, and Methods (p. 852)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Drag - superclass: SpacewarpObject 149
Constructor:
Drag ...
Properties:
<Drag>.‘time on’ Integer default: 0 -- integer; Time_On
The frame numbers at which the space warp becomes active and becomes inactive.
<Drag>.‘time off’ Integer default: 16000 -- animatable; integer;
Time_Off
The frame numbers at which the space warp becomes active and becomes inactive.
<Drag>.symmetry Integer default: 0 -- radio button number;
Damping_Symmetry
This group lets you choose Linear Damping, Spherical Damping, or Cylindrical Damping,
plus a set of parameters for each.
<Drag>.dampingx Float default: 5.0 -- animatable; percentage;
X_Damping; Controller Scaling: (1 : 100.0)
Specifies the percentage of particle motion along the local Drag space warp axis that’s
affected by the damping.
<Drag>.rangex Float default: 100.0 -- animatable; float; X_Range
Sets the thickness of the “range plane,” or the infinite plane perpendicular to the specified
axis. Takes effect only when Unlimited Range is turned off.
<Drag>.falloffx Float default: 1000.0 -- animatable; float;
X_Falloff
Specifies the distance beyond the X, Y, or Z Range within which Linear Damping is
applied. Damping is strongest at the Range distance, decreases linearly out to the limit of
the Falloff, and has no effect beyond that. While Falloff is effected only beyond the Range,
it is measured from the center of the icon, and always has a minimum value equal to the
Range value. Takes effect only when Unlimited Range is turned off.
<Drag>.dampingy Float default: 0.0 -- animatable; percentage;
Y_Damping; Controller Scaling: (1 : 100.0)
Specifies the percentage of particle motion along the local Drag space warp axis that’s
affected by the damping.
150 Chapter 1 | What’s New in 3ds max 4 MAXScript
See Also
Modifier and SpacewarpModifier Types (p. 1100)
MultiRes - superclass: modifier 153
Properties:
<MultiRes>.Vtx_Count Integer default: 0 -- animatable;
integer
The total number of vertices in the modified object. Use this control to set the maximum
number of vertices in the output mesh. Adjusting this setting alters the Percent value
as well.
<MultiRes>.Vertex_Percentage Float default: 100.0 --
animatable; float
The modified object’s vertex count as a percentage of the overall number of vertices in the
original mesh. Adjusting this setting alters the Count value as well.
Note: After you type in a specific percentage, such as 30, you might find that the software
changes the value to a slightly lower one, such as 29.971. This is due to the relationship
between the overall number of vertices in the model and the percentage calculation. It is
not a bug, but simply the closest solution to your request.
<MultiRes>.Vertex_Merging BooleanClass default: false -- boolean
When on, lets MultiRes merge vertices between discrete elements in a model.
For example, if you apply MultiRes to a teapot, which comprises four separate elements,
and turn on Vertex Merging, as you adjust the vertex resolution, the separate components
will meld together into one contiguous lower-resolution object.
To control Vertex Merging, you can set a Merge Threshold. This value determines the
3ds max unit distance within which to merge elements.
<MultiRes>.Threshold Float default: 0.0 -- float
This spinner value sets the maximum distance in 3ds max units between vertices in order
for those vertices to be considered for merging. Once this threshold is achieved, then the
vertices between elements will be welded together as the mesh is reduced in complexity.
Note: To eliminate only coincident vertices, set Merge Threshold to 0.0. This is similar to
the Weld Vertex function.
154 Chapter 1 | What’s New in 3ds max 4 MAXScript
general, crease angles approaching 0 yield smoother shading. Crease angles approaching
180 yield more visible corners.
<MultiRes>.Crease_Angle Float default: 75.0 -- float
The value of the crease necessary in order to generate multiple normals. Available only
when Multiple Normals Per Vertex is on.
The optimal crease angle depends on the model; set it interactively and check the viewport
and rendered images for shading effects. While use of multiple normals per vertex enables
more accurate shading, it can require more internal data.
<MultiRes>.Generate BooleanClass default: false -- boolean
Applies the current MultiRes settings to the modified object. When you first apply
MultiRes to an object, it must initialize its mesh-optimizing algorithm; you are prompted
by the modifier to “Generate when ready”.
Note: When working with complex meshes, the initial analysis may take a little while.
During this time, MultiRes displays a special cursor to indicate it is working. Progress is
indicated on this cursor by the movement of the gray area from top to bottom. To cancel
this process, press ESC.
Example:
modPanel.addModToSelection(MultiRes())
$.modifiers[#MultiRes].Vtx_Count = 482
$.modifiers[#MultiRes].Vertex_Percentage = 100
$.modifiers[#MultiRes].Vertex_Percentage = 99
$.modifiers[#MultiRes].Vtx_Count = 476
$.modifiers[#MultiRes].Vertex_Percentage = 98.7552
$.modifiers[#MultiRes].Vertex_Merging = on
$.modifiers[#MultiRes].Threshold = 0.01
$.modifiers[#MultiRes].Merge_Within = on
$.modifiers[#MultiRes].Boundary_Metric = on
$.modifiers[#MultiRes].Maintain_Base_Vertices = on
$.modifiers[#MultiRes].Crease_Angle = 75.75
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
156 Chapter 1 | What’s New in 3ds max 4 MAXScript
Properties:
<Vortex>.‘time on’ Integer default: 0 -- integer; Time_On
The frame numbers at which the space warp becomes active and becomes inactive.
<Vortex>.‘time off’ Integer default: 16000 -- animatable;
integer; Time_Off
The frame numbers at which the space warp becomes active and becomes inactive.
<Vortex>.axialstrength Float default: 0.1 -- animatable; float;
Axial_Drop_Strength
Specifies how quickly particles move in the direction of the drop axis.
<Vortex>.axialrange Float default: 100.0 -- animatable;
float; Axial_Range
The distance from the center of the Vortex icon, in system units, at which Axial Damping
has its full effect. Takes effect only when Unlimited Range is turned off.
<Vortex>.axialfalloff Float default: 1000.0 -- animatable;
float; Axial_Falloff
Specifies the distance beyond the Axial Range within which Axial Damping is applied.
Axial Damping is strongest at the Range distance, decreases linearly out to the limit of the
Axial Falloff, and has no effect beyond that. Takes effect only when Unlimited Range is
turned off.
<Vortex>.axialdamping Float default: 5.0 -- animatable;
percentage; Axial_Damping; Controller Scaling: (1 : 100.0)
Controls the degree to which particle motion parallel to the drop axis is restrained per
frame. Default=5.0. Range=0 to 100.
For subtle effects, use values of less than 10%. For more overt effects, try using higher
values that increase to 100% over the course of a few frames.
<Vortex>.rotationstrength Float default: 0.5 -- animatable; float;
Orbital_Speed_Strength
Specifies how quickly the particles rotate.
Vortex - superclass: SpacewarpObject 157
See Also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Keys
Bezier Keys inTangentLength and outTangentLength
Topic: version 4 MAXScript Language Improvements/Keys
There are 2 additional properties in MAXScript for bezier keys .inTangentLength and
.outTangentLength. These are the handles’ magnitude in frames.
There is a new check box to the key property/Master Point control dialog found in the Motion Panel.
It is called Free Handle. When Free Handle is checked, the user can move the horizontal handle
where ever s/he feels. Otherwise, s/he is constrained, to prevent discontinuities.
Correspondingly, there is a new bezier key property called .freeHandle that implements the
functionality described above.
Note:
There are a fair number of classes that don’t implement the showproperties method. MAXKey is one
of them. getPropNames is not implemented for it either.
See Also
MAXKey Values (p. 767)
MAXKeyArray Values (p. 793)
MAXKey Common Properties, Operators, and Methods (p. 768)
Working with MAXKey Values (p. 769)
Class and Object Inspector Functions Enhanced 159
See Also
Core Interfaces (p. 70)
Other Interfaces (p. 71)
Renderer
See Also
Controlling the Renderer (p. 1664)
Interface: NetRender (p. 379)
Bitmap Manager – Function Published BMM control 161
SuperClasses
See Also
BMP, PNG, JPEG and TGA I/O Interfaces (p. 164)
BMP interfaces: (p. 437)
Portable Network Graphics interfaces: (p. 473)
JPEG interfaces: (p. 454)
Targa interfaces: (p. 529)
See Also
Render Element Manager (p. 92)
Plug In Manager (p. 86)
Plug-in Manager interfaces: (p. 473)
Visual MAXScript (p. 117)
162 Chapter 1 | What’s New in 3ds max 4 MAXScript
Renderer
Topic: version 4 MAXScript Language Improvements/SuperClasses
A MAXClass wrapper added for the plug-in renderer superclass so that a renderer instances can be
worked with in MAXScript. The new superclass is named “Renderer”.
See Also
Controlling the Renderer (p. 1664)
Interface: NetRender (p. 379)
See Also
Scripted Cameras (p. 94)
Scripted Manipulators (p. 97)
In prior releases, globals had to be declared inside on-handler bodies. Any initializers present in a
global declaration like this are at compile time, so the initial value expressions must be executable
at the time the script is compiled.
See Also
Scope of Variables (p. 646)
See Also
Definition Constructs Can Include Global Variable Declarations At Top Level (p. 162)
Scope of Variables (p. 646)
See Also
Material Editor (p. 1606)
Material Editor Access (p. 165)
Material Level Show-in-viewport State (p. 166)
164 Chapter 1 | What’s New in 3ds max 4 MAXScript
See Also
bitmapTex interfaces: (p. 434)
BitmapTexture : TextureMap (p. 1243)
BMP, PNG, JPEG and TGA I/O Interfaces (p. 164)
Material Editor Access (p. 165)
Accessing The Material Editor Active Slot (p. 163)
Material Level Show-in-viewport State (p. 166)
showTextureMap() function (p. 167)
Prototype:
<boolean>OkMtlForScene <material>mtl
Parameters:
<material>mtl
The pointer to the material.
Return Value:
This method is available in release 4.0 and later only.
Before assigning material to scene, call this to avoid duplicate names.
Prototype:
<void>UpdateMtlEditorBrackets()
Remarks:
This method is available in release 3.0 and later only.
This method makes sure the Materials Editor slots correctly reflect which materials are used in the
scene, which are used by selected objects, etc. This is used internally for the drag-and-drop of
materials to nodes -- there is no reason why a plug-in developer should need to call it.
See Also
Interface: medit (p. 371)
BitmapTex Reload and viewImage (p. 164)
See Also
Material Common Properties, Operators, and Methods (p. 1203)
i-drop - drag and drop (p. 62)
showTextureMap() function 167
showTextureMap() function
Topic: version 4 MAXScript Language Improvements/Material Editor, Material and Textures
The showTextureMap() function has been updated to allow control over material level texture
showing in the viewport. The full form is now:
showTextureMap <material> [<texmap>] <boolean>
If the optional <texmap> is supplied, it must be a direct subtexture of the supplied material and its
show-in-viewport state will be set on or off according to the <boolean> argument. If only a
<material> is supplied, its show-in-viewport state will be set by the <boolean> argument.
Example:
showTextureMap $foo.material on
showTextureMap $foo.material $foo.material.diffusemap off
Note:
Mapping coordinates aren’t explicitly enabled for the objects at creation time. When a script is
run in the Listener, using ‘showTextureMap’ is indirectly turning mapping coordinates on. This
happens during the scene redraw which happens after each line is executed, if needed. If a script
is run from a script editor, or if you put parenthesis around a script, no scene redraw is
performed until the entire script is run. Since no redraw is performed, no mapping coordinates
exist on the object when the script tries to access them. Solutions: explicitly perform a scene
redraw [redrawViews()] after ‘showTextureMap’, or explicitly turn on mapping coordinates for
the object.
See Also
Material Editor (p. 1606)
TextureMap Common Properties, Operators, and Methods (p. 1235)
Material Level Show-in-viewport State (p. 166)
Accessing The Material Editor Active Slot (p. 163)
Material Editor Access (p. 165)
168 Chapter 1 | What’s New in 3ds max 4 MAXScript
User Interface
Angle UI element
Topic: version 4 MAXScript Language Improvements/User Interface
The Angle UI element:
• Display of caption string
• Handling of align layout parameter
• StartDegrees and startRadians properties - controls the zero degrees position
• Dir property - either #cw or #ccw (default #ccw)
• Range property - point3 specifying min, max, and value in degrees.
• If min and max values are the same sign, click and move in angle UI will give result of correct
sign. If min and max are different signs, shift or ctrl click will give negative result, click will give
positive result.
Example:
rollout test “ Angle Test”
(
Angle ang2 “Angle” diameter:40 align:#center range:[-180,180,45] startdegrees:270
dir:#cw
)
createdialog test 200 100
See Also
Rollout User-Interface Controls (p. 1481)
Rollout User-Interface Controls Types (p. 1484)
Rollout User-Interface Controls Common Layout Parameters (p. 1483)
Rollout User-Interface Controls Common Properties (p. 1481)
CreateDialog 169
CreateDialog
Topic: version 4 MAXScript Language Improvements/User Interface
CreateDialog has been enhanced. The prototype is now:
CreateDialog <Rollout> [<height> <width> <position_x> <position_y>] \
[pos:<Point2>] [width:<integer>] [height:<integer>] \
[bgcolor:<color>] [fgcolor:<color>] \
[bitmap:<bitmap>] {bmpstyle:<bmpstyle> \
[menu:<RCMenu>] [style:<array>] [modal:<boolean>]
Modal dialog support added to MAXScript scripter dialogs, those created with the CreateDialog()
function. A new keyword argument can be supplied to the CreateDialog() function,
modal:<boolean>, to control whether the dialog is modal or not. Defaults to modal:false.
A modal dialog ignores all user interactions except those within the dialog. Call DestroyDialog() to
close it, presumably in a scripted OK button, or the like. The user can also close a modal scripted
dialog by hitting the <escape> key.
Associated Methods:
Prototype:
<Point2> GetDialogPos <Rollout>
Remarks:
Returns the position of the Dialog built from the rollout relative to the upper left corner of the screen
in Point2 format.
Prototype:
SetDialogPos <Rollout> <Point2>
Parameters:
<Rollout>
The rollout used to build the Dialog to set the position of.
<Point2>
Position where to place the Dialog.
Remarks:
Sets the position of the dialog built from the rollout relative to the upper left corner of the screen.
See Also
MAXScript Dialogs and Rollout Floaters as Extended viewports (p. 186)
170 Chapter 1 | What’s New in 3ds max 4 MAXScript
Curve Control
Topic: version 4 MAXScript Language Improvements/User Interface
uiFlags:
Any combination of the following flags:
#drawBG, #drawgrid, #upperToolbar, #showReset, #scrollBars, #constrainY,#xvalue
rcmFlags:
Any combination of the following flags:
#move_xy, #move_x, #move_y, #scale, #corner, #bezier, #delete, #all
Properties:
<curvecontrol>.visible : Boolean
<curvecontrol>.x_range : Point2
Curve Control 171
<curvecontrol>.y_range : Point2
<curvecontrol>.displayModes : BitArray
<curvecontrol>.commandMode : Name
<curvecontrol>.zoomValues : Point2
Note:
The following will automatically do a zoom extents all:
zoom <curvecontrol> #all
<curvecontrol>.scrollValues : Point2
<curvecontrol>.curves : Array, read-only
Returns an array of curves of type MAXCurve
Events:
In the following events <ci> represents the active Curve Index.
on <curvecontrol> selChanged <ci> <val> do <expr>
Sent when a point is selected or deselected. <val> is the number of points, which
are selected.
on <curvecontrol> ptChanged <ci> <val> do <expr>
Sent when a point is changed, <val> is the index of the changed point
on <curvecontrol> tangentChanged <ci> <val> type do <expr>
Sent when a point’s in or out tangent is changed, <val> is the index of the changed point
type is #inTangent or #outTangent, depending on what changed.
on <curvecontrol> deleted <ci> <val> do <expr>
Sent when a point is deleted, val is the index of the deleted point.
on <curvecontrol> reset <ci> do <expr>
Sent when a curve is reset
ccCurve represents a single curve in a curve control
Properties:
<ccCurve>.animatable : Boolean
<ccCurve>.color : Color
<ccCurve>.disabledColor : Color
<ccCurve>.width : Integer
<ccCurve>.disabledWidth: Integer
<ccCurve>.disabledStyle : Name
<ccCurve>.style : Name
these are the drawing styles for the curves, can be any one of the following
#solid, #dash, #dot, #dashDot, #dashDotDot, #null, #insideFrame
<ccCurve>.lookupTableSize: Integer
This method sets the size of the Curve Control lookup table. The lookup table allows users of the
Curve Control to easily speed up their value access. The default value for the lookup table size is
1000. Used when getValue() is called on the curve.
172 Chapter 1 | What’s New in 3ds max 4 MAXScript
<ccCurve>.numPoints: Integer
<ccCurve>.points: Array, read-only
Returns a CurvePointsArray
Methods:
getValue ccCurve <time_value> <float_x> [lookup:<false>]
Returns a Point2
isAnimated ccCurve <index>
Returns a Boolean value
getSelectedPts ccCurve
Returns a BitArray
setSelectedPts <ccCurve> <bitarray> [#select] [#deSelect] [#clear]
setPoint <ccCurve> <index> <ccpoint> [checkConstraints:<true>]
getPoint <ccCurve> <index>
insertPoint <ccCurve> <index> <ccpoint>
deletePoint <ccCurve> <index>
CurvePointsArray represents an array of curve points. CurvePointValue represents a
curve point.
CurvePointValue represents a curve point, you create a curve point like:
ccPoint <pt_point2> <in_point> <out_point2> \
[bezier:<false>] [corner:<false>] [lock_x:<false>] [lock_y:<false>] \
[select:<false>] [end:<false>] [noXConstraint:<false>]
Properties:
<ccpoint>.value: Point2
<ccpoint>.inTangent: Point2
<ccpoint>.outTangent: Point2
<ccpoint>.bezier: Boolean
<ccpoint>.corner: Boolean
<ccpoint>.lock_x: Boolean
<ccpoint>.lock_y: Boolean
<ccpoint>.selected: Boolean
<ccpoint>.end: Boolean
<ccpoint>.noXConstraint: Boolean
Example:
rollout uTestCurveControl “Curve Control”(
-- Curve control Properties
local ccProps = #(
#visible,
#numCurves,
#x_range,
#y_range,
#displayModes,
#zoomValues,
#scrollValues,
#commandMode)
Curve Control 173
-- Curve properties
local curveProps = #(
#name,
#animatable,
#color,
#disabledColor,
#width,
#disabledWidth,
#style,
#disabledStyle,
#numPoints,
#lookupTableSize)
on btn_props pressed do
(
local tab = “\t”
-- print the CC properties
format “Curve Control Properties\n”
for p in ccProps do
format (tab + “% : %\n”) (p as string) (getProperty cc_test p)
for p in curveProps do
format (tab + “\t% : %\n”) (p as string) (getProperty crv p)
See Also
Rollout User-Interface Controls (p. 1481)
Rollout User-Interface Controls Types (p. 1484)
Rollout User-Interface Controls Common Layout Parameters (p. 1483)
Rollout User-Interface Controls Common Properties (p. 1481)
getTextExtent
Topic: version 4 MAXScript Language Improvements/User Interface
getTextExtent <string>
Returns a Point2 value containing the size of the string in pixels if it was displayed in a
command panel.
See Also
String Values (p. 722)
176 Chapter 1 | What’s New in 3ds max 4 MAXScript
isActive
Topic: version 4 MAXScript Language Improvements/User Interface
Prototype:
isActive <atmos>
Return Value:
Returns true if the atmospheric is set to active; false otherwise
See Also
Atmospheric Effects Common Properties, Operators, and Methods
Prototype:
isActive <renderEffect>
Return Value:
Returns true if the render effect is set to active; false otherwise
See Also
Render Effects Common Properties, Operators, and Methods (p. 1347)
keyboard.escPressed
Topic: version 4 MAXScript Language Improvements/User Interface
keyboard const StructDef (p. 237)
A new keyboard key-state system variable, keyboard.escPressed. Read-only variable yields true or
false depending on whether the Esc key is currently pressed.
See Also
Keyboard Entry (p. 1623)
3D Studio MAX System Globals (p. 630)
In order to make the menu and CUI files more easily localized, a keyword argument,
GlobalCategory:, has been added to the macroScript facility.
Previously, when a macroScript is assigned to a CUI button or menu item, it is identified in the CUI
or MNU file using the macroScript name and category, like this (from the menu file):
Item6_Action=647394:Isolate`Tools
The problem is when the macroScript is localized, the category is localized but the macroScript name
“Isolate” should not be localized. When it is localized, then the MNU file entry of “Isolate `Tools”
no longer works.
A non-localized category name is needed that would be used to write the operation to MNU and
CUI files.
In this case the macroScript now looks like:
MacroScript Isolate
Category:”Tools”
GlobalCategory:”Tools” -- This is the new keyword
ToolTip:”Isolate Tool”
Icon:#(”ViewPortNavigationControls”,7)
When this macroScript is localized the Category would be translated, but the GlobalCategory
would not.
See Also
3ds max File Loading and Saving (p. 1639)
178 Chapter 1 | What’s New in 3ds max 4 MAXScript
The function returns true of it succeeds and false if it can’t find the named menu.
You can set the quad right-click menu that MAX uses in the viewports using the following
MAXScript:
menuMan.setViewportRightClickMenu #nonePressed “Modeling 2”
Sets the default (no keys pressed) quad menu to “Modeling 2”. The menu name must be a quad
menu that is listed in the “Quads” customization dialog, and the name must match exactly,
including capitalization.
For the first parameter, you can use one of the following 8 values:
#nonePressed
#shiftPressed
#altPressed
#controlPressed
#shiftAndAltPressed
#shiftAndControlPressed
#controlAndAltPressed
#shiftAndAltAndControlPressed
Here are two macroScripts that set and reset two of the right-click menus:
Example:
macroScript SetQuads
category:”Custom UI”
tooltip:”Set Quad”
(
on execute do
(
menuMan.setViewportRightClickMenu #nonePressed “Modeling 2”
menuMan.setViewportRightClickMenu #controlPressed “Sample 4x1”
)
)
------------------------------
macroScript ResetQuads
category:”Custom UI”
Menu and CUI Loading 179
tooltip:”Reset Quads”
(
on execute do
(
menuMan.setViewportRightClickMenu #nonePressed “Default Viewport
Quad”
menuMan.setViewportRightClickMenu #controlPressed “Modeling 1
[Cntrl+RMB]”
)
)
See Also
cui const StructDef (p. 234)
3D Studio MAX System Globals (p. 630)
180 Chapter 1 | What’s New in 3ds max 4 MAXScript
mtlBrowser
Topic: version 4 MAXScript Language Improvements/User Interface
mtlBrowser const StructDef (p. 244)
Prototype:
mtlBrowser.browseFrom [#mtlLibrary | #mtlEditor | #activeSlot | #selected | #scene |
#new]
Remarks:
Lets you set the Browse From: source for the modeless material browser.
See Also
Miscellaneous Dialogs (p. 1621)
SetBackground Method
Topic: version 4 MAXScript Language Improvements/User Interface
Changed SetBackground to take a color in addition to a point3.
Prototype:
setBackGround [<time>] <color>
Remarks:
If the time value is not specified, the current MAXScript time is used.
Prototype:
getBackGround [<time>]
Remarks:
Gets method that parallels setBackGround method.
See Also
Working with Atmospherics (p. 1345)
mouseTrack() Function
Topic: version 4 MAXScript Language Improvements/User Interface
While the tracking is going on, this function is called whenever a mouse action occurs, such as a
button click or a drag, etc. The function has the form:
mouseTrack [on:<node>] [prompt:”msg”] [snap:#2D|#3D]
[trackCallback:fn|#(fn,arg)]
mouseTrack() Function 181
Parameters:
on:<node>
Optionally specifies a scene object to track on. If you don’t supply an object, the
mouse tracks on the current active grid. Note that the object surface tracker uses
the SDK function IntersectRay() which is not reliably implemented on all object
types. Editable meshes always work OK, so you can convertToMesh() if needed.
prompt:”msg”
Displays the prompt message in the MAX status line
snap:#2D|#3D
Relevant when not tracking on an object surface (no on:<node> specified). If snap
mode is on and #2D is supplied, snaps to snap points on grid, if #3D is specified
snaps to any near snap point in space.
trackCallback:fn|#(fn,arg)
Is where you specify the function to be called as the mouse is dragged over the
active grid or object surface. You can specify it is a single function or a function
and an argument value in a two element array. The latter form is useful if you
have a common callback function for many tasks and want to send in a parameter
to control its operation for a particular use. The function you give must be of the
following form:
fn callback_fn msg ir obj faceNum shift ctrl alt = ...
in other words, a scripted function of 7 arguments. While the tracking is going
on, it is called whenever a mouse action occurs, such as a button click or a
drag, etc.
The ‘msg’ argument is a message code that indicates what kind of action occurred, and can be one of:
#freeMove - means the mouse is moved without a button being pressed
#mousePoint - means the left mouse button has just been pressed
#mouseMove - means the mouse is being dragged with the left button down
#mouseAbout - means the right mouse button was clicked, normally meaning cancel
Parameters:
‘ir’
The grid or surface intersection normal Ray at the current mouse position. The ray
has a .pos property giving the point in space of the normal and a .dir property
giving the normal’s direction vector.
‘obj’
The object being dragged over or undefined if no on:<node> was supplied.
‘faceNum’
The number of the face the mouse is over if the object being tracked is an editable
mesh, undefined otherwise.
182 Chapter 1 | What’s New in 3ds max 4 MAXScript
See Also
Rollout User-Interface Controls (p. 1481)
snapMode
Topic: version 4 MAXScript Language Improvements/User Interface
snapMode const StructDef (p. 254)
Prototype:
snapMode.active
Remarks:
Lets you get and set a Boolean value defining the Snap toggle state - on (true) or off (false).
Prototype:
snapMode.type
Remarks:
Lets you get and set a Name value defining whether 2D (#2D), 2.5D (#2_5D), or 3D (#3D)
is the current snap type.
See Also
3D Studio MAX System Globals (p. 630)
See Also
Spinner (p. 1509)
Rollout User-Interface Controls (p. 1481)
Rollout User-Interface Controls Types (p. 1484)
Rollout User-Interface Controls Common Layout Parameters (p. 1483)
Rollout User-Interface Controls Common Properties (p. 1481)
Timer UI element
Topic: version 4 MAXScript Language Improvements/User Interface
The Timer UI element has been enhanced in the following ways:
• The initial state of timer now respects the timer’s .active parameter.
• A new .ticks read/write property which is incremented by 1 at each ‘tick’ of the timer.
See Also
Timer (p. 1512)
Rollout User-Interface Controls (p. 1481)
Rollout User-Interface Controls Types (p. 1484)
Rollout User-Interface Controls Common Layout Parameters (p. 1483)
Rollout User-Interface Controls Common Properties (p. 1481)
See Also
Interface: timeSlider (p. 428)
184 Chapter 1 | What’s New in 3ds max 4 MAXScript
will generate an undo-block for all the operations in the block-expression following the
prefix, which will display in the undo/redo lists with the given string as its name. The
name must be a literal string and is optional, and will default to “MAXScript”.
See Also
undo (p. 687)
Sticky Contexts (p. 689)
Zoom to Bounds
Topic: version 4 MAXScript Language Improvements/User Interface
ZoomToBounds just zooms the current or selected viewport to a bounding region.
Prototype:
Viewport.ZoomToBounds <A_Point3> <B_Point3> <All_Bool>
Parameters:
A_Point3 and B_Point3 define the bounding region to zoom to.
All_Bool determines whether only the selected or all viewports get zoomed
See Also
viewport const StructDef (p. 258)
Customize The Order of Rollup Pages 185
See Also
Interface: cmdPanel (p. 356)
Rollout Systems ‘category’ Mechanism (p. 188)
Rollout User-Interface Controls (p. 1481)
Rollout User-Interface Controls Types (p. 1484)
Rollout User-Interface Controls Common Layout Parameters (p. 1483)
Rollout User-Interface Controls Common Properties (p. 1481)
Visual MAXScript (p. 117)
186 Chapter 1 | What’s New in 3ds max 4 MAXScript
See Also
ActiveX Controls in MAXScript Rollouts (p. 10)
See Also
Rollout User-Interface Controls (p. 1481)
Rollout User-Interface Controls Types (p. 1484)
Rollout User-Interface Controls Common Properties (p. 1481)
Rollout User-Interface Controls Common Layout Parameters (p. 1483)
See Also
Rollout User-Interface Controls (p. 1481)
Rollout User-Interface Controls Types (p. 1484)
Rollout User-Interface Controls Common Properties (p. 1481)
Customize The Order of Rollup Pages (p. 185)
Interface: cmdPanel (p. 356)
Rollout User-Interface Controls Common Layout Parameters (p. 1483)
Visual MAXScript (p. 117)
Const Class
When you say something like “fn test val = ...”, a MAXScriptFunction value is created and stored
in variable test. If variable test was passed into another method, for example as a filter function, that
method would test the class of the value to make sure it’s a MAXScriptFunction and then call it using
apply().
The ‘Const’ preceding the following simply says that it is a value that is created during MAXScript
initialization.
A Generic is one or more methods with the same name, but defined for different classes. Which
method is called depends on the class of the first argument to the method. For example, ‘random’
is declared as a Generic, and there are methods implementing ‘random’ in several classes - Integer,
Float, Point3, Color, Quat, etc. When MAXScript sees ‘random v1 v2’ in a script, it looks at the class
of v1, and then calls the ‘random’ method for that class. So if v1 were a float, MAXScript would call
the Float::random() method.
A MappedGeneric is the same as a Generic, but the first argument can be a collection. If it is a
collection, the the method is called individually on each member of the collection. For example,
‘deleteTime $box* 10f 10f’ deletes 10f at frame 10 in all keys in all objects named $box*. deleteTime
can also be used on controllers, that’s why it is a Generic
A NodeGeneric is the same as a MappedGeneric, but its first argument has to be a node or a
collection of nodes. But given the definition of Generic, that doesn’t make much sense. If the first
argument is a collection, and the method is applied to each member of the collection.
Primitives are methods that aren’t class specific. The method is responsible for checking the types
of its arguments (if any) and throwing an error if one isn’t correct. There is only one definition of
the Primitive.
A StructDef is a structure value. If the structure value is created by a script, its class is StructDef. If
MAXScript creates the structure during initialization, its class is Const StructDef. So, for example,
my meshop methods are defined to exist in a structure called meshop. Since this structure is created
during initialization, the class of meshop is Const StructDef.
Const Class is just a class that is defined in MAXScript itself. So, for example, BitArray is a Const
Class. MAXScript also scans the classes registered with MAX - these classes will be created in
MAXScript as Const MAXClass.
190 Chapter 1 | What’s New in 3ds max 4 MAXScript
See Also
MAXScriptFunction List (p. 190)
Const Generic (p. 195)
Const MappedGeneric (p. 207)
Const NodeGeneric (p. 209)
Const Primitives (p. 213)
Const StructDef (p. 231)
Const Class (p. 191)
MAXScriptFunction List
AddConstraint Controller Functions for use with Constraint Assignments (p. 42)
Camera Common Properties, Operators, and Methods (p. 974) - in example
Scripted Geometry Plug-ins (p. 1555) - in example
Scripted Shape Plug-ins (p. 1560) - in example
Scripted SimpleObject Plug-ins (p. 1556) - in example
The Return Expression (p. 705) - in example
Time Values (p. 751)
AddConstraintTargets Controller Functions for use with Constraint Assignments (p. 42)
AddListController Controller Functions for use with Constraint Assignments (p. 42)
AddMod
ApplyOperation ApplyOperation function (p. 54)
ChangeSystemColorsAnimateOff
ChangeSystemColorsAnimateOn
help
KindOfRenderElement
RElements2cws
SaveQuadClr
SetActiveController Controller Functions for use with Constraint Assignments (p. 42)
show “Apropos” and “ShowProperties” and now “Help” and “Show” (p. 128)
TurnToSeq
See Also
Definitions for MAXScript internal organization (p. 188)
Const Class 191
Const Class
ActionPredicate
ActiveXControl ActiveX Controls in MAXScript Rollouts (p. 10) - in example with
def
AngleAxis
AngleControl
Array
ArrayParameter
AtmosphericClass MAXScript Class Hierarchy (p. 1688)
BigMatrix BigMatrix Values (p. 748) - in example with def
Basic Data Values (p. 717)
Const Generic (p. 195) – links
Const MappedGeneric (p. 207)
MAXScript Class Hierarchy (p. 1688)
BigMatrixRowArray BigMatrix Values (p. 748) - in example with def
MAXScript Class Hierarchy (p. 1688)
BinStream
BipedExportInterface
BipedFSKey
BipedGeneric
BipedKey
BitArray
bitmap
BitmapControl
BooleanClass
Box2
ButtonControl
ccCurve
ccPoint
CCRootClass
ChangeHandler
CharStream
CheckBoxControl
CheckButtonControl
class
color
ColorPickerControl
ComboBoxControl
Control
CTBitMap
CTMotionTracker
CurveCtlGeneric
CurvePointsArray
EdgeSelection
EditTextControl
EffectClass
EmptyClass
EulerAngles
FaceSelection
192 Chapter 1 | What’s New in 3ds max 4 MAXScript
FileStream
float
Function
Generic
GeomObject
GroupBoxControl
GroupEndControl
GroupStartControl
HashTable
ImgTag
integer
Interface
InterfaceFunction
Interval
IObject
LabelControl
LinkControl
ListBoxControl
MapButtonControl
MappedGeneric
MappedPrimitive
MapSupportClass
MaterialLibrary
Matrix3
MAXAKey
MAXClass
MAXCurveCtl
MAXFilterClass
MAXKey
MAXKeyArray
MAXMeshClass
MAXModifierArray
MAXNoteKey
MAXNoteKeyArray
MAXObject
MAXRefTarg
MAXRootNode
MAXScriptFunction
MAXSuperClass
MAXTVNode
MeditMaterialsClass
menuitem
MixinInterface
ModifierClass
MoFlow
MoFlowScript
MoFlowSnippet
MoFlowTranInfo
MoFlowTransition
MotionTracker
MouseTool
Const Class 193
MSBipedRootClass
MSComMethod
MSCustAttribDef
MSDispatch
MSPluginClass
MtlButtonControl
MultiListBoxControl
MultiMaterialClass
MultipleFSParams
name
NodeChildrenArray
NodeGeneric
NoteTrack
Number
NURBS1RailSweepSurface
NURBS2RailSweepSurface
NURBSBlendCurve
NURBSBlendSurface
NURBSCapSurface
NURBSChamferCurve
NURBSControlVertex
NURBSCurve
NURBSCurveConstPoint
NURBSCurveIntersectPoint
NURBSCurveOnSurface
NURBSCurveSurfaceIntersectPoint
NURBSCVCurve
NURBSCVSurface
NURBSDisplay
NURBSExtrudeSurface
NURBSFilletCurve
NURBSFilletSurface
NURBSIndependentPoint
NURBSIsoCurve
NURBSLatheSurface
NURBSMirrorCurve
NURBSMirrorSurface
NURBSMultiCurveTrimSurface
NURBSNBlendSurface
NURBSObject
NURBSOffsetCurve
NURBSOffsetSurface
NURBSPoint
NURBSPointConstPoint
NURBSPointCurve
NURBSPointCurveOnSurface
NURBSPointSurface
NURBSProjectNormalCurve
NURBSProjectVectorCurve
NURBSRuledSurface
NURBSSelection
194 Chapter 1 | What’s New in 3ds max 4 MAXScript
NURBSSet
NURBSSurface
NURBSSurfaceApproximation
NURBSSurfaceEdgeCurve
NURBSSurfaceNormalCurve
NURBSSurfConstPoint
NURBSSurfSurfIntersectionCurve
NURBSTexturePoint
NURBSTextureSurface
NURBSULoftSurface
NURBSUVLoftSurface
NURBSXFormCurve
NURBSXFormSurface
object
ObjectSet
OkClass
OLEMethod
OLEObject
PathName
PhyBlendedRigidVertex
PhyContextExport
PhyRigidVertex
PickerControl
Point2
point3
Primitive
progressBar
Quat
RadioControl
Ray
RCMenu
RolloutClass
RolloutControl
RolloutFloater
SelectionSet
SelectionSetArray
set
SliderControl
SpinnerControl
StandardMaterialClass
StaticMethodInterface
String
StringStream
StructDef
subAnim
TxtureClass
time
Timer
TriMesh
UndefinedClass
UnsuppliedClass
Const Generic 195
UserGeneric
value
ValueRef
VertexSelection
WindowStream
XRefScene
See Also
Definitions for MAXScript internal organization (p. 188)
Const Generic
abs Number Values (p. 717) - in example with def
Camera Common Properties, Operators, and Methods (p. 974) - in example
Scripted Geometry Plug-ins (p. 1555) - in example
Scripted Shape Plug-ins (p. 1560) - in example
Scripted SimpleObject Plug-ins (p. 1556) - in example
The Return Expression (p. 705) - in example
Time Values (p. 751)
addMultiplierCurve Controller Ease and Multiplier Curve Functions (p. 1297) - in example with def
addNewNoteKey MAXNoteKeyArray Values (p. 817) - in example
MAXNoteKey Values (p. 818) - in example
Working with Note Tracks (p. 818) - in example
addNewNoteKey MAXNoteKeyArray Values (p. 817) - in example
MAXNoteKey Values (p. 818) - in example
Working with Note Tracks (p. 818) - in example
addPluginRollouts Scripted Plug-in Methods (p. 1551)
AllowBlending PhyContextExport Values (p. 1458)
append
appendCurve NURBS1RailSweepSurface : NURBSSurface (p. 1427)
NURBS2RailSweepSurface : NURBSSurface (p. 1429)
NURBSMultiCurveTrimSurface : NURBSSurface (p. 1438)
NURBSULoftSurface : NURBSSurface (p. 1443)
appendCurveByID NURBS1RailSweepSurface : NURBSSurface (p. 1427)
NURBS2RailSweepSurface : NURBSSurface (p. 1429)
NURBSMultiCurveTrimSurface : NURBSSurface (p. 1438)
NURBSULoftSurface : NURBSSurface (p. 1443)
appendGizmo Atmospheric Effects Common Properties, Operators, and Methods (p. 1338)
Working with Atmospherics (p. 1345) - example
196 Chapter 1 | What’s New in 3ds max 4 MAXScript
getObject Patches
GetOffsetVector Biped and Physique (p. 1456) - in example
getParent NURBSBlendSurface : NURBSSurface (p. 1430)
NURBSFilletSurface : NURBSSurface (p. 1436)
NURBSMultiCurveTrimSurface : NURBSSurface (p. 1438)
NURBSNBlendSurface : NURBSSurface (p. 1439)
Trackviews (p. 114)
getParentID NURBSBlendSurface : NURBSSurface (p. 1430)
NURBSFilletSurface : NURBSSurface (p. 1436)
NURBSMultiCurveTrimSurface : NURBSSurface (p. 1438)
NURBSNBlendSurface : NURBSSurface (p. 1439)
getPixels Bitmap Files (p. 1641)
Scripted RenderEffect Plug-ins (p. 1566)
getPoint NURBSIndependentPoint : NURBSPoint (p. 1406)
NURBSPointCurve : NURBSCurve (p. 1418)
NURBSPointSurface : NURBSSurface (p. 1441)
NURBSTexturePoint : NURBSObject (p. 1446)
NURBSTextureSurface : Value (p. 1455)
Curve Control (p. 170)
Scripted Manipulators (p. 97)
getProdTess NURBSSet : Value (p. 1450)
NURBSSurface : NURBSObject (p. 1425)
getPropNames Class and Object Inspector Functions (p. 799)
Array Values (p. 776) - in example
ActiveX Controls in MAXScript Rollouts (p. 10)
Scripted Manipulators (p. 97) - in example
getRadius NURBSFilletSurface : NURBSSurface (p. 1436)
getSeed NURBSFilletSurface : NURBSSurface (p. 1436)
getSplitMesh Editable Mesh : GeometryClass and TriMesh : Value (p. 1041)
getSubAnim Indexed Access to Animatable Properties in 3D Studio MAX Objects (p. 806)
getSubAnimName Indexed Access to Animatable Properties in 3D Studio MAX Objects (p. 806)
Subanim Indexing Operator, [], on MAX Objects Now Takes Subanim Names (p. 139)
getSubAnimNames Indexed Access to Animatable Properties in 3D Studio MAX Objects (p. 806)
Subanim Indexing Operator, [], on MAX Objects Now Takes Subanim Names (p. 139)
getSubdivisionDisplacement Editable Mesh : GeometryClass and TriMesh : Value (p. 1041)
getTextureSurface NURBSSurface : NURBSObject (p. 1425)
NURBSTextureSurface : Value (p. 1455)
getTextureUVs NURBSSurface : NURBSObject (p. 1425)
getTiling NURBSSurface : NURBSObject (p. 1425)
getTilingOffset NURBSSurface : NURBSObject (p. 1425)
Const Generic 201
See Also
Definitions for MAXScript internal organization (p. 188)
Const MappedGeneric
addEaseCurve Controller Ease and Multiplier Curve Functions (p. 1297)
Nested Object Controller Functions (p. 814)
Time and Key Functions on Object Hierarchies (p. 1299)
addNewKey MAXKey Common Properties, Operators, and Methods (p. 768)
deleteEaseCurve Controller Ease and Multiplier Curve Functions (p. 1297)
Nested Object Controller Functions (p. 814)
Time and Key Functions on Object Hierarchies (p. 1299)
deleteKeys MAXKeyArray Values (p. 793)
Nested Object Controller Functions (p. 814)
Time and Key Functions on Object Hierarchies (p. 1299)
Controller Key Functions (p. 1294)
deleteTime Controller Time Functions (p. 1292)
Nested Object Controller Functions (p. 814)
Time and Key Functions on Object Hierarchies (p. 1299)
deselectKeys Nested Object Controller Functions (p. 814)
Time and Key Functions on Object Hierarchies (p. 1299)
Controller Key Functions (p. 1294)
enableORTs Controller Out-Of-Range Functions (p. 1296)
Nested Object Controller Functions (p. 814)
Time and Key Functions on Object Hierarchies (p. 1299)
Identity BigMatrix Values (p. 748)
insertTime Controller Time Functions (p. 1292)
Nested Object Controller Functions (p. 814)
Time and Key Functions on Object Hierarchies (p. 1299)
mapKeys mapKeys() method (p. 144)
moveKeys MAXKeyArray Values (p. 793)
Controller Key Functions (p. 1294)
Nested Object Controller Functions (p. 814)
Time and Key Functions on Object Hierarchies (p. 1299)
Orthogonalize Matrix3 Values (p. 744)
PreRotate Matrix3 Values (p. 744)
PreRotateX Matrix3 Values (p. 744)
PreRotateY Matrix3 Values (p. 744)
PreRotateZ Matrix3 Values (p. 744)
PreScale Matrix3 Values (p. 744)
208 Chapter 1 | What’s New in 3ds max 4 MAXScript
See Also
Definitions for MAXScript internal organization (p. 188)
Const NodeGeneric
addAndWeld SplineShape : Shape (p. 1079)
addKnot SplineShape : Shape (p. 1079)
addModifier
addNewSpline SplineShape : Shape (p. 1079)
addNURBSSet Modifying Existing NURBS Objects (p. 1390)
NURBS Node Properties and Methods (p. 1397)
Parameter Ranges for Curves and Surfaces (p. 1391)
bindKnot SplineShape : Shape (p. 1079)
bindSpaceWarp
breakCurve NURBS Node Properties and Methods (p. 1397)
breakSurface Modifying Existing NURBS Objects (p. 1390)
NURBS Node Properties and Methods (p. 1397)
collapseStack Editable Mesh : GeometryClass and TriMesh : Value (p. 1041)
Modifier Common Properties, Operators, and Methods (p. 1096)
Node Common Properties, Operators, and Methods (p. 820)
Patch : GeometryClass (p. 1088)
convertTo Editable Mesh : GeometryClass and TriMesh : Value (p. 1041)
Node Common Properties, Operators, and Methods (p. 820)
NURBS Node Properties and Methods (p. 1397)
Patch : GeometryClass (p. 1088)
Patches (p. 55)
convertToMesh
convertToNURBSCurve Collections (p. 773)
Node Common Properties, Operators, and Methods (p. 820)
NURBS Node Properties and Methods (p. 1397)
convertToNURBSSurface Node Common Properties, Operators, and Methods (p. 820)
NURBS Node Properties and Methods (p. 1397)
convertToPoly
convertToSplineShape Modifier Common Properties, Operators, and Methods (p. 1096)
Node Common Properties, Operators, and Methods (p. 820)
NURBS Node Properties and Methods (p. 1397)
Scripting Vertex and Control Point Animation (p. 1461)
Section : Shape (p. 959)
SplineShape : Shape (p. 1079)
copy
210 Chapter 1 | What’s New in 3ds max 4 MAXScript
reverse
rotate
scale
select
selectmore Node Common Properties, Operators, and Methods (p. 820)
ObjectSet Values (p. 781) - In Example With Def
setEdgeSelection polyop const StructDef (p. 248)
Editable Mesh : GeometryClass and TriMesh : Value (p. 1041) - In Example
setFaceSelection polyop const StructDef (p. 248)
Editable Mesh : GeometryClass and TriMesh : Value (p. 1041) - In Example
setFirstKnot SplineShape : Shape (p. 1079)
setFirstSpline SplineShape : Shape (p. 1079)
setInVec SplineShape : Shape (p. 1079)
setKnotPoint SplineShape : Shape (p. 1079)
setKnotType SplineShape : Shape (p. 1079)
setOutVec SplineShape : Shape (p. 1079)
setRenderApproximation NURBS Node Properties and Methods (p. 1397)
NURBSSurfaceApproximation : Value (p. 1453)
setSegmentType SplineShape : Shape (p. 1079)
setSurfaceDisplay NURBS Node Properties and Methods (p. 1397)
NURBSSurfaceApproximation : Value (p. 1453)
setUserProp Node Common Properties, Operators, and Methods (p. 820)
Node User-Defined Properties and Methods (p. 848) - In Example With Def
setUserPropBuffer Node Common Properties, Operators, and Methods (p. 820)
Node User-Defined Properties and Methods (p. 848) - In Example With Def
setVertSelection Editable Mesh : GeometryClass and TriMesh : Value (p. 1041) - In Example With Def
polyop const StructDef (p. 248)
setViewApproximation NURBS Node Properties and Methods (p. 1397)
NURBSSurfaceApproximation : Value (p. 1453)
snapShot Editable Mesh : GeometryClass and TriMesh : Value (p. 1041)
Node Common Properties, Operators, and Methods (p. 820)
unbindKnot SplineShape : Shape (p. 1079)
unfreeze MAX Commands (p. 1630)
MAX Commands in MAXScript (p. 620)
Node Common Properties, Operators, and Methods (p. 820)
Unwrap UVW interfaces: (p. 530)
UVWUnwrap interfaces: (p. 568)
Visual MAXScript (p. 117)
unhide
unhideSegments SplineShape : Shape (p. 1079)
Const Primitives 213
See Also
Definitions for MAXScript internal organization (p. 188)
Const Primitives
All known const Primitives.
getListenerSel Controlling the Listener Contents and the Insertion Point (p. xlii)
getListenerSelText Controlling the Listener Contents and the Insertion Point (p. xlii)
getMaterialID SplineShape : Shape (p. 1079)
getMatLibFileName Material Editor (p. 1606)
MaterialLibrary Values (p. 795)
getMAXFileObjectNames 3ds max File Loading and Saving (p. 1639)
Zip-file Script Packages (p. 122)
getMAXOpenFileName MAX Open & Save Dialogs (p. 177)
getMAXSaveFileName MAX Open & Save Dialogs (p. 177)
getMeditMaterial Material Common Properties, Operators, and Methods (p. 1203)
Material Editor (p. 1606)
MaterialLibrary Values (p. 795)
getMKKey Barycentric Morph Controller : MorphController (p. 1306)
Barycentric Morph Controller Keys (p. 1308)
getMKKeyIndex Barycentric Morph Controller : MorphController (p. 1306)
getMKTargetNames Barycentric Morph Controller : MorphController (p. 1306)
getMKTargetWeights Barycentric Morph Controller : MorphController (p. 1306)
getMKTime Barycentric Morph Controller Keys (p. 1308)
getMKWeight Barycentric Morph Controller Keys (p. 1308)
getMTLMEditFlags Material Common Properties, Operators, and Methods (p. 1203)
getMTLMeditObjType Material Common Properties, Operators, and Methods (p. 1203)
getMTLMeditTiling Material Common Properties, Operators, and Methods (p. 1203)
getNamedSelSetItem SelectionSetArray Values (p. 783)
getNamedSelSetItemCount SelectionSetArray Values (p. 783)
getNamedSelSetName SelectionSetArray Values (p. 783)
getNodeByName Node Common Properties, Operators, and Methods (p. 820)
getNoteTrack Notetrack Values (p. 816)
MAXNoteKeyArray Values (p. 817)
Working with Note Tracks (p. 818)
getNumAxis Main Toolbar (p. 1574)
getNumberDisplayFilters Selection Filter (p. 61)
getNumberSelectFilters Selection Filter (p. 61)
getNumNamedSelSets SelectionSetArray Values (p. 783)
getOpenFileName Standard Open and Save File Dialogs (p. 1643)
ActiveX Controls in MAXScript Rollouts (p. 10) – in example
getPatchSteps Patch : GeometryClass (p. 1088)
getPhyContextExport Biped and Physique (p. 1456)
PhyContextExport Values (p. 1458)
getPointController Controller Common Properties, Operators, and Methods (p. 1289)
220 Chapter 1 | What’s New in 3ds max 4 MAXScript
GetTMController
gettoolbtnstate Main Toolbar (p. 1574)
getTrajectoryOn Node Common Properties, Operators, and Methods (p. 820)
getTransformAxis Node Common Properties, Operators, and Methods (p. 820)
getTransformLockFlags Node Common Properties, Operators, and Methods (p. 820)
GetUIColor 3ds max User Interface Colors (p. 1604)
getUseDraftRenderer Render Scene Dialog (p. 1611)
getUseEnvironmentMap Working with Atmospherics (p. 1345)
getViewFOV Accessing Active Viewport Info, Type, and Transforms (p. 1581)
getViewSize Accessing Active Viewport Info, Type, and Transforms (p. 1581)
ActiveX Controls in MAXScript Rollouts (p. 10) - in example
getViewTM Accessing Active Viewport Info, Type, and Transforms (p. 1581)
getVisController General Node Properties (p. 836)
Node Common Properties, Operators, and Methods (p. 820)
getVPortBGColor Miscellaneous Viewport Methods and System Globals (p. 1603)
getXYZControllers XYZ Controllers (p. 1335)
group Node Common Properties, Operators, and Methods (p. 820)
hasNoteTracks Notetrack Values (p. 816)
Working with Note Tracks (p. 818) - in example
hasProperty hasProperty() function (p. 135)
HitByNameDlg Main Toolbar (p. 1574)
holdMaxFile 3ds max File Loading and Saving (p. 1639)
importFile Zip-file Script Packages (p. 122)
3ds max File Loading and Saving (p. 1639)
include Including Scripts Within Scripts (p. lix)
Symbolic Pathnames (p. 140)
insertItem Array Values (p. 776)
interpCurve3D SplineShape : Shape (p. 1079)
intersectRayEx Node Common Properties, Operators, and Methods (p. 820)
invalidateTM Node Common Properties, Operators, and Methods (p. 820)
invalidateTreeTM Node Common Properties, Operators, and Methods (p. 820)
invalidateWS Node Common Properties, Operators, and Methods (p. 820)
isActive
isBoneOnly Node Common Properties, Operators, and Methods (p. 820)
isController Value Common Properties, Operators, and Methods (p. 714)
isCPEdgeOnInView Miscellaneous Viewport Methods and System Globals (p. 1603)
isCreatingObject
isGroupHead Node Common Properties, Operators, and Methods (p. 820)
222 Chapter 1 | What’s New in 3ds max 4 MAXScript
See Also
Definitions for MAXScript internal organization (p. 188)
Const StructDef 231
Const StructDef
AttachCtrl (p. 232)
autoBackup (p. 232)
bit (p. 233)
boolObj (p. 233)
callbacks (p. 233)
cui (p. 234)
custAttributes (p. 234)
DOF (p. 234)
fileProperties (p. 235)
flexOps (p. 235)
gw (p. 235)
ik (p. 237)
keyboard (p. 237)
LE (p. 237)
LinkCtrl (p. 238)
ListCtrl (p. 238)
logsystem (p. 238)
macros (p. 239)
mapPaths (p. 239)
meshop (p. 239)
meshOps (p. 243)
modPanel (p. 244)
mouse (p. 244)
mtlBrowser (p. 244)
options (p. 245)
patch (p. 245)
patchOps (p. 247)
persistents (p. 247)
polyop (p. 248)
polyOps (p. 251)
patch.getEdgeVec21
preferences (p. 252)
refs (p. 252)
scanlineRender (p. 252)
schematicView (p. 252)
232 Chapter 1 | What’s New in 3ds max 4 MAXScript
See Also
Definitions for MAXScript internal organization (p. 188)
See Also
PositionSpring interfaces: (p. 497)
Point3Spring interfaces: (p. 482)
SpringPoint3Controller interfaces: (p. 523)
SpringPoint3Controller - superclass: Point3Controller (p. 336)
SpringPositionController interfaces: (p. 526)
SpringPositionController - superclass: PositionController (p. 337)
Flex : Modifier (p. 1128)
Flex interfaces: (p. 438)
flexOps const StructDef (p. 235)
gw const StructDef
Viewport Drawing Methods (p. 1592)
gw.clearScreen
gw.enlargeUpdateRect
gw.GetCPDisp
gw.getDriverString
gw.getFlipped
gw.GetFocalDist
gw.getHitherCoord
gw.getMaxLights
236 Chapter 1 | What’s New in 3ds max 4 MAXScript
gw.GetPointOnCP
gw.getRndLimits
gw.getRndMode
gw.getSkipCount
gw.getUpdateRect
gw.getViewportDib
gw.GetVPWorldWidth
gw.getWinDepth
gw.getWinSizeX
gw.getWinSizeY
gw.getYonCoord
gw.hMarSker
gw.hPolygon
gw.hPolyline
gw.hText
gw.hTransPoint
gw.hTriStrip
gw.isPerspectiveView
gw.IsPerspView
gw.MapCPToWorld
gw.marker
gw.NonScalingObjectSize
gw.polygon
gw.polyline
gw.querySupport
gw.resetUpdateRect
gw.setColor
gw.setPos
gw.setRndLimits
gw.setSkipCount
gw.setTransform
gw.SnapLength
gw.SnapPoint
gw.text
gw.transPoint
gw.updateScreen
gw.wMarker
gw.wPolygon
gw.wPolyline
gw.wText
gw.wTransPoint
gw.wTriStrip
See Also
Accessing Active Viewport Info, Type, and Transforms (p. 1581)
ik const StructDef 237
ik const StructDef
IK_ControllerMatrix3Controller : Matrix3Controller (p. 1313)
ik.getBindOrient
ik.getBindPos
ik.GetEndTime
ik.getIsTerminator
ik.GetIterations
ik.getPinNode
ik.GetPosThreshold
ik.getPrecedence
ik.GetRotThreshold
ik.GetStartTime
ik.setBindOrient
ik.setBindPos
ik.SetEndTime
ik.setIsTerminator
ik.SetIterations
ik.setPinNode
ik.SetPosThreshold
ik.setPrecedence
ik.SetRotThreshold
ik.SetStartTime
LE const StructDef
Lens Effects : RenderEffect (p. 1357)
LE.addASec
LE.addGlow
LE.addLight
LE.addLightNode
LE.addMSec (p. 1366)
LE.addRay
LE.addRing
LE.addStar
LE.addStreak (p. 1379)
LE.deleteElement
LE.deleteElementByName
LE.deleteLight
238 Chapter 1 | What’s New in 3ds max 4 MAXScript
LE.deleteLightByName
LE.lightIndex
LE.lightName
LE.load
LE.numLights
LE.save
See Also
List Controllers (p. 1317)
See Also
List Controllers (p. 1317)
logsystem const StructDef 239
meshop.deleteMapVertSet
meshop.deleteVerts
meshop.detachFaces
meshop.detachVerts
meshop.divideEdge
meshop.divideEdges
meshop.divideFace
meshop.divideFaceByEdges
meshop.divideFaces
meshop.edgeTessellate
meshop.explodeAllFaces
meshop.explodeFaces
meshop.extrudeEdges
meshop.extrudeFaces
meshop.flipNormals
meshop.freeMapChannel
meshop.freeMapFaces
meshop.freeMapVerts
meshop.freeVAlphas
meshop.freeVData
meshop.freeVertCorners
meshop.freeVertWeights
meshop.freeVSelectWeights
meshop.getAffectBackfacing
meshop.getBaryCoords
meshop.getBubble
meshop.getDisplacementMapping
meshop.getEdgesReverseEdge
meshop.getEdgesUsingFace
meshop.getEdgesUsingVert
meshop.getElementsUsingFace
meshop.getExtrusionType
meshop.getFaceArea
meshop.getFaceCenter
meshop.getFaceRNormals
meshop.getFacesUsingEdge
meshop.getFacesUsingVert
meshop.getFalloff
meshop.getHiddenFaces
meshop.getHiddenVerts
meshop.getIgnoreBackfacing
meshop.getIgnoreVisEdges
meshop.getIsoMapVerts
meshop.getIsoVerts
meshop.getMapFace
meshop.getMapFacesUsingMapVert
meshop.getMapSupport
meshop.getMapVert
meshop.getMapVertsUsingMapFace
meshop.getNormalSize
meshop.getNumCPVVerts
meshop const StructDef 241
meshop.getNumFaces
meshop.getNumMapFaces
meshop.getNumMaps
meshop.getNumMapVerts
meshop.getNumTVerts
meshop.getNumVDataChannels
meshop.getNumVerts
meshop.getOpenEdges
meshop.getPinch
meshop.getPlanarThreshold
meshop.getPolysUsingEdge
meshop.getPolysUsingFace
meshop.getPolysUsingVert
meshop.getSelByVertex
meshop.getShowFNormals
meshop.getShowVNormals
meshop.getSoftSel
meshop.getSplitMesh
meshop.getSSEdgeDist
meshop.getSSUseEdgeDist
meshop.getSubdivisionAngle
meshop.getSubdivisionDisplacement
meshop.getSubdivisionDistance
meshop.getSubdivisionEdge
meshop.getSubdivisionMaxLevels
meshop.getSubdivisionMaxTriangles
meshop.getSubdivisionMethod
meshop.getSubdivisionMinLevels
meshop.getSubdivisionSteps
meshop.getSubdivisionStyle
meshop.getSubdivisionView
meshop.getUIParam
meshop.getVAlpha
meshop.getVDataChannelSupport
meshop.getVDataValue
meshop.getVert
meshop.getVertCorner
meshop.getVertexAngles
meshop.getVertsByColor
meshop.getVertsUsedOnlyByFaces
meshop.getVertsUsingEdge
meshop.getVertsUsingFace
meshop.getVertWeight
meshop.getVSelectWeight
meshop.getWeldPixels
meshop.getWeldThreshold
meshop.makeFacesPlanar
meshop.makeMapPlanar
meshop.makeVertsPlanar
meshop.minVertexDistanceFrom
meshop.minVertexDistancesFrom
242 Chapter 1 | What’s New in 3ds max 4 MAXScript
meshop.moveVert
meshop.moveVertsToPlane
meshop.optimize
meshop.removeDegenerateFaces
meshop.removeIllegalFaces
meshop.resetVAlphas
meshop.resetVertCorners
meshop.resetVertWeights
meshop.resetVSelectWeights
meshop.setAffectBackfacing
meshop.setBubble
meshop.setDisplacementMapping
meshop.setExtrusionType
meshop.setFaceAlpha
meshop.setFaceColor
meshop.setFalloff
meshop.setHiddenFaces
meshop.setHiddenVerts
meshop.setIgnoreBackfacing
meshop.setIgnoreVisEdges
meshop.setMapFace
meshop.setMapSupport
meshop.setMapVert
meshop.setNormalSize
meshop.setNumCPVVerts
meshop.setNumFaces
meshop.setNumMapFaces
meshop.setNumMaps
meshop.setNumMapVerts
meshop.setNumTVerts
meshop.setNumVDataChannels
meshop.setNumVerts
meshop.setPinch
meshop.setPlanarThreshold
meshop.setSelByVertex
meshop.setShowFNormals
meshop.setShowVNormals
meshop.setSoftSel
meshop.setSplitMesh
meshop.setSSEdgeDist
meshop.setSSUseEdgeDist
meshop.setSubdivisionAngle
meshop.setSubdivisionDisplacement
meshop.setSubdivisionDistance
meshop.setSubdivisionEdge
meshop.setSubdivisionMaxLevels
meshop.setSubdivisionMaxTriangles
meshop.setSubdivisionMethod
meshop.setSubdivisionMinLevels
meshop.setSubdivisionSteps
meshop.setSubdivisionStyle
meshOps const StructDef 243
meshop.setSubdivisionView
meshop.setUIParam
meshop.setVAlpha
meshop.setVDataChannelSupport
meshop.setVDataValue
meshop.setVert
meshop.setVertAlpha
meshop.setVertColor
meshop.setVertCorner
meshop.setVertWeight
meshop.setVSelectWeight
meshop.setWeldPixels
meshop.setWeldThreshold
meshop.slice
meshop.supportVAlphas
meshop.supportVertCorners
meshop.supportVertWeights
meshop.supportVSelectWeights
meshop.turnEdge
meshop.unifyNormals
meshop.weldVertsByThreshold
meshop.weldVertSet
meshOps.startChamfer
meshOps.startCreate
meshOps.startCut
meshOps.startDivide
meshOps.startExtrude
meshOps.startFlipNormalMode
meshOps.startSlicePlane
meshOps.startTurn
meshOps.startWeldTarget
meshOps.tessellate
meshOps.unhideAll
meshOps.unifyNormal
meshOps.viewAlign
meshOps.visibleEdge
meshOps.weld
See Also
Modifier Common Properties, Operators, and Methods (p. 1096)
Modifier : MAXWrapper and SpacewarpModifier : MAXWrapper (p. 1095)
See Also
mtlBrowser (p. 180)
options const StructDef 245
See Also
Value Common Properties, Operators, and Methods (p. 714)
patch.getVertEdges
patch.getVertPatches
patch.getVertType
patch.getVertVecs
patch.interpQuadPatch
patch.interpTriPatch
patch.makeQuadPatch
patch.makeTriPatch
patch.maxMapChannels
patch.patchNormal
patch.setAdaptive
patch.setMapPatch
patch.setMapSupport
patch.setMapVert
patch.setMeshSteps
patch.setMeshStepsRender
patch.setMtlID
patch.setNumEdges
patch.setNumMapPatches
patch.setNumMaps
patch.setNumMapVerts
patch.setNumPatches
patch.setNumVecs
patch.setNumVerts
patch.setPatchMtlID
patch.setShowInterior
patch.setVec
patch.setVert
patch.subdivideEdges
patch.subdividePatches
patch.transform
patch.unifyNormals
patch.update
patch.updatePatchNormals
patch.weld2Verts
patch.weldEdges
patch.weldVerts
See Also
Patch Select - superclass: modifier (p. 307)
patchOps const StructDef (p. 247)
patchOps const StructDef 247
See Also
Patches (p. 55)
patch const StructDef (p. 245)
patchOps const StructDef (p. 247)
Patch_Select - superclass: modifier (p. 307)
polyop.getFaceCenter
polyop.getFaceDeg
polyop.getFaceEdges
polyop.getFaceFlags
polyop.getFaceMatID
polyop.getFaceNormal
polyop.getFacesByFlag
polyop.getFaceSelection
polyop.getFaceSmoothGroup
polyop.getFacesUsingEdge
polyop.getFacesUsingVert
polyop.getFaceVerts
polyop.getHasDeadStructs
polyop.getHiddenFaces
polyop.getHiddenVerts
polyop.getMapFace
polyop.getMapSupport
polyop.getMapVert
polyop.getNumEDataChannels
polyop.getNumEdges
polyop.getNumFaces
polyop.getNumMapFaces
polyop.getNumMaps
polyop.getNumMapVerts
polyop.getNumVDataChannels
polyop.getNumVerts
polyop.getOpenEdges
polyop.getSafeFaceCenter
polyop.getSlicePlane
polyop.getVDataChannelSupport
polyop.getVDataValue
polyop.getVert
polyop.getVertFlags
polyop.getVertsByColor
polyop.getVertsByFlag
polyop.getVertSelection
polyop.getVertsUsedOnlyByFaces
polyop.getVertsUsingEdge
polyop.getVertsUsingFace
polyop.inSlicePlaneMode
polyop.isEdgeDead
polyop.isFaceDead
polyop.isMeshFilledIn
polyop.isVertDead
polyop.makeEdgesPlanar
polyop.makeFacesPlanar
polyop.makeVertsPlanar
polyop.meshSmoothByEdge
polyop.meshSmoothByFace
polyop.meshSmoothByVert
polyop.moveEdgesToPlane
250 Chapter 1 | What’s New in 3ds max 4 MAXScript
polyop.moveFacesToPlane
polyop.moveVert
polyop.moveVertsToPlane
polyop.propagateFlags
polyop.resetEData
polyop.resetSlicePlane
polyop.resetVData
polyop.retriangulate
polyop.setDiagonal
polyop.setEDataChannelSupport
polyop.setEDataValue
polyop.setEdgeFlags
polyop.setEdgeSelection
polyop.setEdgeVis
polyop.setFaceColor
polyop.setFaceFlags
polyop.setFaceMatID
polyop.setFaceSelection
polyop.setFaceSmoothGroup
polyop.setHiddenFaces
polyop.setHiddenVerts
polyop.setMapFace
polyop.setMapSupport
polyop.setMapVert
polyop.setNumEDataChannels
polyop.setNumMapFaces
polyop.setNumMaps
polyop.setNumMapVerts
polyop.setNumVDataChannels
polyop.setSlicePlane
polyop.setVDataChannelSupport
polyop.setVDataValue
polyop.setVert
polyop.setVertColor
polyop.setVertFlags
polyop.setVertSelection
polyop.slice
polyop.splitEdges
polyop.tessellateByEdge
polyop.tessellateByFace
polyop.tessellateByVert
polyop.unHideAllFaces
polyop.unHideAllVerts
polyop.weldEdges
polyop.weldEdgesByThreshold
polyop.weldVerts
polyop.weldVertsByThreshold
polyOps const StructDef 251
See Also
Miscellaneous Viewport Methods and System Globals (p. 1603)
See Also
3D Studio MAX System Globals (p. 630)
3ds max Scanline A-Buffer Renderer Anti-Aliasing Filters (p. 1614)
skinOps.pasteToSelectedBone
skinOps.RemoveBone
skinOps.RemoveCrossSection
skinOps.ReplaceVertexWeights
skinOps.resetAllBones
skinOps.resetSelectedBone
skinOps.resetSelectedVerts
skinOps.saveEnvelope
skinOps.SelectBone
skinOps.selectCrossSection
skinOps.selectEndPoint
skinOps.selectGizmo
skinOps.selectGizmoType
skinOps.selectNextBone
skinOps.selectPreviousBone
skinOps.selectStartPoint
skinOps.SelectVertices
skinOps.setBonePropEnvelopeVisible
skinOps.setBonePropFalloff
skinOps.setBonePropRelative
skinOps.SetCrossSectionU
skinOps.SetEndPoint
skinOps.SetInnerRadius
skinOps.SetOuterRadius
skinOps.setSelectedBonePropEnvelopeVisible
skinOps.setSelectedBonePropFalloff
skinOps.setSelectedBonePropRelative
skinOps.SetStartPoint
skinOps.SetVertexWeights
skinOps.ZoomToBone
skinOps.ZoomToGizmo
See Also
snapMode (p. 182)
3D Studio MAX System Globals (p. 630)
splineOps const StructDef 255
See Also
3D Studio MAX System Globals (p. 630)
toolMode const StructDef 257
See Also
Trackbar (p. 1581)
See Also
Trackbar (p. 1581)
maxOps (p. 87)
ItrackBar (p. 113)
See Also
Trackviews (p. 114)
258 Chapter 1 | What’s New in 3ds max 4 MAXScript
See Also
3D Studio MAX System Globals (p. 630)
Zoom to Bounds (p. 184)
Properties:
<Alpha>.enabled BooleanClass default: true -- boolean
Shows whether the element is enabled.
<Alpha>.filterOn BooleanClass default: true -- boolean; FilteringOn
Shows whether the active antialiasing filter is enabled for the element.
<Alpha>.elementName String default: “Alpha” -- string
Shows the name of the currently selected element. You can type in a custom name for the
element.
This control is unavailable when multiple elements are selected.
<Alpha>.bitmap UndefinedClass default: undefined -- bitmap
alphaRenderElement - superclass: MAXObject 263
See Also
alphaRenderElement - superclass: MAXObject (p. 263)
Atmosphere - superclass: MAXObject (p. 264)
atmosphereRenderElement - superclass: MAXObject (p. 265)
BackgroundRenderElement - superclass: MAXObject (p. 269)
bgndRenderElement - superclass: MAXObject (p. 270)
clrShadowRenderElement - superclass: MAXObject (p. 272)
Colored Shadow - superclass: MAXObject (p. 273)
Diffuse - superclass: MAXObject (p. 279)
diffuseRenderElement - superclass: MAXObject (p. 280)
emissionRenderElement - superclass: MAXObject (p. 285)
Reflection - superclass: MAXObject (p. 323)
reflectionRenderElement - superclass: MAXObject (p. 324)
Refraction - superclass: MAXObject (p. 326)
refractionRenderElement - superclass: MAXObject (p. 327)
Self Illumination - superclass: MAXObject (p. 331)
ShadowRenderElement - superclass: MAXObject (p. 332)
Specular - superclass: MAXObject (p. 334)
specularRenderElement - superclass: MAXObject (p. 335)
Properties:
<alphaRenderElement>.enabled BooleanClass default: true -- boolean
Shows whether the element is enabled.
<alphaRenderElement>.filterOn BooleanClass default: true --
boolean; FilteringOn
Shows whether the active antialiasing filter is enabled for the element.
<alphaRenderElement>.elementName String default: “Alpha” --
string
Shows the name of the currently selected element. You can type in a custom name for the
element.
264 Chapter 1 | What’s New in 3ds max 4 MAXScript
See Also
Alpha - superclass: MAXObject (p. 262)
Atmosphere - superclass: MAXObject (p. 264)
atmosphereRenderElement - superclass: MAXObject (p. 265)
BackgroundRenderElement - superclass: MAXObject (p. 269)
bgndRenderElement - superclass: MAXObject (p. 270)
clrShadowRenderElement - superclass: MAXObject (p. 272)
Colored_Shadow - superclass: MAXObject (p. 273)
Diffuse - superclass: MAXObject (p. 279)
diffuseRenderElement - superclass: MAXObject (p. 280)
emissionRenderElement - superclass: MAXObject (p. 285)
Reflection - superclass: MAXObject (p. 323)
reflectionRenderElement - superclass: MAXObject (p. 324)
Refraction - superclass: MAXObject (p. 326)
refractionRenderElement - superclass: MAXObject (p. 327)
Self_Illumination - superclass: MAXObject (p. 331)
ShadowRenderElement - superclass: MAXObject (p. 332)
Specular - superclass: MAXObject (p. 334)
specularRenderElement - superclass: MAXObject (p. 335)
Properties:
<Atmosphere>.enabled BooleanClass default: true -- boolean
Shows whether the element is enabled.
<Atmosphere>.filterOn BooleanClass default: true -- boolean;
FilteringOn
Shows whether the active antialiasing filter is enabled for the element.
<Atmosphere>.elementName String default: “Atmosphere” -- string
atmosphereRenderElement - superclass: MAXObject 265
Shows the name of the currently selected element. You can type in a custom name for the
element.
This control is unavailable when multiple elements are selected.
<Atmosphere>.bitmap UndefinedClass default: undefined -- bitmap
See Also
Alpha - superclass: MAXObject (p. 262)
alphaRenderElement - superclass: MAXObject (p. 263)
atmosphereRenderElement - superclass: MAXObject (p. 265)
BackgroundRenderElement - superclass: MAXObject (p. 269)
bgndRenderElement - superclass: MAXObject (p. 270)
clrShadowRenderElement - superclass: MAXObject (p. 272)
Colored Shadow - superclass: MAXObject (p. 273)
Diffuse - superclass: MAXObject (p. 279)
diffuseRenderElement - superclass: MAXObject (p. 280)
emissionRenderElement - superclass: MAXObject (p. 285)
Reflection - superclass: MAXObject (p. 323)
reflectionRenderElement - superclass: MAXObject (p. 324)
Refraction - superclass: MAXObject (p. 326)
refractionRenderElement - superclass: MAXObject (p. 327)
Self Illumination - superclass: MAXObject (p. 331)
ShadowRenderElement - superclass: MAXObject (p. 332)
Specular - superclass: MAXObject (p. 334)
specularRenderElement - superclass: MAXObject (p. 335)
Properties:
<atmosphereRenderElement>.enabled BooleanClass default: true --
boolean
Shows whether the element is enabled.
<atmosphereRenderElement>.filterOn BooleanClass default: true --
boolean; FilteringOn
Shows whether the active antialiasing filter is enabled for the element.
266 Chapter 1 | What’s New in 3ds max 4 MAXScript
See Also
Alpha - superclass: MAXObject (p. 262)
alphaRenderElement - superclass: MAXObject (p. 263)
Atmosphere - superclass: MAXObject (p. 264)
BackgroundRenderElement - superclass: MAXObject (p. 269)
bgndRenderElement - superclass: MAXObject (p. 270)
clrShadowRenderElement - superclass: MAXObject (p. 272)
Colored Shadow - superclass: MAXObject (p. 273)
Diffuse - superclass: MAXObject (p. 279)
diffuseRenderElement - superclass: MAXObject (p. 280)
emissionRenderElement - superclass: MAXObject (p. 285)
Reflection - superclass: MAXObject (p. 323)
reflectionRenderElement - superclass: MAXObject (p. 324)
Refraction - superclass: MAXObject (p. 326)
refractionRenderElement - superclass: MAXObject (p. 327)
Self Illumination - superclass: MAXObject (p. 331)
ShadowRenderElement - superclass: MAXObject (p. 332)
Specular - superclass: MAXObject (p. 334)
specularRenderElement - superclass: MAXObject (p. 335)
AutomaticAdaptiveExposureControl - superclass: MAXObject 267
Properties:
<AutomaticAdaptiveExposureControl>.physicalScale Float default: 1500.0
-- animatable; float; Physical_Scale
Sets a physical scale for exposure control to use. This is a light intensity value, in candelas.
It can range from 0.0 to 200,000.0. The physical scale is factored into light multiplier
values, and self-illumination, reflection, and refraction maps. Default=1500.0.
Decreasing the physical scale dims the scene. Increasing the physical scale increases
brightness, up to a scale value at which the scene grows no brighter.
This parameter is animatable.
<AutomaticAdaptiveExposureControl>.chromaticAdaptation BooleanClass default:
false -- boolean; Chromatic_Adaptation
When the check box is turned on, chromatic adaptation converts all colors so the color
displayed in the color swatch appears as white. Default=off.
Clicking the color swatch displays a Color Selector so you can choose the color to adapt to.
Chromatic adaptation is a form of color correction. You can use this control to simulate
the eye adjusting to lighting. For example, when the light in a room has a yellow cast, our
mind adjusts it so that objects we know to be white, such as printed pages, appear as
white.
<AutomaticAdaptiveExposureControl>.colorDiscrimination BooleanClass default:
false -- boolean; Color_Discrimination
When on, renders dimly lit colors as if the light were too dim for the eye to distinguish
between colors. When on, renders even dimly lit colors. Default=off.
Color differentiation simulates the eye’s response to dim lighting. In dim lighting, the eye
does not perceive colors and sees tones of gray instead.
The effect of this setting is not apparent except at very low light levels: below 5.62
candelas. This occurs only if the Physical Scale is less than 5.62, if a light’s Multiplier is less
than 0.00017, or both. When Physical Scale is less than 0.00562, the scene is completely
gray.
<AutomaticAdaptiveExposureControl>.whiteColor Color default: (color
255 255 255) -- animatable; RGB color; Color_Discrimination; Controller Scaling:
([1,1,1] : (color 255 255 255))
268 Chapter 1 | What’s New in 3ds max 4 MAXScript
Properties:
<Automatic_Exposure_Control>.physicalScale Float default: 1500.0
-- animatable; float; Physical_Scale
Sets a physical scale for exposure control to use. This is a light intensity value, in candelas.
It can range from 0.0 to 200,000.0. The physical scale is factored into light multiplier
values, and self-illumination, reflection, and refraction maps. Default=1500.0.
Decreasing the physical scale dims the scene. Increasing the physical scale increases
brightness, up to a scale value at which the scene grows no brighter.
This parameter is animatable.
<Automatic_Exposure_Control>.chromaticAdaptation BooleanClass default: false
-- boolean; Chromatic_Adaptation
When the check box is turned on, chromatic adaptation converts all colors so the color
displayed in the color swatch appears as white. Default=off.
Clicking the color swatch displays a Color Selector so you can choose the color to adapt to.
Chromatic adaptation is a form of color correction. You can use this control to simulate
the eye adjusting to lighting. For example, when the light in a room has a yellow cast, our
mind adjusts it so that objects we know to be white, such as printed pages, appear as
white.
<Automatic_Exposure_Control>.colorDiscrimination BooleanClass default: false
-- boolean; Color_Discrimination
When on, renders dimly lit colors as if the light were too dim for the eye to distinguish
between colors. When on, renders even dimly lit colors. Default=off.
Color differentiation simulates the eye’s response to dim lighting. In dim lighting, the eye
does not perceive colors and sees tones of gray instead.
The effect of this setting is not apparent except at very low light levels: below 5.62
candelas. This occurs only if the Physical Scale is less than 5.62, if a light’s Multiplier is less
BackgroundRenderElement - superclass: MAXObject 269
than 0.00017, or both. When Physical Scale is less than 0.00562, the scene is completely
gray.
<Automatic_Exposure_Control>.whiteColor Color default: (color 255 255 255) --
animatable; RGB color; Color_Discrimination; Controller Scaling: ([1,1,1] :
(color 255 255 255))
Properties:
<BackgroundRenderElement>.enabled BooleanClass default: true --
boolean
Shows whether the element is enabled.
<BackgroundRenderElement>.filterOn BooleanClass default: true --
boolean; FilteringOn
Shows whether the active antialiasing filter is enabled for the element.
<BackgroundRenderElement>.elementName String default:
“Background” -- string
Shows the name of the currently selected element. You can type in a custom name for the
element.
This control is unavailable when multiple elements are selected.
<BackgroundRenderElement>.bitmap UndefinedClass default: undefined --
bitmap
See Also
Alpha - superclass: MAXObject (p. 262)
alphaRenderElement - superclass: MAXObject (p. 263)
Atmosphere - superclass: MAXObject (p. 264)
atmosphereRenderElement - superclass: MAXObject (p. 265)
bgndRenderElement - superclass: MAXObject (p. 270)
270 Chapter 1 | What’s New in 3ds max 4 MAXScript
Properties:
<bgndRenderElement>.enabled BooleanClass default: true -- boolean
Shows whether the element is enabled.
<bgndRenderElement>.filterOn BooleanClass default: true -- boolean;
FilteringOn
Shows whether the active antialiasing filter is enabled for the element.
<bgndRenderElement>.elementName String default: “Background” --
string
Shows the name of the currently selected element. You can type in a custom name for the
element.
This control is unavailable when multiple elements are selected.
<bgndRenderElement>.bitmap UndefinedClass default: undefined --
bitmap
See Also
bitmapTex interfaces: (p. 434)
Alpha - superclass: MAXObject (p. 262)
alphaRenderElement - superclass: MAXObject (p. 263)
Atmosphere - superclass: MAXObject (p. 264)
BlendRenderElement - superclass: MAXObject 271
Properties:
<BlendRenderElement>.enabled BooleanClass default: true -- boolean
Shows whether the element is enabled.
<BlendRenderElement>.filterOn BooleanClass default: true -- boolean;
FilteringOn
Shows whether the active antialiasing filter is enabled for the element.
<BlendRenderElement>.elementName String default: “Blend” -- string
Shows the name of the currently selected element. You can type in a custom name for the
element.
This control is unavailable when multiple elements are selected.
<BlendRenderElement>.bitmap UndefinedClass default: undefined -- bitmap
Properties:
<clrShadowRenderElement>.enabled BooleanClass default: true --
boolean
Shows whether the element is enabled.
<clrShadowRenderElement>.filterOn BooleanClass default: true --
boolean; FilteringOn
Shows whether the active antialiasing filter is enabled for the element.
<clrShadowRenderElement>.elementName String default: “Colored
Shadow” -- string
Shows the name of the currently selected element. You can type in a custom name for the
element.
This control is unavailable when multiple elements are selected.
<clrShadowRenderElement>.bitmap UndefinedClass default: undefined --
bitmap
Colored_Shadow - superclass: MAXObject 273
See Also
Alpha - superclass: MAXObject (p. 262)
alphaRenderElement - superclass: MAXObject (p. 263)
Atmosphere - superclass: MAXObject (p. 264)
atmosphereRenderElement - superclass: MAXObject (p. 265)
BackgroundRenderElement - superclass: MAXObject (p. 269)
bgndRenderElement - superclass: MAXObject (p. 270)
Colored Shadow - superclass: MAXObject (p. 273)
Diffuse - superclass: MAXObject (p. 279)
diffuseRenderElement - superclass: MAXObject (p. 280)
emissionRenderElement - superclass: MAXObject (p. 285)
Reflection - superclass: MAXObject (p. 323)
reflectionRenderElement - superclass: MAXObject (p. 324)
Refraction - superclass: MAXObject (p. 326)
refractionRenderElement - superclass: MAXObject (p. 327)
Self Illumination - superclass: MAXObject (p. 331)
ShadowRenderElement - superclass: MAXObject (p. 332)
Specular - superclass: MAXObject (p. 334)
specularRenderElement - superclass: MAXObject (p. 335)
Properties:
<Colored_Shadow>.enabled BooleanClass default: true -- boolean
Shows whether the element is enabled.
<Colored_Shadow>.filterOn BooleanClass default: true -- boolean;
FilteringOn
Shows whether the active antialiasing filter is enabled for the element.
<Colored_Shadow>.elementName String default: “Colored Shadow” --
string
Shows the name of the currently selected element. You can type in a custom name for the
element.
This control is unavailable when multiple elements are selected.
<Colored_Shadow>.bitmap UndefinedClass default: undefined -- bitmap
274 Chapter 1 | What’s New in 3ds max 4 MAXScript
See Also
Alpha - superclass: MAXObject (p. 262)
alphaRenderElement - superclass: MAXObject (p. 263)
Atmosphere - superclass: MAXObject (p. 264)
atmosphereRenderElement - superclass: MAXObject (p. 265)
BackgroundRenderElement - superclass: MAXObject (p. 269)
bgndRenderElement - superclass: MAXObject (p. 270)
clrShadowRenderElement - superclass: MAXObject (p. 272)
Diffuse - superclass: MAXObject (p. 279)
diffuseRenderElement - superclass: MAXObject (p. 280)
emissionRenderElement - superclass: MAXObject (p. 285)
Reflection - superclass: MAXObject (p. 323)
reflectionRenderElement - superclass: MAXObject (p. 324)
Refraction - superclass: MAXObject (p. 326)
refractionRenderElement - superclass: MAXObject (p. 327)
Self Illumination - superclass: MAXObject (p. 331)
ShadowRenderElement - superclass: MAXObject (p. 332)
Specular - superclass: MAXObject (p. 334)
specularRenderElement - superclass: MAXObject (p. 335)
Properties:
<Combustion.coordinates>.blur Float default: 1.0 -- animatable;
float
Affects the sharpness or blurriness of the map based on its distance from the view. The
farther away the map is, the greater the blurring. The Blur value blurs maps in world space.
Blur is primarily used to avoid aliasing.
<Combustion.coordinates>.mapping Integer default: 0
See Also
Combustion (p. 38)
Material Common Properties, Operators, and Methods (p. 1203)
276 Chapter 1 | What’s New in 3ds max 4 MAXScript
Properties:
<Cone_Angle>.Origin Point3 default: [0,0,0] -- point3
<Cone_Angle>.Direction Point3 default: [0,0,-1] -- point3
<Cone_Angle>.Angle Float default: 15.0 -- animatable; angle;
Controller Scaling: (1 : 57.2958)
The initial angle of the manipulator.
<Cone_Angle>.Distance Float default: 0.0 -- float
The length of the manipulator, in 3ds max units. Default=the distance of mouse drag
when the manipulator was created.
<Cone_Angle>.UseSquare BooleanClass default: false -- boolean;
Use_Square
When on, the base of the cone is square or rectangular, rather than circular. Default=off.
<Cone_Angle>.Aspect Float default: 1.0 -- float
When Use Square is on, adjusts the aspect ratio of the rectangular cone base. Default=1.0.
See Also
Scripted Manipulators (p. 97)
Interface: manip (p. 366)
radiusManip interfaces: (p. 500)
ConeAngleManip - superclass: helper (p. 277)
PlaneAngleManip - superclass: helper (p. 311)
Scripted Plug-ins (p. 1538)
sliderManipulator - superclass: helper (p. 333)
sliderManipulator interfaces: (p. 520)
uvwMappingHeightManip interfaces: (p. 551)
uvwMappingLengthManip interfaces: (p. 555)
uvwMappingUTileManip interfaces: (p. 558)
uvwMappingVTileManip interfaces: (p. 562)
uvwMappingWidthManip interfaces: (p. 565)
ConeAngleManip - superclass: helper 277
Properties:
<ConeAngleManip>.Origin Point3 default: [0,0,0] -- point3
<ConeAngleManip>.Direction Point3 default: [0,0,-1] -- point3
<ConeAngleManip>.Angle Float default: 15.0 -- animatable; angle;
Controller Scaling: (1 : 57.2958)
The initial angle of the manipulator.
<ConeAngleManip>.Distance Float default: 0.0 -- float
The length of the manipulator, in 3ds max units. Default=the distance of mouse drag
when the manipulator was created.
<ConeAngleManip>.UseSquare BooleanClass default: false -- boolean;
Use_Square
When on, the base of the cone is square or rectangular, rather than circular. Default=off.
<ConeAngleManip>.Aspect Float default: 1.0 -- float
When Use Square is on, adjusts the aspect ratio of the rectangular cone base. Default=1.0.
See Also
Interface: manip (p. 366)
sliderManipulator interfaces: (p. 520)
radiusManip interfaces: (p. 500)
uvwMappingHeightManip interfaces: (p. 551)
uvwMappingLengthManip interfaces: (p. 555)
uvwMappingUTileManip interfaces: (p. 558)
uvwMappingVTileManip interfaces: (p. 562)
uvwMappingWidthManip interfaces: (p. 565)
ConeAngleManip - superclass: helper (p. 277)
PlaneAngleManip - superclass: helper (p. 311)
Scripted Plug-ins (p. 1538)
sliderManipulator - superclass: helper (p. 333)
278 Chapter 1 | What’s New in 3ds max 4 MAXScript
Properties:
<ConvertToPatch>.quadsToQuads BooleanClass default: true --
animatable; boolean; Quads_to_Quad_Patches
Turns quad faces in meshes or polymeshes into quad patches.
<ConvertToPatch>.selectionConversion Integer default: 0 -- integer;
Selection_Conversion
<ConvertToPatch>.useSoftSelection Integer default: 1 -- integer;
Use_Soft_Selection
When these are on, 3ds max applies a spline curve deformation to unselected vertices
surrounding the transformed selected sub-object. This provides a magnet-like effect, with a
sphere of influence around the transformation. Use this when you want to preserve the
soft selection from beneath. For example, if Use Soft Selection is on when you select
vertices on an editable mesh, and you apply Turn To Patch with Include Soft Selection on,
then the same soft selection will apply to the patch vertices.
<ConvertToPatch>.selectionLevel Integer default: 0 -- integer;
Selection_Level
These options set the sub-object selection level for passing up the rest of the stack.
From Pipeline: Uses the equivalent of whatever the input object uses. (Patch level becomes face
level, and so on.). For example, if you create a box, convert it to an editable mesh in face mode
and apply a Turn To Patch modifier to it, 3ds max passes a sub-object selection in patch mode
up the stack. The Turn To Patch modifier takes the sub-object face selection into account and
selects the patches that derive from the face selection.
DeletePatch - superclass: modifier 279
Object: Uses object as the selection level for passing up the rest of the stack.
Edge: Uses edge as the sub-object selection level for passing up the rest of the stack.
Vertex: Uses vertex as the sub-object selection level for passing up the rest of the stack.
Patch: Uses patch as the sub-object selection level for passing up the rest of the stack.
Properties:
<Diffuse>.enabled BooleanClass default: true -- boolean
Shows whether the element is enabled.
<Diffuse>.filterOn BooleanClass default: true -- boolean;
FilteringOn
Shows whether the active antialiasing filter is enabled for the element.
<Diffuse>.elementName String default: “Diffuse” -- string
Shows the name of the currently selected element. You can type in a custom name for the
element.
This control is unavailable when multiple elements are selected.
<Diffuse>.bitmap UndefinedClass default: undefined -- bitmap
See Also
Alpha - superclass: MAXObject (p. 262)
alphaRenderElement - superclass: MAXObject (p. 263)
Atmosphere - superclass: MAXObject (p. 264)
atmosphereRenderElement - superclass: MAXObject (p. 265)
BackgroundRenderElement - superclass: MAXObject (p. 269)
bgndRenderElement - superclass: MAXObject (p. 270)
clrShadowRenderElement - superclass: MAXObject (p. 272)
Colored Shadow - superclass: MAXObject (p. 273)
diffuseRenderElement - superclass: MAXObject (p. 280)
emissionRenderElement - superclass: MAXObject (p. 285)
280 Chapter 1 | What’s New in 3ds max 4 MAXScript
Properties:
<diffuseRenderElement>.enabled BooleanClass default: true --
boolean
Shows whether the element is enabled.
<diffuseRenderElement>.filterOn BooleanClass default: true --
boolean; FilteringOn
Shows whether the active antialiasing filter is enabled for the element.
<diffuseRenderElement>.elementName String default: “Diffuse” --
string
Shows the name of the currently selected element. You can type in a custom name for the
element.
This control is unavailable when multiple elements are selected.
<diffuseRenderElement>.bitmap UndefinedClass default: undefined --
bitmap
See Also
Alpha - superclass: MAXObject (p. 262)
alphaRenderElement - superclass: MAXObject (p. 263)
Atmosphere - superclass: MAXObject (p. 264)
atmosphereRenderElement - superclass: MAXObject (p. 265)
BackgroundRenderElement - superclass: MAXObject (p. 269)
bgndRenderElement - superclass: MAXObject (p. 270)
clrShadowRenderElement - superclass: MAXObject (p. 272)
Colored Shadow - superclass: MAXObject (p. 273)
Drag - superclass: SpacewarpObject 281
Properties:
<Drag>.‘time on’ Integer default: 0 -- integer; Time_On
The frame numbers at which the space warp becomes active and becomes inactive.
<Drag>.‘time off’ Integer default: 16000 -- animatable; integer;
Time_Off
The frame numbers at which the space warp becomes active and becomes inactive.
<Drag>.symmetry Integer default: 0 -- radio button number;
Damping_Symmetry
This group lets you choose Linear Damping, Spherical Damping, or Cylindrical Damping,
plus a set of parameters for each.
<Drag>.dampingx Float default: 5.0 -- animatable; percentage;
X_Damping; Controller Scaling: (1 : 100.0)
Specifies the percentage of particle motion along the local Drag space warp axis that’s
affected by the damping.
<Drag>.rangex Float default: 100.0 -- animatable; float; X_Range
282 Chapter 1 | What’s New in 3ds max 4 MAXScript
Sets the thickness of the “range plane,” or the infinite plane perpendicular to the specified
axis. Takes effect only when Unlimited Range is turned off.
<Drag>.falloffx Float default: 1000.0 -- animatable; float;
X_Falloff
Specifies the distance beyond the X, Y, or Z Range within which Linear Damping is
applied. Damping is strongest at the Range distance, decreases linearly out to the limit of
the Falloff, and has no effect beyond that. While Falloff is effected only beyond the Range,
it is measured from the center of the icon, and always has a minimum value equal to the
Range value. Takes effect only when Unlimited Range is turned off.
<Drag>.dampingy Float default: 0.0 -- animatable; percentage;
Y_Damping; Controller Scaling: (1 : 100.0)
Specifies the percentage of particle motion along the local Drag space warp axis that’s
affected by the damping.
<Drag>.rangey Float default: 100.0 -- animatable; float; Y_Range
Sets the thickness of the “range plane,” or the infinite plane perpendicular to the specified
axis. Takes effect only when Unlimited Range is turned off.
<Drag>.falloffy Float default: 1000.0 -- animatable; float;
Y_Falloff
Specifies the distance beyond the X, Y, or Z Range within which Linear Damping is
applied. Damping is strongest at the Range distance, decreases linearly out to the limit of
the Falloff, and has no effect beyond that. While Falloff is effected only beyond the Range,
it is measured from the center of the icon, and always has a minimum value equal to the
Range value. Takes effect only when Unlimited Range is turned off.
<Drag>.dampingz Float default: 0.0 -- animatable; percentage;
Z_Damping; Controller Scaling: (1 : 100.0)
Specifies the percentage of particle motion along the local Drag space warp axis that’s
affected by the damping.
<Drag>.rangez Float default: 100.0 -- animatable; float; Z_Range
Sets the thickness of the “range plane,” or the infinite plane perpendicular to the specified
axis. Takes effect only when Unlimited Range is turned off.
<Drag>.falloffz Float default: 1000.0 -- animatable; float;
Z_Falloff
Specifies the distance beyond the X, Y, or Z Range within which Linear Damping is
applied. Damping is strongest at the Range distance, decreases linearly out to the limit of
the Falloff, and has no effect beyond that. While Falloff is effected only beyond the Range,
it is measured from the center of the icon, and always has a minimum value equal to the
Range value. Takes effect only when Unlimited Range is turned off.
<Drag>.dampingr Float default: 5.0 -- animatable; percentage;
Radial_Damping; Controller Scaling: (1 : 100.0)
Radial specifies the percentage of particle motion toward or away from the center of the
Drag icon that’s affected by the damping. Tangential specifies the percentage of particle
motion across the body of the Drag icon that’s affected by the damping.
Drag - superclass: SpacewarpObject 283
beyond the Range, it is measured from the center of the icon, and always has a minimum
value equal to the Range value. Takes effect only when Unlimited Range is turned off.
<Drag>.dampingc Float default: 0.0 -- animatable; percentage;
Tangential_Damping; Controller Scaling: (1 : 100.0)
Damping controls the percentage of particle motion toward or away from the center of the
circular portion of the icon (Radial), across the radial vector (Tangential), or along the
length of the icon’s long axis (Axial) that’s affected by the damping, on a per-frame basis.
<Drag>.rangec Float default: 100.0 -- animatable; float;
Tangential_Range
Specifies the distance from the center of the Drag icon, in system units, within which
Radial and Axial damping are in full effect. Range also specifies the thickness of the
infinite plane that governs the range of Axial damping. Takes effect only when Unlimited
Range is turned off.
<Drag>.falloffc Float default: 1000.0 -- animatable; float;
Tangential_Falloff
Specifies the distance beyond the Radial/Tangential/Axial Range within which Linear
Damping is applied. Damping is strongest at the Range distance, decreases linearly out to
the limit of the Falloff, and has no effect beyond that. While Falloff is effected only
beyond the Range, it is measured from the center of the icon, and always has a minimum
value equal to the Range value. Takes effect only when Unlimited Range is turned off.
<Drag>.dampingax Float default: 0.0 -- animatable; percentage;
Axial_Damping; Controller Scaling: (1 : 100.0)
Damping controls the percentage of particle motion toward or away from the center of the
circular portion of the icon (Radial), across the radial vector (Tangential), or along the
length of the icon’s long axis (Axial) that’s affected by the damping, on a per-frame basis.
<Drag>.rangeax Float default: 100.0 -- animatable; float;
Axial_Range
Specifies the distance from the center of the Drag icon, in system units, within which
Radial and Axial damping are in full effect. Range also specifies the thickness of the
infinite plane that governs the range of Axial damping. Takes effect only when Unlimited
Range is turned off.
<Drag>.falloffax Float default: 1000.0 -- animatable; float;
Axial_Falloff
Specifies the distance beyond the Radial/Tangential/Axial Range within which Linear
Damping is applied. Damping is strongest at the Range distance, decreases linearly out to
the limit of the Falloff, and has no effect beyond that. While Falloff is effected only
beyond the Range, it is measured from the center of the icon, and always has a minimum
value equal to the Range value. Takes effect only when Unlimited Range is turned off.
<Drag>.rangeless BooleanClass default: true -- boolean; Unlimited_Range
<Drag>.iconsize Float default: 10.0 -- float; Icon_Size
Specifies the size of the icon.
emissionRenderElement - superclass: MAXObject 285
Example:
Drag time_on:0 time_off:10 symmetry:0 dampingx:5 rangex:100 falloffx:1000
dampingy:0 rangey:100 falloffy:1000 dampingz:0 rangez:100 falloffz:1000 dampingr:5
ranger:100 falloffr:1000 dampinggc:0 rangegc:100 falloffgc:1000 dampingrc:5
rangerc:100 falloffrc:1000 dampingc:0 rangec:100 falloffc:1000 dampingax:0
rangeax:100 falloffax:1000 rangeless:on pos:[-16.2008,-105.647,0] isSelected:on
iconSize:13.7761
See Also
Modifier and SpacewarpModifier Types (p. 1100)
Properties:
<emissionRenderElement>.enabled BooleanClass default: true --
boolean
Shows whether the element is enabled.
<emissionRenderElement>.filterOn BooleanClass default: true --
boolean; FilteringOn
Shows whether the active antialiasing filter is enabled for the element.
<emissionRenderElement>.elementName String default: “Self-
Illumination” -- string
Shows the name of the currently selected element. You can type in a custom name for
the element.
This control is unavailable when multiple elements are selected.
<emissionRenderElement>.bitmap UndefinedClass default: undefined --
bitmap
See Also
Self Illumination - superclass: MAXObject (p. 331)
Alpha - superclass: MAXObject (p. 262)
alphaRenderElement - superclass: MAXObject (p. 263)
Atmosphere - superclass: MAXObject (p. 264)
atmosphereRenderElement - superclass: MAXObject (p. 265)
BackgroundRenderElement - superclass: MAXObject (p. 269)
bgndRenderElement - superclass: MAXObject (p. 270)
clrShadowRenderElement - superclass: MAXObject (p. 272)
286 Chapter 1 | What’s New in 3ds max 4 MAXScript
Properties:
<FloatList>.available Float default: 0.0 -- animatable; float;
Controller Scaling: (1 : 0.0); WeirdScaled (0.0)
See Also
FloatList interfaces: (p. 450)
FloatReactor - superclass: FloatController 287
Properties:
<Hose>.End_Placement_Method Integer default: 1 -- integer
<Hose>.Generate_Mapping_Coordinates Integer default: 0 -- integer
Sets up required coordinates for applying mapped materials to the hose. Default=off.
<Hose>.Hose_Height Float default: 1.0 -- animatable;
float
Use this field/spinner to set the straight-line height or length of the hose when it is not
bound. This is not the actual length of the hose. Available only when Free Hose is chosen.
<Hose>.Segments_Along_Hose Integer default: 45 -- animatable;
integer
The total number of segments in the hose’s length. Increase this setting for a smooth
profile when the hose is curved. Default=16.
<Hose>.Smooth_Spring Integer default: 0 -- integer
Choose one of the following smoothing options:
All: The entire hose is smoothed.
Sides: Smoothing is applied along the length of the hose but not around its circumference.
None: No smoothing is applied.
Segments: Smoothing is applied only on the inner section of the hose.
<Hose>.Renderable_Hose Integer default: 1 -- integer
When on, the hose is rendered using the specified settings. When off, the hose is not
rendered. Default=on.
288 Chapter 1 | What’s New in 3ds max 4 MAXScript
See Also
GeometryClass Common Properties, Operators, and Methods (p. 852)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Properties:
<HSDS_Modifier>.levelOfDetail Integer default: 0 -- integer; LOD
Shows the current level of the subdivision hierarchy. Automatically increments when you
subdivide a sub-object selection. To edit at a different level of detail, change the setting to
the desired level.
<HSDS_Modifier>.matId Integer default: 1 -- integer;
Material_Id
Displays the material ID assigned to the current selection. Available only in Polygon and
Element sub-object modes. If multiple sub-objects are selected and they don’t share an ID,
this field is blank.
<HSDS_Modifier>.shadedLattice BooleanClass default: false -- boolean;
Shaded_Lattice
Displays only polygons at the current level of detail, with highlights, but without
smoothing. Use this option to speed up the display when working with complex objects.
Default=off.
<HSDS_Modifier>.ignoreBackface BooleanClass default: false -- boolean;
Ignore_Backface
When on, you can select only those sub-objects whose normals are visible in the viewport.
When off (the default), selection includes all sub-objects, regardless of the direction of
their normals.
<HSDS_Modifier>.useSoftSel BooleanClass default: false -- boolean;
Use_Soft_Selection
These controls let you set a gradual falloff of influence between selected and unselected
vertices. See Soft Selection Rollout (Edit/Editable Mesh).
Vertex Interpolation rollout
Determines how selected vertices are treated during subdivision. Available only in Vertex
sub-object mode.
HSDS_Modifier - superclass: modifier 291
For best results, use when moving control grid vertices at a level of detail lower than the
highest in which the vertex resides.
<HSDS_Modifier>.useEdgeDist BooleanClass default: false -- boolean;
Use_Edge_Distance
See Also
HSDS Modifier interfaces: (p. 453)
Properties:
<HSDSObject>.levelOfDetail Integer default: 0 -- integer; LOD
Shows the current level of the subdivision hierarchy. Automatically increments when you
subdivide a sub-object selection. To edit at a different level of detail, change the setting to
the desired level.
<HSDSObject>.matId Integer default: 1 -- integer; Material_Id
Displays the material ID assigned to the current selection. Available only in Polygon and
Element sub-object modes. If multiple sub-objects are selected and they don’t share an ID,
this field is blank.
<HSDSObject>.shadedLattice BooleanClass default: false -- boolean;
Shaded_Lattice
Displays only polygons at the current level of detail, with highlights, but without
smoothing. Use this option to speed up the display when working with complex objects.
Default=off.
<HSDSObject>.ignoreBackface BooleanClass default: false -- boolean;
Ignore_Backface
When on, you can select only those sub-objects whose normals are visible in the viewport.
When off (the default), selection includes all sub-objects, regardless of the direction of
their normals.
<HSDSObject>.useSoftSel BooleanClass default: false -- boolean;
Use_Soft_Selection
These controls let you set a gradual falloff of influence between selected and unselected
vertices. See Soft Selection Rollout (Edit/Editable Mesh).
Vertex Interpolation rollout
HSDSObject - superclass: modifier 293
Determines how selected vertices are treated during subdivision. Available only in Vertex
sub-object mode.
For best results, use when moving control grid vertices at a level of detail lower than the
highest in which the vertex resides.
<HSDSObject>.useEdgeDist BooleanClass default: false -- boolean;
Use_Edge_Distance
This setting limits the region affected by the number of edges between the selection and
the affected vertices. The affected region is measured in terms of “edge-distance” space,
along the surface, rather than real space.
<HSDSObject>.affectBackface BooleanClass default: false -- boolean;
Affect_Backface
When on, deselected sub-objects whose normals (or, in the case of vertices and edges, the
normals of faces to which they’re attached) are facing in the opposite direction to the
average normal of the selected sub-objects, are affected by the soft selection influence.
Turn off Affect Backfacing when you want to pull faces of a thin object, such as a thin box,
but don’t want to affect faces on the other side of the object.
Note:
Affect Backfacing is not available when editing splines.
When using Edit/Editable Mesh, you can also use the keyboard shortcut CTRL+F to toggle Affect
Backfacing (while the Keyboard Shortcut Override Toggle button is turned on).
<HSDSObject>.edgeDistance Integer default: 1 -- integer; Edge_Dist
This setting limits the region affected by the number of edges between the selection and
the affected vertices. The affected region is measured in terms of “edge-distance” space,
along the surface, rather than real space.
<HSDSObject>.falloff Float default: 20.0 -- float
Distance in current units from the center to the edge of a sphere defining the affected
region. Use higher falloff settings to achieve more gradual slopes, depending on the scale
of your geometry. Default=20.
Note:
At the Vertex sub-object level, the region specified by the Falloff setting is depicted graphically in
the viewports as a vertex-color gradient from the Sub-selection color (normally red) to the Vertex
Ticks color (normally blue). In addition, this gradient is updated in real time as you change the
Falloff setting.
<HSDSObject>.pinch Float default: 0.0 -- float
Raises and lowers the top point of the curve along the vertical axis. Sets the relative
“pointedness” of the region. When negative, a crater is produced instead of a point. At a
setting of 0, Pinch produces a smooth transition across this axis. Default=0.
<HSDSObject>.bubble Float default: 0.0 -- float
Expands and contracts the curve along the vertical axis. Sets the relative “fullness” of the
region. Limited by Pinch, which sets a fixed starting point for Bubble. A setting of 0 for
294 Chapter 1 | What’s New in 3ds max 4 MAXScript
Pinch and 1.0 for Bubble produces a maximum smooth bulge. Negative values for Bubble
move the bottom of the curve below the surface, creating a “valley” around the base of the
region. Default=0.
<HSDSObject>.vertexType Integer default: 0 -- integer;
Vertex_Type]
Standard/Conic/Cusp/Corner:
Determines how closely mesh vertices follow the movement of control grid vertices.
Standard provides the least amount of relative movement, while Cusp and Corner provide
the most. Corner also more closely matches mesh edges to the control grid edges attached
to the moved vertex. Default=Standard.
See Also
HSDSObject interfaces: (p. 453)
Properties:
<imageMotionBlur>.duration Float default: 1.0 -- animatable; float
Specifies how long the “virtual shutter” is open. When this is set to 1.0, the virtual shutter
is open for the entire duration between one frame and the next. The higher the value, the
greater the motion Blur effect. Default=1.0.
<imageMotionBlur>.transparency BooleanClass default: true -- boolean
When on, motion blur is applied to objects behind transparent objects. When off, objects
behind transparent objects receive no motion blur. Turning off this toggle can improve
rendering speed. Default=on.
See Also
imageMotionBlur interfaces: (p. 454)
Constructor:
Link ...
Properties:
<Link>.key_mode Integer default: 0 -- integer; Link_KeyMode
<Link>.link_params SubAnim default: SubAnim:Link_Params -- transform
See Also
Link.link_params - superclass: MAXObject (p. 295)
Properties:
<Link.link_params>.position Point3 default: [0,0,0] -- animatable;
point3
<Link.link_params>.rotation Quat default: (quat 0 0 0 1) -- animatable;
quat
<Link.link_params>.scale Point3 default: [1,1,1] -- animatable;
point3
See Also
Link interfaces: (p. 455)
Link - superclass: Matrix3Controller (p. 294)
Properties:
<Link_Constraint>.key_mode Integer default: 0 -- integer; Link_KeyMode
Remarks:
You can choose between 3 different Key Modes which will determine how keyframes are written
on the linked objects as part of the link constraint. These options will provide the following:
296 Chapter 1 | What’s New in 3ds max 4 MAXScript
See Also
Link Constraint.link params - superclass: MAXObject (p. 296)
Link Constraint interfaces: (p. 455)
Properties:
<Link_Constraint.link_params>.position Point3 default: [0,0,0] --
animatable; point3
<Link_Constraint.link_params>.rotation Quat default: (quat 0 0 0 1) --
animatable; quat
<Link_Constraint.link_params>.scale Point3 default: [1,1,1] --
animatable; point3
See Also
Link_Constraint interfaces: (p. 455)
Link_Constraint - superclass: Matrix3Controller (p. 295)
LinkedXForm - superclass: modifier 297
Properties:
<LinkedXForm>.node UndefinedClass default: undefined -- node
Object that the vertices are linked to. When transformed, the vertices follow.
Properties:
<LookAt_Constraint>.relative BooleanClass default: false --
boolean
<LookAt_Constraint>.lookat_vector_length Float default: 100.0 --
animatable; float; Vector_Length
<LookAt_Constraint>.set_orientation BooleanClass default: false --
boolean
<LookAt_Constraint>.target_axis Integer default: 2 -- integer
<LookAt_Constraint>.target_axisFlip BooleanClass default: false --
boolean
<LookAt_Constraint>.upnode_axis Integer default: 0 -- integer
<LookAt_Constraint>.upnode_world BooleanClass default: true --
boolean
<LookAt_Constraint>.pickUpNode UndefinedClass default: undefined --
node; Pick_Upnode
<LookAt_Constraint>.StoUP_axis Integer default: 0 -- integer
<LookAt_Constraint>.StoUP_axisFlip BooleanClass default: false --
boolean
<LookAt_Constraint>.viewline_length_abs BooleanClass default: true --
boolean; Viewline_Abs
See Also
LookAt Constraint interfaces: (p. 455)
298 Chapter 1 | What’s New in 3ds max 4 MAXScript
Properties:
<Mesher>.pick UndefinedClass default: undefined -- node
Click this button and then select the object to be instanced by the Mesher object. After
doing so, the name of the instanced object appears on the button.
<Mesher>.renderTimeOnly BooleanClass default: false -- boolean
When on, the Mesher particles do not appear in the viewports, but only when you render
the scene. Default=off.
<Mesher>.extranodes ArrayParameter default: #() -- node array
<Mesher>.time Float default: 0.0 -- float
The number of frames ahead of or behind the original particle system that the Mesher’s
particle system will run. Default=0.
<Mesher>.radius Float default: 10.0 -- float
<Mesher>.useCustomBounds BooleanClass default: false -- boolean;
Use_Custom_Bounds
When on, Mesher replaces the dynamic bounding box derived from the particle system
and modifier with a static bounding box of the user’s choice.
<Mesher>.boundsMin Point3 default: [1,1,1] -- point3; BoundsA
<Mesher>.boundsMax Point3 default: [-1,-1,-1] -- point3;
BoundsB
The coordinates of the opposite corners of the custom bounding box.
See Also
Mesher (p. 82)
particleMesher - superclass: GeometryClass (p. 306)
Properties:
<meshsmooth>.subdivMethod Integer default: 2 -- integer;
Subdivision_Method
Selects the Subdivision method to use:
meshsmooth - superclass: modifier 299
See Also
MeshSmooth : Modifier (p. 1139)
302 Chapter 1 | What’s New in 3ds max 4 MAXScript
Properties:
<Motion_Blur>.duration Float default: 1.0 -- animatable;
float
Specifies how long the “virtual shutter” is open. When this is set to 1.0, the virtual shutter
is open for the entire duration between one frame and the next. The higher the value, the
greater the motion Blur effect. Default=1.0.
<Motion_Blur>.transparency BooleanClass default: true -- boolean
When on, motion blur is applied to objects behind transparent objects. When off, objects
behind transparent objects receive no motion blur. Turning off this toggle can improve
rendering speed. Default=on.
See Also
Motion_Blur interfaces: (p. 462)
Properties:
<MultiRes>.Vtx_Count Integer default: 0 -- animatable;
integer
The total number of vertices in the modified object. Use this control to set the maximum
number of vertices in the output mesh. Adjusting this setting alters the Percent value
as well.
MultiRes - superclass: modifier 303
object level. Next, click the Vertex entry. The MultiRes vertices appear on the mesh as blue
dots. You can select these using any standard interactive method, but you cannot
transform them.
Important: After selecting MultiRes sub-object vertices with Maintain Base Vertices turned
on, re-generate the mesh before changing the vertex resolution.
In the following illustration, the clown started out as a high-resolution mesh. All of the
MultiRes vertices in the right half were selected, Maintain Base Vertices was turned on, and
then the vertices were reduced.
{mrm_clown.bmp}
<MultiRes>.Multiple_Normals_Per_Vertex BooleanClass default: true -- boolean
When on, lets MultiRes assign multiple normals for each vertex. By default, MultiRes
generates a single normal per vertex.
If multiple normals are generated, they are applied as the vertex resolution is decreased
and increased.
When the Multiple Normals Per Vertex option is checked, the MultiRes modifier generates
normal updates when the geometry surrounding a vertex changes. You must specify a
crease angle in degrees (0.0 - 180.0). The crease angle is the angle between the face normals.
It is used to decide when a normal should be shared across an edge between two faces.
For example, in a plane defined as a mesh grid of 10 x 10 faces, any two adjacent faces
have a crease angle of zero. In a cube, adjacent faces have a crease angle of 90 degrees. In
general, crease angles approaching 0 yield smoother shading. Crease angles approaching
180 yield more visible corners.
<MultiRes>.Crease_Angle Float default: 75.0 -- float
The value of the crease necessary in order to generate multiple normals. Available only
when Multiple Normals Per Vertex is on.
The optimal crease angle depends on the model; set it interactively and check the viewport
and rendered images for shading effects. While use of multiple normals per vertex enables
more accurate shading, it can require more internal data.
<MultiRes>.Generate BooleanClass default: false -- boolean
Applies the current MultiRes settings to the modified object. When you first apply
MultiRes to an object, it must initialize its mesh-optimizing algorithm; you are prompted
by the modifier to “Generate when ready”.
Note: When working with complex meshes, the initial analysis may take a little while.
During this time, MultiRes displays a special cursor to indicate it is working. Progress is
indicated on this cursor by the movement of the gray area from top to bottom. To cancel
this process, press ESC.
Normalize_Spl - superclass: modifier 305
Example:
modPanel.addModToSelection(MultiRes())
$.modifiers[#MultiRes].Vtx_Count = 482
$.modifiers[#MultiRes].Vertex_Percentage = 100
$.modifiers[#MultiRes].Vertex_Percentage = 99
$.modifiers[#MultiRes].Vtx_Count = 476
$.modifiers[#MultiRes].Vertex_Percentage = 98.7552
$.modifiers[#MultiRes].Vertex_Merging = on
$.modifiers[#MultiRes].Threshold = 0.01
$.modifiers[#MultiRes].Merge_Within = on
$.modifiers[#MultiRes].Boundary_Metric = on
$.modifiers[#MultiRes].Maintain_Base_Vertices = on
$.modifiers[#MultiRes].Crease_Angle = 75.75
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Properties:
<Normalize_Spl>.Length Float default: 20.0 -- float
Determines how many control points are added. Smaller values produce more control
points; larger values produce fewer.
The positions of the original vertices are disregarded. Vertices are set to regular intervals
once the Normalize Spline modifier is applied.
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods
306 Chapter 1 | What’s New in 3ds max 4 MAXScript
Properties:
<Orientation_Constraint>.relative BooleanClass default: false --
boolean
<Orientation_Constraint>.local_world Integer default: 0 -- integer;
LocalOrWorld
See Also
Orientation_Constraint interfaces: (p. 462)
Properties:
<particleMesher>.pick UndefinedClass default: undefined -- node
Click this button and then select the object to be instanced by the Mesher object. After
doing so, the name of the instanced object appears on the button.
<particleMesher>.renderTimeOnly BooleanClass default: false -- boolean
When on, the Mesher particles do not appear in the viewports, but only when you render
the scene. Default=off.
Use this option to reduce the amount of computation required for the viewport display.
<particleMesher>.extranodes ArrayParameter default: #() -- node array
<particleMesher>.time Float default: 0.0 -- float
The number of frames ahead of or behind the original particle system that the Mesher’s
particle system will run. Default=0.
Patch_Select - superclass: modifier 307
See Also
Mesher (p. 82)
Mesher - superclass: GeometryClass (p. 298)
See Also
Patches (p. 55)
patch const StructDef (p. 245)
patchOps const StructDef (p. 247)
Patch : GeometryClass (p. 1088)
Properties:
<Path_Constraint>.percent Float default: 0.0 --
animatable; percentage; Controller Scaling: (1 : 100.0)
Sets the percent that the object is positioned along the path. This duplicates the Value
spinner in the track Properties dialog for the Percent track in Track View. If you want to set
keys to place an object at a certain percent along the path, turn on Animate, move to the
308 Chapter 1 | What’s New in 3ds max 4 MAXScript
frame where you want the key set, and adjust the % Along Path spinner to move the
object.
<Path_Constraint>.follow BooleanClass default: false -- boolean
Aligns the object to the trajectory as it follows the contour.
<Path_Constraint>.path UndefinedClass default: undefined --
node; Path_Constraint
Add Path: is used to add a new spline path that influences the constrained object.
Delete path: is used to remove a path from the target list. Once removing the path target,
it will no longer influence the constrained object
<Path_Constraint>.bank BooleanClass default: false -- boolean
Allows the object to bank (roll) as it negotiates the curves of the spline.
<Path_Constraint>.bankAmount Float default: 0.5 --
animatable; float; Bank_Amount
Adjusts the amount of the banking to one side or the other, depending on whether the
value is positive or negative
<Path_Constraint>.smoothness Float default: 0.5 --
animatable; float
Controls how rapidly the roll angle changes as the object moves through bends in the
trajectory. Smaller values will make the object more responsive to subtle changes in the
curve, while larger values smooth out jerking. The default value is a good value for general
damping along the curve. Values below 2 tend to make the action jerky, but values around
3 can be very useful for simulating a certain degree of realistic instability.
<Path_Constraint>.allowUpsideDown BooleanClass default: false --
boolean; Allow_Upside_Down
Turn on to avoid the situation in which an object flips when going around a vertically
oriented path.
<Path_Constraint>.constantVel BooleanClass default: false --
boolean; Constant_Velocity
Provides a constant velocity along the path. When off, the velocity of the object along the
path varies depending on the distance between the vertices on the path.
<Path_Constraint>.axis Integer default: 0 -- integer
Defines which axis of the object is aligned to the trajectory of the path.
<Path_Constraint>.axisFlip BooleanClass default: false --
boolean; Axis_Flip
Turn on to flip the direction of the axis
<Path_Constraint>.loop BooleanClass default: false -- boolean
By default, when the constrained object reaches the end of a path it can no longer move
past the end point. The loop option changes this behavior so that when the constrained
object reaches the end of the path it loops back to the starting point.
<Path_Constraint>.relative BooleanClass default: false -- boolean
Turn on to maintain the original position of the constrained object. The object will follow
the path with an offset distance based on its original world space position
PDynaflector - superclass: SpacewarpObject 309
See Also
Path_Constraint interfaces: (p. 468)
Properties:
<PDynaflector>.’time on’ Integer default: 0 -- animatable; integer;
Time_On
Properties:
<Plane_Angle>.Origin Point3 default: [0,0,0] -- point3
<Plane_Angle>.NormalVec Point3 default: [0,0,1] -- point3; Normal_Vector
<Plane_Angle>.UpVec Point3 default: [0,1,0] -- point3; Up_Vector
<Plane_Angle>.Angle Float default: 0.0 -- animatable; angle;
Controller Scaling: (1 : 57.2958)
The angle of the manipulator, from 0.0 to 360.0 (both values are perpendicular in the Y
axis of the viewport where you created the manipulator, unless you have rotated the
manipulator object). Default=0.0.
<Plane_Angle>.Distance Float default: 0.0 -- float
The length of the manipulator, in 3ds max units. Default=the distance of mouse drag
when the manipulator was created.
<Plane_Angle>.Size Float default: 1.0 -- float
The size of the manipulator’s handle, in 3ds max units. Default=1.0.
PlaneAngleManip - superclass: helper 311
See Also
Scripted Manipulators (p. 97)
Interface: manip (p. 366)
sliderManipulator interfaces: (p. 520)
radiusManip interfaces: (p. 500)
uvwMappingHeightManip interfaces: (p. 551)
uvwMappingLengthManip interfaces: (p. 555)
uvwMappingUTileManip interfaces: (p. 558)
uvwMappingVTileManip interfaces: (p. 562)
uvwMappingWidthManip interfaces: (p. 565)
ConeAngleManip - superclass: helper (p. 277)
PlaneAngleManip - superclass: helper (p. 311)
Scripted Plug-ins (p. 1538)
sliderManipulator - superclass: helper (p. 333)
Properties:
<PlaneAngleManip>.Origin Point3 default: [0,0,0] -- point3
<PlaneAngleManip>.NormalVec Point3 default: [0,0,1] -- point3;
Normal_Vector
<PlaneAngleManip>.UpVec Point3 default: [0,1,0] -- point3; Up_Vector
<PlaneAngleManip>.Angle Float default: 0.0 -- animatable; angle;
Controller Scaling: (1 : 57.2958)
The angle of the manipulator, from 0.0 to 360.0 (both values are perpendicular in the Y
axis of the viewport where you created the manipulator, unless you have rotated the
manipulator object). Default=0.0.
<PlaneAngleManip>.Distance Float default: 0.0 -- float
The length of the manipulator, in 3ds max units. Default=the distance of mouse drag
when the manipulator was created.
<PlaneAngleManip>.Size Float default: 1.0 -- float
The size of the manipulator’s handle, in 3ds max units. Default=1.0.
312 Chapter 1 | What’s New in 3ds max 4 MAXScript
See Also
Scripted Manipulators (p. 97)
Interface: manip (p. 366)
sliderManipulator interfaces: (p. 520)
radiusManip interfaces: (p. 500)
uvwMappingHeightManip interfaces: (p. 551)
uvwMappingLengthManip interfaces: (p. 555)
uvwMappingUTileManip interfaces: (p. 558)
uvwMappingVTileManip interfaces: (p. 562)
uvwMappingWidthManip interfaces: (p. 565)
ConeAngleManip - superclass: helper (p. 277)
PlaneAngleManip - superclass: helper (p. 311)
Scripted Plug-ins (p. 1538)
sliderManipulator - superclass: helper (p. 333)
Properties:
<Point3List>.available Point3 default: [0,0,0] -- animatable; point3;
Controller Scaling: ([1,1,1] : [0,0,0]); WeirdScaled ([0,0,0])
See Also
Point3List interfaces: (p. 479)
See Also
Point3Reactor interfaces: (p. 481)
Point3Spring - superclass: Point3Controller 313
Properties:
<Point3Spring>.position Point3 default: [0,0,0] -- animatable; point3
<Point3Spring>.x_effect Float default: 100.0
These settings let you control the percentage of the effect on the individual world axes.
Default=100. Range=0 to 200.
<Point3Spring>.y_effect Float default: 100.0
These settings let you control the percentage of the effect on the individual world axes.
Default=100. Range=0 to 200.
<Point3Spring>.z_effect Float default: 100.0
These settings let you control the percentage of the effect on the individual world axes.
Default=100. Range=0 to 200.
See Also
PositionSpring interfaces: (p. 497)
Point3Spring interfaces: (p. 482)
SpringPoint3Controller interfaces: (p. 523)
SpringPoint3Controller - superclass: Point3Controller (p. 336)
SpringPositionController interfaces: (p. 526)
SpringPositionController - superclass: PositionController (p. 337)
Flex : Modifier (p. 1128)
Flex interfaces: (p. 438)
flexOps const StructDef (p. 235)
314 Chapter 1 | What’s New in 3ds max 4 MAXScript
Properties:
<Point_Cache>.time Float default: 0.0 -- float
<Point_Cache>.start_time Float default: 0.0 -- float
The frame number at which the cached animation starts playing back. Using decimal
fractions lets you start at a sub-frame setting when using a Frame:Ticks time display.
Default=0.0.
Sets the first frame for recording the vertex animation.
<Point_Cache>.end_time Float default: 100.0 -- float
Sets the last frame for recording the vertex animation.
<Point_Cache>.samples Integer default: 1 -- integer
<Point_Cache>.cache_file UndefinedClass default: undefined -- string
Loads a vertex animation from a cache file on disk into the Point Cache modifier. If
number of vertices in the cache file does not match the number of vertices in the object, a
warning appears, but no error occurs.
<Point_Cache>.relativeOffset BooleanClass default: false -- boolean;
Relative_Offset
Makes the Strength setting available. This enables offsetting the animated vertex positions
relative to their positions as recorded. Default=off.
Note: When you turn on Use Relative Offsets and play back a cached animation with the
modifiers turned on, the cached vertex positions are calculated relative to their positions
as calculated by the modifiers. For example, if you record a Bend animation to a cache file,
and then play it back with both Use Relative Offsets and the Bend modifier turned on and
Strength=1.0, all vertex positions are doubled, resulting in exaggerated motion.
<Point_Cache>.strength Float default: 1.0 -- animatable; float
Affects the motion relative to the original animation. Available only when Use Relative
Offsets is turned on. Default=1.0. Range=-10.0 to 10.0.
At 1.0, the animation plays back the same as recorded. With strengths between 0 and 1,
the animation is relatively restrained. At strengths greater than 1, the animation is
exaggerated. With negative Strength settings, the motion is reversed.
See Also
Point Cache Modifier (p. 26)
Point_Cache interfaces: (p. 484)
Point_CacheSpacewarpModifier - superclass: SpacewarpModifier (p. 315)
Point_CacheSpacewarpModifier interfaces: (p. 485)
Point_CacheSpacewarpModifier - superclass: SpacewarpModifier 315
Properties:
<Point_CacheSpacewarpModifier>.time Float default: 0.0 --
float
<Point_CacheSpacewarpModifier>.start_time Float default: 0.0 --
float
The frame number at which the cached animation starts playing back. Using decimal
fractions lets you start at a sub-frame setting when using a Frame:Ticks time display.
Default=0.0.
Sets the first frame for recording the vertex animation.
<Point_CacheSpacewarpModifier>.end_time Float default: 100.0 --
float
Sets the last frame for recording the vertex animation.
<Point_CacheSpacewarpModifier>.samples Integer default: 1 --
integer
<Point_CacheSpacewarpModifier>.cache_file UndefinedClass default:
undefined -- string
Loads a vertex animation from a cache file on disk into the Point Cache modifier. If
number of vertices in the cache file does not match the number of vertices in the object, a
warning appears, but no error occurs.
<Point_CacheSpacewarpModifier>.relativeOffset BooleanClass default: false --
boolean; Relative_Offset
Makes the Strength setting available. This enables offsetting the animated vertex positions
relative to their positions as recorded. Default=off.
Note: When you turn on Use Relative Offsets and play back a cached animation with the
modifiers turned on, the cached vertex positions are calculated relative to their positions
as calculated by the modifiers. For example, if you record a Bend animation to a cache file,
and then play it back with both Use Relative Offsets and the Bend modifier turned on and
Strength=1.0, all vertex positions are doubled, resulting in exaggerated motion.
<Point_CacheSpacewarpModifier>.strength Float default: 1.0 --
animatable; float
Affects the motion relative to the original animation. Available only when Use Relative
Offsets is turned on. Default=1.0. Range=-10.0 to 10.0.
At 1.0, the animation plays back the same as recorded. With strengths between 0 and 1,
the animation is relatively restrained. At strengths greater than 1, the animation is
exaggerated. With negative Strength settings, the motion is reversed.
316 Chapter 1 | What’s New in 3ds max 4 MAXScript
See Also
Point Cache Modifier (p. 26)
Point_Cache interfaces: (p. 484)
Point_Cache - superclass: modifier (p. 314)
Point_CacheSpacewarpModifier interfaces: (p. 485)
Properties:
<PointCache>.time Float default: 0.0 -- float
<PointCache>.start_time Float default: 0.0 -- float
The frame number at which the cached animation starts playing back. Using decimal
fractions lets you start at a sub-frame setting when using a Frame:Ticks time display.
Default=0.0.
Sets the first frame for recording the vertex animation.
<PointCache>.end_time Float default: 100.0 -- float
Sets the last frame for recording the vertex animation.
<PointCache>.samples Integer default: 1 -- integer
<PointCache>.cache_file UndefinedClass default: undefined -- string
Loads a vertex animation from a cache file on disk into the Point Cache modifier. If
number of vertices in the cache file does not match the number of vertices in the object, a
warning appears, but no error occurs.
<PointCache>.relativeOffset BooleanClass default: false -- boolean;
Relative_Offset
Makes the Strength setting available. This enables offsetting the animated vertex positions
relative to their positions as recorded. Default=off.
Note: When you turn on Use Relative Offsets and play back a cached animation with the
modifiers turned on, the cached vertex positions are calculated relative to their positions
as calculated by the modifiers. For example, if you record a Bend animation to a cache file,
and then play it back with both Use Relative Offsets and the Bend modifier turned on and
Strength=1.0, all vertex positions are doubled, resulting in exaggerated motion.
PointCacheWSM - superclass: SpacewarpModifier 317
See Also
Point Cache Modifier (p. 26)
Point_Cache interfaces: (p. 484)
Point_CacheSpacewarpModifier - superclass: SpacewarpModifier (p. 315)
Point_CacheSpacewarpModifier interfaces: (p. 485)
Properties:
<PointCacheWSM>.time Float default: 0.0 -- float
<PointCacheWSM>.start_time Float default: 0.0 -- float
The frame number at which the cached animation starts playing back. Using decimal
fractions lets you start at a sub-frame setting when using a Frame:Ticks time display.
Default=0.0.
Sets the first frame for recording the vertex animation.
<PointCacheWSM>.end_time Float default: 100.0 -- float
Sets the last frame for recording the vertex animation.
<PointCacheWSM>.samples Integer default: 1 -- integer
<PointCacheWSM>.cache_file UndefinedClass default: undefined -- string
Loads a vertex animation from a cache file on disk into the Point Cache modifier. If
number of vertices in the cache file does not match the number of vertices in the object, a
warning appears, but no error occurs.
318 Chapter 1 | What’s New in 3ds max 4 MAXScript
See Also
Point Cache Modifier (p. 26)
Point_Cache interfaces: (p. 484)
Point_Cache - superclass: modifier (p. 314)
Point_CacheSpacewarpModifier interfaces: (p. 485)
Properties:
<PointHelperObj>.size Float default: 20.0 --
animatable; float
Sets the size for the point object. Use this to minimize the point object, or increase its size
to aid in locating it. Default=20.
<PointHelperObj>.centermarker BooleanClass default: false --
animatable; boolean; Center_Marker
Displays a small X marker at the center of the point object.
<PointHelperObj>.axistripod BooleanClass default: false --
animatable; boolean; Axis_Tripod
Displays a tripod axis indicating the position and orientation of the point object. The axis
remains visible when the point object is no longer selected.
Poly_Select - superclass: modifier 319
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Properties:
<Poly_Select>.useSoftSelection BooleanClass default: false --
boolean; Use_Soft_Selection
Affects the action of Move, Rotate, and Scale functions within editable object or edit
modifier, and the action of deformation modifiers applied to the object if they are
operating on a sub-object selection. When on, 3ds max applies a spline curve deformation
to the unselected sub-objects surrounding the selection that you transform. To take effect,
this check box must be on before moving the selection.
You can also use the keyboard shortcut CTRL+S to toggle Use Soft Selection (while the
Plug-In Keyboard Shortcut Toggle button is turned on).
<Poly_Select>.softselUseEdgeDistance BooleanClass default: false --
boolean; Use_Edge_Distance
<Poly_Select>.softselEdgeDist Integer default: 1 --
animatable; integer; Edge_Distance
This spinner setting limits the region affected by the number of edges between the
selection and the affected vertices. The affected region is measured in terms of
“edge-distance” space, along the surface, rather than real space.
320 Chapter 1 | What’s New in 3ds max 4 MAXScript
Properties:
<Position_Constraint>.relative BooleanClass default: false -- boolean
PositionList - superclass: PositionController 321
See Also
Position_Constraint interfaces: (p. 488)
Properties:
<PositionList>.available Point3 default: [0,0,0] -- animatable; point3
See Also
PositionList interfaces: (p. 494)
See Also
PositionReactor interfaces: (p. 496)
Properties:
<PositionSpring>.effectHow Integer default: 1 -- radio button
number; Abs_Rel
<PositionSpring>.forceNode ArrayParameter default: #() -- node array;
Force_Nodes; SubAnim
<PositionSpring>.steps Integer default: 2 -- integer
<PositionSpring>.x_effect Float default: 100.0 -- animatable;
float
These settings let you control the percentage of the effect on the individual world axes.
Default=100. Range=0 to 200.
322 Chapter 1 | What’s New in 3ds max 4 MAXScript
See Also
PositionSpring interfaces: (p. 497)
Point3Spring interfaces: (p. 482)
SpringPoint3Controller interfaces: (p. 523)
SpringPoint3Controller - superclass: Point3Controller (p. 336)
SpringPositionController interfaces: (p. 526)
SpringPositionController - superclass: PositionController (p. 337)
Flex : Modifier (p. 1128)
Flex interfaces: (p. 438)
flexOps const StructDef (p. 235)
Properties:
<PSpawnflector>.‘time on’ Integer default: 0 -- animatable;
integer; Time_On
<PSpawnflector>.‘time off’ Integer default: 16000 --
animatable; integer; Time_Off
<PSpawnflector>.affects Float default: 10000.0 --
animatable; percentage; Reflects; Controller Scaling: (1 : 100.0)
<PSpawnflector>.bounce Float default: 1.0 -- animatable;
float
<PSpawnflector>.bouncevar Float default: 0.0 -- animatable;
percentage; Bounce_Variation; Controller Scaling: (1 : 100.0)
<PSpawnflector>.chaos Float default: 0.0 -- animatable;
percentage; Controller Scaling: (1 : 100.0)
Reflection - superclass: MAXObject 323
Properties:
<Reflection>.enabled BooleanClass default: true -- boolean
Shows whether the element is enabled.
<Reflection>.filterOn BooleanClass default: true -- boolean;
FilteringOn
Shows whether the active antialiasing filter is enabled for the element.
324 Chapter 1 | What’s New in 3ds max 4 MAXScript
See Also
Alpha - superclass: MAXObject (p. 262)
alphaRenderElement - superclass: MAXObject (p. 263)
Atmosphere - superclass: MAXObject (p. 264)
atmosphereRenderElement - superclass: MAXObject (p. 265)
BackgroundRenderElement - superclass: MAXObject (p. 269)
bgndRenderElement - superclass: MAXObject (p. 270)
clrShadowRenderElement - superclass: MAXObject (p. 272)
Colored_Shadow - superclass: MAXObject (p. 273)
Diffuse - superclass: MAXObject (p. 279)
diffuseRenderElement - superclass: MAXObject (p. 280)
emissionRenderElement - superclass: MAXObject (p. 285)
reflectionRenderElement - superclass: MAXObject (p. 324)
Refraction - superclass: MAXObject (p. 326)
refractionRenderElement - superclass: MAXObject (p. 327)
Self_Illumination - superclass: MAXObject (p. 331)
ShadowRenderElement - superclass: MAXObject (p. 332)
Specular - superclass: MAXObject (p. 334)
specularRenderElement - superclass: MAXObject (p. 335)
Properties:
<reflectionRenderElement>.enabled BooleanClass default: true --
boolean
Shows whether the element is enabled.
reflectionRenderElement - superclass: MAXObject 325
See Also
Alpha - superclass: MAXObject (p. 262)
alphaRenderElement - superclass: MAXObject (p. 263)
Atmosphere - superclass: MAXObject (p. 264)
atmosphereRenderElement - superclass: MAXObject (p. 265)
BackgroundRenderElement - superclass: MAXObject (p. 269)
bgndRenderElement - superclass: MAXObject (p. 270)
clrShadowRenderElement - superclass: MAXObject (p. 272)
Colored_Shadow - superclass: MAXObject (p. 273)
Diffuse - superclass: MAXObject (p. 279)
diffuseRenderElement - superclass: MAXObject (p. 280)
emissionRenderElement - superclass: MAXObject (p. 285)
Reflection - superclass: MAXObject (p. 323)
Refraction - superclass: MAXObject (p. 326)
refractionRenderElement - superclass: MAXObject (p. 327)
Self_Illumination - superclass: MAXObject (p. 331)
ShadowRenderElement - superclass: MAXObject (p. 332)
Specular - superclass: MAXObject (p. 334)
specularRenderElement - superclass: MAXObject (p. 335)
326 Chapter 1 | What’s New in 3ds max 4 MAXScript
Properties:
<Refraction>.enabled BooleanClass default: true -- boolean
Shows whether the element is enabled.
<Refraction>.filterOn BooleanClass default: true -- boolean;
FilteringOn
Shows whether the active antialiasing filter is enabled for the element.
<Refraction>.elementName String default: “Refraction” -- string
Shows the name of the currently selected element. You can type in a custom name for the
element.
This control is unavailable when multiple elements are selected.
<Refraction>.bitmap UndefinedClass default: undefined -- bitmap
See Also
Alpha - superclass: MAXObject (p. 262)
alphaRenderElement - superclass: MAXObject (p. 263)
Atmosphere - superclass: MAXObject (p. 264)
atmosphereRenderElement - superclass: MAXObject (p. 265)
BackgroundRenderElement - superclass: MAXObject (p. 269)
bgndRenderElement - superclass: MAXObject (p. 270)
clrShadowRenderElement - superclass: MAXObject (p. 272)
Colored_Shadow - superclass: MAXObject (p. 273)
Diffuse - superclass: MAXObject (p. 279)
diffuseRenderElement - superclass: MAXObject (p. 280)
emissionRenderElement - superclass: MAXObject (p. 285)
Reflection - superclass: MAXObject (p. 323)
reflectionRenderElement - superclass: MAXObject (p. 324)
refractionRenderElement - superclass: MAXObject (p. 327)
Self_Illumination - superclass: MAXObject (p. 331)
ShadowRenderElement - superclass: MAXObject (p. 332)
Specular - superclass: MAXObject (p. 334)
specularRenderElement - superclass: MAXObject (p. 335)
refractionRenderElement - superclass: MAXObject 327
Properties:
<refractionRenderElement>.enabled BooleanClass default: true --
boolean
Shows whether the element is enabled.
<refractionRenderElement>.filterOn BooleanClass default: true --
boolean; FilteringOn
Shows whether the active antialiasing filter is enabled for the element.
<refractionRenderElement>.elementName String default:
“Refraction” -- string
Shows the name of the currently selected element. You can type in a custom name for the
element.
This control is unavailable when multiple elements are selected.
<refractionRenderElement>.bitmap UndefinedClass default: undefined -
- bitmap
See Also
Alpha - superclass: MAXObject (p. 262)
alphaRenderElement - superclass: MAXObject (p. 263)
Atmosphere - superclass: MAXObject (p. 264)
atmosphereRenderElement - superclass: MAXObject (p. 265)
BackgroundRenderElement - superclass: MAXObject (p. 269)
bgndRenderElement - superclass: MAXObject (p. 270)
clrShadowRenderElement - superclass: MAXObject (p. 272)
Colored_Shadow - superclass: MAXObject (p. 273)
Diffuse - superclass: MAXObject (p. 279)
diffuseRenderElement - superclass: MAXObject (p. 280)
emissionRenderElement - superclass: MAXObject (p. 285)
Reflection - superclass: MAXObject (p. 323)
reflectionRenderElement - superclass: MAXObject (p. 324)
Refraction - superclass: MAXObject (p. 326)
Self_Illumination - superclass: MAXObject (p. 331)
ShadowRenderElement - superclass: MAXObject (p. 332)
328 Chapter 1 | What’s New in 3ds max 4 MAXScript
Properties:
<RotationList>.available Quat default: (quat 0 0 0 1) -- animatable; quat
See Also
RotationList interfaces: (p. 510)
See Also
RotationReactor interfaces: (p. 512)
Properties:
<ScaleList>.available Point3 default: [0,0,0] -- animatable; point3
See Also
ScaleList interfaces: (p. 517)
ScaleReactor - superclass: ScaleController 329
See Also
ScaleReactor interfaces: (p. 519)
Properties:
<SDynaflector>.‘time on’ Integer default: 0 -- animatable; integer;
Time_On
Properties:
<section>.angle Float default: 0.0 -- float
<section>.renderable BooleanClass default: false -- boolean
<section>.mapCoords BooleanClass default: false -- boolean
<section>.thickness Float default: 1.0 -- float
<section>.sides Float default: 12.0 -- integer
<section>.viewport_thickness Float default: 1.0 -- float
<section>.viewport_sides Integer default: 12 -- integer
<section>.viewport_angle Float default: 0.0 -- float
<section>.DisplayRenderMesh BooleanClass default: false -- boolean
<section>.UseViewportSettings BooleanClass default: false -- boolean
<section>.DisplayRenderSettings BooleanClass default: true -- boolean
Notes:
Setting to false won’t “take” if <shape>.useViewportSettings or <shape>.displayRenderMesh is
false. This matches the behavior in the UI where the “Viewport” option is disabled in this case.
Self_Illumination - superclass: MAXObject 331
Properties:
<Self_Illumination>.enabled BooleanClass default: true -- boolean
Shows whether the element is enabled.
<Self_Illumination>.filterOn BooleanClass default: true -- boolean;
FilteringOn
Shows whether the active antialiasing filter is enabled for the element.
<Self_Illumination>.elementName String default: “Self-
Illumination” -- string
Shows the name of the currently selected element. You can type in a custom name for the
element.
This control is unavailable when multiple elements are selected.
<Self_Illumination>.bitmap UndefinedClass default: undefined --
bitmap
See Also
LOOKS THE SAME AS emissionRenderElement - superclass: MAXObject (p. 285)
Alpha - superclass: MAXObject (p. 262)
alphaRenderElement - superclass: MAXObject (p. 263)
Atmosphere - superclass: MAXObject (p. 264)
atmosphereRenderElement - superclass: MAXObject (p. 265)
BackgroundRenderElement - superclass: MAXObject (p. 269)
bgndRenderElement - superclass: MAXObject (p. 270)
clrShadowRenderElement - superclass: MAXObject (p. 272)
Colored_Shadow - superclass: MAXObject (p. 273)
Diffuse - superclass: MAXObject (p. 279)
diffuseRenderElement - superclass: MAXObject (p. 280)
emissionRenderElement - superclass: MAXObject (p. 285)
Reflection - superclass: MAXObject (p. 323)
reflectionRenderElement - superclass: MAXObject (p. 324)
Refraction - superclass: MAXObject (p. 326)
refractionRenderElement - superclass: MAXObject (p. 327)
ShadowRenderElement - superclass: MAXObject (p. 332)
332 Chapter 1 | What’s New in 3ds max 4 MAXScript
Properties:
<ShadowRenderElement>.enabled BooleanClass default: true --
boolean
Shows whether the element is enabled.
<ShadowRenderElement>.filterOn BooleanClass default: true --
boolean; FilteringOn
Shows whether the active antialiasing filter is enabled for the element.
<ShadowRenderElement>.elementName String default: “Shadow” --
string
Shows the name of the currently selected element. You can type in a custom name for the
element.
This control is unavailable when multiple elements are selected.
<ShadowRenderElement>.bitmap UndefinedClass default: undefined --
bitmap
See Also
Alpha - superclass: MAXObject (p. 262)
alphaRenderElement - superclass: MAXObject (p. 263)
Atmosphere - superclass: MAXObject (p. 264)
atmosphereRenderElement - superclass: MAXObject (p. 265)
BackgroundRenderElement - superclass: MAXObject (p. 269)
bgndRenderElement - superclass: MAXObject (p. 270)
clrShadowRenderElement - superclass: MAXObject (p. 272)
Colored_Shadow - superclass: MAXObject (p. 273)
Diffuse - superclass: MAXObject (p. 279)
diffuseRenderElement - superclass: MAXObject (p. 280)
emissionRenderElement - superclass: MAXObject (p. 285)
Reflection - superclass: MAXObject (p. 323)
reflectionRenderElement - superclass: MAXObject (p. 324)
Refraction - superclass: MAXObject (p. 326)
sliderManipulator - superclass: helper 333
Properties:
<sliderManipulator>.value Float default: 0.0 -- animatable; float
The value of the slider, based on the position of the slidable triangle. Default=0.0.
<sliderManipulator>.minVal Float default: 0.0 -- animatable; float
The minimum possible value of the slider. Default=0.0.
<sliderManipulator>.maxVal Float default: 100.0 -- animatable; float
The maximum possible value of the slider. Default=100.0.
When the minimum is 0.0 and the maximum is 100.0, the slider Value can represent a
percentage.
<sliderManipulator>.xPos Float default: 0.0 -- float
The slider’s X location in the active viewport. Default=Viewport X location you clicked
when you created the slider.
<sliderManipulator>.yPos Float default: 0.0 -- float
The slider’s Y location in the active viewport. Default=Viewport Y location you clicked
when you created the slider.
<sliderManipulator>.width Float default: 100.0 -- float
The slider’s width, in 3ds max units. Default=100.0.
<sliderManipulator>.hide BooleanClass default: false -- boolean
When on, hides all of the slider except for the label and the move and show/hide
components. Default=off.
<sliderManipulator>.sldName String default: ““ -- string
The slider label that appears in viewports. Default=none.
<sliderManipulator>.snapToggle BooleanClass default: true -- boolean
When on, the slider “snaps” to incremental values. When off, Default=on.
<sliderManipulator>.snapVal Float default: 0.01 -- float
The increment used by the slider when Snap is on. Default=0.01.
334 Chapter 1 | What’s New in 3ds max 4 MAXScript
See Also
Scripted Manipulators (p. 97)
Interface: manip (p. 366)
radiusManip interfaces: (p. 500)
ConeAngleManip - superclass: helper (p. 277)
PlaneAngleManip - superclass: helper (p. 311)
Scripted Plug-ins (p. 1538)
sliderManipulator - superclass: helper (p. 333)
sliderManipulator interfaces: (p. 520)
uvwMappingHeightManip interfaces: (p. 551)
uvwMappingLengthManip interfaces: (p. 555)
uvwMappingUTileManip interfaces: (p. 558)
uvwMappingVTileManip interfaces: (p. 562)
uvwMappingWidthManip interfaces: (p. 565)
Properties:
<Specular>.enabled BooleanClass default: true -- boolean
Shows whether the element is enabled.
<Specular>.filterOn BooleanClass default: true -- boolean;
FilteringOn
Shows whether the active antialiasing filter is enabled for the element.
<Specular>.elementName String default: “Specular” -- string
Shows the name of the currently selected element. You can type in a custom name for the
element.
This control is unavailable when multiple elements are selected.
<Specular>.bitmap UndefinedClass default: undefined -- bitmap
See Also
Alpha - superclass: MAXObject (p. 262)
alphaRenderElement - superclass: MAXObject (p. 263)
Atmosphere - superclass: MAXObject (p. 264)
atmosphereRenderElement - superclass: MAXObject (p. 265)
specularRenderElement - superclass: MAXObject 335
Properties:
<specularRenderElement>.enabled BooleanClass default: true --
boolean
Shows whether the element is enabled.
<specularRenderElement>.filterOn BooleanClass default: true --
boolean; FilteringOn
Shows whether the active antialiasing filter is enabled for the element.
<specularRenderElement>.elementName String default: “Specular” --
string
Shows the name of the currently selected element. You can type in a custom name for the
element.
This control is unavailable when multiple elements are selected.
<specularRenderElement>.bitmap UndefinedClass default: undefined --
bitmap
336 Chapter 1 | What’s New in 3ds max 4 MAXScript
See Also
Alpha - superclass: MAXObject (p. 262)
alphaRenderElement - superclass: MAXObject (p. 263)
Atmosphere - superclass: MAXObject (p. 264)
atmosphereRenderElement - superclass: MAXObject (p. 265)
BackgroundRenderElement - superclass: MAXObject (p. 269)
bgndRenderElement - superclass: MAXObject (p. 270)
clrShadowRenderElement - superclass: MAXObject (p. 272)
Colored_Shadow - superclass: MAXObject (p. 273)
Diffuse - superclass: MAXObject (p. 279)
diffuseRenderElement - superclass: MAXObject (p. 280)
emissionRenderElement - superclass: MAXObject (p. 285)
Reflection - superclass: MAXObject (p. 323)
reflectionRenderElement - superclass: MAXObject (p. 324)
Refraction - superclass: MAXObject (p. 326)
refractionRenderElement - superclass: MAXObject (p. 327)
Self_Illumination - superclass: MAXObject (p. 331)
ShadowRenderElement - superclass: MAXObject (p. 332)
Specular - superclass: MAXObject (p. 334) specularRenderElement_superclass_MAXObject
Properties:
<SpringPoint3Controller>.position Point3 default: [0,0,0] -- animatable;
point3
<SpringPoint3Controller>.x_effect Float default: 100.0
These settings let you control the percentage of the effect on the individual world axes.
Default=100. Range=0 to 200.
<SpringPoint3Controller>.y_effect Float default: 100.0
These settings let you control the percentage of the effect on the individual world axes.
Default=100. Range=0 to 200.
SpringPositionController - superclass: PositionController 337
See Also
PositionSpring interfaces: (p. 497)
Point3Spring interfaces: (p. 482)
SpringPoint3Controller interfaces: (p. 523)
SpringPoint3Controller - superclass: Point3Controller (p. 336)
SpringPositionController interfaces: (p. 526)
SpringPositionController - superclass: PositionController (p. 337)
Flex : Modifier (p. 1128)
Flex interfaces: (p. 438)
flexOps const StructDef (p. 235)
Properties:
<SpringPositionController>.effectHow Integer default: 1 -- radio
button number; Abs_Rel
<SpringPositionController>.forceNode ArrayParameter default: #() -- node
array; Force_Nodes; SubAnim
<SpringPositionController>.steps Integer default: 2 -- integer
<SpringPositionController>.x_effect Float default: 100.0 --
animatable; float
These settings let you control the percentage of the effect on the individual world axes.
Default=100. Range=0 to 200.
<SpringPositionController>.y_effect Float default: 100.0 --
animatable; float
These settings let you control the percentage of the effect on the individual world axes.
Default=100. Range=0 to 200.
<SpringPositionController>.z_effect Float default: 100.0 --
animatable; float
These settings let you control the percentage of the effect on the individual world axes.
Default=100. Range=0 to 200.See Also
338 Chapter 1 | What’s New in 3ds max 4 MAXScript
See Also
PositionSpring interfaces: (p. 497)
Point3Spring interfaces: (p. 482)
SpringPoint3Controller interfaces: (p. 523)
SpringPoint3Controller - superclass: Point3Controller (p. 336)
SpringPositionController interfaces: (p. 526)
SpringPositionController - superclass: PositionController (p. 337)
Flex : Modifier (p. 1128)
Flex interfaces: (p. 438)
flexOps const StructDef (p. 235)
Properties:
<SSpawnflector>.’time on’ Integer default: 0 -- animatable; integer;
Time_On
The software interprets the text you type into the Script text box as the body of a MAXScript block
expression. You can type as many expressions as you want on as many lines as you want, and they
are evaluated in turn. The value of the last expression is taken as the controller value. This must yield
a matrix3 value for Transform Script controllers.
Since the text is inside a block expression, you can declare local variables which are visible only
within the script and are temporary for one evaluation. You can also declare or access global
variables that are shared with all other scripts in MAXScript and hold their values from one
evaluation to the next.
A controller is always evaluated by the software with respect to a specific animation time. This might
be the current time slider or incrementing frame time if an animation is playing, or a rendering is
under way. In the case of Script controllers, the time being evaluated is used to establish an
automatic “at time” context around the controller script, so any properties you access (outside of
other explicit “at time” expressions) yield the correct values for the current controller evaluation
time. This means you don’t have to do anything special in your scripts to work at the correct time.
You can access the evaluation time, with the standard MAXScript variable, current Time. You can
also reference scene property values at other times by using “at time” expressions in your scripts, as
in regular MAXScript programming.
Constructor:
transform_script ...
Properties:
<transform_script>.script String default: “(matrix3 1)”
See Also
Script Controllers (p. 1329)
Properties:
<Turn_to_Mesh>.useInvisibleEdges BooleanClass default: true --
animatable; boolean; Use_Invisible_Edges
When on, uses invisible edges to represent polygons. When off, produces a completely
triangulated mesh with all visible edges. Default=on.
Turn_to_Mesh - superclass: modifier 341
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
342 Chapter 1 | What’s New in 3ds max 4 MAXScript
Properties:
<Turn_to_Patch>.quadsToQuads BooleanClass default: true --
animatable; boolean; Quads_to_Quad_Patches
Turns quad faces in meshes or polymeshes into quad patches.
Note: When you turn this option off, 3ds max triangulates quads when the Turn To Patch
modifier is applied to a patch object.
<Turn_to_Patch>.selectionConversion Integer default: 0 -- integer;
Selection_Conversion
<Turn_to_Patch>.useSoftSelection Integer default: 1 -- integer;
Use_Soft_Selection
Affects the action of sub-object Move, Rotate, and Scale functions. When these are on,
3D Studio MAX applies a spline curve deformation to unselected vertices surrounding the
transformed selected sub-object. This provides a magnet-like effect, with a sphere of
influence around the transformation. Use this when you want to preserve the soft
selection from beneath. For example, if Use Soft Selection is on when you select vertices on
an editable poly, and you apply Turn To Mesh with Include Soft Selection on, then the
same soft selection will apply to the mesh vertices. Default=on.
For more information, see Soft Selection Rollout.
Important: Be aware that when Include Soft Selection is on, bound vertices can turn to
meshes.
<Turn_to_Patch>.selectionLevel Integer default: 0 -- integer;
Selection_Level
From Pipeline: Uses the equivalent of whatever the input object uses. (Patch level becomes
face level, and so on.). For example, if you create a box, convert it to an editable mesh in
face mode and apply a Turn To Patch modifier to it, 3ds max passes a sub-object selection
in face mode up the stack. The Turn To Patch modifier takes the sub-object face selection
into account and selects the patches that derive from the face selection.
Object: Uses object as the selection level for passing up the rest of the stack.
Edge: Uses edge as the sub-object selection level for passing up the rest of the stack.
Vertex: Uses vertex as the sub-object selection level for passing up the rest of the stack.
Face: Uses face as the sub-object selection level for passing up the rest of the stack.
Turn_to_Poly - superclass: modifier 343
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Properties:
<Turn_to_Poly>.keepConvex BooleanClass default: false --
animatable; boolean; Keep_Convex
Does not join across edges if the resulting polygon would not be convex. “Convex” means
that you can connect any two points in the polygon with a line that doesn’t go outside the
polygon. A polygon is not convex if you can draw a line between vertices and that line lays
outside of the polygon.
Problems that can occur with non-convex polygons include the fact that changes in the
geometry of the input object can result in a different topology for the Turn To Poly result.
For instance, in a box, if you drag one of the top corners across the middle of the top face,
the box becomes non-convex. Turn To Poly would then see this as two triangles instead of
one quad, and the number of points in the result would change.
<Turn_to_Poly>.limitPolySize BooleanClass default: false --
animatable; boolean; Limit_Polygon_Size
Limits the number of sides to a polygon so that the surface is better defined. For example,
you might want to produce a polymesh of triangles and quads, or one composed of all
triangles, rather than joining together more than two triangles into pentagons, hexagons,
and so on.
<Turn_to_Poly>.maxPolySize Integer default: 4 -- animatable;
integer; Max_Polygon_Size
The maximum number of sides to a polygon.
<Turn_to_Poly>.requirePlanar BooleanClass default: false --
animatable; boolean; Require_Planar_Polygons
Creates polygons composed of flat planes. Does not join faces together across an edge if
the edge has a sharper angle than the threshold listed.
<Turn_to_Poly>.planarThresh Float default: 15.0 --
animatable; angle; Planar_Threshold; Controller Scaling: (1 : 57.2958)
Controls the threshold of the angle between polygonal planes.
<Turn_to_Poly>.removeMidEdgeVertices BooleanClass default: true -- boolean;
Remove_Mid_Edge_Vertices
344 Chapter 1 | What’s New in 3ds max 4 MAXScript
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
UDynaDeflector - superclass: SpacewarpObject 345
Properties:
<UDynaDeflector>.’time on’ Integer default: 0 -- animatable; integer;
Time_On
Properties:
<USpawnDeflector>.‘time on’ Integer default: 0 -- animatable; integer;
Time_On
Constructor:
Vortex ...
Properties:
<Vortex>.‘time on’ Integer default: 0 -- integer; Time_On
The frame numbers at which the space warp becomes active and becomes inactive.
<Vortex>.‘time off’ Integer default: 16000 -- animatable;
integer; Time_Off
The frame numbers at which the space warp becomes active and becomes inactive.
<Vortex>.axialstrength Float default: 0.1 -- animatable; float;
Axial_Drop_Strength
Specifies how quickly particles move in the direction of the drop axis.
<Vortex>.axialrange Float default: 100.0 -- animatable;
float; Axial_Range
The distance from the center of the Vortex icon, in system units, at which Axial Damping
has its full effect. Takes effect only when Unlimited Range is turned off.
<Vortex>.axialfalloff Float default: 1000.0 -- animatable;
float; Axial_Falloff
Specifies the distance beyond the Axial Range within which Axial Damping is applied.
Axial Damping is strongest at the Range distance, decreases linearly out to the limit of the
Axial Falloff, and has no effect beyond that. Takes effect only when Unlimited Range is
turned off.
<Vortex>.axialdamping Float default: 5.0 -- animatable;
percentage; Axial_Damping; Controller Scaling: (1 : 100.0)
Controls the degree to which particle motion parallel to the drop axis is restrained per
frame. Default=5.0. Range=0 to 100.
For subtle effects, use values of less than 10%. For more overt effects, try using higher
values that increase to 100% over the course of a few frames.
<Vortex>.rotationstrength Float default: 0.5 -- animatable; float;
Orbital_Speed_Strength
Specifies how quickly the particles rotate.
<Vortex>.rotationrange Float default: 100.0 -- animatable;
float; Orbital_Range
The distance from the center of the Vortex icon, in system units, at which Orbital
Damping has its full effect. Takes effect only when Unlimited Range is turned off.
<Vortex>.rotationfalloff Float default: 1000.0 -- animatable;
float; Orbital_Falloff
Specifies the distance beyond the Orbital Range within which Orbital Damping is applied.
Orbital Damping is strongest at the Range distance, decreases linearly out to the limit of
the Orbital Falloff, and has no effect beyond that. Takes effect only when Unlimited Range
is turned off.
Vortex - superclass: SpacewarpObject 349
See Also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Properties:
<Z_Depth>.enabled BooleanClass default: true -- boolean
Shows whether the element is enabled.
<Z_Depth>.filterOn BooleanClass default: true -- boolean; FilteringOn
When on, applies the active antialiasing filter to the rendered element. When off, the
rendered element does not use the antialiasing filter. Default=on.
The Filter Enabled column of the elements list shows whether or not the filter is enabled
for an element.
You choose the antialiasing filter in the Anti-Aliasing group of the MAX Default Scanline
A-Buffer rollout.
Disabling antialiasing can improve rendering time, although the rendered element that
results might appear jagged.
<Z_Depth>.elementName String default: “Z Depth” -- string
Shows the name of the element. You can change the default name of elements, in the
Selected Element Parameters group.
To select an element, click its name in the list. Use CTRL+click to select additional
elements, or SHIFT+click to select a contiguous group of additional elements.
<Z_Depth>.bitmap UndefinedClass default: undefined -- bitmap
<Z_Depth>.zMin Float default: 100.0 -- float; Z_Min
The minimum distance to include in the Z-depth rendering. This is a value in 3ds max
units. Default=0.0 (cannot be less than zero).
<Z_Depth>.zMax Float default: 300.0 -- float; Z_Max
The maximum distance to include in the Z-depth rendering. This is a value in 3ds max
units. Default=100.0.
ZRenderElement - superclass: MAXObject 351
Properties:
<ZRenderElement>.enabled BooleanClass default: true -- boolean
Shows whether the element is enabled.
<ZRenderElement>.filterOn BooleanClass default: true -- boolean;
FilteringOn
When on, applies the active antialiasing filter to the rendered element. When off, the
rendered element does not use the antialiasing filter. Default=on.
The Filter Enabled column of the elements list shows whether or not the filter is enabled
for an element.
You choose the antialiasing filter in the Anti-Aliasing group of the MAX Default Scanline
A-Buffer rollout.
Disabling antialiasing can improve rendering time, although the rendered element that
results might appear jagged.
<ZRenderElement>.elementName String default: “Z Depth” -- string
Shows the name of the element. You can change the default name of elements, in the
Selected Element Parameters group.
To select an element, click its name in the list. Use CTRL+click to select additional
elements, or SHIFT+click to select a contiguous group of additional elements.
<ZRenderElement>.bitmap UndefinedClass default: undefined -- bitmap
<ZRenderElement>.zMin Float default: 100.0 -- float; Z_Min
The minimum distance to include in the Z-depth rendering. This is a value in 3ds max
units. Default=0.0 (cannot be less than zero).
<ZRenderElement>.zMax Float default: 300.0 -- float; Z_Max
The maximum distance to include in the Z-depth rendering. This is a value in 3ds max
units. Default=100.0.
352 Chapter 1 | What’s New in 3ds max 4 MAXScript
See Also
Other Interfaces (p. 71)
Class and Object Inspector Functions (p. 799)
Class and Object Inspector Functions Enhanced (p. 159)
Interface: actionMan 353
Interface: actionMan
Action Manager (p. 9)
All Action Items are macro recorded when executed. This includes main menus items, CUI buttons,
keyboard shortcuts and quad menu items.
Prototype:
<boolean>executeAction <integer>tableId <string>persistentId
Parameters:
<integer>tableId
<string>persistentId
Return Value:
True if successful and false otherwise.
Prototype:
<boolean>loadKeyboardFile <string>file
Parameters:
<string>file
Return Value:
True if successful and false otherwise.
Prototype:
<boolean>saveKeyboardFile <string>file
Parameters:
<string>file
Return Value:
True if successful and false otherwise.
Prototype:
<string>getKeyboardFile()
Return Value:
True if successful and false otherwise.
See Also
Action Manager (p. 9)
The Macro Recorder (p. l)
Defining Macro Scripts (p. 1521)
The MAXScript Listener Window (p. xxxvi)
354 Chapter 1 | What’s New in 3ds max 4 MAXScript
Interface: BoneSys
Bone Creation (p. 25)
Interface: BoneSys
Methods:
Prototype:
<node>createBone <point3>startPos <point3>endPos <point3>zAxis
Parameters:
<point3>startPos
The location of the new bone as point3
<point3>endPos
The direction (X axis) of the bone and the bone length as point3
<point3>zAxis
The direction of the Z axis for the new bone node as point3
Return Value:
It returns the new bone node that was created.
Note:
If the Z axis is not perpendicular to the X axis, the Z axis will be made perpendicular. To create a
bone chain, call createBone repeatedly with the startPosition set to the value of the previous
endPosition. Note that newly created bones are not linked to any parent. So to create a bone chain,
the script would also need to link each newly created bone segment to the previous.
See Also
Bones : System (p. 991)
Core Interfaces (p. 70)
Node Common Properties, Operators, and Methods (p. 820)
Bone Creation (p. 25)
Bone : Helper (p. 978)
Skin : Modifier (p. 1157)
Access to the new node bone properties and methods (p. 23) Bones_SystemBones_System
Interface: browserMgr 355
Interface: browserMgr
This represents the interface to the Browser Manager.
Methods:
Prototype:
<Interface>newBrowser <string>rootURL <boolean>showDirectory <boolean>showContent
<boolean>showToolbar <boolean>showMenu
Remarks:
This method will create and open a new browser window.
Parameters:
<string>rootURL
The string containing the URL.
<boolean>showDirectory
TRUE to show as a directory, otherwise FALSE.
<boolean>showContent
TRUE to show the content window, otherwise FALSE.
<boolean>showToolbar
TRUE to show the browser toolbar, otherwise FALSE.
<boolean>showMenu
TRUE to show the browser menu, otherwise FALSE.
Return Value:
An interface to a new browsermgr.
Prototype:
<integer>numBrowsers()
Return Value:
This method will return the current number of browsers.
Prototype:
<Interface>getBrowser <integer>index
Remarks:
This method allows you to obtain a pointer to a specific browser.
Parameters:
<integer>index
Return Value:
An interface to the ith browser.
356 Chapter 1 | What’s New in 3ds max 4 MAXScript
See Also
Asset Browser enhancements (p. 22)
iDrop - drag and drop (p. 62)
Zip-file Script Packages (p. 122)
Interface: cmdPanel
Customize The Order of Rollup Pages (p. 185)
Methods:
Prototype:
<integer>GetRollupThreshold()
Return Value:
Returns how many pixels of a rollout should be scrollable in the command panel before the rollout
is shifted into a separate command panel column. This option is only applicable when there are
multiple columns displayed in the command panel.
Prototype:
<void>SetRollupThreshold <integer>threshold
Remarks:
Parameters:
<integer>threshold
See Also
Rollout User-Interface Controls (p. 1481)
Rollout User-Interface Controls Types (p. 1484)
Rollout User-Interface Controls Common Properties (p. 1481)
Rollout User-Interface Controls Common Layout Parameters (p. 1483)
Customize The Order of Rollup Pages (p. 185)
Visual MAXScript (p. 117)
Interface: colorMan
Color Manager (p. 35)
This is an interface to the Color Manager. Within MAX, using the Customize pull down menu/
Customize User Interface choice/Colors tab, a user is able to alter the colors used for various UI
elements. They can change the saturation, value and transparency of elements, and load and save
color schemes.
Prototype:
<boolean>useStandardWindowsColors()
Interface: colorMan 357
Return Value:
Returns true if the standard windows colors are used and false if custom colors are used.
Prototype:
<void>setUseStandardWindowsColors <boolean>onOff
Remarks:
Sets whether standard windows colors are used or not. This allows the developer to tell the system
to use standard windows colors, instead of the custom colors.
Parameters:
<boolean>onOff
Pass true to use the standard windows color and false to use the custom colors.
Prototype:
<boolean>registerColor <string>color <string>name <string>category <point3 by
value>defaultColor
Remarks:
This registers a new color with the system. This adds a color to the color manager database that is
then accessible from the color customization UI.
Parameters:
<string>color
The ID of the color to register. Example: #myNewColor
<string>name
The name for the color. Example: “My Own Color”
<string>category
The category for the color. If the name passed matches one of the existing MAX
categories the color will be placed in there, otherwise a new one will be created.
Example: “Fun Gaming Colors”
<point3 by value>defaultColor
The default value for the color. This is the value that the color will be reset to
when a MAX user presses “Reset” in the color customization dialog.
Example: [1,0,0]
Return Value:
Returns false if the color is already registered; otherwise true.
Prototype:
<boolean>loadColorFile <string>file
Remarks:
This method will load the specified color file from the current UI directory.
Parameters:
<string>file
The filename of the color file to load.
358 Chapter 1 | What’s New in 3ds max 4 MAXScript
Return Value:
TRUE if the load was successful, otherwise FALSE.
Prototype:
<boolean>saveColorFile <string>file
Remarks:
This method will save the specified color file from the current UI directory.
Parameters:
<string>file
The filename of the color file to save.
Return Value:
TRUE if the save process was successful, otherwise FALSE.
Prototype:
<string>getColorFile()
Return Value:
This method returns the file name of the current color file.
Prototype:
<boolean>setColor <string>color <point3 by value>colorValue
Remarks:
Sets the color value of the previously registered color whose ID is passed.
Parameters:
<string>color
Specifies which color to set.
<point3 by value>colorValue
The color value to set.
Predefined colors include:
#background -- The background for all controls and buttons
#text -- The text for all controls and buttons
#activeCommand -- The color command mode buttons turn when pressed
#hilight -- The hilight color for 3d controls
#shadow -- The shadow color for 3d controls
#window -- The background color for edit boxes, list boxes and
other windows
#activeCaption --
#toolTipBackground -- The background for viewport tool tips
#toolTipText -- The text color for viewport tool tips
#hilightText -- The hilight color in the stack view drop-down list
#windowText -- The color used in edit boxes, list boxes and other
windows
#itemHilight --
#subObjectColor -- The color used to hilight sub-object levels in
StackView
#3dDarkShadow -- the dark shadow color on 3d controls
Interface: colorMan 359
Parameters:
<string>color
The ID of the color.
Return Value:
Returns the name of the color whose ID is passed.
360 Chapter 1 | What’s New in 3ds max 4 MAXScript
Prototype:
<string>getCategory <string>color
Parameters:
<string>color
The ID of the color.
Return Value:
Returns the category string of the color whose ID is passed.
Prototype:
<float>getIconColorScale <enum>type <enum>which
type enums: {#disabledIcon|#enabledIcon}
which enums: {#saturationScale|#valueScale|#alphaScale}
Parameters:
<enum>type
One of the following values:
#disabledIcon
The disabled icons.
#enabledIcon
The enabled icons.
<enum>which
The icon color scale. One of the following values:
#saturationScale
The saturation scale.
#valueScale
The value scale.
#alphaScale
The alpha scale.
Return Value:
Returns a floating point value (in the range 0.0f to 1.0f) that is one of the scale factors applied to the
specified icon type. These scale values used to do image processing on the icons at start-up time.
Prototype:
<void>setIconColorScale <enum>type <enum>which <float>value
type enums: {#disabledIcon|#enabledIcon}
which enums: {#saturationScale|#valueScale|#alphaScale}
Remarks:
Sets the specified scale factor for the icon type passed. The color manager maintains the values for
the MAX icon image processing system. Developers can set values to scale the saturation, value and
transparency for enabled and disabled icon images using this method.
Interface: colorMan 361
Parameters:
<enum>type
The icon type. One of the following values:
#disabledIcon
The disabled icons.
#enabledIcon
The enabled icons.
<enum>which
The icon color scale. One of the following values:
#saturationScale
The saturation scale.
#valueScale
The value scale.
#alphaScale
The alpha scale.
<float>value
The value runs from 0.0 to 100.0.
Prototype:
<boolean>getIconColorInvert <enum>type
type enums: {#disabledIcon|#enabledIcon}
Parameters:
<enum>type
The icon type. One of the following values:
#disabledIcon
The disabled icons.
#enabledIcon
The enabled icons.
Return Value:
Returns true if the invert flag is set for the specified icon type and false if not set.
Prototype:
<void>setIconColorInvert <enum>type <boolean>value
type enums: {#disabledIcon|#enabledIcon}
Remarks:
Sets the invert flag for the specified icon type to on or off.
Parameters:
<enum>type
The icon type. One of the following values:
#disabledIcon
The disabled icons.
362 Chapter 1 | What’s New in 3ds max 4 MAXScript
#enabledIcon
The enabled icons.
<boolean>value
Pass true for inverted; false for not inverted.
Prototype:
<string>getFileName()
Remarks:
Returns the file name of the currently loaded color file.
Prototype:
<point3 by value>getDefaultColor <string>color
Parameters:
<string>color
The ID of the color.
Return Value:
Returns the default color for the specified ID. The default color is the value passed as defaultValue
in registerColor, regardless if a SetColor() has been done subsequently. This is used by the UI when
the user presses “Reset” to reset a color to its default value.
Prototype:
<void>repaintUI <enum>type
type enums: {#repaintAll|#repaintTrackBar|#repaintTimeBar}
Remarks:
This method allows you to issue a repaint of the user interface.
Parameters:
RepaintType type
The type of repaint you wish to issue; #repaintAll, #repaintTrackBar,
#repaintTimeBar.
See Also
In The MAXSDK Help File:
Class IColorManager
Interface: dragAndDrop
iDrop - drag and drop (p. 62)
The Drag and Drop system is managed through a Core Function Published interface. It provides
control over the DnD system, manages handler registration and exposes some useful utility methods
for downloading URL’s, simulating drops, etc.
Interface: dragAndDrop 363
Prototype:
<void>globalEnableDragAndDrop <boolean>onOff
Remarks:
This method allows you to globally enable or disable the DnD interface.
Parameters:
<boolean>onOff
TRUE to enable, FALSE to disable.
Prototype:
<boolean>isEnabled()
Return Value:
This method returns TRUE if the global DnD interface is enabled, otherwise FALSE.
Prototype:
<boolean>enableDragAndDrop <HWND>window <boolean>onOff
Remarks:
This method allows you to enable DnD for a given window (and its children). If no custom
DragAndDropHandler is supplied, a default one is used that will accept dropped scene files for
opening and scripts for running.
Parameters:
<HWND>window
A handle to the window you wish to enable or disable DnD for.
<boolean>onOff
TRUE to enable, FALSE to disable.
Return Value:
True if successful and false otherwise.
Prototype:
<boolean>dropPackage <HWND>window <&point>mousePoint <&string array>files
Remarks:
This method allows the simulation of a package of files into a window at a given point. A package
of files, specified as a list of URL strings is the common form of DropType data from iDrop sources
and files dragged from the Windows desktop. The entire package is downloaded, as needed, but only
the first file in the list is actually dropped into MAX. The other files in the package are presumed to
be support files, such as texmaps or xref sources, for the main drop file. After the drop, the URL
strings in the URLTab are converted to fully-specified path names to local file copies, if any had to
be downloaded from the web.
Parameters:
<HWND>window
A handle to the window. If this is set to NULL, the default MAX window is used.
<&point>mousePoint
The point at which to drop.
364 Chapter 1 | What’s New in 3ds max 4 MAXScript
<&string array>files
A reference to the local copies of the URL strings.
Return Value:
TRUE if the drop was successful, otherwise FALSE.
Prototype:
<boolean>downloadPackage <&string array>files <string>directory
Remarks:
This method serves as a utility function that can be used to download a package of URLs to the
specified directory. If the hwnd argument is supplied, any progress or other messages are centered
over that window.
Parameters:
<&string array>files
A reference to the local copies of the URL strings.
<string>directory
The directory path string to download to.
Return Value:
True if successful and false otherwise.
Prototype:
<string>getDownloadDirectory()
Return Value:
This method returns the fully-specified path to the directory in which package drops are
downloaded.
Prototype:
<boolean>DownloadUrlToDisk <string>url <string>fileName <integer>flags
Remarks:
This method allows you to download the file referenced by the URL to disk.
Parameters:
<string>url
The URL string of the file to download.
<string>fileName
The filename string of the URL to store on disk.
<integer>flags
Return Value:
True if successful and false otherwise.
Prototype:
<node>ImportContextNode()
Return Value:
Returns a pointer to the import context node.
Interface: HDIKSys 365
See Also
Zip-file Script Packages (p. 122)
iDrop - drag and drop (p. 62)
Interface: HDIKSys
Interface: HDIKSys
Methods:
Prototype:
<void>ikChain <node>startJoint <node>endJoint <boolean>createEndEffector
Parameters:
<node>startJoint
<node>endJoint
<boolean>createEndEffector
Prototype:
<boolean>RemoveChain <node>chainNode
Remarks:
Calling this method on the master controller causes all slave controllers in the chain to be replaced
with default transform controllers (PRS). This method will support undo if it is enabled but will not
turn undo on. This method does not cause viewports to be redrawn.
Parameters:
<node>chainNode
See Also
HD IK controller chains can be assigned to existing hierarchies (p. 73)
Interface: IKSys
Interface: IKSys
Methods:
Prototype:
<node>ikChain <node>startJoint <node>endJoint <string>solver
Remarks:
Where startJoint is the first node in the new chain (ancestor), endJoint is the last node in the
chain (decendent) and assignEE is a boolean parameter: when TRUE, a position end effector is
crated at the endJoint.
Parameters:
<node>startJoint
<node>endJoint
<string>solver
366 Chapter 1 | What’s New in 3ds max 4 MAXScript
Interface: manip
Scripted Manipulators (p. 97)
Properties:
.msXYPlane : Interface : Read
.msXZPlane : Interface : Read
.msYZPlane : Interface : Read
Prototype:
<mesh>makeSphere <point3 by value>pos <float>radius <integer>segments
Parameters:
<point3 by value>pos
<float>radius
Specifies the radius of the sphere.
<integer>segments
Sets the number of polygonal divisions for the sphere.
Return Value:
This returns a mesh sphere with the given position, radius, and segments.
Prototype:
<mesh>makeTorus <point3 by value>pos <float>radius <float>radius2 <integer>segs
<integer>sides
Parameters:
<point3 by value>pos
<float>radius
Sets the distance from the center of the torus to the center of the cross-sectional
circle. This is the radius of the torus ring.
<float>radius2
Sets the radius of the cross-sectional circle. The default is 10 units. This value is
replaced each time you create a torus.
<integer>segs
Sets the number of radial divisions around the torus. By reducing this number,
you can create polygonal rings instead of circular ones.
<integer>sides
Sets the number of sides on the cross-sectional circle of the torus. By reducing this
number, you can create prism-like cross sections instead of circular ones.
Return Value:
Create a torus mesh with the given values.
Prototype:
<mesh>makeBox <point3 by value>pos <float>l <float>w <float>h <integer>lsegs
<integer>wsegs <integer>hsegs
Interface: manip 367
Parameters:
<point3 by value>pos
<float>l
Sets the length, width, and height of the Box object. These fields also act as
readouts while you drag the sides of the box. Default=0,0,0.
<float>w
Sets the length, width, and height of the Box object. These fields also act as
readouts while you drag the sides of the box. Default=0,0,0.
<float>h
Sets the length, width, and height of the Box object. These fields also act as
readouts while you drag the sides of the box. Default=0,0,0.
<integer>lsegs
Sets the number of divisions along each axis of the object. Can be set before or
after creation. By default, each side of the box is a single segment. When you reset
these values, the new values become the default during a session. Default=1,1,1.
Tip: Increase the Segments settings to give objects extra resolution for being affected by modifiers.
For example, if you’re going to bend a box on the Z axis, you might want to set its Height Segments
parameter to 4 or more.
<integer>wsegs
Sets the number of divisions along each axis of the object. Can be set before or
after creation. By default, each side of the box is a single segment. When you reset
these values, the new values become the default during a session. Default=1,1,1.
Tip: Increase the Segments settings to give objects extra resolution for being affected by modifiers.
For example, if you’re going to bend a box on the Z axis, you might want to set its Height Segments
parameter to 4 or more.
<integer>hsegs
Sets the number of divisions along each axis of the object. Can be set before or
after creation. By default, each side of the box is a single segment. When you reset
these values, the new values become the default during a session. Default=1,1,1.
Tip: Increase the Segments settings to give objects extra resolution for being affected by modifiers.
For example, if you’re going to bend a box on the Z axis, you might want to set its Height Segments
parameter to 4 or more.
Return Value:
Creates a box mesh with the given parameters.
Prototype:
<Interface>makePlaneFromPts <point3 by value>p1 <point3 by value>p2 <point3 by
value>p3
Parameters:
<point3 by value>p1
<point3 by value>p2
<point3 by value>p3
368 Chapter 1 | What’s New in 3ds max 4 MAXScript
Prototype:
<Interface>makePlaneFromNormal <point3 by value>normal <point3 by value>point
Parameters:
<point3 by value>normal
<point3 by value>point
Return Value:
Creates a Plane object with the given normal that passes through the given point.
Prototype:
<Interface>makeGizmoShape()
Prototype:
<Interface>makeCircle <point3 by value>center <float>radius <integer>segments
Parameters:
<point3 by value>center
<float>radius
<integer>segments
Interface: maxOps
maxOps (p. 87)
Properties:
.productVersion : enum : Read
productVersion enums:
{#productVersionDevel|#productVersionTrial|#productVersionOrdinary|#productVersion
Edu|#productVersionNFR}
.licenseBehavior : enum : Read
licenseBehavior enums:
{#licenseBehaviorPermanent|#licenseBehaviorExtendable|#licenseBehaviorNonextendabl
e}
.licenseDaysLeft : integer : Read
.trackbar : Interface : Read
Methods:
Prototype:
<boolean>canImportBitmap <string>fileName
Parameters:
<string>fileName
Return Value:
True if successful and false otherwise.
Prototype:
<void>displayActiveCameraViewWithMultiPassEffect()
Remarks:
displayActiveCameraViewWithMultiPassEffect - no automatic redraw after invoked
Interface: maxOps 369
Prototype:
<void>setActiveViewportTransparencyDisplay <integer>transparencyLevel
Parameters:
<integer>transparencyLevel
Prototype:
<boolean>loadCUIFile <string>fileName
Parameters:
<string>fileName
Return Value:
True if successful and false otherwise.
Prototype:
<boolean>isFeatureLicensed <integer>featureNumber
Parameters:
<integer>featureNumber
Return Value:
True if successful and false otherwise.
Prototype:
<Interface>GetCurRenderElementMgr()
Return Value:
gets the current render element manager.
Prototype:
<Interface>GetRenderElementMgr <enum>
Parameters:
{#Production|#Draft}
Return Value:
Gets a specific render element manager.
Prototype:
<void>CollapseNode <node>node <boolean>noWarning
Remarks:
Parameters:
<node>node
<boolean>noWarning
Prototype:
<boolean>CollapseNodeTo <node>node <index>modIndex <boolean>noWarning
Parameters:
<node>node
<index>modIndex
<boolean>noWarning
370 Chapter 1 | What’s New in 3ds max 4 MAXScript
Return Value:
True if successful and false otherwise.
Prototype:
<boolean>CloneNodes <&node array>nodes <&point3>offset expandHierarchy:<boolean>
cloneType:<enum> actualNodeList:<node array> newNodes:<node array>
Parameters:
<&node array>nodes
<&point3>offset
expandHierarchy:<boolean>
expandHierarchy default value: false
cloneType:<enum>
cloneType enums: {#copy|#instance|#reference}
cloneType default value: #copy
actualNodeList:<node array>
actualNodeList default value: #()
newNodes:<node array>
newNodes default value: #()
Return Value:
True if successful and false otherwise.
Prototype:
<boolean>setSelectionType <boolean>auto <enum>method
Parameters:
<boolean>auto
method enums: {#window|#crossing|#leftToRight|#rightToLeft}
Return Value:
True if successful and false otherwise.
Prototype:
<maxObject>getNodeByHandle <DWORD>handle
Parameters:
<DWORD>handle
Return Value:
Return a node associated with a given handle.
Prototype:
<Interface>getTrackBar()
Return Value:
The interface to a trackbar is returned.
Interface: medit 371
Interface: medit
Interface available for Texmap and Mtl Interface_medit.
Prototype:
<maxObject>GetCurMtl()
Return Value:
This method returns a material base pointer for the current material.
Prototype:
<void>SetActiveMtlSlot <index>slot <boolean>forceUpdate
Parameters:
<index>slot
The material slot index.
<boolean>forceUpdate
Set this to TRUE to update the slot contents.
Remarks:
This method allows you to set the active material slot.
Prototype:
<index>GetActiveMtlSlot()
Return Value:
This method returns the index of the active material slot.
Prototype:
<void>PutMtlToMtlEditor <maxObject>mtl <index>slot
Parameters:
<maxObject>mtl
The material you want to put.
<index>slot
The index of the material slot you wish to put the material into.
Remarks:
This method allows you to put the specified material to the specified material editor slot.
Prototype:
<maxObject>GetTopMtlSlot <index>slot
Parameters:
<index>slot
The index of the material slot for which you wish to obtain the material.
Return Value:
This method returns a pointer to the material base from the specified slot.
Prototype:
<boolean>OkMtlForScene <material>mtl
372 Chapter 1 | What’s New in 3ds max 4 MAXScript
Parameters:
<material>mtl
The pointer to the material.
Return Value:
Before assigning material to scene, call this to avoid duplicate names.
Prototype:
<void>UpdateMtlEditorBrackets()
Remarks:
This method makes sure the Materials Editor slots correctly reflect which materials are used in the
scene, which are used by selected objects, etc. This is used internally for the drag-and-drop of
materials to nodes -- there is no reason why a plug-in developer should need to call it.
See Also
Material Editor Access (p. 165)
BitmapTex Reload and viewImage (p. 164)
Interface: menuMan
Prototype:
<boolean>loadMenuFile <string>file
Remarks:
This method allows you to load a menu file from disk and automatically update the UI accordingly.
Parameters:
<string>file
The path and filename of the menu file to load.
Return Value:
TRUE if the menu file was loaded, otherwise FALSE.
Prototype:
<boolean>saveMenuFile <string>file
Remarks:
This method allows you to save a menu file to disk.
Parameters:
<string>file
The path and filename of the menu file to save.
Return Value:
TRUE if the menu file was saved, otherwise FALSE.
Interface: menuMan 373
Prototype:
<string>getMenuFile()
Return Value:
This method returns the file name of the currently loaded and active menu file.
Prototype:
<void>updateMenuBar()
Remarks:
This method can be called to update MAX’ main menu bar after adding sub-menu’s or menu items.
Prototype:
<boolean>registerMenuContext <integer>contextId
Remarks:
To add items to MAX’s main menu, the plug-in should check the return value of
RegisterMenuContext(), and if it is true, that means that this is the first time it has been registered,
and the plug-in can then create new menus, add items to MAX’s main menu and Quad menus.
Prototype:
<Interface>findMenu <string>menuName
Remarks:
This method will return a pointer to a menu based on its name.
Parameters:
<string>menuName
The name of the menu to return.
Return Value:
A pointer to the menu or NULL if the menu wasn’t found.
Prototype:
<Interface>findQuadMenu <string>menuName
Remarks:
This method will return a pointer to a quad menu based on its name.
Parameters:
<string>menuName
The name of the menu to return.
Return Value:
A pointer to the quad menu or NULL if the menu wasn’t found.
Prototype:
<boolean>unRegisterMenu <Interface>menu
Remarks:
This method allows you to remove a menu form the mananger.
374 Chapter 1 | What’s New in 3ds max 4 MAXScript
Parameters:
<Interface>menu
Points to the menu to unregister.
Return Value:
FALSE if the menu was not registered, TRUE if successfully unregistered.
Prototype:
<boolean>unRegisterQuadMenu <Interface>quadMenu
Parameters:
<Interface>quadMenu
Remarks:
This is like “unregisterMenu” but for quad menus.
Prototype:
<Interface>createMenu <string>name
Parameters:
<string>name
Return Value:
This creates a new, empty menu with the given name.
Prototype:
<Interface>createQuadMenu <string>name <string>quad1Name <string>quad2Name
<string>quad3Name <string>quad4Name
Parameters:
<string>name
<string>quad1Name
<string>quad2Name
<string>quad3Name
<string>quad4Name
Remarks:
This creates a new, empty quad menu. It contains, 4 empty menus, one for each quad.
Prototype:
<Interface>createSubMenuItem <string>name <Interface>subMenu
Parameters:
<string>name
<Interface>subMenu
Remarks:
This creates a new sub-menu item that can be added to a menu. It uses the given “name” and it
displays the given sub-menu.
Prototype:
<Interface>createSeparatorItem()
Interface: menuMan 375
Return Value:
This creates a new menu separator that can be added to a menu.
Prototype:
<Interface>createActionItem <string>macroScriptName <string>macroScriptCategory
Parameters:
<string>macroScriptName
<string>macroScriptCategory
Return Value:
This creates a new menu item that can be added to a menu. The item is an action that executes the
macro script with the given name and category. This returns “undefined” if there is no macroScript
with the given name and category.
Prototype:
<boolean>setViewportRightClickMenu <enum>which <Interface>menu
which enums:
{#nonePressed|#shiftPressed|#altPressed|#controlPressed|#shiftAndAltPressed|#shiftAndControlPres
sed|#controlAndAltPressed|#shiftAndAltAndControlPressed}
Remarks:
This method allows you to set the viewport right-click menu to the specified quad menu.
Parameters:
<enum>which
See the List of Right-Click Contexts above.
<Interface>menu
A pointer to the quad menu you wish to set.
Return Value:
TRUE if it was set successfully.
Prototype:
<Interface>getViewportRightClickMenu <enum>which
which enums:
{#nonePressed|#shiftPressed|#altPressed|#controlPressed|#shiftAndAltPressed|#shiftAndControlPres
sed|#controlAndAltPressed|#shiftAndAltAndControlPressed}
Parameters:
<enum>which
See the List of Right-Click Contexts..
Return Value:
This method returns a pointer to the current viewport right-click quad menu.
Prototype:
<Interface>getMainMenuBar()
376 Chapter 1 | What’s New in 3ds max 4 MAXScript
Return Value:
This method returns a pointer to the main menu bar.
Prototype:
<boolean>setMainMenuBar <Interface>menu
Remarks:
This method allows you to set the main menu bar.
Parameters:
<Interface>menu
A pointer to the menu you wish to set as the main menu bar.
Return Value:
TRUE if it was set successfully.
Prototype:
<bool>getShowAllQuads <Interface>quadMenu
Remarks:
This method checks if the “Show All Quads” flag is set for a specific QuadMenu.
Parameters:
<Interface>quadMenu
A pointer to the QuadMenu you wish to check the flag for.
Return Value:
This method will return TRUE if the flag is set or FALSE if the flag is not set.
Prototype:
<void>setShowAllQuads <Interface>quadMenu <bool>value
Remarks:
This method sets the “Show All Quads” flag for a specific QuadMenu.
Parameters:
<Interface>quadMenu
A pointer to the QuadMenu you wish to set the flag for.
<bool>value
TRUE to set the flag to on, FALSE to set the flag off.
Prototype:
<string>getQuadMenuName <Interface>quadMenu
Parameters:
<Interface>quadMenu
A pointer to the QuadMenu for which you wish to retrieve the name.
Return Value:
This method returns the name given to a specific QuadMenu as a string.
Interface: menuMan 377
Prototype:
<void>setQuadMenuName <Interface>quadMenu <string>name
Remarks:
This method allows you to set the name of a specific QuadMenu.
Parameters:
<Interface>quadMenu
A pointer to the QuadMenu for which you wish to set the name.
<string>name
The string containing the name for the QuadMenu.
Prototype:
<integer>numMenus()
Return Value:
Returns the total number of menus in registered with the menu manager.
Prototype:
<Interface>getMenu <index>index
Parameters:
<index>index
Return Value:
Retrieves the “index”th menu in the menu manager. This is a 1-based index.
Prototype:
<integer>numQuadMenus()
Return Value:
Returns the total number of quad menus registered with the menu manager.
Prototype:
<Interface>getQuadMenu <index>index
Parameters:
<index>index
Return Value:
Retrieves the “index”th quad menu in the menu manager. This is a 1-based index.
See Also
In The MAXSDK Help File
Class ImenuManager
See Also
Menu Manager (p. 75)
Interface: quadMenuSettings (p. 414)
378 Chapter 1 | What’s New in 3ds max 4 MAXScript
Interface: msZip
Prototype:
<boolean>fileInPackage <string>fileName <&TSTR>extractDir
Remarks:
extractDir is In parameter
This method will unload and run a zip package and return the extract_dir.
Parameters:
<string>fileName
The file name of the ZIP script package.
<&TSTR>extractDir
The directory in which the files were extracted.
Return Value:
TRUE if the zip package was run, otherwise FALSE.
Prototype:
<boolean>unloadPackage <string>fileName <&TSTR>extractDir <&TSTR>dropFile
Remarks:
extractDir is In parameter
dropFile is In parameter
This method will unload the package while ignoring any drop or run commands and return the
extract_dir and any primary drop file. If the primary dropFile is a *.ds, compile it in context of the
package and return the MacroEntry in dropScript.
Parameters:
<string>fileName
The file name of the ZIP script package.
<&TSTR>extractDir
The directory in which the files were extracted.
<&TSTR>dropFile
The primary drop file.
Return Value:
TRUE if the package was unloaded, otherwise FALSE.
See Also
Interface: dragAndDrop (p. 362)
Zip-file Script Packages (p. 122)
iDrop - drag and drop (p. 62)
Interface: NetRender 379
Interface: NetRender
Methods:
Prototype:
<Interface>GetManager()
Remarks:
In order to access network rendering through the scripter, you need to create a manager instance.
The syntax is the following:
netrender.getmanager()
#message mymessage
Called when the manager has a text message for the user. Requires a function defined
with 1 string parameter which is the message text.
380 Chapter 1 | What’s New in 3ds max 4 MAXScript
Example:
fn myNetMessage msg =-- NOTE: one string parameter
format “Message: %\n” msg
m.setcallback #message mymessage -- sets the #message callback to use
mymessage()
#update myupdate
Called when something has changed, like a job started or finished. Let’s you know
when you need to make GetUpdate calls, or other refreshing. Requires a function
defined with no parameters.
Example:
fn myUpdate =
job.GetUpdate()--example of what you might do
m.setcallback #update myupdate -- sets the #update callback to use
myupdate()
#managerdown mymanagerdown
Called when the manager shuts down. Requires a function defined with no
parameters.
Example:
fn myManagerDown =
format “Manager is dead\n”
m.setcallback mymanagerdown -- sets the #managerdown callback to use
mymanagerdown()
#queuecontrol myqueuecontrol
Called whenever queue control changes. Requires a function defined with no
parameters.
Example:
fn myQueueControl =
format “Queue control has changed\n”
m.setcallback #QueueControl myQueueControl--install the “QueueControl”
callback
#querycontrol myquerycontrol
Called when you have Queue Control, and another computer wants it, either via the
QueueManager, or with the script function <netManager>.QueryControl(). If you
want to keep control, set the value <netManager>.WantControl to true, otherwise set
it to false. The function must take one arguement, which is the name of the machine
requesting control. See the function <netManager>.QueueControl() for more
information.
Working with the manager 381
Example:
fn myQueryControl clientName = (--NOTE: one string parameter
format “The computer % wants queue control” clientName
m.wantControl = true-- use this to keep queue control
m.wantControl = false-- use this to release queue control
)
m.setcallback #QueryControl myQueryControl--install the “QueryControl”
callback
Prototype:
<netManager>.GetCallback <#progress | #message | #update | #managerdown |
#queuecontrol | #querycontrol>
Remarks:
Returns the name of the function used for that particular callback. Returns an empty array if no
callback is assigned. Requires 1 argument, can be:
#progress
Called anytime a download/upload is underway, including anytime you fetch
information about jobs or servers
#message
Called when the manager has a text message for the user
#update
Called when something has changed, like a job started or finished. Let’s you know
when you need to make GetUpdate calls, or other refreshing
#managerdown
Called when the manager dies
#queuecontrol
Called whenever queue control changes
#querycontrol
Called when you have Queue Control, and another computer wants it
Prototype:
<netManager>.connect #manual <manager name>|<manager IP address> [port:<integer>]
or
<netManager>.connect #automatic <subnet mask> [port:<integer>]
Remarks:
Establishes a connection to the manager, allowing access to job states, server states, editing job
settings, etc…
.It takes 2 arguments and a 3rd optional argument. You can either connect to a manager
manually by specifying the manager name or ip address of the manager as a string, or automatically
by specifying the subnet mask and optional port number, eg:
m.connect #manual “manager” -- connects to manager of name “manager”
or:
m.connect #manual “192.168.0.1” -- connects to manager of IP 192.168.0.1
or:
382 Chapter 1 | What’s New in 3ds max 4 MAXScript
Prototype:
<netManager>.Lock <true | false>
Remarks:
Locks out others from getting queue control; and if they call QueryControl, it will automatically
return false. For example, suppose you got control of the queue through the scripter using
getcontrol(), someone else who has the queuemanager up in readonly mode can request
queuecontrol. Setting lock to true, will disallow anyone else to take control until you until you
disconnect from the manager, or until you reset the lock to false. Note that the QueueManager
always calls QueryControl to check if it can grab the queue.
Prototype:
<netManager>.SetUpdates <true | false>
Remarks:
This function’s usage resemebles the Lock() function, in that a boolean value is passed, and you must
already have queue control. Setting updates to false will freeze the manager so that it refuses any
changes to the queue. It does not affect the callbacks. Fewer Update callbacks will be received, since
the job queue is not
updating. Use this function when submitting large numbers of changes, and when you want all the
changes to take effect at the same time. This will occur when setUpdates is called with a true value.
Prototype:
<netManager>.checkoutputvisibility <path>
Takes 1 argument, a pathname defined as a string, ie “c:\\temp”.
Remarks:
It verifies that the path exists, returns “The system cannot find the path specified. (0x3)” if the path
doesn’t exist.
Note:
Note that the manager checks this output path relative to itself, not to your local machine. Thus if
you pass “C:\\” and you have not shared you C drive, it will return OK (because the manager checks
its own C drive). Thus you should use a network name when calling this function, like
“\\\\mymachine\\share\\”. Also, if the parameter does not end in \\, the functions assumes
you’re naming a file (not a directory) and checks whether this file could be created. Always include
the \\ at the end if you’re checking whether a directory is accessible.
Properties:
The following properties can be used to get information or set certain properties of the manager.
Prototype:
<netManager>.connected
Remarks:
Returns true if connected to the manager.
384 Chapter 1 | What’s New in 3ds max 4 MAXScript
Prototype:
<netManager>.netStatus
Remarks:
Returns the status of the manager. Various information about the manager can be gathered through
netstatus,see netstatus topic.
Prototype:
<netManager>.wantControl
Remarks:
If you have QueueControl, and other computers call QueryControl, this indicates whether you want
to maintain control, or relinquish it; their call to QueryControl will return whatever you have set
for WantControl
Prototype:
<netManager>.haveControl
Remarks:
True, if you currently have QueueControl.
Prototype:
<netManager>.numJobs
Remarks:
Returns the number of jobs in the queue.
Prototype:
<netManager>.numServers
Remarks:
Returns the number of servers.
Prototype:
<netManager>.numGroups
Remarks:
Returns the number of groups.
Prototype:
<netManager>.getjobs [filter:#suspended | #complete | #waiting | #started | #error
| #name | #handle | #index] [key:<name> | <handle> | <index>]
The latter three filter types require a corresponding key arguement.
If used without a filter, returns an array of all jobs in queue. If no jobs are in the queue, an empty
array will be returned.
filter:#suspended
Returns an array of all suspended jobs. Returns an empty array #() if no jobs are
suspended
filter:#complete
Returns an array of all completed jobs. Returns an empty array #() if no jobs are
complete.
filter:#waiting
Returns an array of jobs that are waiting to be rendered or are being rendered. Will
return an empty array #() if no jobs are waiting.
filter:#started
returns an array of jobs that are actually started and being rendered.
filter:#complete
Returns an array of all completed jobs. Returns an empty array #() if no jobs are
complete
filter:#error
Returns an array of all jobs experiencing an error. Returns an empty array #() if no
jobs have errors
filter:#name
Pass a name as the Key argument; Returns an array of all jobs with the given
name. Returns an empty array #() if the no jobs have that name
filter:#handle
Pass a handle as the Key argument; the job with that handle will be returned (as
an array with one element). Returns an empty array #() if the no job has
that handle
filter:#index
Pass an integer as the Key argument; the job at that index in the queue will be
returned (as an array with one element). Returns an empty array #() if the no job
exists at that index
Example:
manager.GetControl() --get queue control
manager.SetUpdates false --the queue is now frozen
jobs = manager.GetJobs()
manager.SetUpdates true --the queue is unfrozen
Note:
The GetJobs() function could return incorrect results if the Queue is changed while the job
information is downloading. SetUpdates is used to guarantee that GetJobs operates without error.
386 Chapter 1 | What’s New in 3ds max 4 MAXScript
Prototype:
<netManager>.SetJobOrder <array>
Remarks:
Changes the order of the jobs in the queue. The array must contain the same jobs that are contained
in the array from .getjobs(), although they can be in different order. You must also have
queuecontrol, use .getcontrol() function to take control before setting the job order.
Prototype:
<netManager>.NewJob file:<filename>
Example:
job.newJob file:”file.max” --submitting a file
job.newJob() --submitting the current scene
Remarks:
Creates a new job instance. It requires a valid max file name, ie a max file that exists somewhere on
the hard drive or the network. Returns a job definition if the file exists, undefined if the file can’t be
found.
Note:
Jobs can not have maps included, and render element data will not be available for submitted job
but render elements will process correctly. These problems are resent when submitting a job from a
file, but not when submitting the current scene.
Prototype:
<job>.GetUpdate()
Remarks:
Updates the information about the selected job. Remember this involves a network interaction, so
it’s a heavyweight operation
Prototype:
<job>.SendUpdate()
Remarks:
Updates the job in the queue with new job settings. Must have queuecontrol. Use
<netManager>.getcontrol() to get queue control. Remember this involves a network
interaction, so it’s a heavyweightoperation
Prototype:
<job>.Submit() Servers:<array>
Remarks:
Submits a new job to be rendered to the queue. Must have queuecontrol. Use
<netManager>.getcontrol() to get queue control. if no servers are provided, then all servers will
be assigned to the job.
Prototype:
<job>.Suspend()
Working with jobs 387
Remarks:
Suspends the selected job. Must have queuecontrol. Use <netManager>.getcontrol() to get
queue control.
Prototype:
<job>.Resume()
Remarks:
Will cause the job to resume where it left off when it was suspended. Must have queuecontrol. Use
<netManager>.getcontrol() to get queue control.
Prototype:
<job>.Restart()
Remarks:
Will restart the job from the beginning. Must have queuecontrol. Use
<netManager>.getcontrol() to get queue control.
Prototype:
<job>.Delete()
Remarks:
Will delete the job from the queue. Must have queuecontrol. Use <netManager>.getcontrol()
to get queue control.
Prototype:
<job>.AssignServer <server>
Remarks:
Assigns a selected server to the job. Must have queuecontrol. Use <netManager>.getcontrol()
to get queue control.
Prototype:
<job>.SuspendServer <server>
Remarks:
Removes a server from the selected job. Must have queuecontrol. Use
<netManager>.getcontrol() to get queue control.
Prototype:
<job>.GetServerInfo <integer>
Remarks:
Gets information about a particular server assigned to the job. Requires a server number, 1 based.
Prototype:
<job>.GetRenderElement <index>
388 Chapter 1 | What’s New in 3ds max 4 MAXScript
Remarks:
Returns information as a data structure about the nth element in the. The <element> structure is
defined below. Returns undefined if no element at the index number, eg: el =
jobs[1].getrenderelement 1 -- retrieves the 1st element in the 1st job in the queue. With this
you can find out if the element is enabled, if filtering is enabled, if atmosphere is applied, if shadows
are applied, the element name and the element output filename. The following are the properties
that are valid for an element.
Prototype:
<element>.enabled
Remarks:
Returns true if the element is enabled. Can also set it’s state.
Prototype:
<element>.filterEnabled
Remarks:
Returns true if filtering is enabled. Can also set it’s state.
Prototype:
<element>.atmosphereApplied
Remarks:
Returns true if atmosphere is applied. READ-ONLY
Prototype:
<element>.shadowsApplied
Remarks:
Returns true if shadows are applied. READ-ONLY
Prototype:
<element>.name
Remarks:
Returns the elements name. Name can be changed.
Prototype:
<element>.output
Remarks:
Returns the element’s output file name. Output name and path can be changed, however, changing
the filetype will change the extension of the image but not the actual file type, eg: the current output
returned is “\\ej4sf\frames\foo_diffuse.tga”, changing the extension to .bmp will just
result in the tga file having a .bmp extension instead of the .tga extension.
Prototype:
<job>.SetRenderElement <index> <element>
Working with jobs 389
Remarks:
Sets the selected render element to the new values assigned to the element. In order for the change
to take effect in the job, you need to do a <job>.sendupdate() to update the job itself in the
queue.
Prototype:
<job>.GetCameras()
Remarks:
Returns an array of cameras in the scene. An empty array #() is returned if no cameras are in the
scene.
Prototype:
<job>.GetLog() start:x numLines:y
Remarks:
Returns the log for the job as text. The ‘start’ and ‘numLines’ parameters are optional. If you pass no
parameters, you get the entire log. If you only pass start, you get every line starting from the given
line. If you pass only numLines, then start is assumed to be 0.
Prototype:
<job>.GetFrameInfo <integer>
Remarks:
Returns information, as a data structure, about the nth frame. The index is 1 based. The <frame>
structure is defined below.
Example:
fr = getframeinfo 4 -- Returns info about the 4th frame. Read-only
Prototype:
<frame>.state
Remarks:
Returns the state of the frame. The state can be #waiting, #assigned or #complete.
Prototype:
<frame>.index
Remarks:
Returns the actual frame number. Read-only
Prototype:
<frame>.serverhandle
Remarks:
Returns the serverhandle. Should return undefined when frame hasn’t been rendered yet. Read-only
Prototype:
<frame>.servername
390 Chapter 1 | What’s New in 3ds max 4 MAXScript
Remarks:
Returns the name of the server that is assigned to that frame. Should return undefined if the frame
isn’t assigned yet. Read-only
Prototype:
<frame>.elapsedtime
Remarks:
Returns the time it took for the frame to render. Should return undefined if the frame isn’t assigned
yet. Read-only
Prototype:
<job>.GetServerStatusText <server>
Remarks:
Returns any messages from the chosen server assigned to the job. Will return an empty string if no
messages from the server. Read-only
Prototype:
<job>.numServers
Remarks:
Returns the number of servers assigned to the job. Read-only
Prototype:
<job>.state
Remarks:
Returns the state of the job. This can be #complete, #suspended, #busy or #waiting. Read-only
Prototype:
<job>.serverPID
Remarks:
This function gives low-level information that is intended for internal-use-only.
Prototype:
<job>.handle
Remarks:
Returns the job’s handle. Read-only
Many of the following values are read-write, but changes you make to these values will not register
with the manager until you call <job>.SendUpdate().
Note that SendUpdate requires queue control (obtained via <NetManager>.getControl)
Prototype:
<job>.name
Remarks:
Returns the name of the job. The name can be changed
Working with jobs 391
Prototype:
<job>.filesize
Remarks:
Returns the job’s file size
Prototype:
<job>.filesizeExtracted
Remarks:
Returns the job’s extracted file size. Read-only
Prototype:
<job>.timeSubmitted
Remarks:
Returns the time at which the job was submitted as a string.
Prototype:
<job>.timeStarted
Remarks:
Returns the time at which the job was started as a string. Returns undefined if job hasn’t started.
Read-only
Prototype:
<job>.timeFinished
Remarks:
Returns the time at which the job was finished as a sting. Returns undefined if job hasn’t finished.
Read-only
Prototype:
<job>.notifications
Remarks:
Returns true if notifications are on. Can be changed
Prototype:
<job>.notifyFailure
Remarks:
Returns true if notified of failures. Can be changed
Prototype:
<job>.notifyProgress
Remarks:
Returns true if notified of progress. Can be changed
Prototype:
<job>.notifyCompletion
392 Chapter 1 | What’s New in 3ds max 4 MAXScript
Remarks:
Returns true if notified of progress is on. Can be changed
Prototype:
<job>.notifyFrameInterval
Remarks:
Returns an interval at which notifications occur. Can be changed
Prototype:
<job>.fromFrame
Remarks:
Returns the rendering start frame. Can be changed
Prototype:
<job>.toFrame
Remarks:
Returns the rendering end frame. Can be changed
Prototype:
<job>.nthFrame
Remarks:
Returns the rendering frame interval. Can be changed
Prototype:
<job>.outputWidth
Remarks:
Returns the width of the rendered frame. Can be changed
Prototype:
<job>.outputHeight
Remarks:
Returns the height of the rendered frame. Can be changed
Prototype:
<job>.numFramesComplete
Remarks:
The number of completed frames for the job. Read-only
Prototype:
<job>.priority
Remarks:
Returns the job priority.
Working with jobs 393
Prototype:
<job>.videoPost
Remarks:
Returns true if there is a video post sequence. Read-only
Prototype:
<job>.nonconcurrentDriver
Remarks:
Returns true if the output cannot be rendered one frame at a time (like .MOV). Read-only
Prototype:
<job>.includeMaps
Remarks:
Returns true if the job was submitted with include maps on. Can be changed
Prototype:
<job>.uninterruptibleDriver
Remarks:
Returns true if the render can’t be resumed if it was interrupted or suspended. For an.AVI, you cannot
render half the file, then finish it later. You need to render the whole thing without interruption.
Read-only
Prototype:
<job>.skipRenderedFrames
Remarks:
Returns true if skip rendered frames was set to on when job was submitted. Can be changed
Prototype:
<job>.useAllServers
Remarks:
Returns true if use all servers was set to on when job was submitted. Can be changed
Prototype:
<job>.suspended
Remarks:
Returns true if the job is suspended. Read-only. To suspend the job use <job>.suspend()
Prototype:
<job>.finished
Remarks:
Returns true if the job is finished. Read-only
Prototype:
<job>.ignoreShare
394 Chapter 1 | What’s New in 3ds max 4 MAXScript
Remarks:
Returns true if the job was submitted with ignore share on. Can be changed
Prototype:
<job>.skipOutputTest
Remarks:
Returns true if the job was submitted with skip output test on. Can be changed
Prototype:
<job>.nonSeqFrames
Remarks:
Returns true if the job was submitted to render non sequential frames. Can be changed
Prototype:
<job>.combustionJob
Remarks:
Returns false if the job is a max job. Read-only
Prototype:
<job>.uncompressedFile
Remarks:
Returns false if the job file is compressed. Read-only
Prototype:
<job>.gammaCorrection
Remarks:
Returns true if the job was submitted with gamma correction on. Can be changed.
Prototype:
<job>.gammaValueIn
Remarks:
Returns a float value of the incomming gamma value. Can be changed.
Prototype:
<job>.gammaValueOut
Remarks:
Returns a float value of the outgoing gamma value. Can be changed.
Prototype:
<job>.renderPixelAspect
Remarks:
Returns a float value of the render pixel aspect ratio. Can be changed.
Working with jobs 395
Prototype:
<job>.renderCamera
Remarks:
Returns a string with the name of the camera view being rendered. Will return an empty string if
view being rendered is an non camera view, ie perspective, front, user, etc…Can be changed. Use
<job>.getcameras() function to get a list of valid cameras in the scene to change to.
Prototype:
<job>.renderElements
Remarks:
Returns true if a job was submitted with the render elements active. Note that this will return true
even there aren’t any elements to be rendered. Can be changed.
Prototype:
<job>.numSceneObjects
Remarks:
Returns the number of objects in the scene as an integer. Read-only
Prototype:
<job>.numSceneFaces
Remarks:
Returns the number of faces in the scene as an integer. Read-only
Prototype:
<job>.numSceneLights
Remarks:
Returns the number of lights in the scene as an integer. Read-only
Prototype:
<job>.sceneStartTime
Remarks:
Returns the scene start time in frames, so if your scene is set to use MM:SS:Ticks, this will still return
a value in frames.
Prototype:
<job>.sceneEndTime
Remarks:
Returns the scene end time in frames.
Prototype:
<job>.videoColorCheck
Remarks:
Returns true if the job was submitted with videocolorcheck on. Can be changed.
396 Chapter 1 | What’s New in 3ds max 4 MAXScript
Prototype:
<job>.force2Sided
Remarks:
Returns true if the job was submitted with force 2 sided on. Can be changed.
Prototype:
<job>.renderHiddenObjects
Remarks:
Returns true if the job was submitted with render hidden objects on. Can be changed.
Prototype:
<job>.renderAtmosphericEffects
Remarks:
Returns true if the job was submitted with render render atmospheric effects on. Can be changed.
Prototype:
<job>.superBlack
Remarks:
Returns true if the job was submitted with superblack on. Can be changed.
Prototype:
<job>.serialNumbering
Remarks:
Returns true if nth serial numbering is on this property is accesible through the preferences \
rendering dialog.
Prototype:
<job>.ditherPaletted
Returns true if Dither Paletted was enabled when the job was submitted. Can be changed.
Prototype:
<job>.ditherTrueColor
Remarks:
Returns true if Dither True Color was enabled when the job was submitted. Can be changed.
Prototype:
<job>.renderFields
Remarks:
Returns true if Render Fields was enabled when the job was submitted. Can be changed.
Prototype:
<job>.renderDisplacements
Remarks:
Returns true if displacements was enabled when the job was submitted. Can be changed.
Working with jobs 397
Prototype:
<job>.renderEffects
Remarks:
Returns true if render effects was enabled when the job was submitted. Can be changed.
Prototype:
<job>.fieldOrder
Remarks:
Returns either #odd or #even depending on what the field order was set to when job was submitted.
Can be changed.
Prototype:
<job>.numRenderElements
Remarks:
Returns the number of render elements in the scene. Read-only.
Prototype:
<job>.userName
Remarks:
Returns the name of the user, as a string, that submitted the job. Note that if a job is submitted
through the scripter using <job>.submit(), and the max file was last saved by another user on a
different computer, the username will be that of the other user. Read-only
Prototype:
<job>.computerName
Remarks:
Returns the name of the computer, as a string, that the job was submitted from. Note that if a job is
submitted through the scripter using <job>.submit(), and the max file was last saved by another
user on a different computer, the computername will be that of the computer on which the max file
was last saved. Read-only
Prototype:
<job>.managerShare
Remarks:
Returns the shared folder as a string where all jobs are stored on the manager.
Prototype:
<job>.frames
Remarks:
Returns a string of frames to render, ie “1,3,5-12”. Can be changed.
Prototype:
<job>.frameOutputName
398 Chapter 1 | What’s New in 3ds max 4 MAXScript
Remarks:
Returns the name and path of the output file. Can be changed
Prototype:
<job>.frameOutputGamma
Remarks:
Returns the output gamma of the rendered frames.
Prototype:
<job>.frameOutputDevice
Remarks:
Returns the device name if a device is specified at render time.
Prototype:
<job>.numFrames
Remarks:
Returns the total number of frames for the particular job
filter:#error
Returns an array of all servers experiencing an error
filter:#group
Returns an array of servers in a group. Requires that the key option is used, the
key can be a group name as a string or a group number as an integer (1 based). An
empty array is returned if no groups are defined.
filter:#job
Returns an array of servers that are assigned to the specified job. Requires that the
key option be used, the key must be a job definition.
filter:#handle
Returns the server with a given handle (as an array with one item). Requires that
the key option be used, the key must be a server handle.
filter:#index
Returns the server at a given index in the server list (as an array with one item).
Requires that the key option be used, the key must be an integer (the index).
server = m.getservers()
Prototype:
<server>.GetUpdate()
Remarks:
Gets an update on the state of the server. Returns Ok if succesful.
Prototype:
<server>.SendUpdate()
Remarks:
Updates the server with new settings. Must have queuecontrol.
Prototype:
<server>.Delete()
Remarks:
Deletes the server from the manager. Must have queuecontrol.
Prototype:
<server>.ResetPerformance()
Remarks:
Resets the performance metric to 0.0. Must have queuecontrol and must do <server>.sendupdate()
to update the server.
Prototype:
<server>.netStatus
Remarks:
Netstatus
Prototype:
<server>.handle
400 Chapter 1 | What’s New in 3ds max 4 MAXScript
Remarks:
Returns the server’s handle. Read-only
Prototype:
<server>.state
Remarks:
Returns the state of the server, this can be #idle, #absent, #busy
Prototype:
<server>.name
Remarks:
Returns the name of the server. Read-only
Prototype:
<server>.totalFrames
Remarks:
Returns the total number of frames rendered by the server. Read-only
Prototype:
<server>.totalTime
Remarks:
Returns the total time that the server has been up. The value returned is in hours.
Prototype:
<server>.performance
Remarks:
Returns the performance index of the server. Read-only
Prototype:
<server>.AttendedPriority
Remarks:
Returns the priority, as an integer, of the server when the user is logged in.
0 = high priority, 1 = low priority, 2 = idle. Can be changed.
Prototype:
<server>.UnattendedPriority
Working with groups 401
Remarks:
Returns the priority level, as an integer, of the server when the system is logged out.
0 = high priority, 1 = low priority, 2 = idle.
Note that this is only valid if running serversvc and the user is not logged in on the system. If
running serversvc and a user is logged in on the system then the attendedpriority values are in effect.
Can be changed
Prototype:
<server>.schedule
Remarks:
Returns an array of 7 bitarrays. Each bitarray is a day, each bit is an hour, each bit within that bit
array means that the server is available at that hour. A bit array of #{1, 3..5, 15..24} means that
the server is available from 12 midnight to 1am, from 3am to 5am and from 3pm to midnight.
Prototype:
<server>.jobHandle
Remarks:
Returns the handle ot the job it is working on. Will return a value of 0 if no job is being worked on
by that server.
Prototype:
<server>.jobFrameIndex
Remarks:
Returns the frame index of the job that the server is working on.
Prototype:
<server>.jobFrameTimeStarted
Remarks:
Returns the time at which the frame being rendered was started.
Prototype:
<netManager>.CreateGroup <array> <string>
Remarks:
Creates a named group of servers. It takes 2 arguments: an array of servers and a string to define the
group name.
Prototype:
<netManager>.DeleteGroup <string>
Remarks:
Deletes a named group. Takes a string as an argument.
Netstatus
Both manager and servers have a netstatus property. All properties are Read-only.
system = m.netstatus
Prototype:
<system>.SpaceOnDisk <index>
Remarks:
Returns the amount of space in megs on a specified disk. The index is 1 based. Disks 1 and 2 are the
a: and b: drives.
Prototype:
<system>.numDroppedPackets
Remarks:
Returns the number of dropped packets.
Prototype:
<system>.numBad
Remarks:
Returns the number of bad packets.
Prototype:
<system>.numTCPRequests
Remarks:
Returns the number of TCP requests
Prototype:
<system>.numUDPRequests
Remarks:
Returns the number of UDP packets
Prototype:
<system>.bootTime
Netstatus 403
Remarks:
Returns the time at which the system was started.
Prototype:
<system>.memorySize
Remarks:
Returns the amount of memory of the system.
Prototype:
<system>.numProcessors
Remarks:
Returns the number of processors in system machine
Prototype:
<system>.platformID
Remarks:
Returns an integer, a value of 1 indicates win95, a value of 2 indicates WinNT
Prototype:
<system>.majorVersion
Remarks:
Returns an integer. When the platformID indicates a WinNT system, a value of 5 or higher here
indicates Win2k.
Prototype:
<system>.minorVersion
Remarks:
Returns an integer. Win98 is indicated by a minor build greater than 0 for win95
Prototype:
<system>.buildNumber
Remarks:
Returns the build number, this only applies to winnt and win2k. Not supported under win95, win98
or win ME.
Prototype:
<system>.CSDVersion
Remarks:
Returns the service pack number of the OS as a string.
Prototype:
<system>.username
404 Chapter 1 | What’s New in 3ds max 4 MAXScript
Remarks:
Returns the login name of the user logged in on the computer or the login name used by the service.
Prototype:
<system>.tempDir
Remarks:
Returns the tempdir for the system.
Prototype:
<system>.computerName
Remarks:
Returns the name of the computer.
Prototype:
<system>.workdisk
Remarks:
Returns the disk where max is setup.
Prototype:
<system>.Disks
Remarks:
Returns a bitarray of which disks exist (1=A, 2=B, 3=C etc.)
Prototype:
<system>.mac
Remarks:
Returns the MAC address of the system’s network card. If the computer is a network server, this is its
handle.
Examples:
-- ESTABLISHING A CONNECTION --
m = netrender.getmanager()--get a NetManager instance
--start this session
m.connect #manual “nimbus”
-- OR m.connect #manual “nimbus” port:1234--specifying a port number
-- QUEUE CONTROL --
--Get QueueControl using GetControl();
--there is no way to release control, but if wantControl==false
--then control will be relinquished to the next client
--that requests it
if( m.QueryControl #wait ) do --only take control if you have permission
m.getcontrol() --takes queue control
m.wantControl=true--if another client does QueryControl(), they will get a return
value of false
m.Lock true--this completely prevents others from getting queue control
Examples: 405
--QUERYCONTROL CALLBACK; Called when you have Queue Control, and another computer
wants it
fn myQueryControl clientName = (--NOTE: one string parameter
format “The computer % wants queue control” clientName
m.wantControl = true-- use this to keep queue control
Examples: 407
-- RENDERELEMENT OBJECTS --
--Information about particular render elements for a job
n = j[1].numRenderElements--how many render elements for this job?
re = j[1].GetRenderElement 1--get the first one
re.enabled = false--disable it
re.filterEnabled = false--disable filtering
re.name = “newName”--change its name
useShadows = re.shadowsApplied--are shadows applied? (read-only)
useShadows = re.atmosphereApplied--are atmospherics applied (read-only)
re.output = “C:\\share\\rendElem1.bmp”--change its output path & name
j[1].SetRenderElement 1 re--update the job with the new changes
j[1].SendUpdate--upload the changes
-- WEEKLY SCHEDULES --
-- a servers’ weekly schedule is an array of seven BitArrays;
-- Each bitArray is a day, each bit is an hour
sched = s[1].schedule
sched[1][11] = false--sunday 11am, the server will not work
sched[1][12] = false -- same for sunday noon
s[1].attendedPriority = 60--set the priorities for the server’s schedule
s[1].unattendedPriority = 10
s[1].schedule = sched--set the new schedule
s[1].schedule --printout to prove the change worked
s[1].SendUpdate()--upload the changes to this server
--NOTE: a Schedule is just a BitArray and has no GetUpdate,
--you must fetch it again from the server to see any changes
-- MISCELANEOUS FUNCTIONS --
jobList = #( j[3], j[1], j[2] )--make an array of some jobs
m.SetJobOrder jobList--rearrange the jobs; e.g. j[3] is now the first in the queue
mName = (m.netStatus).computerName --the machine name of the manager
-- JOB & SERVER FILTERS --
jobServers = m.getservers filter:#Job key:j[1]
groupServers = m.getservers filter:#group key:”Clouds”
-- ENDING THE SEESION --
m.wantControl=true--other clients can now get QueueControl
m.disconnect()--end this session
-- m.kill()--brings down the manager, (would need queue control)
Interface: NullInterface 409
Interface: NullInterface
Interface: NullInterface
Note:
Intentionally blank.
Interface: objXRefs
Interface: objXRefs
Methods:
Prototype:
<maxObject>addNewXRefObject <filename>fname <string>objname <boolean>proxy
Parameters:
<filename>fname
<string>objname
<boolean>proxy
Prototype:
<integer>getNumXRefObjects <filename>fname
Parameters:
<filename>fname
Prototype:
<maxObject>getXRefObject <filename>fname <index>index
Parameters:
<filename>fname
<index>index
Prototype:
<integer>getNumFiles()
Prototype:
<filename>getFileName <index>index
Parameters:
<index>index
Prototype:
<boolean>reloadFile <filename>fname
Parameters:
<filename>fname
Return Value:
True if successful and false otherwise.
Prototype:
<boolean>isFileUnresolved <filename>fname
410 Chapter 1 | What’s New in 3ds max 4 MAXScript
Parameters:
<filename>fname
Return Value:
True if successful and false otherwise.
Prototype:
<boolean>isFileDisabled <filename>fname
Parameters:
<filename>fname
Return Value:
True if successful and false otherwise.
See Also
XRefObject : Node (p. 1037)
XRefScene Values (p. 1038)
XRef Files (p. 1643)
Interface: paramWire
Parameter Wiring (p. 85)
This class represents the interface that provides general access to the parameter wiring functions.
Prototype:
<void>start()
Remarks:
This method will launch the parameter wiring UI mode on the currently selected object. Only works
if there is a single object selected in the viewport. It will move the cursor to the pivot point of the
node.
Example:
It might be used in a macroScript like this:
macroScript paramWire
category:”Tools”
buttonText:”Wire Parameters”
tooltip:”Start Param Wiring”
Icon:#(”MAXScript”,1)
(
on execute do paramWire.start()
on isEnabled return selection.count == 1
)
Prototype:
<void>openEditor()
Interface: paramWire 411
Remarks:
This method will open up the parameter wiring dialog on the selected objects with no track selected
in either tree view.
Prototype:
<void>editParams <value>leftParam <value>rightParam
Remarks:
Opens the parameter wiring editor dialog on the parameters specified. The parameter is specified as
a SubAnim in MAXScript, via the index [] operator on a MAX object.
Parameters:
<value>leftParam
The sub-animatable of the left-hand reference target.
<value>rightParam
The sub-animatable of the right-hand reference target.
Note:
The subanim index operator can also take number indexes.
Prototype:
<void>editParam <value>param
Remarks:
Opens the parameter wiring editor dialog on the parameter specified. The parameter is specified as
a SubAnim in MAXScript, via the index [] operator on a MAX object.
Parameters:
<value>param
The sub-animatable of the left-hand reference target.
Example:
-- The radius parameter in a sphere node
paramWire.editParam $sphere01.baseObject[#radius]
-- The angle parameter in a bend modifier would be
paramWire.editParam $foo.bend[#angle]
-- The position parameter in node would be
paramWire.editParam $foo[#transform][#position], etc.
Prototype:
<void>editControllers <control>leftController <control>rightController
Remarks:
Opens the parameter wiring editor dialog on the two given existing wire controllers.
Parameters:
<control>leftController
A pointer to the controller for the left-hand wire.
<control>rightController
A pointer to the controller for the right-hand wire.
412 Chapter 1 | What’s New in 3ds max 4 MAXScript
Prototype:
<void>editController <control>controller
Remarks:
Opens the parameter wiring editor dialog on the given existing wire controller.
Parameters:
<control>controller
A pointer to the controller being edited.
Example:
paramWire.editController $foo.radius.controller
Prototype:
<bool>connect <value>fromParam <value>toParam <string>toExpr
Remarks:
This method allows you to set up a one-way parameter wire from the ‘fromParam’ subAnim to the
‘toParam’ subAnim, using the ‘toExpr’ as the expression for the controlled parameter.
Parameters:
<value>fromParam
The sub-animatable to wire from.
<value>toParam
The sub-animatable to wire to.
<string>toExpr
A string containing the expression on the “to wire”.
Return Value:
TRUE if the connection can be made, otherwise FALSE.
Example:
paramWire.connect $foo.baseObject[#radius] $baz.bend[#angle] “radius / 2”
Prototype:
<bool>connect2Way <value>leftParam <value>rightParam <string>leftExpr
<string>rightExpr
Remarks:
This method allows you to set up a two-way parameter wire between the ‘leftParam’ parameter and
the ‘rightParam’ parameter, with the given expression strings.
Parameters:
<value>leftParam
The sub-animatable of the left-hand reference target.
<value>rightParam
The sub-animatable of the right-hand reference target.
Interface: paramWire 413
<string>leftExpr
A string containing the expression for the left-hand target.
<string>rightExpr
A string containing the expression for the right-hand target.
Return Value:
TRUE if the connection can be made, otherwise FALSE.
Example:
paramWire.connect2Way $foo.baseObject[#radius] $baz.bend[#angle] \ “angle / 2”
“radius * 2”
Prototype:
<bool>disconnect <control>controller
Remarks:
This method allows you to disconnect a one-way wireController from its current parameter,
replacing it with either the wire’s existing animation track or a default controller for the parameter.
Parameters:
<control>controller
A pointer to the wire controller you wish to disconnect.
Return Value:
TRUE if the disconnect was successful, otherwise FALSE.
Prototype:
<bool>disconnect2Way <control>leftController <control>rightController
Remarks:
This method allows you to disconnect a two-way wire between ‘leftcontroller’ and ‘rightController’.
If this is the last two-way wire for either controller, replace it with either the the wire’s existing
animation track or a default controller for the parameter.
Parameters:
<control>leftController
A pointer to the first wire controller you wish to disconnect.
<control>rightController
A pointer to the second wire controller you wish to disconnect.
Return Value:
TRUE if the disconnect was successful, otherwise FALSE.
See Also
In The MAXSDK Help File
Class IParamWireMgr
414 Chapter 1 | What’s New in 3ds max 4 MAXScript
Interface: pluginManager
Interface: pluginManager
Properties:
.visible : boolean : Read|Write
Remarks:
Show and hide the plug-in manager.
Methods:
<void>loadClass <class>class
Remarks:
Will ensure that the given class is loaded, in the event that it is a deferred loading class, and so any
MAXScript methods or Function Published interfaces it publishes will be available.
Parameters:
<class>class
Example:
plug-inManager.loadClass Flex
After this code is executed, all the Flex modifier MAXScript methods are installed and callable.
Note this is only needed in situations where a plug-in loading may be deferred and it does not
have any instances already in the current scene.
See Also
Interface: pluginManager (p. 414)
Plugin_Manager interfaces: (p. 473)
Interface: quadMenuSettings
This represents an interface for quad menu settings.
Note:
PickObject() does not pick objects when launched from a Quad Menu. It will hang and refuses to
pick any object. Hit ‘escape’ for emergency exit. PickObject works correctly from a shortcut and
toolbar.
Prototype:
<void>ResetDefaults()
Remarks:
This method will reset the menu settings to their defaults.
Prototype:
<void>SetBorderSize <integer>borderSize
Interface: quadMenuSettings 415
Remarks:
This method allows you to set the menu border size.
Parameters:
<integer>borderSize
The border size in pixels.
Prototype:
<integer>GetBorderSize()
Return Value:
This method returns the menu border size.
Prototype:
<void>SetHorizontalMarginInPoints <integer>horizontalMarginInPoints
Remarks:
This method allows you to set the menu’s horizontal margin size.
Parameters:
<integer>horizontalMarginInPoints
The horizontal margin size in points.
Prototype:
<integer>GetHorizontalMarginInPoints()
Return Value:
This method returns the menu’s horizontal margin size (in points).
Prototype:
<void>SetVerticalMarginInPoints <integer>verticalMarginInPoints
Remarks:
This method allows you to set the menu’s vertical margin size.
Parameters:
<integer>verticalMarginInPoints
The vertical margin size in points.
Prototype:
<integer>GetVerticalMarginInPoints()
Return Value:
This method returns the menu’s vertical margin size (in points).
Prototype:
<void>SetItemFontFace <string>szItemFontFace
Remarks:
This method allows you to set the menu item’s font typeface.
416 Chapter 1 | What’s New in 3ds max 4 MAXScript
Parameters:
<string>szItemFontFace
A string containing the typeface name.
Prototype:
<string>GetItemFontFace()
Return Value:
This method returns the name of the menu item’s font typeface.
Prototype:
<void>SetTitleFontFace <string>szTitleFontFace
Remarks:
This method allows you to set the menu title’s font typeface.
Parameters:
<string>szTitleFontFace
A string containing the typeface name.
Prototype:
<string>GetTitleFontFace()
Return Value:
This method returns the name of the menu title’s font typeface.
Prototype:
<void>SetItemFontSize <integer>itemFontSize
Remarks:
This method allows you to set the menu item’s font size.
Parameters:
<integer>itemFontSize
The size of the font, in points.
Prototype:
<integer>GetItemFontSize()
Return Value:
This method returns the menu item’s font size, in points.
Prototype:
<void>SetTitleFontSize <integer>titleFontSize
Remarks:
This method allows you to set the menu title’s font size.
Parameters:
<integer>titleFontSize
The size of the font, in points.
Interface: quadMenuSettings 417
Prototype:
<integer>GetTitleFontSize()
Return Value:
This method returns the menu title’s font size, in points.
Prototype:
<void>SetUseUniformItemHeight <boolean>useUniformItemHeight
Remarks:
This method allows you to set the status of a menu item’s uniform height flag.
Parameters:
<boolean>useUniformItemHeight
TRUE to set the uniform height flag ON, FALSE to set it to OFF.
Prototype:
<boolean>GetUseUniformItemHeight()
Return Value:
This method returns TRUE or FALSE if the menu item’s uniform height flag is set or not set,
respectively.
Prototype:
<void>SetOpacity <float>opacity
Remarks:
This method allows you to set the menu’s opacity value.
Parameters:
<float>opacity
The opacity value, ranging from 0.0 – 1.0 where 1 is opaque.
Prototype:
<float>GetOpacity()
Return Value:
This method returns the menu’s opacity value.
Prototype:
<void>SetDisplayMethod <integer>displayMethod
Remarks:
This method allows you to set a menu’s display method.
Parameters:
<integer>displayMethod
The display method which is one of the following:
0 - displays the menu with transparency, if opacity is < 1.
1 - stretch animate the menu by making it grow in size from its center
with transparency, if opacity is < 1.
2 - fade in from invisible to whatever opacity is set to.
418 Chapter 1 | What’s New in 3ds max 4 MAXScript
Prototype:
<integer>GetDisplayMethod()
Return Value:
This method returns the menu’s display method, which is either of the following; DM_NORMAL,
DM_STRETCH, DM_FADE, DM_NUM_METHODS
Prototype:
<void>SetAnimatedSteps <integer>animatedSteps
Remarks:
This method allows you to set the menu’s number of animated steps for the ‘growing’ effect.
Parameters:
<integer>animatedSteps
The number of steps.
Prototype:
<integer>GetAnimatedSteps()
Return Value:
This method returns the menu’s number of animated steps used for the ‘growing’ effect.
Prototype:
<void>SetAnimatedStepTime <integer>animatedStepTime
Remarks:
This method allows you to set the menu’s animated step time.
Parameters:
<integer>animatedStepTime
The animated step time, in milliseconds.
Prototype:
<integer>GetAnimatedStepTime()
Return Value:
This method returns the menu’s animated step time, in milliseconds.
Prototype:
<void>SetSubMenuPauseTime <integer>subMenuPauseTime
Remarks:
This method allows you to set the delay before a submenu is displayed.
Parameters:
<integer>subMenuPauseTime
The delay, in milliseconds.
Prototype:
<integer>GetSubMenuPauseTime()
Interface: quadMenuSettings 419
Return Value:
This method returns the delay before a submenu is displayed, in milliseconds.
Prototype:
<void>SetUseLastExecutedItem <boolean>useLastSelectedItem
Remarks:
This method allows you to set the “last executed item” flag which determines whether to use the
menu’s last executed item when the user clicks on the menu’s titlebar.
Parameters:
<boolean>useLastSelectedItem
Prototype:
<boolean>GetUseLastExecutedItem()
Return Value:
This method returns whether the “last executed item” flag is set (TRUE) or not set (FALSE). The flag
determines whether to use the menu’s last executed item when the user clicks on the menu’s titlebar.
Prototype:
<void>SetRepositionWhenClipped <boolean>repositionWhenClipped
Remarks:
This method allows you to set the flag which controls and determines whether the menu is
repositioned when near the edge of the screen.
Parameters:
<boolean>repositionWhenClipped
TRUE to turn repositioning ON, FALSE to turn it OFF.
Prototype:
<integer>GetRepositionWhenClipped()
Remarks:
This method returns the status of the flag which controls and determines whether the menu is
repositioned when near the edge of the screen.
Return Value:
TRUE if the flag is ON, otherwise FALSE.
Prototype:
<void>SetRemoveRedundantSeparators <boolean>removeRedundantSeparators
Remarks:
This method allows you to set the flag which controls and determines whether the menu should
remove redundant separators.
Parameters:
<boolean>removeRedundantSeparators
TRUE to turn the flag ON, FALSE to turn it OFF.
420 Chapter 1 | What’s New in 3ds max 4 MAXScript
Prototype:
<integer>GetRemoveRedundantSeparators()
Remarks:
This method returns the status of the flag which controls and determines whether the menu should
remove redundant separators.
Return Value:
TRUE if the flag is ON, otherwise FALSE.
Prototype:
<void>SetFirstQuadDisplayed <integer>firstQuadDisplayed
Remarks:
This method allows you to set the first quad which will be displayed when a quad menu pops up.
Parameters:
<integer>firstQuadDisplayed
The quad index, one of the following; QUAD_ONE, QUAD_TWO, QUAD_THREE, or
QUAD_FOUR.
Prototype:
<integer>GetFirstQuadDisplayed()
Remarks:
This method returns the index of the first quad which will be displayed.
Return Value:
The quad index, one of the following; QUAD_ONE, QUAD_TWO, QUAD_THREE, or QUAD_FOUR.
Prototype:
<void>SetUseUniformQuadWidth <boolean>useUniformQuadWidth
Remarks:
This method allows you to set whether the quad menu has a uniform width.
Parameters:
<boolean>useUniformQuadWidth
TRUE to set the uniform width, FALSE to set it to non-uniform.
Prototype:
<boolean>GetUseUniformQuadWidth()
Return Value:
This method returns the status of the uniform width flag for the quad menu. TRUE if the quad menu
has been set to use uniform width, otherwise FALSE.
Prototype:
<void>SetMirrorQuad <boolean>mirrorQuad
Remarks:
This method allows you to set whether the quad menus are mirrored left to right.
Interface: quadMenuSettings 421
Parameters:
<boolean>mirrorQuad
TRUE to mirror the menus, otherwise FALSE.
Prototype:
<integer>GetMirrorQuad()
Return Value:
This method returns TRUE if the quad menu is mirrored left to right, otherwise FALSE.
Prototype:
<void>SetMoveCursorOnReposition <boolean>moveCursorOnReposition
Remarks:
This method allows you to set whether the cursor moves when the quad menu is repositioned
because of clipping the edge of the screen.
Parameters:
<boolean>moveCursorOnReposition
TRUE to move the cursor, otherwise FALSE.
Prototype:
<boolean>GetMoveCursorOnReposition()
Return Value:
This method returns TRUE if the cursor moves when the quad menu is repositioned because of
clipping the edge of the screen, otherwise FALSE.
Prototype:
<void>SetReturnCursorAfterReposition <boolean>returnCursorAfterReposition
Remarks:
This method allows you to set whether the cursor is moved the opposite distance that it was
automatically moved when the quad menu is repositioned because of clipping the edge of the
screen.
Parameters:
<boolean>returnCursorAfterReposition
TRUE to set the flag, otherwise FALSE.
Prototype:
<boolean>GetReturnCursorAfterReposition()
Return Value:
This method returns TRUE if the cursor is moved the opposite distance that it was automatically
moved when the quad menu is repositioned because of clipping the edge of the screen, otherwise
FALSE.
Prototype:
<void>SetInitialCursorLocInBox_0to1 <float>initialCursorLocX
<float>initialCursorLocY
422 Chapter 1 | What’s New in 3ds max 4 MAXScript
Remarks:
This method allows you to set the initial location of the cursor in the center quad box.
Parameters:
<float>initialCursorLocX
<float>initialCursorLocY
The location of the cursor, as a ratio of the box size, between 0.0 and 1.0.
Prototype:
<float>GetInitialCursorLocXInBox_0to1()
Return Value:
This method returns the initial x location of the cursor in the center quad box, as a ratio of the box
size, between 0.0 and 1.0.
Prototype:
<float>GetInitialCursorLocYInBox_0to1()
Return Value:
This method returns the initial y location of the cursor in the center quad box, as a ratio of the box
size, between 0.0 and 1.0.
Prototype:
<void>SetTitleBarBackgroundColor <integer>quad <&RGBA color>color
Remarks:
This method allows you to set the title bar background color for a specific quad.
color is In parameter
Parameters:
<integer>quad
The quad (numbered 1 through 4).
<&RGBA color>color
The color to set.
Prototype:
<&RGBA color>GetTitleBarBackgroundColor <integer>quad
Parameters:
<integer>quad
The quad (numbered 1 through 4).
Return Value:
This method returns the title bar background color of a specific quad. This method returns the color
as a Color.
Prototype:
<void>SetTitleBarTextColor <integer>quad <&RGBA color>color
Interface: quadMenuSettings 423
Remarks:
This method allows you to set the title bar text color for a specific quad.
color is In parameter
Parameters:
<integer>quad
The quad (numbered 1 through 4).
<&RGBA color>color
The color to set.
Prototype:
<&RGBA color>GetTitleBarTextColor <integer>quad
Parameters:
<integer>quad
The quad (numbered 1 through 4).
Return Value:
This method returns the title bar text color of a specific quad. This method returns the color as a
Color
Prototype:
<void>SetItemBackgroundColor <integer>quad <&RGBA color>color
Remarks:
This method allows you to set the item background color for a specific quad.
color is In parameter
Parameters:
<integer>quad
The quad (numbered 1 through 4).
<&RGBA color>color
The color to set.
Prototype:
<&RGBA color>GetItemBackgroundColor <integer>quad
Parameters:
<integer>quad
The quad (numbered 1 through 4).
Return Value:
This method returns the item background color of a specific quad. This method returns the color as
a Color.
Prototype:
<void>SetItemTextColor <integer>quad <&RGBA color>color
424 Chapter 1 | What’s New in 3ds max 4 MAXScript
Remarks:
This method allows you to set the item text color for a specific quad.
color is In parameter
Parameters:
<integer>quad
The quad (numbered 1 through 4).
<&RGBA color>color
The color to set.
Prototype:
<&RGBA color>GetItemTextColor <integer>quad
Parameters:
<integer>quad
The quad (numbered 1 through 4).
Return Value:
This method returns the item text color of a specific quad. This method returns the color as a Color.
Prototype:
<void>SetLastExecutedItemTextColor <integer>quad <&RGBA color>color
Remarks:
This method allows you to set the last executed item text color for a specific quad.
color is In parameter
Parameters:
<integer>quad
The quad (numbered 1 through 4).
<&RGBA color>color
The color to set.
Prototype:
<&RGBA color>GetLastExecutedItemTextColor <integer>quad
Parameters:
<integer>quad
The quad (numbered 1 through 4).
Return Value:
This method returns the last executed item text color of a specific quad. This method returns the
color as a Color.
Prototype:
<void>SetHighlightedItemBackgroundColor <integer>quad <&RGBA color>color
Remarks:
This method allows you to set the highlighted item background color for a specific quad.
Color is In parameter.
Interface: quadMenuSettings 425
Parameters:
<integer>quad
The quad (numbered 1 through 4).
<&RGBA color>color
The color to set.
Prototype:
<&RGBA color>GetHighlightedItemBackgroundColor <integer>quad
Parameters:
<integer>quad
The quad (numbered 1 through 4).
Return Value:
This method returns the highlighted item background color of a specific quad. This method returns
the color as a Color.
Prototype:
<void>SetHighlightedItemTextColor <integer>quad <&RGBA color>color
Remarks:
This method allows you to set the highlighted item text color for a specific quad.
color is In parameter
Parameters:
<integer>quad
The quad (numbered 1 through 4).
<&RGBA color>color
The color to set.
Prototype:
<&RGBA color>GetHighlightedItemTextColor <integer>quad
Parameters:
<integer>quad
The quad (numbered 1 through 4).
Return Value:
This method returns the highlighted item text color of a specific quad. This method returns the color
as a Color.
Prototype:
<void>SetBorderColor <integer>quad <&RGBA color>color
Remarks:
This method allows you to set the border color for a specific quad.
color is In parameter
426 Chapter 1 | What’s New in 3ds max 4 MAXScript
Parameters:
<integer>quad
The quad (numbered 1 through 4).
<&RGBA color>color
The color to set.
Prototype:
<&RGBA color>GetBorderColor <integer>quad
Parameters:
<integer>quad
The quad (numbered 1 through 4).
Return Value:
This method returns the border color of a specific quad. This method returns the color as a Color.
Prototype:
<void>SetDisabledShadowColor <integer>quad <&RGBA color>color
Remarks:
This method allows you to set the disabled shadow color for a specific quad.
color is In parameter
Parameters:
<integer>quad
The quad (numbered 1 through 4).
<&RGBA color>color
The color to set.
Prototype:
<&RGBA color>GetDisabledShadowColor <integer>quad
Parameters:
<integer>quad
The quad (numbered 1 through 4).
Return Value:
This method returns the disabled shadow color of a specific quad. This method returns the color as
a Color.
Prototype:
<void>SetDisabledHighlightColor <integer>quad <&RGBA color>color
Interface: rollup 427
Remarks:
This method allows you to set the disabled highlight color for a specific quad.
color is In parameter
Parameters:
<integer>quad
The quad (numbered 1 through 4).
<&RGBA color>color
The color to set.
Prototype:
<&RGBA color>GetDisabledHighlightColor <integer>quad
Parameters:
<integer>quad
The quad (numbered 1 through 4).
Return Value:
This method returns the disabled highlight color of a specific quad. This method returns the color
as a Color.
See Also
In The MAXSDK Help File
Class IMenuSettings
See Also
Menu Manager (p. 75)
Interface: menuMan (p. 372)
Interface: rollup
Interface: rollup
Note:
Intentionally blank.
Interface: SceneExposureControl
Interface: SceneExposureControl
Properties:
.exposureControl : maxObject : Read|Write|Validated by
428 Chapter 1 | What’s New in 3ds max 4 MAXScript
Interface: SceneRadiosity
Interface: SceneRadiosity
Properties:
.radiosity : maxObject : Read|Write|Validated by
Methods:
Prototype:
<void>showPanel()
Remarks:
The radiosity panel is disabled from the scriptor when there are no radiosity plugins registered. In
this case the SceneRadiosity.showPanel() function published method doesn’t do anything.
Prototype:
<void>closePanel()
Prototype:
<void>minimizePanel()
Interface: timeSlider
This represents the interface for the time slider.
Methods:
Prototype:
<void>setVisible <boolean>visible
Remarks:
This method allows you to set the visibility flags of the time slider.
This Setting is sticky across sessions and will be stored in the ini file.
Parameters:
<boolean>visible
TRUE to set the time slider visible, otherwise FALSE.
Prototype:
<boolean>isVisible()
Return Value:
This method returns TRUE if the time slider is visible, otherwise FALSE.
See Also
In The MAXSDK Help File
Class ITimeSlider
Interface: trackviews 429
Interface: trackviews
Interface: trackviews
Properties:
.currentTrackView : Interface : Read
.lastUsedTrackViewName : string : Read
Methods:
Prototype:
<Interface>getTrackView <fpvalue>name or index
Parameters:
<fpvalue>name or index
Return Value:
This method will get a trackview based on it’s index or name.
Prototype:
<Interface by value array>getAllOpenTrackViews()
Return Value:
Returns an array of trackviews.
Prototype:
<integer>numTrackViews()
Return Value:
Returns the number of trackviews.
Prototype:
<boolean>open <fpvalue>name or index
Parameters:
<fpvalue>name or index
Return Value:
Open a trackview based on it’s index or name.
Prototype:
<boolean>close <fpvalue>name or index
Parameters:
<fpvalue>name or index
Return Value:
Close a trackview based on it’s index or name.
Prototype:
<void>delete <fpvalue>name or index
430 Chapter 1 | What’s New in 3ds max 4 MAXScript
Remarks:
Parameters:
<fpvalue>name or index
Prototype:
<string>getTrackViewName <index>index
Parameters:
<index>index
Return Value:
Returns the name of the trackview window based on the index.
Prototype:
<boolean>zoomSelected <TSTR>name
Parameters:
<TSTR>name
Return Value:
Zooms to the selected object’s track
Prototype:
<boolean>zoomOn <TSTR>name <maxObject>object <index>subNum
Parameters:
<TSTR>name
<maxObject>object <index>subNum
Return Value:
True if successful and false otherwise.
Prototype:
<boolean>setFilter()
Remarks:
setFilter has variable number of arguments
Return Value:
True if successful and false otherwise.
Prototype:
<boolean>clearFilter()
Remarks:
clearFilter has variable number of arguments
Return Value:
True if successful and false otherwise.
Prototype:
<fpvalue by value>pickTrackDlg()
Interface: trackviews 431
Remarks:
pickTrackDlg has variable number of arguments
Return Value:
This method brings up the Track View Pick dialog and returns a TrackViewPick value when the user
selects a track and clicks “Ok”, or undefined if the user clicks “Cancel”. If the optional argument
#multiple is passed, multiple tracks can be picked in the dialog and an array of TrackViewPick values
is returned instead of single value.
Prototype:
<boolean>isOpen <fpvalue>name or index
Parameters:
<fpvalue>name or index
Return Value:
Returns a boolean value indicating if the specified trackview is open.
Prototype:
<boolean>openLastUsedTrackView()
Return Value:
Opens the current trackview if it has been closed.
Prototype:
<boolean>isCurrent <fpvalue>name or index
Parameters:
<fpvalue>name or index
Return Value:
Returns a boolean value indicating if the trackview is the last one used or not.
Prototype:
<boolean>setCurrent <fpvalue>name or index
Parameters:
<fpvalue>name or index
Return Value:
Sets the specified trackview to be the current one. Returns true if successful.
See Also
Track View Pick Dialog (p. 1617)
432 Chapter 1 | What’s New in 3ds max 4 MAXScript
Other Interfaces
Topic: version 4 MAXScript New Features/Interfaces
Interfaces (p. 67)
bitmapTex (p. 434)
Block Control (p. 435)
BMP (p. 437)
Flex interfaces: (p. 438)
float list (p. 441)
Float Reactor (p. 443)
Float Wire interfaces: (p. 448)
FloatList (p. 450)
FloatReactor (p. 452)
HSDS Modifier (p. 453)
HSDSObject (p. 453)
IKChainControl (p. 453)
imageMotionBlur (p. 454)
JPEG (p. 454)
Link (p. 455)
Link Constraint (p. 455)
LookAt Constraint (p. 455)
Motion Blur (p. 462)
Orientation Constraint (p. 462)
path (p. 462)
Path Constraint (p. 468)
Plugin Manager (p. 473)
Portable Network Graphics (p. 473)
point3 list (p. 475)
Point3 Reactor (p. 477)
Point3 Wire (p. 477)
Point3List (p. 479)
Point3Reactor (p. 481)
Point3Spring (p. 482)
Point Cache (p. 484)
Point CacheSpacewarpModifier (p. 485)
Interface: trackviews 433
See Also
Core Interfaces (p. 70)
Class and Object Inspector Functions (p. 799)
Class and Object Inspector Functions Enhanced (p. 159)
bitmapTex interfaces:
bitmapTex interfaces:
Interface: bitmapTex
Methods:
Prototype:
<void>reload()
Remarks:
Reloads the bitmap file using the same name and path. You don’t need to use the file browser to
reload the bitmap after you’ve updated it in your paint program.
Clicking reload for any instance of the map updates the map in all sample slots and in the scene.
Prototype:
<void>viewImage()
Remarks:
Displays a Virtual Frame Buffer that shows the bitmap surrounded by a region outline. The region
outline has handles at its sides and corners. When cropping is on, dragging the handles changes the
size of the crop area. You can also drag within the region area to move it.
The VFB editing window has U/V and W/H (width/height) spinners on its toolbar. Use these to
adjust the location and size the image or crop area.
When Place is turned on, dragging the region area handles changes the scale of the bitmap (hold
down CTRL to preserve the bitmap’s aspect ratio), and dragging the image changes its location
within the tile area.
When Crop is turned on, the UV or XY button at the right of the virtual frame buffer toolbar lets
you switch between using UV or XY coordinates in the toolbar spinners. Also, you can zoom out by
pressing SHIFT+Z and zoom in by pressing Z.
Block_Control interfaces: 435
See Also
BitmapTexture : TextureMap (p. 1243)
BMP, PNG, JPEG and TGA I/O Interfaces (p. 164)
Material Editor Access (p. 165)
Accessing The Material Editor Active Slot (p. 163)
Material Level Show-in-viewport State (p. 166)
showTextureMap() function (p. 167)
Block_Control interfaces:
Interface: list
Properties:
.count : integer : Read
.active : index : Read|Write
Methods:
Prototype:
<integer>getCount()
Remarks:
This method returns the number of items that appear in the List controllers list box.
Prototype:
<void>setActive <index>listIndex
Remarks:
This method allows you to sets the indexed item in the list active so its parameters appear in the
motion panel, and any input is directed to the indexed sub controller.
Parameters:
<index>listIndex
The index of the item to set as the active item.
Prototype:
<integer>getActive()
Remarks:
This method returns the index of the currently active item.
Prototype:
<void>delete <index>listIndex
436 Chapter 1 | What’s New in 3ds max 4 MAXScript
Remarks:
This method allows you to delete the indexed sub controller from the list.
Parameters:
<index>listIndex
The index of the item to delete from the list.
Prototype:
<void>cut <index>listIndex
Remarks:
This method allows you to cut the index sub controller from the list and stores it in the buffer to
paste later.
Parameters:
<index>listIndex
The index of the item you wish to cut.
Prototype:
<void>paste <index>listIndex
Remarks:
This method allows you to paste the sub-controller from the buffer into the indexed slot in the list.
Parameters:
<index>listIndex
The index of the slot to paste into.
Prototype:
<TSTR by value>getName <index>listIndex
Remarks:
This method returns the class name of the indexed sub-controller if a user defined name doesn’t
exist.
Parameters:
<index>listIndex
The index of the item for which to get the name.
Prototype:
<void>setName <index>listIndex <string>name
Remarks:
This method allows you to set the name of an indexed item.
Parameters:
<index>listIndex
The index of the item.
<string>name
The name to set it to.
BMP interfaces: 437
See Also
In the MAXSDK Help File
Class IListControl
BMP interfaces:
This represents the interface for the Bitmap IO BMP format.
Interface: ibmpio
Methods:
Prototype:
<enum>getType()
getType enums: {#noType|#paletted|#true24}
Return Value:
This method returns the format type, which is one of the enum types.
Note:
#noType is equivalent to #true24
Prototype:
<void>setType <enum>type
type enums: {#noType|#paletted|#true24}
Remarks:
This method allows you to set the format type.
Parameters:
<enum>type
The type, which is one of the enum types.
Note:
#noType is equivalent to #true24
See Also
In The MAXSDK Help File
Class IBitmapIO_Bmp
438 Chapter 1 | What’s New in 3ds max 4 MAXScript
Flex interfaces:
Flex interfaces:
Interface: flexOps
Methods:
Prototype:
<void>paint()
Prototype:
<void>setReference()
Prototype:
<void>reset()
Prototype:
<void>addForce <node>force
Parameters:
<node>force
Prototype:
<void>removeForce <integer>force
Parameters:
<integer>force
Prototype:
<integer>numberVertices()
Prototype:
<void>selectVertices <bitArray>sel <boolean>update
Parameters:
<bitArray>sel
<boolean>update
Prototype:
<bitArray>getSelectedVertices()
Prototype:
<float>getVertexWeight <integer>index
Parameters:
<integer>index
Prototype:
<void>setVertexWeight <int array>indices <float array>values
Parameters:
<int array>indices
<float array>values
Prototype:
<void>setEdgeList <bitArray>sel <boolean>update
Flex interfaces: 439
Parameters:
<bitArray>sel
<boolean>update
Prototype:
<bitArray>getEdgeList()
Prototype:
<void>addSpringFromSelection <integer>flag <boolean>addDuplicates
Parameters:
<integer>flag
<boolean>addDuplicates
Prototype:
<void>addSpring <integer>indexA <integer>indexB <integer>flag
<boolean>addDuplicates
Parameters:
<integer>indexA
<integer>indexB
<integer>flag
<boolean>addDuplicates
Prototype:
<void>removeAllSprings()
Prototype:
<void>addSpringButton()
Prototype:
<void>removeSpringButton()
Prototype:
<void>optionsButton()
Prototype:
<void>createSimpleSoftButton()
Prototype:
<void>removeSpringByEnd <integer>a
Parameters:
<integer>a
Prototype:
<void>removeSpringByEnds <integer>a <integer>b
Parameters:
<integer>a
<integer>b
440 Chapter 1 | What’s New in 3ds max 4 MAXScript
Prototype:
<void>removeSpringByIndex <integer>index
Parameters:
<integer>index
Prototype:
<integer>numberSprings()
Prototype:
<integer>getSpringGroup <integer>index
Parameters:
<integer>index
Prototype:
<void>setSpringGroup <integer>index <integer>group
Parameters:
<integer>index <integer>group
Prototype:
<float>getSpringLength <integer>index
Parameters:
<integer>index
Prototype:
<void>setSpringLength <integer>index <float>length
Parameters:
<integer>index
<float>length
Prototype:
<integer>getIndex <integer>a <integer>b
Parameters:
<integer>a
<integer>b
See Also
PositionSpring interfaces: (p. 497)
Point3Spring interfaces: (p. 482)
SpringPoint3Controller interfaces: (p. 523)
SpringPoint3Controller - superclass: Point3Controller (p. 336)
SpringPositionController interfaces: (p. 526)
SpringPositionController - superclass: PositionController (p. 337)
Flex : Modifier (p. 1128)
Flex interfaces: (p. 438)
flexOps const StructDef (p. 235)
float_list interfaces: 441
float_list interfaces:
float_list interfaces:
This class represents the interface to the list controller.
Interface: list
Properties:
.count : integer : Read
.active : index : Read|Write
Methods:
Prototype:
<integer>getCount()
Remarks:
This method returns the number of items that appear in the List controllers list box.
Prototype:
<void>setActive <index>listIndex
Remarks:
This method allows you to sets the indexed item in the list active so its parameters appear in the
motion panel, and any input is directed to the indexed sub controller.
Parameters:
<index>listIndex
The index of the item to set as the active item.
Prototype:
<integer>getActive()
Remarks:
This method returns the index of the currently active item.
Prototype:
<void>delete <index>listIndex
Remarks:
This method allows you to delete the indexed sub controller from the list.
Parameters:
<index>listIndex
The index of the item to delete from the list.
Prototype:
<void>cut <index>listIndex
Remarks:
This method allows you to cut the index sub controller from the list and stores it in the buffer to
paste later.
442 Chapter 1 | What’s New in 3ds max 4 MAXScript
Parameters:
<index>listIndex
The index of the item you wish to cut.
Prototype:
<void>paste <index>listIndex
Remarks:
This method allows you to paste the sub-controller from the buffer into the indexed slot in the list.
Parameters:
<index>listIndex
The index of the slot to paste into.
Prototype:
<TSTR by value>getName <index>listIndex
Remarks:
This method returns the class name of the indexed sub-controller if a user defined name doesn’t
exist.
Parameters:
<index>listIndex
The index of the item for which to get the name.
Prototype:
<void>setName <index>listIndex <string>name
Remarks:
This method allows you to set the name of an indexed item.
Parameters:
<index>listIndex
The index of the item.
<string>name
The name to set it to.
See Also
In the MAXSDK Help File
Class IListControl
Float Reactor interfaces: 443
Prototype:
<integer>getCount()
Return Value:
Returns the reaction count.
Prototype:
<void>select <index>index
Parameters:
<index>index
Prototype:
<index>getSelected()
Return Value:
Prototype:
<boolean>setStateToCurrent <index>index
Parameters:
<index>index
Remarks:
This is a Time Variant function. Sets the reaction state to the current state at the given MAXScript
time.
Return Value:
Returns true is successful and false otherwise.
Prototype:
<boolean>setFloatState <index>index <float>state
Parameters:
<index>index
<float>state
Remarks:
Set the reaction state to the value passed in. The function you use depends on the type of reactor
controller it is.
Return Value:
Returns true is successful and false otherwise.
Prototype:
<boolean>setVectorState <index>index <point3>state
Parameters:
<index>index
<point3>state
Remarks:
Set the reaction state to the value passed in. The function you use depends on the type of reactor
controller it is.
Float Reactor interfaces: 445
Return Value:
Returns true is successful and false otherwise.
Prototype:
<boolean>setRotationState <index>index <quat>state
Parameters:
<index>index
<quat>state
Remarks:
Set the reaction state to the value passed in. The function you use depends on the type of reactor
controller it is.
Return Value:
Returns true is successful and false otherwise.
Prototype:
<boolean>setValueToCurrent <index>index
Parameters:
<index>index
Remarks:
This is a Time Variant function. Sets the reaction value to value of the ReactTo object at the given
MAXScript time.
Return Value:
Returns true is successful and false otherwise.
Prototype:
<boolean>setValueAsFloat <index>index <float>value
Parameters:
<index>index
<float>value
Remarks:
Set the reaction value to the value passed in. The function you use depends on the type of object or
controller you are reacting to. See getType() below.
Return Value:
Returns true is successful and false otherwise.
Prototype:
<boolean>setValueAsVector <index>index <point3>value
Parameters:
<index>index
<point3>value
446 Chapter 1 | What’s New in 3ds max 4 MAXScript
Remarks:
Set the reaction value to the value passed in. The function you use depends on the type of object or
controller you are reacting to. See getType() below.
Return Value:
Returns true is successful and false otherwise.
Prototype:
<boolean>setValueAsQuat <index>index <quat>value
Parameters:
<index>index
<quat>value
Remarks:
Set the reaction value to the value passed in. The function you use depends on the type of object or
controller you are reacting to. See getType() below.
Return Value:
Returns true is successful and false otherwise.
Prototype:
<boolean>setInfluence <index>index <float>influence
Parameters:
<index>index
<float>influence
Remarks:
Sets the influence for the specified reaction.
Return Value:
Returns true is successful and false otherwise.
Prototype:
<boolean>setStrength <index>index <float>strength
Parameters:
<index>index
<float>strength
Remarks:
Sets the strength for the specified reaction.
Return Value:
Returns true is successful and false otherwise.
Prototype:
<boolean>setFalloff <index>index <float>influence
Parameters:
<index>index
<float>influence
Float Reactor interfaces: 447
Remarks:
Sets the falloff for the specified reaction.
Return Value:
Prototype:
<void>setName <index>index <string>name
Parameters:
<index>index
<string>name
Remarks:
Set the name of the reaction specified by the index.
Prototype:
<string>getName <index>index
Parameters:
<index>index
Return Value:
Returns the reaction name.
Prototype:
<float>getInfluence <index>index
Parameters:
<index>index
Return Value:
Returns the reaction influence.
Prototype:
<float>getStrength <index>index
Parameters:
<index>index
Return Value:
Returns the reaction strength.
Prototype:
<float>getFalloff <index>index
Parameters:
<index>index
Return Value:
Returns the reaction falloff.
Prototype:
<enum>getType()
getType enums: { #floatReaction | #positionalReaction | #rotationalReaction
| #scaleReaction }
448 Chapter 1 | What’s New in 3ds max 4 MAXScript
Return Value:
The type of object you are reacting to.
Prototype:
<fpvalue by value>getState <index>index
Parameters:
<index>index
Return Value:
Returns the reaction state. This value can be either a Point3, a Quat, or a float depending on the type
of reactor controller this is.
Prototype:
<fpvalue by value>getValue <index>index
Parameters:
<index>index
Return Value:
Returns the reaction value. This value can be either a Point3, a Quat, or a float depending on the
type of reactor controller this is.
Float_Wire interfaces:
This represents the interface for individual wire controllers.
Interface: wireController
Properties:
.numWires : integer : Read
This property returns the number of wires out of this controller (i.e. the number of
dependent params).
.isMaster : boolean : Read
This property will return TRUE if the wire is a master predicate, otherwise it will return
FALSE.
.isSlave : boolean : Read
This method will return TRUE if the wire is a slave predicate, otherwise it will return
FALSE.
.isTwoWay : boolean : Read
This method will return TRUE if the wire is a two-way predicate, otherwise it will return
FALSE.
.slaveAnimation : control : Read|Write
This method returns a pointer to the slave animation controller.
This method allows you to set the slave animation controller.
Prototype:
<maxObject>getWireParent <index>index
Float_Wire interfaces: 449
Parameters:
<index>index
The index you wish to retrieve.
Return Value:
This method returns a pointer to the i-th dependent parameter parent.
Prototype:
<integer>getWireSubnum <index>index
Remarks:
This method returns the i-th dependent parameter subanim num in the animatable.
Parameters:
<index>index
The index of the subanim.
Return Value:
This method returns the i-th dependent parameter subanim num in the animatable.
Prototype:
<control>getCoController <index>index
Parameters:
<index>index
The index of the controller.
Return Value:
This method returns a pointer to the i-th CoController.
Prototype:
<string>getExprText <index>index
Parameters:
<index>index
The index of the parameter.
Return Value:
This method returns the expression string of the i-th wire parameter.
Prototype:
<void>setExprText <index>index <string>text
Remarks:
This method allows you to set the expression string of the i-th wire parameter.
Parameters:
<index>index
The index of the parameter
<string>text
The expression you wish to set.
450 Chapter 1 | What’s New in 3ds max 4 MAXScript
See Also
In The MAXSDK Help File
Class IBaseWireControl
FloatList interfaces:
This class represents the interface to the list controller.
Properties:
.count : integer : Read
.active : index : Read|Write
Methods:
Prototype:
<integer>getCount()
Remarks:
This method returns the number of items that appear in the List controllers list box.
Prototype:
<void>setActive <index>listIndex
Remarks:
This method allows you to sets the indexed item in the list active so its parameters appear in the
motion panel, and any input is directed to the indexed sub controller.
Parameters:
<index>listIndex
The index of the item to set as the active item.
Prototype:
<integer>getActive()
Remarks:
This method returns the index of the currently active item.
Prototype:
<void>delete <index>listIndex
Remarks:
This method allows you to delete the indexed sub controller from the list.
Parameters:
<index>listIndex
The index of the item to delete from the list.
Prototype:
<void>cut <index>listIndex
FloatList interfaces: 451
Remarks:
This method allows you to cut the index sub controller from the list and stores it in the buffer to
paste later.
Parameters:
<index>listIndex
The index of the item you wish to cut.
Prototype:
<void>paste <index>listIndex
Remarks:
This method allows you to paste the sub-controller from the buffer into the indexed slot in the list.
Parameters:
<index>listIndex
The index of the slot to paste into.
Prototype:
<TSTR by value>getName <index>listIndex
Remarks:
This method returns the class name of the indexed sub-controller if a user defined name doesn’t
exist.
Parameters:
<index>listIndex
The index of the item for which to get the name.
Prototype:
<void>setName <index>listIndex <string>name
Remarks:
This method allows you to set the name of an indexed item.
Parameters:
<index>listIndex
The index of the item.
<string>name
The name to set it to.
See Also
In the MAXSDK Help File
Class IListControl
452 Chapter 1 | What’s New in 3ds max 4 MAXScript
FloatReactor interfaces:
FloatReactor interfaces:
Interface: reactions
Properties:
.editStateMode : boolean : Read|Write
.useCurve : boolean : Read|Write
methods:
<void>reactTo <maxObject>object
<boolean>create name:<string>
name default value: “scriptCreated”}
<boolean>delete <index>index
<integer>getCount()
<void>select <index>index
<index>getSelected()
<boolean>setStateToCurrent <index>index
<boolean>setFloatState <index>index <float>state
<boolean>setVectorState <index>index <point3>state
<boolean>setRotationState <index>index <quat>state
<boolean>setValueToCurrent <index>index
<boolean>setValueAsFloat <index>index <float>value
<boolean>setValueAsVector <index>index <point3>value
<boolean>setValueAsQuat <index>index <quat>value
<boolean>setInfluence <index>index <float>influence
<boolean>setStrength <index>index <float>strength
<boolean>setFalloff <index>index <float>influence
<void>setName <index>index <string>name
<string>getName <index>index
<float>getInfluence <index>index
<float>getStrength <index>index
<float>getFalloff <index>index
<enum>getType()
getType enums:
{#floatReaction|#positionalReaction|#rotationalReaction|#scaleReaction}
<fpvalue by value>getState <index>index
<fpvalue by value>getValue <index>index
Actions:
HSDS_Modifier interfaces: 453
HSDS_Modifier interfaces:
HSDS_Modifier interfaces:
Interface: hsdsOps
Properties:
methods:
<void>subdivide()
<void>deletePolygon()
<void>hide()
<void>showAll()
<void>createNamedSelection <string>name
<void>activateNamedSelection <string>name
<void>addDetail <float>length <float>angle
<void>removeDetail <float>length <float>angle
Actions:
HSDSObject interfaces:
HSDSObject interfaces:
Interface: hsdsOps
Properties:
methods:
<void>subdivide()
<void>deletePolygon()
<void>hide()
<void>showAll()
<void>createNamedSelection <string>name
<void>activateNamedSelection <string>name
<void>addDetail <float>length <float>angle
<void>removeDetail <float>length <float>angle
Actions:
IKChainControl interfaces:
IKChainControl interfaces:
Interface: Action
Properties:
methods:
<float>snap() -- Action Interface
<float>ikSnap() -- Action Interface
<float>fkSnap() -- Action Interface
Actions:
Category: IK_Chain_Actions; Action: IK_Chain_Snap_Action; Shortcut: -- none
defined --
Category: IK_Chain_Actions; Action: IK_Chain_IK_Snap; Shortcut: -- none defined
--
Category: IK_Chain_Actions; Action: IK_Chain_FK_Snap; Shortcut: -- none defined
–
454 Chapter 1 | What’s New in 3ds max 4 MAXScript
imageMotionBlur interfaces:
imageMotionBlur interfaces:
Interface: ImageMotionBlur
Properties:
methods:
Actions:
JPEG interfaces:
This represents the interface for the Bitmap IO JPG format.
Interface: ijpegio
Methods:
Prototype:
<integer>getQuality()
Return Value:
This method returns the quality level of the output image.
Prototype:
<void>setQuality <integer>quality
Remarks:
This method allows you to set the quality level of the output image.
Parameters:
<integer>quality
The quality level.
Prototype:
<integer>getSmoothing()
Return Value:
This method returns the smoothing level of the output image.
Prototype:
<void>setSmoothing <integer>smoothing
Remarks:
This method allows you set the smoothing level of the output image.
Parameters:
<integer>smoothing
The smoothing level.
Link interfaces: 455
See Also
In The MAXSDK Help File
Class IBitmapIO_Jpeg
Link interfaces:
Link interfaces:
Interface: constraints
Properties:
methods:
<node>getTarget <index>index
<boolean>setTarget <node>target <index>index
<float>getFrameNo <index>index <time>time
<boolean>setFrameNo <integer>frameNo <index>index <time>time
<integer>getNumTargets()
<boolean>appendTarget <node>target <time>time
<void>DeleteTarget <integer>targetNumber
Actions:
Link_Constraint interfaces:
Link_Constraint interfaces:
Interface: constraints
Methods:
<node>getTarget <index>index
<boolean>setTarget <node>target <index>index
<float>getFrameNo <index>index <time>time
<boolean>setFrameNo <integer>frameNo <index>index <time>time
<integer>getNumTargets()
<boolean>appendTarget <node>target <time>time
<void>DeleteTarget <integer>targetNumber
LookAt_Constraint interfaces:
This class is an interface to the LookAt Constraint rotation controller.
Interface: constraints
Methods:
Prototype:
<node>getTarget <index>index
Parameters:
<index>index
The node number in the Look-At target list to be obtained.
456 Chapter 1 | What’s New in 3ds max 4 MAXScript
Remarks:
This method will return a pointer to a node of one of the Look-At nodes that the Look-At constraint
controller targets, specified by targetNumber.
Prototype:
<boolean>setTarget <node>target <index>index
Parameters:
<node>target
Points to the node to follow.
<index>index
The node number in the Look-At target list to be set.
Remarks:
Sets one of the Look-At nodes that the Look-At constraint controller targets, specified by
targetNumber. If targetNumber is greater than the number of targets in the current list, it returns a
FALSE. In this case use the function AppendTarget.
Return Value:
TRUE if success; FALSE otherwise.
Prototype:
<float>getWeight <index>index <time>time
Parameters:
<index>index
The node number in the Look-At target list whose weight is to be obtained.
<time>time
The time at which the weight is to be obtained. The weights are animatable.
Remarks:
Gets the weight of one of the Look-At nodes that the Look-At constraint controller targets, specified
by targetNumber, and time t.
Prototype:
<boolean>setWeight <float>weight <index>index <time>time
Parameters:
<float>weight
The weight to set.
<index>index
The node number in the Look-At target list whose weight is to be set.
<time>time
The time at which the weight is to be set. The weights are animatable.
LookAt_Constraint interfaces: 457
Remarks:
Sets the weight of one of the Look-At nodes that the Look-At constraint controller follows, specified
by targetNumber, and time t.
Return Value:
TRUE if there is more than one Look-At targets in the list and you are trying to set weight, FALSE
otherwise.
Prototype:
<integer>getNumTargets()
Remarks:
Returns the number of nodes in the list of nodes to look at.
Prototype:
<void>appendWeightedTarget <node>target <float>weight
Parameters:
<node>target
The node that is to be appended to the current Look-At target list.
<float>weight
This is the weight that is to be assigned to the newly appended Look-At target. The
default weight is 50.0.
Remarks:
Appends the current Look-At target list by one and appends the current Look-At target weightlist by
one.
Prototype:
<boolean>appendTarget <node>target
Parameters:
<node>target
The node that is to be appended to the current Look-At target list.
Remarks:
Appends the current Look-At target list by one and appends the current Look-At target weightlist
by one.
Prototype:
<boolean>getRelative()
Remarks:
Gets the relative/absolute mode corresponding to the “Keep Initial Offset” checkbox in the UI.
Prototype:
<boolean>getUpnodeWorld()
458 Chapter 1 | What’s New in 3ds max 4 MAXScript
Remarks:
Returns TRUE if the “World” checkbox is on; FALSE if off.
Prototype:
<boolean>getStoUpAxisFlip()
Remarks:
Returns TRUE if the “selected” axis flip checkbox is on; FALSE if off.
Prototype:
<boolean>getTargetAxisFlip()
Remarks:
Returns TRUE if the “source” axis flip checkbox is on; FALSE if off.
Prototype:
<boolean>getSetOrient()
Remarks:
Returns TRUE if the orientation flag is set, FALSE if off.
Prototype:
<boolean>getTargetAxis()
Remarks:
Gets the selection corresponding to the “Select LookAt Axis” button in the UI. Obtains which of the
source axes is required to coincide with the target axis.
Return Value:
(0) if the target axis coincides with the x axis of the source object. (1) if the target axis coincides with
the y axis of the source object. (2) if the target axis coincides with the z axis of the source object.
Prototype:
<boolean>getUpNodeAxis()
Remarks:
Gets the selection corresponding to the “Source/Upnode Alignment: Aligned to UpNode Axis:”
radiobutton in the UI. Obtains which of the upnode axes is required to align with a specified source
axis.
Return Value:
(0) if the upnode x axis coincides with a specified source object. (1) if the upnode y axis coincides
with a specified source object. (2) if the upnode z axis coincides with a specified source object.
Prototype:
<boolean>getStoUPAxis()
Remarks:
Gets the selection corresponding to the “Source/Upnode Alignment: Aligned to UpNode Axis:”
radiobutton in the UI. Obtains which of the source axes is required to align with a specified
upnode axis.
LookAt_Constraint interfaces: 459
Return Value:
(0) if the source x axis coincides with a specified upnode axis. (1) if the source y axis coincides with
a specified upnode axis. (2) if the source z axis coincides with a specified upnode axis.
Prototype:
<void>setRelative <boolean>rel
Parameters:
<boolean>rel
TRUE to set the relative flag, otherwise FALSE.
Remarks:
This method allows you to set the “relative” flag.
Prototype:
<void>setUpnodeWorld <boolean>upnode
Parameters:
<boolean>upnode
TRUE to set the world flag, otherwise false.
Remarks:
This method allows you to set the “World” flag.
Prototype:
<void>setTargetAxisFlip <boolean>staxflip
Parameters:
<boolean>staxflip
TRUE to set the source flip axis flag, otherwise FALSE.
Remarks:
This method allows you to set the “source” flip axis flag.
Prototype:
<void>setStoUPAxisFlip <boolean>ssuaflip
Parameters:
<boolean>ssuaflip
TRUE to set the selected axis flip flag, otherwise FALSE.
Remarks:
This method allows you to set the “selected” axis flip flag.
Prototype:
<void>setSetOrient <boolean>ssorient
460 Chapter 1 | What’s New in 3ds max 4 MAXScript
Parameters:
<boolean>ssorient
TRUE to set the orientation flag, otherwise FALSE.
Remarks:
This method allows you to set the orientation flag.
Prototype:
<void>setResetOrient()
Remarks:
Resets to zero the amount of orientation offset, effected through the “Set Orientation” feature.
Prototype:
<void>setTargetAxis <integer>staxis
Parameters:
<integer>staxis
(0) if TargetAxis coincides with the X axis of the source object. (1) if TargetAxis
coincides with the Y axis of the source object. (2) if TargetAxis coincides with the Z
axis of the source object
Remarks:
Sets the selection corresponding to the “Set Orientation” button in the UI. Specifies which of the
source axes is required to coincide with the target axis.
Prototype:
<void>setUpNodeAxis <integer>sunaxis
Parameters:
<integer>sunaxis
(0) if the upnode X axis coincides with a specified source axis. (1) if the upnode Y axis
coincides with a specified source axis. (2) if the upnode Z axis coincides with a
specified source axis.
Remarks:
Sets the selection corresponding to the “Source/Upnode Alignment: Aligned to UpNode Axis:”
radiobutton in the UI. Specifies which of the upnode axes is required to align with a specified source
axis.
Prototype:
<void>setStoUPAxis <integer>ssuaxis
Parameters:
<integer>ssuaxis
(0) if the source X axis coincides with a specified upnode axis. (1) if the source Y axis
coincides with a specified upnode axis. (2) if the source Z axis coincides with a
specified upnode axis.
LookAt_Constraint interfaces: 461
Remarks:
Sets the selection corresponding to the “Source/Upnode Alignment: Aligned to UpNode Axis:”
radiobutton in the UI. Specifies which of the source axes is required to align with a specified upnode
axis.
Prototype:
<boolean>GetVLisAbs()
Remarks:
Gets the ViewLine relative/absolute mode corresponding to the “Keep ViewLine Length Absolute”
checkbox in the UI. When Viewline Length is absolute, the “ViewLine Length” spinner sets the
length of the ViewLine. A negative length implies that starting from the source object the line travels
opposite to the direction of the target object. The source/target distance has no effect on the
ViewLine length in this mode. If the “Keep ViewLine Length Absolute” checkbox is unchecked, the
ViewLine length is determined from the spinner value, which is interpreted as a percentage of the
source/target distance.
Return Value:
TRUE if the ViewLine length is absolute, FALSE otherwise.
Prototype:
<void>SetVLisAbs <boolean>rel
Parameters:
<boolean>rel
TRUE if “Keep ViewLine Length Absolute” is active (checked), FALSE otherwise.
Remarks:
Sets the relative/absolute mode corresponding to the “Keep ViewLine Length Absolute” checkbox in
the UI.
Prototype:
<void>deleteTarget <integer>targetNumber
Parameters:
<integer>targetNumber
The zero based node number in the list of nodes the controller looks at.
Remarks:
This method allows you to delete a specified target.
See Also
In The MAXSDK Help File
Class ILookAtConstRotation
462 Chapter 1 | What’s New in 3ds max 4 MAXScript
Motion_Blur interfaces:
Motion_Blur interfaces:
Interface: ImageMotionBlur
Properties:
methods:
Actions:
Orientation_Constraint interfaces:
Orientation_Constraint interfaces:
Interface: constraints
Properties:
methods:
<node>getTarget <index>index
<boolean>setTarget <node>target <index>index
<float>getWeight <index>index <time>time
<boolean>setWeight <float>weight <index>index <time>time
<integer>getNumTargets()
<integer>getlw()
<void>appendWeightedTarget <node>target <float>weight
<void>deleteNode <integer>targetNumber
Actions:
path interfaces:
path interfaces:
This class represents the interface to the Path Position Controller.
Interface: constraints
Methods:
<integer>getNumTargets()
Remarks:
Returns the number of nodes in the path list.
Prototype:
<node>getTarget <index>index
Remarks:
Gets one of the path nodes that the path controller follows, specified by targetNumber.
Parameters:
<index>index
The node number in the path list to be obtained.
Prototype:
<boolean>setTarget <node>target <index>index
path interfaces: 463
Prototype:
<float>getWeight <index>index <time>time
Remarks:
Gets the weight of one of the path nodes that the path controller follows, specified by targetNumber,
and time t. If the targetNumber is not relevant then 0.0f is returned.
Parameters:
<index>index
The node number in the path list whose weight is to be obtained.
<time>time
Prototype:
<boolean>setWeight <float>weight <index>index <time>time
Remarks:
Sets the weight of one of the path nodes that the path controller follows, specified by targetNumber.
Parameters:
<float>weight
The weight to assign.
<index>index
The node number in the path list whose weight is to be set.
<time>time
Return Value:
TRUE if there is more than one path in the list and you are trying to set weight, FALSE otherwise.
Prototype:
<void>appendWeightedTarget <node>target <float>weight
Remarks:
Appends the current path list by one and appends the current weight list by one.
Parameters:
<node>target
The node that is to be appended to the current path list.
<float>weight
The weight to be assigned to the newly appended path.
Prototype:
<void>setFollow <boolean>isSetFollow
Remarks:
This method allows you to set the follow flag.
Parameters:
<boolean>isSetFollow
TRUE for on, FALSE for off.
464 Chapter 1 | What’s New in 3ds max 4 MAXScript
Prototype:
<boolean>getFollow()
Remarks:
This method returns the state of the follow flag. TRUE if on; FALSE if off.
Prototype:
<void>setBankAmount <float>bankAmount
Remarks:
Sets the bank amount parameter.
Bank and tracking are scaled in the UI.
Parameters:
<float>bankAmount
The bank amount.
Prototype:
<float>getBankAmount()
Remarks:
Returns the bank amount setting. See the remarks in SetBankAmount() above.
Prototype:
<void>SetBank <boolean>isSetBank
Remarks:
Sets the bank parameter to on or off.
Parameters:
<boolean>isSetBank
TRUE for on; FALSE for off.
Prototype:
<boolean>getBank()
Remarks:
Returns the on/off state of the bank parameter. TRUE if on; FALSE if off.
Prototype:
<void>setTracking <float>tracking
Remarks:
Sets the smoothness parameter.
Parameters:
<float>tracking
The smoothness setting.
Prototype:
<float>getTracking()
path interfaces: 465
Remarks:
Returns the smoothness setting. See remarks in SetTracking() above.
Prototype:
<void>setAllowFlip <boolean>allowFlip
Remarks:
Sets the state of the ‘Allow Upside Down’ parameter.
Parameters:
<boolean>allowFlip
TRUE for on; FALSE for off.
Prototype:
<boolean>getAllowFlip()
Remarks:
Returns the state of the ‘Allow Upside Down’ parameter.
Return Value:
TRUE for on; FALSE for off.
Prototype:
<void>setConstVel <boolean>constVel
Remarks:
Sets the state of the ‘Constant Velocity’ parameter.
Parameters:
<boolean>constVel
TRUE for on; FALSE for off.
Prototype:
<boolean>getConstVel()
Remarks:
Returns the state of the ‘Constant Velocity’ parameter.
Return Value:
TRUE for on; FALSE for off.
Prototype:
<void>setFlip <boolean>Flip
Remarks:
Sets the state of the ‘Flip’ parameter.
Parameters:
<boolean>Flip
TRUE for on; FALSE for off.
466 Chapter 1 | What’s New in 3ds max 4 MAXScript
Prototype:
<boolean>getFlip()
Remarks:
Returns the state of the ‘Flip’ parameter.
Return Value:
TRUE for on; FALSE for off.
Prototype:
<void>setAxis <integer>isSetFollow
Remarks:
Set the state of the axis parameter.
Parameters:
<integer>isSetFollow
The axis setting. One of the following values:
0: X axis.
1: Y axis.
2: Z axis.
Prototype:
<integer>getAxis()
Remarks:
Returns the axis setting.
Return Value:
One of the following values:
0: X axis.
1: Y axis.
2: Z axis.
Prototype:
<void>setLoop <boolean>Loop
Remarks:
This method allows you to set the state of the loop flag.
Parameters:
<boolean>Loop
TRUE for on; FALSE for off.
Prototype:
<boolean>getLoop()
Remarks:
Returns the state of the loop flag.
path interfaces: 467
Return Value:
TRUE for on; FALSE for off.
Prototype:
<void>setRelative <boolean>relative
Remarks:
This method allows you to set the state of the relative/absolute flag.
Parameters:
<boolean>relative
TRUE to set to relative; FALSE to set to absolute.
Prototype:
<boolean>getRelative()
Remarks:
Returns the state of the relative/absolute flag.
Return Value:
TRUE if relative is on; FALSE is off (i.e. absolute).
Prototype:
<void>deleteTarget <integer>targetNumber
Remarks:
This method allows you to delete a specified target.
Parameters:
<integer>targetNumber
The node number in the orientation target list to delete.
Return Value:
TRUE if successful, otherwise FALSE.
See Also
In The MAXSDK Help File
Class IPathPosition
468 Chapter 1 | What’s New in 3ds max 4 MAXScript
Path_Constraint interfaces:
Path_Constraint interfaces:
This class represents the interface to the Path Position Controller.
Interface: constraints
Properties:
Methods:
Prototype:
<integer>getNumTargets()
Prototype:
<node>getTarget <index>index
Parameters:
<index>index
The node number in the path list to be obtained.
Return Value:
Gets one of the path nodes that the path controller follows, specified by targetNumber.
Prototype:
<boolean>setTarget <node>target <index>index
Prototype:
<float>getWeight <index>index <time>time
Parameters:
<index>index
The node number in the path list whose weight is to be obtained.
<time>time
Return Value:
Gets the weight of one of the path nodes that the path controller follows, specified by targetNumber,
and time t. If the targetNumber is not relevant then 0.0f is returned.
Prototype:
<boolean>setWeight <float>weight <index>index <time>time
Remarks:
Sets the weight of one of the path nodes that the path controller follows, specified by targetNumber.
Parameters:
<index>index
The node number in the path list whose weight is to be set.
<float>weight
The weight to assign.
<time>time
Path_Constraint interfaces: 469
Return Value:
TRUE if there is more than one path in the list and you are trying to set weight, FALSE otherwise.
Prototype:
<void>appendWeightedTarget <node>target <float>weight
Remarks:
Appends the current path list by one and appends the current weight list by one.
Parameters:
<node>target
The node that is to be appended to the current path list.
<float>weight
The weight to be assigned to the newly appended path. Default: 50.0
Prototype:
<void>setFollow <boolean>isSetFollow
Remarks:
This method allows you to set the follow flag.
Parameters:
<boolean>isSetFollow
TRUE for on, FALSE for off.
Prototype:
<boolean>getFollow()
Return Value:
This method returns the state of the follow flag. TRUE if on; FALSE if off.
Prototype:
<void>setBankAmount <float>bankAmount
Remarks:
Sets the bank amount parameter.
Bank and tracking are scaled in the UI.
The bank values are scaled in the user interface. The following macros may be used to convert to and
from the UI values.
Parameters:
<float>bankAmount
The bank amount.
Prototype:
<float>getBankAmount()
Return Value:
Returns the bank amount setting. See the remarks in SetBankAmount() above.
470 Chapter 1 | What’s New in 3ds max 4 MAXScript
Prototype:
<void>SetBank <boolean>isSetBank
Remarks:
Sets the bank parameter to on or off.
Parameters:
<boolean>isSetBank
TRUE for on; FALSE for off.
Prototype:
<boolean>getBank()
Return Value:
Returns the on/off state of the bank parameter. TRUE if on; FALSE if off.
Prototype:
<void>setTracking <float>tracking
Remarks:
Sets the smoothness parameter.
The smoothing (tracking) values are scaled in the user interface. The following macros may be used
to convert to and from the UI values.
Parameters:
<float>tracking
The smoothness setting.
Prototype:
<float>getTracking()
Return Value:
Returns the smoothness setting. See remarks in SetTracking() above.
Prototype:
<void>setAllowFlip <boolean>allowFlip
Remarks:
Sets the state of the ‘Allow Upside Down’ parameter.
Parameters:
<boolean>allowFlip
TRUE for on; FALSE for off.
Prototype:
<boolean>getAllowFlip()
Remarks:
Returns the state of the ‘Allow Upside Down’ parameter.
Return Value:
TRUE for on; FALSE for off.
Path_Constraint interfaces: 471
Prototype:
<void>setConstVel <boolean>constVel
Remarks:
Sets the state of the ‘Constant Velocity’ parameter.
Parameters:
<boolean>constVel
TRUE for on; FALSE for off.
Prototype:
<boolean>getConstVel()
Remarks:
Returns the state of the ‘Constant Velocity’ parameter.
Return Value:
TRUE for on; FALSE for off.
Prototype:
<void>setFlip <boolean>Flip
Remarks:
Sets the state of the ‘Flip’ parameter.
Parameters:
<boolean>Flip
TRUE for on; FALSE for off.
Prototype:
<boolean>getFlip()
Remarks:
Returns the state of the ‘Flip’ parameter.
Return Value:
TRUE for on; FALSE for off.
Prototype:
<void>setAxis <integer>isSetFollow
Remarks:
Set the state of the axis parameter.
Parameters:
<integer>isSetFollow
The axis setting. One of the following values:
0: X axis.
1: Y axis.
2: Z axis.
472 Chapter 1 | What’s New in 3ds max 4 MAXScript
Prototype:
<integer>getAxis()
Remarks:
Returns the axis setting.
Return Value:
One of the following values:
0: X axis.
1: Y axis.
2: Z axis.
Prototype:
<void>setLoop <boolean>Loop
Remarks:
This method allows you to set the state of the loop flag.
Parameters:
<boolean>Loop
TRUE for on; FALSE for off.
Prototype:
<boolean>getLoop()
Remarks:
Returns the state of the loop flag.
Return Value:
TRUE for on; FALSE for off.
Prototype:
<void>setRelative <boolean>relative
Remarks:
This method allows you to set the state of the relative/absolute flag.
Parameters:
<boolean>relative
TRUE to set to relative; FALSE to set to absolute.
Prototype:
<boolean>getRelative()
Remarks:
Returns the state of the relative/absolute flag.
Return Value:
TRUE if relative is on; FALSE is off (i.e. absolute).
Plugin_Manager interfaces: 473
Prototype:
<void>deleteTarget <integer>targetNumber
Remarks:
This method allows you to delete a specified target.
Parameters:
<integer>targetNumber
The node number in the orientation target list to delete.
Return Value:
TRUE if successful, otherwise FALSE.
Plugin_Manager interfaces:
Plugin_Manager interfaces:
Interface: PluginMgrAction
Methods:
Prototypes:
<float>show() -- Action Interface
Actions:
Category: Plugin_Manager; Action: Plugin_Manager; Shortcut: -- none defined –
See Also
Plug-In Manager (p. 86)
Interface: pluginManager (p. 414)
Portable_Network_Graphics interfaces:
This represents the interface for the Bitmap IO PNG format.
Interface: ipngio
Methods:
Prototype:
<enum>getType()
getType enums: {#paletted|#true24|#true48|#gray8|#gray16}
Return Value:
This method returns the bitmap type, which is one of the following; BMM_PALETTED,
BMM_TRUE_24, BMM_TRUE_48, BMM_GRAY_8, or BMM_GRAY_16.
474 Chapter 1 | What’s New in 3ds max 4 MAXScript
Prototype:
<void>setType <enum>type type enums:
{#paletted|#true24|#true48|#gray8|#gray16}
Parameters:
<enum>type
One of the following; BMM_PALETTED, BMM_TRUE_24, BMM_TRUE_48,
BMM_GRAY_8, or BMM_GRAY_16.
Remarks:
This method allows you to set the bitmap type.
Prototype:
<boolean>getAlpha()
Return Value:
This method returns TRUE if the alpha flag is set, otherwise FALSE.
Prototype:
<void>setAlpha <boolean>useAlpha
Parameters:
<boolean>useAlpha
TRUE to set the alpha flag, otherwise FALSE.
Remarks:
This method allows you to set the alpha flag.
Prototype:
<boolean>getInterlaced()
Return Value:
This method returns TRUE if the interlaced flag is set, otherwise FALSE.
Prototype:
<void>setInterlaced <boolean>Interlaced
Parameters:
<boolean>Interlaced
TRUE to set the interlaced flag, otherwise FALSE.
Remarks:
This method allows you to set the interlaced flag.
See Also
In The MAXSDK Help File
Class IBitmapIO_Png
point3_list interfaces: 475
point3_list interfaces:
This class represents the interface to the list controller.
Interface: list
Properties:
.count : integer : Read
.active : index : Read|Write
Methods:
Prototype:
<integer>getCount()
Remarks:
This method returns the number of items that appear in the List controllers list box.
Prototype:
<void>setActive <index>listIndex
Parameters:
<index>listIndex
The index of the item to set as the active item.
Remarks:
This method allows you to sets the indexed item in the list active so its parameters appear in the
motion panel, and any input is directed to the indexed sub controller.
Prototype:
<integer>getActive()
Remarks:
This method returns the index of the currently active item.
Prototype:
<void>delete <index>listIndex
Parameters:
<index>listIndex
The index of the item to delete from the list.
Remarks:
This method allows you to delete the indexed sub controller from the list.
Prototype:
<void>cut <index>listIndex
Parameters:
<index>listIndex
The index of the item you wish to cut.
476 Chapter 1 | What’s New in 3ds max 4 MAXScript
Remarks:
This method allows you to cut the index sub controller from the list and stores it in the buffer to
paste later.
Prototype:
<void>paste <index>listIndex
Parameters:
<index>listIndex
The index of the slot to paste into.
Remarks:
This method allows you to paste the sub-controller from the buffer into the indexed slot in the list.
Prototype:
<TSTR by value>getName <index>listIndex
Parameters:
<index>listIndex
The index of the item for which to get the name.
Remarks:
This method allows you to paste the sub-controller from the buffer into the indexed slot in the list.
Prototype:
<void>setName <index>listIndex <string>name
Parameters:
<index>listIndex
The index of the item.
<string>name
The name to set it to.
Remarks:
This method allows you to set the name of an indexed item.
See Also
In the MAXSDK Help File
Class IListControl
Point3_Reactor interfaces: 477
Point3_Reactor interfaces:
Point3_Reactor interfaces:
Interface: reactions
Properties:
.editStateMode : boolean : Read|Write
.useCurve : boolean : Read|Write
methods:
<void>reactTo <maxObject>object
<boolean>create name:<string>
name default value: “scriptCreated”}
<boolean>delete <index>index
<integer>getCount()
<void>select <index>index
<index>getSelected()
<boolean>setStateToCurrent <index>index
<boolean>setFloatState <index>index <float>state
<boolean>setVectorState <index>index <point3>state
<boolean>setRotationState <index>index <quat>state
<boolean>setValueToCurrent <index>index
<boolean>setValueAsFloat <index>index <float>value
<boolean>setValueAsVector <index>index <point3>value
<boolean>setValueAsQuat <index>index <quat>value
<boolean>setInfluence <index>index <float>influence
<boolean>setStrength <index>index <float>strength
<boolean>setFalloff <index>index <float>influence
<void>setName <index>index <string>name
<string>getName <index>index
<float>getInfluence <index>index
<float>getStrength <index>index
<float>getFalloff <index>index
<enum>getType()
getType enums:
{#floatReaction|#positionalReaction|#rotationalReaction|#scaleReaction}
<fpvalue by value>getState <index>index
<fpvalue by value>getValue <index>index
Actions:
Point3_Wire interfaces:
Interface: wireController
Properties:
.numWires : integer : Read
This property returns the number of wires out of this controller (i.e. the number of
dependent params).
.isMaster : boolean : Read
This property will return TRUE if the wire is a master predicate, otherwise it will return
FALSE.
478 Chapter 1 | What’s New in 3ds max 4 MAXScript
Parameters:
<index>index
The index of the subanim.
Remarks:
This method returns the i-th dependent parameter subanim num in the animatable.
Return Value:
This method returns the i-th dependent parameter subanim num in the animatable.
Prototype:
<control>getCoController <index>index
Parameters:
<index>index
The index of the controller.
Return Value:
This method returns a pointer to the i-th CoController.
Prototype:
<string>getExprText <index>index
Parameters:
<index>index
The index of the parameter.
Point3List interfaces: 479
Return Value:
This method returns the expression string of the i-th wire parameter.
Prototype:
<void>setExprText <index>index <string>text
Parameters:
<index>index
The index of the parameter
<string>text
The expression you wish to set.
Remarks:
This method allows you to set the expression string of the i-th wire parameter.
See Also
In The MAXSDK Help File
Class IBaseWireControl
Point3List interfaces:
Point3List interfaces:
This class represents the interface to the list controller.
Interface: list
Properties:
.count : integer : Read
.active : index : Read|Write
Methods:
Prototype:
<integer>getCount()
Remarks:
This method returns the number of items that appear in the List controllers list box.
Prototype:
<void>setActive <index>listIndex
Remarks:
This method allows you to sets the indexed item in the list active so its parameters appear in the
motion panel, and any input is directed to the indexed sub controller.
Parameters:
<index>listIndex
The index of the item to set as the active item.
480 Chapter 1 | What’s New in 3ds max 4 MAXScript
Prototype:
<integer>getActive()
Remarks:
This method returns the index of the currently active item.
Prototype:
<void>delete <index>listIndex
Remarks:
This method allows you to delete the indexed sub controller from the list.
Parameters:
<index>listIndex
The index of the item to delete from the list.
Prototype:
<void>cut <index>listIndex
Remarks:
This method allows you to cut the index sub controller from the list and stores it in the buffer to
paste later.
Parameters:
<index>listIndex
The index of the item you wish to cut.
Prototype:
<void>paste <index>listIndex
Remarks:
This method allows you to paste the sub-controller from the buffer into the indexed slot in the list.
Parameters:
<index>listIndex
The index of the slot to paste into.
Prototype:
<TSTR by value>getName <index>listIndex
Remarks:
This method returns the class name of the indexed sub-controller if a user defined name doesn’t
exist.
Parameters:
<index>listIndex
The index of the item for which to get the name.
Prototype:
<void>setName <index>listIndex <string>name
Point3Reactor interfaces: 481
Remarks:
This method allows you to set the name of an indexed item.
Parameters:
<index>listIndex
The index of the item.
<string>name
The name to set it to.
See Also
In the MAXSDK Help File
Class IListControl
Point3Reactor interfaces:
Point3Reactor interfaces:
Interface: reactions
Properties:
.editStateMode : boolean : Read|Write
.useCurve : boolean : Read|Write
methods:
<void>reactTo <maxObject>object
<boolean>create name:<string>
name default value: “scriptCreated”}
<boolean>delete <index>index
<integer>getCount()
<void>select <index>index
<index>getSelected()
<boolean>setStateToCurrent <index>index
<boolean>setFloatState <index>index <float>state
<boolean>setVectorState <index>index <point3>state
<boolean>setRotationState <index>index <quat>state
<boolean>setValueToCurrent <index>index
<boolean>setValueAsFloat <index>index <float>value
<boolean>setValueAsVector <index>index <point3>value
<boolean>setValueAsQuat <index>index <quat>value
<boolean>setInfluence <index>index <float>influence
<boolean>setStrength <index>index <float>strength
<boolean>setFalloff <index>index <float>influence
<void>setName <index>index <string>name
<string>getName <index>index
<float>getInfluence <index>index
<float>getStrength <index>index
<float>getFalloff <index>index
<enum>getType()
getType enums:
{#floatReaction|#positionalReaction|#rotationalReaction|#scaleReaction}
<fpvalue by value>getState <index>index
482 Chapter 1 | What’s New in 3ds max 4 MAXScript
Point3Spring interfaces:
Interface: Spring
Properties:
Methods:
Prototype:
<float>getMass()
Return Value:
Returns the mass.
Prototype:
<void>setMass <float>mass
Parameters:
<float>mass
Remarks:
Sets the mass. The mass of the object to which the Spring controller is applied. Increasing the mass
causes the “bouncing” spring motion to become more exaggerated.
Prototype:
<float>getDrag()
Return Value:
Returns the drag.
Prototype:
<void>setDrag <float>drag
Parameters:
<float>drag
Remarks:
Sets the drag. Acts as air friction on the spring motion. A low Drag setting results in a greater
“bouncing” effect, while a high Drag results in subdued bouncing. Default=1. Range=0 to 10.
Prototype:
<float>getTension <index>springIndex
Parameters:
<index>springIndex
Return Value:
Gets the tension for the spring corresponding to the index.
Point3Spring interfaces: 483
Prototype:
<void>setTension <index>springIndex <float>tension
Parameters:
<index>springIndex
<float>tension
Remarks:
Sets the tension for the spring corresponding to the index. The “stiffness” of the virtual spring
between the controlled object and the highlighted spring object(s).
Prototype:
<float>getDampening <index>springIndex
Parameters:
<index>springIndex
Return Value:
Gets the dampening for the spring corresponding to the index.
Prototype:
<void>setDampening <index>springIndex <float>dampening
Parameters:
<index>springIndex
<float>dampening
Remarks:
Sets the dampening for the spring corresponding to the index. : Acts as a multiplier of an internal
factor that determines how quickly the object comes to rest. With the Self Influence spring,
changing Dampening has the same effect as changing Drag. With other springs, Dampening affects
only the movement caused by that spring. Internally, the dampening value is proportional to the
tension, so as you increase the tension and make the solution more stiff, the dampening is increased
to maintain system stability.
Prototype:
<boolean>addSpring <node>node
Parameters:
<node>node
Remarks:
Adds the node to the spring list.
Return Value:
Returns true if successful, false otherwise
Prototype:
<integer>getSpringCount()
484 Chapter 1 | What’s New in 3ds max 4 MAXScript
Return Value:
Returns the number of springs in the spring system.
Prototype:
<void>removeSpringByIndex <index>springIndex
Parameters:
<index>springIndex
Remarks:
Removes the spring corresponding to the index.
Prototype:
<void>removeSpring <node>node
Parameters:
<node>node
Remarks:
Removes the spring if the node is in the spring list.
See Also
PositionSpring interfaces: (p. 497)
Point3Spring interfaces: (p. 482)
SpringPoint3Controller interfaces: (p. 523)
SpringPoint3Controller - superclass: Point3Controller (p. 336)
SpringPositionController interfaces: (p. 526)
SpringPositionController - superclass: PositionController (p. 337)
Flex : Modifier (p. 1128)
Flex interfaces: (p. 438)
flexOps const StructDef (p. 235)
Point_Cache interfaces:
This represents the interface to the PointCache Modifier.
Interface: pointCache
Methods:
Prototype:
<void>record()
Remarks:
This method will press the Record button in the rollup interface.
Point_CacheSpacewarpModifier interfaces: 485
Prototype:
<void>setCache()
Remarks:
This method will press the Set Cache button in the rollup interface.
Prototype:
<void>enableMods()
Remarks:
This method will press the Enable Modifiers Below button in the rollup interface.
Prototype:
<void>disableMods()
Remarks:
This method will press the Disable Modifiers Below button in the rollup interface.
See Also
Point Cache Modifier (p. 26)
Point_Cache - superclass: modifier (p. 314)
Point_CacheSpacewarpModifier - superclass: SpacewarpModifier (p. 315)
Point_CacheSpacewarpModifier interfaces: (p. 485)
Point_CacheSpacewarpModifier interfaces:
This represents the interface to the PointCache Modifier.
Interface: pointCacheWSM
Methods:
Prototype:
<void>record()
Remarks:
This method will press the Record button in the rollup interface.
Prototype:
<void>setCache()
Remarks:
This method will press the Set Cache button in the rollup interface.
Prototype:
<void>enableMods()
486 Chapter 1 | What’s New in 3ds max 4 MAXScript
Remarks:
This method will press the Enable Modifiers Below button in the rollup interface.
Prototype:
<void>disableMods()
Remarks:
This method will press the Disable Modifiers Below button in the rollup interface.
See Also
Point Cache Modifier (p. 26)
Point_Cache interfaces: (p. 484)
Point_CacheSpacewarpModifier - superclass: SpacewarpModifier (p. 315)
Point_CacheSpacewarpModifier_interfaces_
PointCache interfaces:
This represents the interface to the PointCache Modifier.
Interface: pointCache
Methods:
Prototype:
<void>record()
Remarks:
This method will press the Record button in the rollup interface.
Prototype:
<void>setCache()
Remarks:
This method will press the Set Cache button in the rollup interface.
Prototype:
<void>enableMods()
Remarks:
This method will press the Enable Modifiers Below button in the rollup interface.
Prototype:
<void>disableMods()
Remarks:
This method will press the Disable Modifiers Below button in the rollup interface.
PointCacheWSM interfaces: 487
See Also
In The MAXSDK Help File
Class IpointCache
See Also
Point Cache Modifier (p. 26)
Point_Cache - superclass: modifier (p. 314)
Point_CacheSpacewarpModifier - superclass: SpacewarpModifier (p. 315)
Point_CacheSpacewarpModifier interfaces: (p. 485)
PointCacheWSM interfaces:
This represents the interface to the PointCache Modifier.
Interface: pointCacheWSM
Methods:
Prototype:
<void>record()
Remarks:
This method will press the Record button in the rollup interface.
Prototype:
<void>setCache()
Remarks:
This method will press the Set Cache button in the rollup interface.
Prototype:
<void>enableMods()
Remarks:
This method will press the Enable Modifiers Below button in the rollup interface.
Prototype:
<void>disableMods()
Remarks:
This method will press the Disable Modifiers Below button in the rollup interface.
See Also
In The MAXSDK Help File
Class IPointCacheWSM
488 Chapter 1 | What’s New in 3ds max 4 MAXScript
See Also
Point Cache Modifier (p. 26)
Point_Cache - superclass: modifier (p. 314)
Point_Cache interfaces: (p. 484)
Point_CacheSpacewarpModifier - superclass: SpacewarpModifier (p. 315)
Point_CacheSpacewarpModifier_interfaces_
Position_Constraint interfaces:
Position_Constraint interfaces:
This class represents the interface to the Position Constraint.
Interface: constraints
Methods:
Prototype:
<integer>getNumTargets()
Remarks:
Returns the number of target nodes in the position target list.
Prototype:
<node>getTarget <index>index
Remarks:
Gets one of the position nodes that the position constraint controller targets, specified by
targetNumber.
Parameters:
<index>index
The node number in the position target list to be obtained.
Prototype:
<boolean>setTarget <node>target <index>index
Prototype:
<float>getWeight <index>index <time>time
Remarks:
Gets the weight of one of the position nodes that the position constraint controller targets, specified
by targetNumber, and time t.
Parameters:
<index>index
The node number in the position target list to set.
<time>time
Position_Constraint interfaces: 489
Return Value:
Returns the position target weight if the targetNumber is relevant, 0.0f otherwise.
Prototype:
<boolean>setWeight <float>weight <index>index <time>time
Remarks:
Sets the weight of one of the position nodes that the position constraint controller follows, specified
by targetNumber, and time t.
Parameters:
<index>index
The node number in the position target list whose weight is to be set.
<float>weight
The weight to set.
<time>time
Return Value:
TRUE if there is more than one position target in the list and you are trying to set weight, FALSE
otherwise.
Prototype:
<boolean>appendTarget <node>target <float>weight
Remarks:
Appends the current position target list by one and appends.
Parameters:
<node>target
The node that is to be appended to the current position target list.
<float>weight
This is the weight that is to be assigned to the newly appended position target. The
default weight is 50.0.
Prototype:
<void>deleteTarget <integer>targetNumber
Remarks:
This method allows you to delete a specified target.
Parameters:
<integer>targetNumber
The node number in the position target list to delete.
Return Value:
TRUE if successful, otherwise FALSE.
490 Chapter 1 | What’s New in 3ds max 4 MAXScript
See Also
In The MAXSDK Help File
Class IPosConstPosition
position_list interfaces:
This class represents the interface to the list controller.
Interface: list
Properties:
.count : integer : Read
.active : index : Read|Write
Methods:
Prototype:
<integer>getCount()
Remarks:
This method returns the number of items that appear in the List controllers list box.
Prototype:
<void>setActive <index>listIndex
Remarks:
This method allows you to sets the indexed item in the list active so its parameters appear in the
motion panel, and any input is directed to the indexed sub controller.
Parameters:
<index>listIndex
The index of the item to set as the active item.
Prototype:
<integer>getActive()
Remarks:
This method returns the index of the currently active item.
Prototype:
<void>delete <index>listIndex
Parameters:
<index>listIndex
The index of the item to delete from the list.
Remarks:
This method allows you to delete the indexed sub controller from the list.
Prototype:
<void>cut <index>listIndex
position_list interfaces: 491
Parameters:
<index>listIndex
The index of the item you wish to cut.
Remarks:
This method allows you to cut the index sub controller from the list and stores it in the buffer to
paste later.
Prototype:
<void>paste <index>listIndex
Parameters:
<index>listIndex
The index of the slot to paste into.
Remarks:
This method allows you to paste the sub-controller from the buffer into the indexed slot in the list.
Prototype:
<TSTR by value>getName <index>listIndex
Parameters:
<index>listIndex
The index of the item for which to get the name.
Remarks:
This method returns the class name of the indexed sub-controller if a user defined name doesn’t
exist.
Prototype:
<void>setName <index>listIndex <string>name
Parameters:
<index>listIndex
The index of the item.
<string>name
The name to set it to.
Remarks:
This method returns the class name of the indexed sub-controller if a user defined name doesn’t
exist.
See Also
In the MAXSDK Help File
Class IListControl
492 Chapter 1 | What’s New in 3ds max 4 MAXScript
Position_Reactor interfaces:
Position_Reactor interfaces:
Interface: reactions
Properties:
.editStateMode : boolean : Read|Write
.useCurve : boolean : Read|Write
methods:
<void>reactTo <maxObject>object
<boolean>create name:<string>
name default value: “scriptCreated”}
<boolean>delete <index>index
<integer>getCount()
<void>select <index>index
<index>getSelected()
<boolean>setStateToCurrent <index>index
<boolean>setFloatState <index>index <float>state
<boolean>setVectorState <index>index <point3>state
<boolean>setRotationState <index>index <quat>state
<boolean>setValueToCurrent <index>index
<boolean>setValueAsFloat <index>index <float>value
<boolean>setValueAsVector <index>index <point3>value
<boolean>setValueAsQuat <index>index <quat>value
<boolean>setInfluence <index>index <float>influence
<boolean>setStrength <index>index <float>strength
<boolean>setFalloff <index>index <float>influence
<void>setName <index>index <string>name
<string>getName <index>index
<float>getInfluence <index>index
<float>getStrength <index>index
<float>getFalloff <index>index
<enum>getType()
getType enums:
{#floatReaction|#positionalReaction|#rotationalReaction|#scaleReaction}
<fpvalue by value>getState <index>index
<fpvalue by value>getValue <index>index
Actions:
Position_Wire interfaces:
This represents the interface for individual wire controllers.
Interface: wireController
Properties:
.numWires : integer : Read
This property returns the number of wires out of this controller (i.e. the number of
dependent params).
Position_Wire interfaces: 493
Prototype:
<string>getExprText <index>index
Parameters:
<index>index
The index of the parameter.
Return Value:
This method returns the expression string of the i-th wire parameter.
Prototype:
<void>setExprText <index>index <string>text
Remarks:
This method allows you to set the expression string of the i-th wire parameter.
Parameters:
<index>index
The index of the parameter
<string>text
The expression you wish to set.
See Also
In The MAXSDK Help File
Class IBaseWireControl
PositionList interfaces:
This class represents the interface to the list controller.
Interface: list
Properties:
.count : integer : Read
.active : index : Read|Write
Methods:
Prototype:
<integer>getCount()
Remarks:
This method returns the number of items that appear in the List controllers list box.
Prototype:
<void>setActive <index>listIndex
Remarks:
This method allows you to sets the indexed item in the list active so its parameters appear in the
motion panel, and any input is directed to the indexed sub controller.
PositionList interfaces: 495
Parameters:
<index>listIndex
The index of the item to set as the active item.
Prototype:
<integer>getActive()
Remarks:
This method returns the index of the currently active item.
Prototype:
<void>delete <index>listIndex
Remarks:
This method allows you to delete the indexed sub controller from the list.
Parameters:
<index>listIndex
The index of the item to delete from the list.
Prototype:
<void>cut <index>listIndex
Remarks:
This method allows you to cut the index sub controller from the list and stores it in the buffer to
paste later.
Parameters:
<index>listIndex
The index of the item you wish to cut.
Prototype:
<void>paste <index>listIndex
Remarks:
This method allows you to paste the sub-controller from the buffer into the indexed slot in the list.
Parameters:
<index>listIndex
The index of the slot to paste into.
Prototype:
<TSTR by value>getName <index>listIndex
Remarks:
This method returns the class name of the indexed sub-controller if a user defined name doesn’t
exist.
Parameters:
<index>listIndex
The index of the item for which to get the name.
496 Chapter 1 | What’s New in 3ds max 4 MAXScript
Prototype:
<void>setName <index>listIndex <string>name
Remarks:
This method allows you to set the name of an indexed item.
Parameters:
<index>listIndex
The index of the item.
<string>name
The name to set it to.
See Also
In the MAXSDK Help File
Class IListControl
PositionReactor interfaces:
PositionReactor interfaces:
Interface: reactions
Properties:
.editStateMode : boolean : Read|Write
.useCurve : boolean : Read|Write
methods:
<void>reactTo <maxObject>object
<boolean>create name:<string>
name default value: “scriptCreated”}
<boolean>delete <index>index
<integer>getCount()
<void>select <index>index
<index>getSelected()
<boolean>setStateToCurrent <index>index
<boolean>setFloatState <index>index <float>state
<boolean>setVectorState <index>index <point3>state
<boolean>setRotationState <index>index <quat>state
<boolean>setValueToCurrent <index>index
<boolean>setValueAsFloat <index>index <float>value
<boolean>setValueAsVector <index>index <point3>value
<boolean>setValueAsQuat <index>index <quat>value
<boolean>setInfluence <index>index <float>influence
<boolean>setStrength <index>index <float>strength
<boolean>setFalloff <index>index <float>influence
<void>setName <index>index <string>name
<string>getName <index>index
<float>getInfluence <index>index
<float>getStrength <index>index
<float>getFalloff <index>index
<enum>getType()
PositionSpring interfaces: 497
getType enums:
{#floatReaction|#positionalReaction|#rotationalReaction|#scaleReaction}
<fpvalue by value>getState <index>index
<fpvalue by value>getValue <index>index
Actions:
PositionSpring interfaces:
Interface: Spring
Properties:
Methods:
Prototype:
<float>getMass()
Return Value:
Returns the mass.
Prototype:
<void>setMass <float>mass
Parameters:
<float>mass
Remarks:
Sets the mass. The mass of the object to which the Spring controller is applied. Increasing the mass
causes the “bouncing” spring motion to become more exaggerated.
Prototype:
<float>getDrag()
Return Value:
Returns the drag.
Prototype:
<void>setDrag <float>drag
Parameters:
<float>drag
Remarks:
Sets the drag. Acts as air friction on the spring motion. A low Drag setting results in a greater
“bouncing” effect, while a high Drag results in subdued bouncing. Default=1. Range=0 to 10.
Prototype:
<float>getTension <index>springIndex
Parameters:
<index>springIndex
498 Chapter 1 | What’s New in 3ds max 4 MAXScript
Return Value:
Gets the tension for the spring corresponding to the index.
Prototype:
<void>setTension <index>springIndex <float>tension
Parameters:
<index>springIndex
<float>tension
Remarks:
Sets the tension for the spring corresponding to the index. The “stiffness” of the virtual spring
between the controlled object and the highlighted spring object(s).
Prototype:
<float>getDampening <index>springIndex
Parameters:
<index>springIndex
Return Value:
Gets the dampening for the spring corresponding to the index.
Prototype:
<void>setDampening <index>springIndex <float>dampening
Parameters:
<index>springIndex
<float>dampening
Remarks:
Sets the dampening for the spring corresponding to the index. : Acts as a multiplier of an internal
factor that determines how quickly the object comes to rest. With the Self Influence spring,
changing Dampening has the same effect as changing Drag. With other springs, Dampening affects
only the movement caused by that spring. Internally, the dampening value is proportional to the
tension, so as you increase the tension and make the solution more stiff, the dampening is increased
to maintain system stability.
Prototype:
<boolean>addSpring <node>node
Parameters:
<node>node
Remarks:
Adds the node to the spring list.
Return Value:
Returns true if successful, false otherwise
PositionSpring interfaces: 499
Prototype:
<integer>getSpringCount()
Return Value:
Returns the number of springs in the spring system.
Prototype:
<void>removeSpringByIndex <index>springIndex
Parameters:
<index>springIndex
Remarks:
Removes the spring corresponding to the index.
Prototype:
<void>removeSpring <node>node
Parameters:
<node>node
Remarks:
Removes the spring if the node is in the spring list.
See Also
PositionSpring interfaces: (p. 497)
Point3Spring interfaces: (p. 482)
SpringPoint3Controller interfaces: (p. 523)
SpringPoint3Controller - superclass: Point3Controller (p. 336)
SpringPositionController interfaces: (p. 526)
SpringPositionController - superclass: PositionController (p. 337)
Flex : Modifier (p. 1128)
Flex interfaces: (p. 438)
flexOps const StructDef (p. 235)
500 Chapter 1 | What’s New in 3ds max 4 MAXScript
radiusManip interfaces:
Interface: Manip
Properties:
.mouseState : enum : Read
mouseState enums: {#mouseIdle|#mouseDragging|#mouseOverManip}
Methods:
Prototype:
<void>clearGizmos()
Remarks:
This must be called at the beginning of the “updateGizmos” handler in order to clear the current
gizmo cache.
Prototype:
<void>addGizmoMesh <mesh>mesh <integer>flags <point3 by value>unselColor <point3 by
value>selColor
Parameters:
<mesh>mesh
<integer>flags
gizmoDontDisplay
Tells the system to not display the gizmo. It will be hit-tested, but not displayed.
gizmoDontHitTest
Tells the system to not hit-test the gizmo. It will be displayed, but not hit-tested.
gizmoActiveViewportOnly
Tells the system to only display and hit-test this gizmo in the active viewport.
<point3 by value>unselColor
<point3 by value>selColor
Remarks:
This creates a gizmo from a mesh (or geometry in MAX lingo). The mesh can be any arbitrary MAX
mesh, and created with the tools in MAXScript for creating meshes. One convenient way to do this
is to create an instance of a primitive and get the mesh from it.
The flags can be 0, or one or more of these values. If you want more than one flag to apply, then you
add the values together.
Prototype:
<void>addGizmoShape <Interface>gizmo <integer>flags <point3 by value>unselColor
<point3 by value>selColor
Parameters:
<Interface>gizmo
<integer>flags
gizmoDontDisplay
Tells the system to not display the gizmo. It will be hit-tested, but not displayed.
radiusManip interfaces: 501
gizmoDontHitTest
Tells the system to not hit-test the gizmo. It will be displayed, but not hit-tested.
gizmoActiveViewportOnly
Tells the system to only display and hit-test this gizmo in the active viewport.
gizmoUseScreenSpace
This tells the system to interpret the coordinates of the shape as device
coordinates in the viewport, not as 3d values. The values are still specified as 3d
points, but the “Z” coordinate is ignored.
gizmoUseRelativeScreenSpace
This is like gizmoUseScreenSpace, but the coordinates are specified as values from
0.0 to 1.0, and interpreted in each viewport as a percentage of the width or height
of the viewport.
<point3 by value>unselColor
<point3 by value>selColor
Remarks:
This creates a gizmo from a shape object. The gizmoShape can be created using functions from the
“manip” package, described below.
The flags can be 0, or one or more of these values. If you want more than one flag to apply, then you
add the values together.
Prototype:
<void>addGizmoMarker <enum>marker <point3 by value>position <integer>flags <point3 by
value>unselColor <point3 by value>selColor
marker enums:
{#point|#hollowBox|#plusSign|#asterisk|#xMarker|#bigBox|#circle|#triangle|#diamond
|#smallHollowBox|#smallCircle|#smallTriangle|#smallDiamond|#dot|#smallDot}
Parameters:
<enum>marker
<point3 by value>position
The position is a point in 3d space, or 2d screen space.
<integer>flags
gizmoDontDisplay
Tells the system to not display the gizmo. It will be hit-tested, but not displayed.
gizmoDontHitTest
Tells the system to not hit-test the gizmo. It will be displayed, but not hit-tested.
gizmoActiveViewportOnly
Tells the system to only display and hit-test this gizmo in the active viewport.
gizmoUseScreenSpace
This tells the system to interpret the coordinates of the shape as device
coordinates in the viewport, not as 3d values. The values are still specified as 3d
points, but the “Z” coordinate is ignored.
502 Chapter 1 | What’s New in 3ds max 4 MAXScript
gizmoUseRelativeScreenSpace
This is like gizmoUseScreenSpace, but the coordinates are specified as values from
0.0 to 1.0, and interpreted in each viewport as a percentage of the width or height
of the viewport.
<point3 by value>unselColor
<point3 by value>selColor
Remarks:
The position is a point in 3d space, or 2d screen space.
Prototype:
<void>addGizmoText <string>text <point3 by value>position <integer>flags <point3 by
value>unselColor <point3 by value>selColor
Parameters:
<string>text
<point3 by value>position
<integer>flags
<point3 by value>unselColor
<point3 by value>selColor
Remarks:
This creates a gizmo that is text on the screen. Note that text cannot be hit-tested or grabbed by the
mouse. It is used for display purposes only.
Prototype:
<ray by value>getLocalViewRay <point2 by value>m
Parameters:
<point2 by value>m
Return Value:
This function takes a mouse position and returns the ray that passes through that mouse position
in the direction of the view. It is returned in the local coordinates of the node that owns the
manipulator target.
Prototype:
<void>updateGizmos <time>t <&TSTR>toolTip
Remarks:
Parameters:
<time>t
<&TSTR>toolTip
RenderElementMgr interfaces: 503
RenderElementMgr interfaces:
Interface: RenderElementMgr
Prototype:
<boolean>AddRenderElement <maxObject>element
Parameters:
<maxObject>element
Remarks:
Adds a specific element.
Return Value:
Returns TRUE if Successful, FALSE otherwise
Prototype:
<boolean>RemoveRenderElement <maxObject>element
Parameters:
<maxObject>element
Remarks:
Removes a specific element.
Return Value:
Returns true is successful and false otherwise.
Prototype:
<void>RemoveAllRenderElements()
Remarks:
Removes all elements in the list.
Prototype:
<integer>NumRenderElements()
Return Value:
Returns number of elements in list
Prototype:
<maxObject>GetRenderElement <integer>index
Parameters:
<integer>index
Return Value:
Returns a specific element, index is 0 based.
Prototype:
<void>SetElementsActive <boolean>active
Parameters:
<boolean>active
504 Chapter 1 | What’s New in 3ds max 4 MAXScript
Remarks:
Sets a boolean indicating elements are active, ie. will be created during a render.
Prototype:
<boolean>GetElementsActive()
Return Value:
Gets a boolean indicating elements are active, ie. will be created during a render.
Prototype:
<void>SetDisplayElements <boolean>display
Parameters:
<boolean>display
Remarks:
Sets boolean indicating elements will be displayed after they are created.
Prototype:
<boolean>GetDisplayElements()
Return Value:
Gets boolean indicating elements will be displayed after they are created.
Prototype:
<void>SetCombustionOutputEnabled <boolean>enabled
Parameters:
<boolean>enabled
Remarks:
Enables or disables output to combustion .cws file.
Prototype:
<boolean>GetCombustionOutputEnabled()
Return Value:
Gets boolean indicating enabled output to combustion .cws file.
Prototype:
<void>SetCombustionOutputPath <string>pathname
Parameters:
<string>pathname
Remarks:
Sets the filename of the .cws file.
Prototype:
<string>GetCombustionOutputPath()
Return Value:
Gets the filename of the .cws file.
rotation_list interfaces: 505
Example:
-- set a list of render elements.
elementlist =
#(specular,diffuse,self_illumination,reflection,refraction,shadowrenderelement,atm
osphere,blend,z_depth,alpha,colored_shadow,backgroundrenderelement)
re = maxOps.GetCurRenderElementMgr() -- get the current render element manager
re.removeallrenderelements() -- remove all renderelements
re.numrenderelements() -- get number of render elements
prod = maxOps.GetRenderElementMgr #Production
draft = maxOps.GetRenderElementMgr #Draft
prod.numrenderelements()
draft.numrenderelements()
-- adds all renderelements to be rendered.
for n in elementlist do
(
re.addrenderelement (n elementname:(”foo_” + (n as string)))
format “\nAdded % renderelement” n
)
rendoutputfilename = “c:\\test.tga”
rendsavefile = true
setsilentmode true -- used to avoid error message when checking the filename of
element
-- get all render elements set and return name of render element and output
filename
for n = 0 to (prod.numrenderelements()- 1) do
(
el = re.getrenderelement n
format “\nGetting % render element” el.elementname
format “\nRender element outputfilename: %” el.bitmap.filename
--el.filename
)
See Also
maxOps (p. 87)
rotation_list interfaces:
This represents the interface to the list controller.
Interface: list
Properties:
.count : integer : Read
.active : index : Read|Write
Methods:
Prototype:
<integer>getCount()
506 Chapter 1 | What’s New in 3ds max 4 MAXScript
Remarks:
This method returns the number of items that appear in the List controllers list box.
Prototype:
<void>setActive <index>listIndex
Remarks:
This method allows you to sets the indexed item in the list active so its parameters appear in the
motion panel, and any input is directed to the indexed sub controller.
Parameters:
<index>listIndex
The index of the item to set as the active item.
Prototype:
<integer>getActive()
Remarks:
This method returns the index of the currently active item.
Prototype:
<void>delete <index>listIndex
Remarks:
This method allows you to delete the indexed sub controller from the list.
Parameters:
<index>listIndex
The index of the item to delete from the list.
Prototype:
<void>cut <index>listIndex
Remarks:
This method allows you to cut the index sub controller from the list and stores it in the buffer to
paste later.
Parameters:
<index>listIndex
The index of the item you wish to cut.
Prototype:
<void>paste <index>listIndex
Remarks:
This method allows you to paste the sub-controller from the buffer into the indexed slot in the list.
Parameters:
<index>listIndex
The index of the slot to paste into.
Rotation_Reactor interfaces: 507
Prototype:
<TSTR by value>getName <index>listIndex
Remarks:
This method returns the class name of the indexed sub-controller if a user defined name doesn’t
exist.
Parameters:
<index>listIndex
The index of the item for which to get the name.
Prototype:
<void>setName <index>listIndex <string>name
Remarks:
This method allows you to set the name of an indexed item.
Parameters:
<index>listIndex
The index of the item.
<string>name
The name to set it to.
See Also
In the MAXSDK Help File
Class IListControl
Rotation_Reactor interfaces:
Rotation_Reactor interfaces:
Interface: reactions
Properties:
.editStateMode : boolean : Read|Write
.useCurve : boolean : Read|Write
Methods:
<void>reactTo <maxObject>object
<boolean>create name:<string>
name default value: “scriptCreated”}
<boolean>delete <index>index
<integer>getCount()
<void>select <index>index
<index>getSelected()
<boolean>setStateToCurrent <index>index
<boolean>setFloatState <index>index <float>state
<boolean>setVectorState <index>index <point3>state
<boolean>setRotationState <index>index <quat>state
<boolean>setValueToCurrent <index>index
<boolean>setValueAsFloat <index>index <float>value
<boolean>setValueAsVector <index>index <point3>value
508 Chapter 1 | What’s New in 3ds max 4 MAXScript
Rotation_Wire interfaces:
This represents the interface for individual wire controllers.
Interface: wireController
Properties:
.numWires : integer : Read
This property returns the number of wires out of this controller (i.e. the number of
dependent params).
.isMaster : boolean : Read
This property will return TRUE if the wire is a master predicate, otherwise it will return
FALSE.
.isSlave : boolean : Read
This method will return TRUE if the wire is a slave predicate, otherwise it will return
FALSE.
.isTwoWay : boolean : Read
This method will return TRUE if the wire is a two-way predicate, otherwise it will return
FALSE.
.slaveAnimation : control : Read|Write
This method returns a pointer to the slave animation controller.
This method allows you to set the slave animation controller.
Prototype:
<maxObject>getWireParent <index>index
Parameters:
<index>index
The index you wish to retrieve.
Return Value:
This method returns a pointer to the i-th dependent parameter parent.
Rotation_Wire interfaces: 509
Prototype:
<integer>getWireSubnum <index>index
Remarks:
This method returns the i-th dependent parameter subanim num in the animatable.
Parameters:
<index>index
The index of the subanim.
Return Value:
This method returns the i-th dependent parameter subanim num in the animatable.
Prototype:
<control>getCoController <index>index
Parameters:
<index>index
The index of the controller.
Return Value:
This method returns a pointer to the i-th CoController.
Prototype:
<string>getExprText <index>index
Parameters:
<index>index
The index of the parameter.
Return Value:
This method returns the expression string of the i-th wire parameter.
Prototype:
<void>setExprText <index>index <string>text
Remarks:
This method allows you to set the expression string of the i-th wire parameter.
Parameters:
<index>index
The index of the parameter
<string>text
The expression you wish to set.
See Also
In The MAXSDK Help File
Class IBaseWireControl
510 Chapter 1 | What’s New in 3ds max 4 MAXScript
RotationList interfaces:
This class represents the interface to the list controller.
Interface: list
Properties:
.count : integer : Read
.active : index : Read|Write
Methods:
Prototype:
<integer>getCount()
Remarks:
This method returns the number of items that appear in the List controllers list box.
Prototype:
<void>setActive <index>listIndex
Remarks:
This method allows you to sets the indexed item in the list active so its parameters appear in the
motion panel, and any input is directed to the indexed sub controller.
Parameters:
<index>listIndex
The index of the item to set as the active item.
Prototype:
<integer>getActive()
Remarks:
This method returns the index of the currently active item.
Prototype:
<void>delete <index>listIndex
Remarks:
This method allows you to delete the indexed sub controller from the list.
Parameters:
<index>listIndex
The index of the item to delete from the list.
Prototype:
<void>cut <index>listIndex
Remarks:
This method allows you to cut the index sub controller from the list and stores it in the buffer to
paste later.
RotationList interfaces: 511
Parameters:
<index>listIndex
The index of the item you wish to cut.
Prototype:
<void>paste <index>listIndex
Remarks:
This method allows you to paste the sub-controller from the buffer into the indexed slot in the list.
Parameters:
<index>listIndex
The index of the slot to paste into.
Prototype:
<TSTR by value>getName <index>listIndex
Remarks:
This method returns the class name of the indexed sub-controller if a user defined name doesn’t
exist.
Parameters:
<index>listIndex
The index of the item for which to get the name.
Prototype:
<void>setName <index>listIndex <string>name
Remarks:
This method allows you to set the name of an indexed item.
Parameters:
<index>listIndex
The index of the item.
<string>name
The name to set it to.
See Also
In the MAXSDK Help File
Class IListControl
512 Chapter 1 | What’s New in 3ds max 4 MAXScript
RotationReactor interfaces:
RotationReactor interfaces:
Interface: reactions
Properties:
.editStateMode : boolean : Read|Write
.useCurve : boolean : Read|Write
methods:
<void>reactTo <maxObject>object
<boolean>create name:<string>
name default value: “scriptCreated”}
<boolean>delete <index>index
<integer>getCount()
<void>select <index>index
<index>getSelected()
<boolean>setStateToCurrent <index>index
<boolean>setFloatState <index>index <float>state
<boolean>setVectorState <index>index <point3>state
<boolean>setRotationState <index>index <quat>state
<boolean>setValueToCurrent <index>index
<boolean>setValueAsFloat <index>index <float>value
<boolean>setValueAsVector <index>index <point3>value
<boolean>setValueAsQuat <index>index <quat>value
<boolean>setInfluence <index>index <float>influence
<boolean>setStrength <index>index <float>strength
<boolean>setFalloff <index>index <float>influence
<void>setName <index>index <string>name
<string>getName <index>index
<float>getInfluence <index>index
<float>getStrength <index>index
<float>getFalloff <index>index
<enum>getType()
getType enums:
{#floatReaction|#positionalReaction|#rotationalReaction|#scaleReaction}
<fpvalue by value>getState <index>index
<fpvalue by value>getValue <index>index
Actions:
scale_list interfaces: 513
scale_list interfaces:
This class represents the interface to the list controller.
Interface: list
Properties:
.count : integer : Read
.active : index : Read|Write
Methods:
Prototype:
<integer>getCount()
Remarks:
This method returns the number of items that appear in the List controllers list box.
Prototype:
<void>setActive <index>listIndex
Remarks:
This method allows you to sets the indexed item in the list active so its parameters appear in the
motion panel, and any input is directed to the indexed sub controller.
Parameters:
<index>listIndex
The index of the item to set as the active item.
Prototype:
<integer>getActive()
Remarks:
This method returns the index of the currently active item.
Prototype:
<void>delete <index>listIndex
Remarks:
This method allows you to delete the indexed sub controller from the list.
Parameters:
<index>listIndex
The index of the item to delete from the list.
Prototype:
<void>cut <index>listIndex
Remarks:
This method allows you to cut the index sub controller from the list and stores it in the buffer to
paste later.
514 Chapter 1 | What’s New in 3ds max 4 MAXScript
Parameters:
<index>listIndex
The index of the item you wish to cut.
Prototype:
<void>paste <index>listIndex
Remarks:
This method allows you to paste the sub-controller from the buffer into the indexed slot in the list.
Parameters:
<index>listIndex
The index of the slot to paste into.
Prototype:
<TSTR by value>getName <index>listIndex
Remarks:
This method returns the class name of the indexed sub-controller if a user defined name doesn’t
exist.
Parameters:
<index>listIndex
The index of the item for which to get the name.
Prototype:
<void>setName <index>listIndex <string>name
Remarks:
This method allows you to set the name of an indexed item.
Parameters:
<index>listIndex
The index of the item.
<string>name
The name to set it to.
See Also
In the MAXSDK Help File
Class IListControl
Scale_Reactor interfaces: 515
Scale_Reactor interfaces:
Scale_Reactor interfaces:
Interface: reactions
Properties:
.editStateMode : boolean : Read|Write
.useCurve : boolean : Read|Write
methods:
<void>reactTo <maxObject>object
<boolean>create name:<string>
name default value: “scriptCreated”}
<boolean>delete <index>index
<integer>getCount()
<void>select <index>index
<index>getSelected()
<boolean>setStateToCurrent <index>index
<boolean>setFloatState <index>index <float>state
<boolean>setVectorState <index>index <point3>state
<boolean>setRotationState <index>index <quat>state
<boolean>setValueToCurrent <index>index
<boolean>setValueAsFloat <index>index <float>value
<boolean>setValueAsVector <index>index <point3>value
<boolean>setValueAsQuat <index>index <quat>value
<boolean>setInfluence <index>index <float>influence
<boolean>setStrength <index>index <float>strength
<boolean>setFalloff <index>index <float>influence
<void>setName <index>index <string>name
<string>getName <index>index
<float>getInfluence <index>index
<float>getStrength <index>index
<float>getFalloff <index>index
<enum>getType()
getType enums:
{#floatReaction|#positionalReaction|#rotationalReaction|#scaleReaction}
<fpvalue by value>getState <index>index
<fpvalue by value>getValue <index>index
Actions:
Scale_Wire interfaces:
This represents the interface for individual wire controllers.
Interface: wireController
Properties:
.numWires : integer : Read
This property returns the number of wires out of this controller (i.e. the number of
dependent params).
516 Chapter 1 | What’s New in 3ds max 4 MAXScript
Prototype:
<string>getExprText <index>index
Parameters:
<index>index
The index of the parameter.
Return Value:
This method returns the expression string of the i-th wire parameter.
Prototype:
<void>setExprText <index>index <string>text
Remarks:
This method allows you to set the expression string of the i-th wire parameter.
Parameters:
<index>index
The index of the parameter
<string>text
The expression you wish to set.
See Also
In The MAXSDK Help File
Class IBaseWireControl
ScaleList interfaces:
This class represents the interface to the list controller.
Interface: list
Properties:
.count : integer : Read
.active : index : Read|Write
Methods:
Prototype:
<integer>getCount()
Remarks:
This method returns the number of items that appear in the List controllers list box.
Prototype:
<void>setActive <index>listIndex
Remarks:
This method allows you to sets the indexed item in the list active so its parameters appear in the
motion panel, and any input is directed to the indexed sub controller.
518 Chapter 1 | What’s New in 3ds max 4 MAXScript
Parameters:
<index>listIndex
The index of the item to set as the active item.
Prototype:
<integer>getActive()
Remarks:
This method returns the index of the currently active item.
Prototype:
<void>delete <index>listIndex
Remarks:
This method allows you to delete the indexed sub controller from the list.
Parameters:
<index>listIndex
The index of the item to delete from the list.
Prototype:
<void>cut <index>listIndex
Remarks:
This method allows you to cut the index sub controller from the list and stores it in the buffer to
paste later.
Parameters:
<index>listIndex
The index of the item you wish to cut.
Prototype:
<void>paste <index>listIndex
Remarks:
This method allows you to paste the sub-controller from the buffer into the indexed slot in the list.
Parameters:
<index>listIndex
The index of the slot to paste into.
Prototype:
<TSTR by value>getName <index>listIndex
Remarks:
This method returns the class name of the indexed sub-controller if a user defined name doesn’t
exist.
Parameters:
<index>listIndex
The index of the item for which to get the name.
ScaleReactor interfaces: 519
Prototype:
<void>setName <index>listIndex <string>name
Remarks:
This method allows you to set the name of an indexed item.
Parameters:
<index>listIndex
The index of the item.
<string>name
The name to set it to.
See Also
In the MAXSDK Help File
Class IListControl
ScaleReactor interfaces:
ScaleReactor interfaces:
Interface: reactions
Properties:
.editStateMode : boolean : Read|Write
.useCurve : boolean : Read|Write
methods:
<void>reactTo <maxObject>object
<boolean>create name:<string>
name default value: “scriptCreated”}
<boolean>delete <index>index
<integer>getCount()
<void>select <index>index
<index>getSelected()
<boolean>setStateToCurrent <index>index
<boolean>setFloatState <index>index <float>state
<boolean>setVectorState <index>index <point3>state
<boolean>setRotationState <index>index <quat>state
<boolean>setValueToCurrent <index>index
<boolean>setValueAsFloat <index>index <float>value
<boolean>setValueAsVector <index>index <point3>value
<boolean>setValueAsQuat <index>index <quat>value
<boolean>setInfluence <index>index <float>influence
<boolean>setStrength <index>index <float>strength
<boolean>setFalloff <index>index <float>influence
<void>setName <index>index <string>name
<string>getName <index>index
<float>getInfluence <index>index
<float>getStrength <index>index
<float>getFalloff <index>index
<enum>getType()
520 Chapter 1 | What’s New in 3ds max 4 MAXScript
getType enums:
{#floatReaction|#positionalReaction|#rotationalReaction|#scaleReaction}
<fpvalue by value>getState <index>index
<fpvalue by value>getValue <index>index
Actions:
sliderManipulator interfaces:
Interface: Manip
Scripted Manipulators (p. 97)
Properties:
.mouseState : enum : Read
mouseState enums: {#mouseIdle|#mouseDragging|#mouseOverManip}
Methods:
Prototype:
<void>clearGizmos()
Remarks:
This must be called at the beginning of the “updateGizmos” handler in order to clear the current
gizmo cache.
Prototype:
<void>addGizmoMesh <mesh>mesh <integer>flags <point3 by value>unselColor <point3 by
value>selColor
Parameters:
<mesh>mesh
<integer>flags
gizmoDontDisplay
Tells the system to not display the gizmo. It will be hit-tested, but not displayed.
gizmoDontHitTest
Tells the system to not hit-test the gizmo. It will be displayed, but not hit-tested.
gizmoActiveViewportOnly
Tells the system to only display and hit-test this gizmo in the active viewport.
<point3 by value>unselColor
<point3 by value>selColor
Remarks:
This creates a gizmo from a mesh (or geometry in MAX lingo). The mesh can be any arbitrary MAX
mesh, and created with the tools in MAXScript for creating meshes. One convenient way to do this
is to create an instance of a primitive and get the mesh from it.
The flags can be 0, or one or more of these value. If you want more than one flag to apply, then you
add the values together.
sliderManipulator interfaces: 521
Prototype:
<void>addGizmoShape <Interface>gizmo <integer>flags <point3 by value>unselColor
<point3 by value>selColor
Parameters:
<Interface>gizmo
<integer>flags
gizmoDontDisplay
Tells the system to not display the gizmo. It will be hit-tested, but not displayed.
gizmoDontHitTest
Tells the system to not hit-test the gizmo. It will be displayed, but not hit-tested.
gizmoActiveViewportOnly
Tells the system to only display and hit-test this gizmo in the active viewport.
gizmoUseScreenSpace
This tells the system to interpret the coordinates of the shape as device
coordinates in the viewport, not as 3d values. The values are still specified as 3d
points, but the “Z” coordinate is ignored.
gizmoUseRelativeScreenSpace
This is like gizmoUseScreenSpace, but the coordinates are specified as values from
0.0 to 1.0, and interpreted in each viewport as a percentage of the width or height
of the viewport.
<point3 by value>unselColor
<point3 by value>selColor
Remarks:
This creates a gizmo from a shape object. The gizmoShape can be created using functions from the
“manip” package, described below.
Prototype:
<void>addGizmoMarker <enum>marker <point3 by value>position <integer>flags <point3 by
value>unselColor <point3 by value>selColor
marker enums:
{#point|#hollowBox|#plusSign|#asterisk|#xMarker|#bigBox|#circle|#triangle|#diamond
|#smallHollowBox|#smallCircle|#smallTriangle|#smallDiamond|#dot|#smallDot}
Parameters:
<enum>marker
<point3 by value>position
The position is a point in 3d space, or 2d screen space.
<integer>flags
gizmoDontDisplay
Tells the system to not display the gizmo. It will be hit-tested, but not displayed.
gizmoDontHitTest
Tells the system to not hit-test the gizmo. It will be displayed, but not hit-tested.
gizmoActiveViewportOnly
Tells the system to only display and hit-test this gizmo in the active viewport.
522 Chapter 1 | What’s New in 3ds max 4 MAXScript
gizmoUseScreenSpace
This tells the system to interpret the coordinates of the shape as device
coordinates in the viewport, not as 3d values. The values are still specified as 3d
points, but the “Z” coordinate is ignored.
gizmoUseRelativeScreenSpace
This is like gizmoUseScreenSpace, but the coordinates are specified as values from
0.0 to 1.0, and interpreted in each viewport as a percentage of the width or height
of the viewport.
<point3 by value>unselColor
<point3 by value>selColor
Remarks:
The position is a point in 3d space, or 2d screen space. The flags are the same ones supported by
addGizmoShape.
Prototype:
<void>addGizmoText <string>text <point3 by value>position <integer>flags <point3 by
value>unselColor <point3 by value>selColor
Parameters:
<string>text
<point3 by value>position
<integer>flags
<point3 by value>unselColor
<point3 by value>selColor
Remarks:
This creates a gizmo that is text on the screen. Note that text cannot be hit-tested or grabbed by the
mouse. It is used for display purposes only.
Prototype:
<ray by value>getLocalViewRay <point2 by value>m
Parameters:
<point2 by value>m
Return Value:
This function takes a mouse position and returns the ray that passes through that mouse position
in the direction of the view. It is returned in the local coordinates of the node that owns the
manipulator target.
Prototype:
<void>updateGizmos <time>t <&TSTR>toolTip
Remarks:
Parameters:
<time>t
<&TSTR>toolTip
SpringPoint3Controller interfaces: 523
See Also
Scripted Manipulators (p. 97)
Interface: manip (p. 366)
radiusManip interfaces: (p. 500)
ConeAngleManip - superclass: helper (p. 277)
PlaneAngleManip - superclass: helper (p. 311)
Scripted Plug-ins (p. 1538)
sliderManipulator - superclass: helper (p. 333)
sliderManipulator interfaces: (p. 520)
uvwMappingHeightManip interfaces: (p. 551)
uvwMappingLengthManip interfaces: (p. 555)
uvwMappingUTileManip interfaces: (p. 558)
uvwMappingVTileManip interfaces: (p. 562)
uvwMappingWidthManip interfaces: (p. 565)
SpringPoint3Controller interfaces:
Interface: Spring
Properties:
Methods:
Prototype:
<float>getMass()
Return Value:
Returns the mass.
Prototype:
<void>setMass <float>mass
Parameters:
<float>mass
Remarks:
Sets the mass. The mass of the object to which the Spring controller is applied. Increasing the mass
causes the “bouncing” spring motion to become more exaggerated.
Prototype:
<float>getDrag()
Return Value:
Returns the drag.
524 Chapter 1 | What’s New in 3ds max 4 MAXScript
Prototype:
<void>setDrag <float>drag
Parameters:
<float>drag
Remarks:
Sets the drag. Acts as air friction on the spring motion. A low Drag setting results in a greater
“bouncing” effect, while a high Drag results in subdued bouncing. Default=1. Range=0 to 10.
Prototype:
<float>getTension <index>springIndex
Parameters:
<index>springIndex
Return Value:
Gets the tension for the spring corresponding to the index.
Prototype:
<void>setTension <index>springIndex <float>tension
Parameters:
<index>springIndex
<float>tension
Remarks:
Sets the tension for the spring corresponding to the index. The “stiffness” of the virtual spring
between the controlled object and the highlighted spring object(s).
Prototype:
<float>getDampening <index>springIndex
Parameters:
<index>springIndex
Return Value:
Gets the dampening for the spring corresponding to the index.
Prototype:
<void>setDampening <index>springIndex <float>dampening
Parameters:
<index>springIndex
<float>dampening
Remarks:
Sets the dampening for the spring corresponding to the index. : Acts as a multiplier of an internal
factor that determines how quickly the object comes to rest. With the Self Influence spring,
SpringPoint3Controller interfaces: 525
changing Dampening has the same effect as changing Drag. With other springs, Dampening affects
only the movement caused by that spring. Internally, the dampening value is proportional to the
tension, so as you increase the tension and make the solution more stiff, the dampening is increased
to maintain system stability.
Prototype:
<boolean>addSpring <node>node
Parameters:
<node>node
Remarks:
Adds the node to the spring list.
Return Value:
Returns true if successful, false otherwise
Prototype:
<integer>getSpringCount()
Return Value:
Returns the number of springs in the spring system.
Prototype:
<void>removeSpringByIndex <index>springIndex
Parameters:
<index>springIndex
Remarks:
Removes the spring corresponding to the index.
Prototype:
<void>removeSpring <node>node
Parameters:
<node>node
Remarks:
Removes the spring if the node is in the spring list.
See Also
PositionSpring interfaces: (p. 497)
Point3Spring interfaces: (p. 482)
SpringPoint3Controller interfaces: (p. 523)
SpringPoint3Controller - superclass: Point3Controller (p. 336)
SpringPositionController interfaces: (p. 526)
526 Chapter 1 | What’s New in 3ds max 4 MAXScript
SpringPositionController interfaces:
Interface: Spring
Properties:
Methods:
Prototype:
<float>getMass()
Return Value:
Returns the mass.
Prototype:
<void>setMass <float>mass
Parameters:
<float>mass
Remarks:
Sets the mass. The mass of the object to which the Spring controller is applied. Increasing the mass
causes the “bouncing” spring motion to become more exaggerated.
Prototype:
<float>getDrag()
Return Value:
Returns the drag.
Prototype:
<void>setDrag <float>drag
Parameters:
<float>drag
Remarks:
Sets the drag. Acts as air friction on the spring motion. A low Drag setting results in a greater
“bouncing” effect, while a high Drag results in subdued bouncing. Default=1. Range=0 to 10.
Prototype:
<float>getTension <index>springIndex
SpringPositionController interfaces: 527
Parameters:
<index>springIndex
Return Value:
Gets the tension for the spring corresponding to the index.
Prototype:
<void>setTension <index>springIndex <float>tension
Parameters:
<index>springIndex
<float>tension
Remarks:
Sets the tension for the spring corresponding to the index. The “stiffness” of the virtual spring
between the controlled object and the highlighted spring object(s).
Prototype:
<float>getDampening <index>springIndex
Parameters:
<index>springIndex
Return Value:
Gets the dampening for the spring corresponding to the index.
Prototype:
<void>setDampening <index>springIndex <float>dampening
Parameters:
<index>springIndex
<float>dampening
Remarks:
Sets the dampening for the spring corresponding to the index. : Acts as a multiplier of an internal
factor that determines how quickly the object comes to rest. With the Self Influence spring,
changing Dampening has the same effect as changing Drag. With other springs, Dampening affects
only the movement caused by that spring. Internally, the dampening value is proportional to the
tension, so as you increase the tension and make the solution more stiff, the dampening is increased
to maintain system stability.
Prototype:
<boolean>addSpring <node>node
Parameters:
<node>node
Remarks:
Adds the node to the spring list.
528 Chapter 1 | What’s New in 3ds max 4 MAXScript
Return Value:
Returns true if successful, false otherwise
Prototype:
<integer>getSpringCount()
Return Value:
Returns the number of springs in the spring system.
Prototype:
<void>removeSpringByIndex <index>springIndex
Parameters:
<index>springIndex
Remarks:
Removes the spring corresponding to the index.
Prototype:
<void>removeSpring <node>node
Parameters:
<node>node
Remarks:
Removes the spring if the node is in the spring list.
See Also
PositionSpring interfaces: (p. 497)
Point3Spring interfaces: (p. 482)
SpringPoint3Controller interfaces: (p. 523)
SpringPoint3Controller - superclass: Point3Controller (p. 336)
SpringPositionController interfaces: (p. 526)
SpringPositionController - superclass: PositionController (p. 337)
Flex : Modifier (p. 1128)
Flex interfaces: (p. 438)
flexOps const StructDef (p. 235)
Targa interfaces: 529
Targa interfaces:
This class represents the interface for the Bitmap IO TGA format.
Interface: itgaio
Methods:
Prototype:
<integer>getColorDepth()
Return Value:
This method returns the color depth, which would be 16, 24, or 32.
Prototype:
<void>setColorDepth <integer>colorDepth
Remarks:
This method allows you to set the color depth.
Parameters:
<integer>colorDepth
The color depth, being either 16, 24, or 32.
Prototype:
<boolean>getCompressed()
Return Value:
This method returns TRUE if the compression flag is set, otherwise FALSE.
Prototype:
<void>setCompressed <boolean>compression
Remarks:
This method allows you to set the compression flag.
Parameters:
<boolean>compression
TRUE to set the compression flag, otherwise FALSE.
Prototype:
<boolean>getAlphaSplit()
Return Value:
This method returns TRUE if the alpha split flag is set, otherwise FALSE.
Prototype:
<void>setAlphaSplit <boolean>alphaSplit
Remarks:
This method allows you to set the alpha split flag.
530 Chapter 1 | What’s New in 3ds max 4 MAXScript
Parameters:
<boolean>alphaSplit
TRUE to set the alpha split flag, otherwise FALSE.
Prototype:
<boolean>getPreMultAlpha()
Return Value:
This method returns TRUE if the premultiplied alpha flag is set, otherwise FALSE.
Prototype:
<void>setPreMultAlpha <boolean>preMultAlpha
Remarks:
This method allows you to set the premultiplied alpha flag.
Parameters:
<boolean>preMultAlpha
TRUE to set the premultiplied alpha flag, otherwise FALSE.
See Also
In The MAXSDK Help File
Class IBitmapIO_Tga
Unwrap_UVW interfaces:
This class represents the interface to the UVW Unwrap Modifier.
Interface: unwrap
Methods:
Prototype:
<void>planarMap()
Remarks:
This method will press the Planar Map button in the rollup interface.
Prototype:
<void>save()
Remarks:
This method will press the Save button in the rollup interface.
Prototype:
<void>load()
Remarks:
This method will press the Load button in the rollup interface.
Unwrap_UVW interfaces: 531
Prototype:
<void>reset()
Remarks:
This method will press the Reset button in the rollup interface.
Prototype:
<void>edit()
Remarks:
This method will press the Edit button in the rollup interface.
Prototype:
<void>setMapChannel <integer>mapChannel
Remarks:
This method will set the Map Channel field value in the rollup.
Parameters:
<integer>mapChannel
The Map Channel you want to set to.
Prototype:
<integer>getMapChannel()
Return Value:
This method will return the Map Channel field in the rollup.
Prototype:
<void>setProjectionType <integer>mapChannel
Parameters:
<integer>mapChannel
The mapping type:
1 for X aligned
2 for Y aligned
3 for Z aligned
4 for normal aligned.
Remarks:
This method will set the mapping type.
Prototype:
<integer>getProjectionType()
Return Value:
This method will return the mapping type; 1 for X aligned, 2 for Y aligned, 3 for Z aligned, 4 for
normal aligned.
Prototype:
<void>setVC <boolean>vertexColor
532 Chapter 1 | What’s New in 3ds max 4 MAXScript
Remarks:
This method will set the Vertex Color Channel radio button in the rollup interface.
Parameters:
<boolean>vertexColor
TRUE to enable; FALSE to disable.
Prototype:
<boolean>getVC()
Return Value:
This method returns the current state of the Vertex Color Channel radio button in the rollup
interface.
Prototype:
<void>move()
Remarks:
This method will press the Move button in the edit floater.
Prototype:
<void>moveh()
Remarks:
This method will press the Move Horizontal button in the edit floater.
Prototype:
<void>movev()
Remarks:
This method will press the Move Vertical button in the edit floater.
Prototype:
<void>rotate()
Remarks:
This method will press the Rotate button in the edit floater.
Prototype:
<void>scale()
Remarks:
This method will press the Scale button in the edit floater.
Prototype:
<void>scaleh()
Remarks:
This method will press the Scale Horizontal button in the edit floater.
Prototype:
<void>scalev()
Unwrap_UVW interfaces: 533
Remarks:
This method will press the Scale Vertical button in the edit floater.
Prototype:
<void>mirrorH()
Remarks:
This method will press the Mirror Horizontal button in the edit floater.
Prototype:
<void>mirrorV()
Remarks:
This method will press the Mirror Vertical button in the edit floater.
Prototype:
<void>expandSelection()
Remarks:
This method will press the Expand Selection button in the edit floater.
Prototype:
<void>contractSelection()
Remarks:
This method will press the Contract Selection button in the edit floater.
Prototype:
<void>setFalloffType <integer>falloffType
Remarks:
This method will set the Falloff type.
Parameters:
<integer>falloffType
The falloff type; 1 for linear, 2 for sinual, 3 for fast, and 4 for slow.
Prototype:
<integer>getFalloffType()
Return Value:
This method will return the falloff type; 1 for linear, 2 for sinual, 3 for fast, and 4 for slow.
Prototype:
<void>setFalloffSpace <integer>falloffSpace
534 Chapter 1 | What’s New in 3ds max 4 MAXScript
Remarks:
This method will set the space you want the falloff to be computed in.
Parameters:
<integer>falloffSpace
The falloff space; 1 for XY, the local space of the object, 2 for UV, the UVW space of
the object.
Prototype:
<integer>getFalloffSpace()
Return Value:
This method will return the falloff space; 1 for XY, the local space of the object, 2 for UV, the UVW
space of the object.
Prototype:
<void>setFalloffDist <float>falloffDist
Remarks:
This method will set the falloff distance in the edit floater.
Parameters:
<float>falloffDist
The falloff distance.
Prototype:
<float>getFalloffDist()
Return Value:
This method will return the falloff distance.
Prototype:
<void>breakSelected()
Remarks:
This method will press the Break Selected button in the edit floater.
Prototype:
<void>weld()
Remarks:
This method will press the Target Weld button in the edit floater.
Prototype:
<void>weldSelected()
Remarks:
This method will press the Weld Selected button in the edit floater.
Prototype:
<void>updateMap()
Unwrap_UVW interfaces: 535
Remarks:
This method will press the Update Map button in the edit floater.
Prototype:
<void>DisplayMap <boolean>displayMap
Remarks:
This method sets the state of the Display Map button in the edit floater
Parameters:
<boolean>displayMap
TRUE to toggle the Display Map button on; FALSE to toggle it off.
Prototype:
<boolean>IsMapDisplayed()
Return Value:
This method returns the state of the Display Map button in the edit floater. TRUE if it’s on; FALSE if
it’s off.
Prototype:
<void>setUVSpace <integer>UVSpace
Remarks:
This method sets the space that you want to view the texture vertices in.
Parameters:
<integer>UVSpace
The texture space; 1 for UV, 2 for VW, 3 for UW.
Prototype:
<integer>getUVSpace()
Return Value:
This method returns the space that the texture vertices are viewed in; 1 for UV, 2 for VW, 3 for UW.
Prototype:
<void>options()
Remarks:
This method will press the Options button in the edit floater.
Prototype:
<void>lock()
Remarks:
This method will toggle the Lock Selected Vertices button in the edit floater.
Prototype:
<void>hide()
536 Chapter 1 | What’s New in 3ds max 4 MAXScript
Remarks:
This method will press the Hide button in the edit floater.
Prototype:
<void>unhide()
Remarks:
This method will press the Unhide button in the edit floater.
Prototype:
<void>freeze()
Remarks:
This method will press the Freeze button in the edit floater.
Prototype:
<void>unfreeze()
Remarks:
This method will press the Unfreeze button in the edit floater.
Prototype:
<void>filterselected()
Remarks:
This method will press the Filter Selected Faces button in the edit floater.
Prototype:
<void>pan()
Remarks:
This method will press the Pan button in the edit floater.
Prototype:
<void>zoom()
Remarks:
This method will press the Zoom button in the edit floater.
Prototype:
<void>zoomRegion()
Remarks:
This method will press the Zoom Region button in the edit floater.
Prototype:
<void>fit()
Remarks:
This method will press the Fit button in the edit floater.
Unwrap_UVW interfaces: 537
Prototype:
<void>fitselected()
Remarks:
This method will press the Fit Selected button in the edit floater.
Prototype:
<void>snap()
Remarks:
This method will press the Snap button in the edit floater.
Prototype:
<integer>getCurrentMap()
Return Value:
This method returns the index into the map drop down list of the current map in the view of the
edit floater.
Prototype:
<void>setCurrentMap <integer>map
Remarks:
This method sets the currently displayed map to the specified map index.
Parameters:
<integer>map
The index of the map in the drop down list to display.
Prototype:
<integer>numberMaps()
Return Value:
This method returns the number of maps in the map drop down list.
Prototype:
<point3>getLineColor()
Return Value:
This method returns the color of the lines used to connect the texture vertices edges as a Point3
pointer.
Prototype:
<void>setLineColor <point3>color
Remarks:
This method sets the line color of the texture vertices.
Parameters:
<point3>color
The color as a Point3.
538 Chapter 1 | What’s New in 3ds max 4 MAXScript
Prototype:
<point3>getSelectionColor()
Return Value:
This method returns the texture vertices selection color as Point3.
Prototype:
<void>setSelectionColor <point3>color
Remarks:
This method sets the color of selected texture vertices.
Parameters:
<point3>color
The color as a Point3.
Prototype:
<integer>getRenderWidth()
Return Value:
This method returns the width of the bitmap used to render 2d/3d textures to and if the Use Bitmap
Resolution bitmaps is not set the width used to render bitmap.
Prototype:
<void>setRenderWidth <integer>width
Remarks:
This method sets the width of the bitmap used to render to for display.
Parameters:
<integer>width
The width in pixels.
Prototype:
<integer>getRenderHeight()
Return Value:
This method returns the height of the bitmap used to render 2d/3d textures to and if the Use Bitmap
Resolution bitmaps is not set the height used to render bitmap.
Prototype:
<void>setRenderHeight <integer>height
Remarks:
This method sets the width of the bitmap used to render to for display.
Parameters:
<integer>height
The height in pixels.
Prototype:
<boolean>getUseBitmapRes()
Unwrap_UVW interfaces: 539
Return Value:
This method returns the state of the Use Bitmap Resolution, if false the bitmaps are rendered using
the RenderWidth/Height values.
Prototype:
<void>setUseBitmapRes <boolean>useRes
Remarks:
This method sets the state of the Use Bitmap Resolution value. If it is false the bitmaps are rendered
using the RenderWidth/Height values.
Parameters:
<boolean>useRes
TRUE to toggle on; FALSE to toggle off.
Prototype:
<float>getWeldThreshold()
Return Value:
This method returns the weld threshold.
Prototype:
<void>setWeldThreshold <float>height
Remarks:
This method sets the threshold values for welds.
Parameters:
<float>height
The welding threshold/
Prototype:
<boolean>getConstantUpdate()
Return Value:
This method returns the state of the Constant Update value which when set true forces the veiwport
to be updated on every move, otherwise it is just updated on mouse up.
Prototype:
<void>setConstantUpdate <boolean>update
Remarks:
This method Sets the state of the Constant Update value which when set true forces the viewport to
be updated on every move, otherwise it is just updated on mouse up.
Parameters:
<boolean>update
TRUE to toggle on; FALSE to toggle off.
Prototype:
<boolean>getShowSelectedVertices()
540 Chapter 1 | What’s New in 3ds max 4 MAXScript
Return Value:
This method returns whether the selected texture vertices are also displayed in the view port.
Prototype:
<void>setShowSelectedVertices <boolean>show
Remarks:
This method sets whether the selected texture vertices are also displayed in the view port.
Parameters:
<boolean>show
TRUE to toggle on; FALSE to toggle off.
Prototype:
<boolean>getMidPixelSnap()
Return Value:
This method returns whether the mid pixels snap is used, if it is false the snap is set to the bottom
right corner of the pixel, else it snaps to the center of the pixel.
Prototype:
<void>setMidPixelSnap <boolean>snap
Remarks:
This method sets whether the mid pixels snap is used, if it is false the snap is set to the bottom right
corner of the pixel, else it snaps to the center of the pixel.
Parameters:
<boolean>snap
TRUE to toggle on; FALSE to toggle off.
Prototype:
<integer>getMatID()
Return Value:
This method returns the current material id index filter.
Prototype:
<void>setMatID <integer>matid
Remarks:
This method sets the material drop list to the index supplied.
Parameters:
<integer>matid
The material ID index to set.
Prototype:
<integer>numberMatIDs()
Return Value:
This method returns the number of material ids in the material id filter drop down.
Unwrap_UVW interfaces: 541
Prototype:
<bitArray>getSelectedVertices()
Return Value:
This method returns the current selected texture vertices in the edit floater as a bit array.
Prototype:
<void>selectVertices <bitArray>selection
Remarks:
This method selects texture vertices in the edit floater dialog.
Parameters:
<bitArray>selection
The selection set as a bit array.
Prototype:
<boolean>isVertexSelected <integer>index
Parameters:
<integer>index
The index of the vertex to check.
Return Value:
This method returns whether a texture vertex is selected.
Prototype:
<void>MoveSelectedVertices <point3>offset
Remarks:
This method moves the selected texture vertices by the offset.
Parameters:
<point3>offset
The offset by which you want to move the vertices.
Prototype:
<void>RotateSelectedVerticesCenter <float>angle
Remarks:
This method rotates the selected vertices around their center point.
Parameters:
<float>angle
The angle in radians that you want to rotate the selection by.
Prototype:
<void>RotateSelectedVertices <float>angle <point3>axis
542 Chapter 1 | What’s New in 3ds max 4 MAXScript
Remarks:
This method rotates the selected vertices around a specified point.
Parameters:
<float>angle
The angle in radians that you want to rotate the selection by.
<point3>axis
The axis that you want to rotate the selected vertices by. This is in the space of the
window.
Prototype:
<void>ScaleSelectedVerticesCenter <float>scale <integer>dir
Remarks:
This method scales the selected points around their center.
Parameters:
<float>scale
The amount that you want to scale by
<integer>dir
The direction; 1 for uniform scaling, 2 for X, and 3 for Y.
Prototype:
<void>ScaleSelectedVertices <float>scale <integer>dir <point3>axis
Remarks:
This method scales the selected points around a specified point.
Parameters:
<float>scale
The amount that you want to scale by
<integer>dir
The direction; 1 for uniform scaling, 2 for X, and 3 for Y.
<point3>axis
The axis that you want to scale the selected vertices by. This is in the space of the
window.
Prototype:
<point3>GetVertexPosition <time>time <integer>index
Parameters:
<time>time
The time at which you want to get the vertex.
<integer>index
The index of the vertex.
Return Value:
This method returns the position of the vertex.
Unwrap_UVW interfaces: 543
Prototype:
<integer>numberVertices()
Return Value:
This method returns the number of texture vertices
Prototype:
<void>moveX <float>p
Remarks:
This method sets the selected vertices x values in absolute coordinates.
Parameters:
<float>p
The absolute position along the x axis
Prototype:
<void>moveY <float>p
Remarks:
This method sets the selected vertices y values in absolute coordinates.
Parameters:
<float>p
The absolute position along the y axis
Prototype:
<void>moveZ <float>p
Remarks:
This method sets the selected vertices z values in absolute coordinates.
Parameters:
<float>p
The absolute position along the s axis
Prototype:
<bitArray>getSelectedPolygons()
Return Value:
This method returns the selected polygons in the view port as a bit array.
Prototype:
<void>selectPolygons <bitArray>selection
Remarks:
This method selects the polygons in the view ports.
Parameters:
<bitArray>selection
The polygons you wish to select.
544 Chapter 1 | What’s New in 3ds max 4 MAXScript
Prototype:
<boolean>isPolygonSelected <integer>index
Parameters:
<integer>index
The index of the polygon to check.
Return Value:
This method returns whether a polygon is selected or not.
Prototype:
<integer>numberPolygons()
Return Value:
This method returns the number of polygons in the object.
Prototype:
<void>detachEdgeVertices()
Remarks:
This method detaches any vertex that is not completely surrounded by selected vertices. This is
similar to a polygon selection detach except it uses the vertex selection to determine what is
detached.
Prototype:
<void>flipHorizontal()
Remarks:
This method will press the Flip Horizontal button in the edit floater.
Prototype:
<void>flipVertical()
Remarks:
This method will press the Flip Vertical button in the edit floater.
Prototype:
<boolean>getLockAspect()
Remarks:
This method returns whether the edit window aspect ratio is locked or not, if the aspect ratio is not
locked the image will try stretch to fit the aspect ratio of the window.
Return Value:
TRUE if locked; FALSE if unlocked.
Prototype:
<void>setLockAspect <boolean>aspect
Unwrap_UVW interfaces: 545
Remarks:
This method sets the Lock Aspect Ratio value
Parameters:
<boolean>aspect
TRUE to lock; FALSE to unlock.
Prototype:
<float>getMapScale()
Return Value:
This method returns the scaling factor when the user applies a planar map. The smaller the value
the more planar map is scaled down.
Prototype:
<void>setMapScale <float>scale
Remarks:
This method sets the scaling factor when the user applies a planar map. The smaller the value the
more planar map is scaled down
Parameters:
<float>scale
The scaling factor for planar map.
Prototype:
<void>getSelectionFromFace()
Remarks:
This method takes the current polygon selection and uses it to select the texture vertices that are
associated with it.
Prototype:
<void>forceUpdate <boolean>update
Remarks:
This method sets a flag to determines how Unwrap will behave when a topology change occurs. If
update is TRUE the mapping gets reset, otherwise unwrap skips mapping the object if it has a
different topology. It is sometimes useful to turn this off if you have MeshSmooth or other topology
changing modifiers below Unwrap that have different topologies when rendering.
Parameters:
<boolean>update
This determines whether the mapping is reset on topology change. TRUE to update,
otherwise FALSE.
Prototype:
<void>zoomToGizmo <boolean>all
546 Chapter 1 | What’s New in 3ds max 4 MAXScript
Remarks:
This method zooms the selected or all the viewports to zoom to the current planar map gizmo.
Parameters:
<boolean>all
This determines whether the active or all the viewports get zoomed. TRUE to zoom all
viewports, FALSE to view the active viewport.
Prototype:
<void>setVertexPosition <time>time <integer>index <point3>pos
Remarks:
This method sets the position of a UVW vertex at a specific time.
Parameters:
<time>time
The time at what you want to set the position.
<integer>index
The index of the vertex.
<point3>pos
The position of the vertex in UVW space.
Prototype:
<void>markAsDead <integer>index
Remarks:
This method marks a vertex that it is dead, and no longer in use. Vertices are not actually deleted
they are just marked and recycled when needed. That means when a vertex is added vertices marked
as dead will be the first ones checked. If there are no dead vertices, the vertex is appended to the end
of the list. Using this function carefully since marking a vertex as dead that is actually in use will
cause strange results.
Parameters:
<integer>index
The index of the vertex to mark as dead.
Prototype:
<integer>numberPointsInFace <integer>index
Parameters:
<integer>index
The index of the face to inspect.
Return Value:
This method retrieves the numbers of vertices that a face contains. A face can contain 3 to N number
of points depending on what type of topology Unwrap is working on. For Tri Meshes this is always
3, for patches this can be 3 or 4, and for polygons this can be 3 or greater. Unwrap abstracts all three
object types into one generic format.
Unwrap_UVW interfaces: 547
Prototype:
<integer>getVertexIndexFromFace <integer>faceIndex <integer>ithVertex
Parameters:
<integer>faceIndex
The index of the face to inspect.
<integer>ithVertex
The I-th vertex of that you want to retrieve. This value should range from 1 to the
number of vertices that the face contains.
Prototype:
<integer>getHandleIndexFromFace <integer>faceIndex <integer>ithVertex
Parameters:
<integer>faceIndex <integer>ithVertex
The index of the face to inspect.
<integer>ithVertex
The I-th handle of that you want to retrieve. This value should range from 1 to the
number of vertices*2 that the face contains.
Return Value:
This method retrieves the index of a handle, from a face. A face contains 0 to N number of handles.
So to retrieve a particular handle index, you give it the face index and the I-th handle that you want
to inspect. So if you wanted to look at the 3 handle on face 1 you would call
GetHandleIndexFromFace(1,3). This only applies for patch meshes.
Prototype:
<integer>getInteriorIndexFromFace <integer>faceIndex <integer>ithVertex
Parameters:
<integer>faceIndex
The index of the face to inspect.
<integer>ithVertex
The I-th interior handle of that you want to retrieve. This value should range from 1
to the number of vertices that the face contains.
Return Value:
This method retrieves the index of a interior handle, from a face. A face contains 0 to N number of
interior handles. So to retrieve a particular interior handle index, you give it the face index and the
I-th interior handle that you want to inspect. So if you wanted to look at the 3 interior handle on
face 1 you would call GetInteriorIndexFromFace(1,3). This only applies for patch meshes.
548 Chapter 1 | What’s New in 3ds max 4 MAXScript
Prototype:
<integer>getVertexGeomIndexFromFace <integer>faceIndex <integer>ithVertex
Parameters:
<integer>faceIndex
The index of the face to inspect.
<integer>ithVertex
The I-th vertex of that you want to retrieve. This value should range from 1 to the
number of vertices that the face contains.
Return Value:
This method retrieves the index of a geometric vertex, from a face. This the vertex that is attached
to the mesh and not the texture faces. A face contains 0 to N number of vertices. So to retrieve a
particular vertex index, you give it the face index and the I-th vertex that you want to inspect. So if
you wanted to look at the 3 vertex on face 1 you would call GetVertexGeomIndexFromFace(1,3).
Prototype:
<integer>getHandleGeomIndexFromFace <integer>faceIndex <integer>ithVertex
Parameters:
<integer>faceIndex
The index of the face to inspect.
<integer>ithVertex
The I-th handle of that you want to retrieve. This value should range from 1 to the
number of vertices*2 that the face contains.
Return Value:
This method retrieves the index of a geometric handle from a patch. This the handle that is attached
to the patch and not the texture faces. A face contains 0 to N number of handle. So to retrieve a
particular handle index, you give it the face index and the I-th handle that you want to inspect. So
if you wanted to look at the 3 handle on face 1 you would call GetHandleGeomIndexFromFace(1,3).
Prototype:
<integer>getInteriorGeomIndexFromFace <integer>faceIndex <integer>ithVertex
Parameters:
<integer>faceIndex
The index of the face to inspect.
<integer>ithVertex
The I-th interior handle of that you want to retrieve. This value should range from 1
to the number of vertices that the face contains.
Return Value:
This method retrieves the index of a geometric interior handle from a patch. This the interior handle
that is attached to the patch and not the texture faces. A face contains 0 to N number of interior
handle. So to retrieve a particular interior handle index, you give it the face index and the I-th
Unwrap_UVW interfaces: 549
interior handle that you want to inspect. So if you wanted to look at the 3 interior handle on face 1
you would call GetInteriorGeomIndexFromFace(1,3).
Prototype:
<void>setFaceVertex <point3>pos <integer>faceIndex <integer>ithVertex <boolean>sel
Remarks:
This method allows you to manipulate the position of vertex attached to a face. Basically it
detaches the vertex if multiple faces share that vertex and then moves it to the position
specified. So if you want to move the 3rd vertex of face 1 to .5,.5,.0 you would do setFaceVertex
[.5 .5 .0] 1 3. If you don’t want the vertex broken use SetVertexSPosition.
Parameters:
<point3>pos
The position that you want to move a vertex to.
<integer>faceIndex
The index of the face that you wish to work on.
<integer>ithVertex
The ith vertex of the face that you want to change
<boolean>sel
Whether or not to select the vertex after it is recreated
Prototype:
<void>setFaceHandle <point3>pos <integer>faceIndex <integer>ithVertex <boolean>sel
Remarks:
This method is identical to SetFaceVertex except works on patch handles.
Parameters:
<point3>pos
The position that you want to move a vertex to.
<integer>faceIndex
The index of the face that you wish to work on.
<integer>ithVertex
The ith vertex of the face that you want to change
<boolean>sel
Whether or not to select the vertex after it is recreated
Prototype:
<void>setFaceInterior <point3>pos <integer>faceIndex <integer>ithVertex
<boolean>sel
Remarks:
This method is identical to SetFaceVertex except works on patch interior handles.
Parameters:
<point3>pos
The position that you want to move a vertex to.
550 Chapter 1 | What’s New in 3ds max 4 MAXScript
<integer>faceIndex
The index of the face that you wish to work on.
<integer>ithVertex
The ith vertex of the face that you want to change
<boolean>sel
Whether or not to select the vertex after it is recreated
Prototype:
<void>setFaceVertexIndex <integer>faceIndex <integer>ithVertex
<integer>vertexIndex
Remarks:
This method allows you to set the index of the ith vertex of a face.
Parameters:
<integer>faceIndex
The index of the face that you wish to work on.
<integer>ithVertex
The ith vertex of the face that you want to manipulate.
<integer>vertexIndex
The index into the vertex list that you want to set to
Prototype:
<void>setFaceHandleIndex <integer>faceIndex <integer>ithVertex
<integer>vertexIndex
Remarks:
This method is identical to setFaceVertexIndex but works on handles for patches.
Parameters:
<integer>faceIndex
The index of the face that you wish to work on.
<integer>ithVertex
The ith vertex of the face that you want to manipulate.
<integer>vertexIndex
The index into the vertex list that you want to set to
Prototype:
<void>setFaceInteriorIndex <integer>faceIndex <integer>ithVertex
<integer>vertexIndex
Remarks:
This method is identical to setFaceVertexIndex but works on interior handles for patches.
Parameters:
<integer>faceIndex
The index of the face that you wish to work on.
<integer>ithVertex
The ith vertex of the face that you want to manipulate.
uvwMappingHeightManip interfaces: 551
<integer>vertexIndex
The index into the vertex list that you want to set to
Prototype:
<void>updateView()
Remarks:
This method forces the viewport and dialog to update.
Prototype:
<void>getFaceSelectionFromStack()
Remarks:
This method looks at the current face selection in the stack, and copies it to the unwrap face
selection. The reason this is useful is that if some one creates a new selection modifier Unwrap can
use it. An example would be if you applied to Unwrap to a whole editable mesh, then you went back
into the editable mesh, selected some faces by smoothing group, then turned off the face subobject
selection. If you went back to Unwrap you could get this selection by calling
getFaceSelectionFromStack.
See Also
In The MAXSDK Help File
Class IUnwrapMod
uvwMappingHeightManip interfaces:
Interface: Manip
Properties:
.mouseState : enum : Read
mouseState enums: {#mouseIdle|#mouseDragging|#mouseOverManip}
Methods:
Prototype:
<void>clearGizmos()
Remarks:
This must be called at the beginning of the “updateGizmos” handler in order to clear the current
gizmo cache.
552 Chapter 1 | What’s New in 3ds max 4 MAXScript
Prototype:
<void>addGizmoMesh <mesh>mesh <integer>flags <point3 by value>unselColor <point3 by
value>selColor
Parameters:
<mesh>mesh
<integer>flags
gizmoDontDisplay
Tells the system to not display the gizmo. It will be hit-tested, but not displayed.
gizmoDontHitTest
Tells the system to not hit-test the gizmo. It will be displayed, but not hit-tested.
gizmoActiveViewportOnly
Tells the system to only display and hit-test this gizmo in the active viewport.
<point3 by value>unselColor
<point3 by value>selColor
Remarks:
This creates a gizmo from a mesh (or geometry in MAX lingo). The mesh can be any arbitrary MAX
mesh, and created with the tools in MAXScript for creating meshes. One convenient way to do this
is to create an instance of a primitive and get the mesh from it.
The flags can be 0, or one or more of these values. If you want more than one flag to apply, then you
add the values together.
Prototype:
<void>addGizmoShape <Interface>gizmo <integer>flags <point3 by value>unselColor
<point3 by value>selColor
Parameters:
<Interface>gizmo
<integer>flags
gizmoDontDisplay
Tells the system to not display the gizmo. It will be hit-tested, but not displayed.
gizmoDontHitTest
Tells the system to not hit-test the gizmo. It will be displayed, but not hit-tested.
gizmoActiveViewportOnly
Tells the system to only display and hit-test this gizmo in the active viewport.
gizmoUseScreenSpace
This tells the system to interpret the coordinates of the shape as device
coordinates in the viewport, not as 3d values. The values are still specified as 3d
points, but the “Z” coordinate is ignored.
gizmoUseRelativeScreenSpace
This is like gizmoUseScreenSpace, but the coordinates are specified as values from
0.0 to 1.0, and interpreted in each viewport as a percentage of the width or height
of the viewport.
<point3 by value>unselColor
<point3 by value>selColor
uvwMappingHeightManip interfaces: 553
Remarks:
This creates a gizmo from a shape object. The gizmoShape can be created using functions from the
“manip” package, described below.
The flags can take on the same value as for “addGizmoMesh”, with two new values supported:
Prototype:
<void>addGizmoMarker <enum>marker <point3 by value>position <integer>flags <point3
by value>unselColor <point3 by value>selColor
marker enums:
{#point|#hollowBox|#plusSign|#asterisk|#xMarker|#bigBox|#circle|#triangle|#diamond
|#smallHollowBox|#smallCircle|#smallTriangle|#smallDiamond|#dot|#smallDot}
Parameters:
<enum>marker
<point3 by value>position
The position is a point in 3d space, or 2d screen space.
<integer>flags
gizmoDontDisplay
Tells the system to not display the gizmo. It will be hit-tested, but not displayed.
gizmoDontHitTest
Tells the system to not hit-test the gizmo. It will be displayed, but not hit-tested.
gizmoActiveViewportOnly
Tells the system to only display and hit-test this gizmo in the active viewport.
gizmoUseScreenSpace
This tells the system to interpret the coordinates of the shape as device
coordinates in the viewport, not as 3d values. The values are still specified as 3d
points, but the “Z” coordinate is ignored.
gizmoUseRelativeScreenSpace
This is like gizmoUseScreenSpace, but the coordinates are specified as values from
0.0 to 1.0, and interpreted in each viewport as a percentage of the width or height
of the viewport.
<point3 by value>unselColor
<point3 by value>selColor
Remarks:
The position is a point in 3d space, or 2d screen space. The flags are the same ones supported by
addGizmoShape.
554 Chapter 1 | What’s New in 3ds max 4 MAXScript
Prototype:
<void>addGizmoText <string>text <point3 by value>position <integer>flags <point3 by
value>unselColor <point3 by value>selColor
Parameters:
<string>text
<point3 by value>position
<integer>flags
<point3 by value>unselColor
<point3 by value>selColor
Remarks:
This creates a gizmo that is text on the screen. Note that text cannot be hit-tested or grabbed by the
mouse. It is used for display purposes only.
Prototype:
<ray by value>getLocalViewRay <point2 by value>m
Parameters:
<point2 by value>m
Return Value:
This function takes a mouse position and returns the ray that passes through that mouse position
in the direction of the view. It is returned in the local coordinates of the node that owns the
manipulator target.
Prototype:
<void>updateGizmos <time>t <&TSTR>toolTip
Remarks:
Parameters:
<time>t
<&TSTR>toolTip
toolTip is In parameter
See Also
Scripted Manipulators (p. 97)
Interface: manip (p. 366)
radiusManip interfaces: (p. 500)
ConeAngleManip - superclass: helper (p. 277)
PlaneAngleManip - superclass: helper (p. 311)
Scripted Plug-ins (p. 1538)
sliderManipulator - superclass: helper (p. 333)
sliderManipulator interfaces: (p. 520)
uvwMappingHeightManip interfaces: (p. 551)
uvwMappingLengthManip interfaces: 555
uvwMappingLengthManip interfaces:
Interface: Manip
Properties:
.mouseState : enum : Read
mouseState enums: {#mouseIdle|#mouseDragging|#mouseOverManip}
Methods:
Prototype:
<void>clearGizmos()
Remarks:
This must be called at the beginning of the “updateGizmos” handler in order to clear the current
gizmo cache.
Prototype:
<void>addGizmoMesh <mesh>mesh <integer>flags <point3 by value>unselColor <point3 by
value>selColor
Parameters:
<mesh>mesh
<integer>flags
gizmoDontDisplay
Tells the system to not display the gizmo. It will be hit-tested, but not displayed.
gizmoDontHitTest
Tells the system to not hit-test the gizmo. It will be displayed, but not hit-tested.
gizmoActiveViewportOnly
Tells the system to only display and hit-test this gizmo in the active viewport.
<point3 by value>unselColor
<point3 by value>selColor
Remarks:
This creates a gizmo from a mesh (or geometry in MAX lingo). The mesh can be any arbitrary MAX
mesh, and created with the tools in MAXScript for creating meshes. One convenient way to do this
is to create an instance of a primitive and get the mesh from it.
The flags can be 0, or one or more of these value. If you want more than one flag to apply, then you
add the values together.
556 Chapter 1 | What’s New in 3ds max 4 MAXScript
Prototype:
<void>addGizmoShape <Interface>gizmo <integer>flags <point3 by value>unselColor
<point3 by value>selColor
Parameters:
<Interface>gizmo
<integer>flags
gizmoDontDisplay
Tells the system to not display the gizmo. It will be hit-tested, but not displayed.
gizmoDontHitTest
Tells the system to not hit-test the gizmo. It will be displayed, but not hit-tested.
gizmoActiveViewportOnly
Tells the system to only display and hit-test this gizmo in the active viewport.
gizmoUseScreenSpace
This tells the system to interpret the coordinates of the shape as device
coordinates in the viewport, not as 3d values. The values are still specified as 3d
points, but the “Z” coordinate is ignored.
gizmoUseRelativeScreenSpace
This is like gizmoUseScreenSpace, but the coordinates are specified as values from
0.0 to 1.0, and interpreted in each viewport as a percentage of the width or height
of the viewport.
<point3 by value>unselColor
<point3 by value>selColor
Remarks:
This creates a gizmo from a shape object. The gizmoShape can be created using functions from the
“manip” package, described below.
The flags can take on the same value as for “addGizmoMesh”, with two new values supported:
Prototype:
<void>addGizmoMarker <enum>marker <point3 by value>position <integer>flags <point3
by value>unselColor <point3 by value>selColor
marker enums:
{#point|#hollowBox|#plusSign|#asterisk|#xMarker|#bigBox|#circle|#triangle|#diamond
|#smallHollowBox|#smallCircle|#smallTriangle|#smallDiamond|#dot|#smallDot}
Parameters:
<enum>marker
<point3 by value>position
The position is a point in 3d space, or 2d screen space.
<integer>flags
gizmoDontDisplay
Tells the system to not display the gizmo. It will be hit-tested, but not displayed.
gizmoDontHitTest
Tells the system to not hit-test the gizmo. It will be displayed, but not hit-tested.
uvwMappingLengthManip interfaces: 557
gizmoActiveViewportOnly
Tells the system to only display and hit-test this gizmo in the active viewport.
gizmoUseScreenSpace
This tells the system to interpret the coordinates of the shape as device
coordinates in the viewport, not as 3d values. The values are still specified as 3d
points, but the “Z” coordinate is ignored.
gizmoUseRelativeScreenSpace
This is like gizmoUseScreenSpace, but the coordinates are specified as values from
0.0 to 1.0, and interpreted in each viewport as a percentage of the width or height
of the viewport.
<point3 by value>unselColor
<point3 by value>selColor
Remarks:
The position is a point in 3d space, or 2d screen space. The flags are the same ones supported by
addGizmoShape.
Prototype:
<void>addGizmoText <string>text <point3 by value>position <integer>flags <point3 by
value>unselColor <point3 by value>selColor
Parameters:
<string>text
<point3 by value>position
<integer>flags
<point3 by value>unselColor
<point3 by value>selColor
Remarks:
This creates a gizmo that is text on the screen. Note that text cannot be hit-tested or grabbed by the
mouse. It is used for display purposes only.
Prototype:
<ray by value>getLocalViewRay <point2 by value>m
Parameters:
<point2 by value>m
Return Value:
This function takes a mouse position and returns the ray that passes through that mouse position
in the direction of the view. It is returned in the local coordinates of the node that owns the
manipulator target.
Prototype:
<void>updateGizmos <time>t <&TSTR>toolTip
Remarks:
Parameters:
<time>t
<&TSTR>toolTip
558 Chapter 1 | What’s New in 3ds max 4 MAXScript
See Also
Scripted Manipulators (p. 97)
Interface: manip (p. 366)
radiusManip interfaces: (p. 500)
ConeAngleManip - superclass: helper (p. 277)
PlaneAngleManip - superclass: helper (p. 311)
Scripted Plug-ins (p. 1538)
sliderManipulator - superclass: helper (p. 333)
sliderManipulator interfaces: (p. 520)
uvwMappingHeightManip interfaces: (p. 551)
uvwMappingLengthManip interfaces: (p. 555)
uvwMappingUTileManip interfaces: (p. 558)
uvwMappingVTileManip interfaces: (p. 562)
uvwMappingWidthManip interfaces: (p. 565)
uvwMappingUTileManip interfaces:
Interface: Manip
Properties:
.mouseState : enum : Read
mouseState enums: {#mouseIdle|#mouseDragging|#mouseOverManip}
Methods:
Prototype:
<void>clearGizmos()
Remarks:
This must be called at the beginning of the “updateGizmos” handler in order to clear the current
gizmo cache.
Prototype:
<void>addGizmoMesh <mesh>mesh <integer>flags <point3 by value>unselColor <point3 by
value>selColor
Parameters:
<mesh>mesh
<integer>flags
gizmoDontDisplay
Tells the system to not display the gizmo. It will be hit-tested, but not displayed.
gizmoDontHitTest
Tells the system to not hit-test the gizmo. It will be displayed, but not hit-tested.
uvwMappingUTileManip interfaces: 559
gizmoActiveViewportOnly
Tells the system to only display and hit-test this gizmo in the active viewport.
<point3 by value>unselColor
<point3 by value>selColor
Remarks:
This creates a gizmo from a mesh (or geometry in MAX lingo). The mesh can be any arbitrary MAX
mesh, and created with the tools in MAXScript for creating meshes. One convenient way to do this
is to create an instance of a primitive and get the mesh from it.
The flags can be 0, or one or more of these values. If you want more than one flag to apply, then you
add the values together.
Prototype:
<void>addGizmoShape <Interface>gizmo <integer>flags <point3 by value>unselColor
<point3 by value>selColor
Parameters:
<Interface>gizmo
<integer>flags
gizmoDontDisplay
Tells the system to not display the gizmo. It will be hit-tested, but not displayed.
gizmoDontHitTest
Tells the system to not hit-test the gizmo. It will be displayed, but not hit-tested.
gizmoActiveViewportOnly
Tells the system to only display and hit-test this gizmo in the active viewport.
gizmoUseScreenSpace
This tells the system to interpret the coordinates of the shape as device
coordinates in the viewport, not as 3d values. The values are still specified as 3d
points, but the “Z” coordinate is ignored.
gizmoUseRelativeScreenSpace
This is like gizmoUseScreenSpace, but the coordinates are specified as values from
0.0 to 1.0, and interpreted in each viewport as a percentage of the width or height
of the viewport.
<point3 by value>unselColor
<point3 by value>selColor
Remarks:
This creates a gizmo from a shape object. The gizmoShape can be created using functions from the
“manip” package, described below.
560 Chapter 1 | What’s New in 3ds max 4 MAXScript
Prototype:
<void>addGizmoMarker <enum>marker <point3 by value>position <integer>flags <point3
by value>unselColor <point3 by value>selColor
marker enums:
{#point|#hollowBox|#plusSign|#asterisk|#xMarker|#bigBox|#circle|#triangle|#diamond
|#smallHollowBox|#smallCircle|#smallTriangle|#smallDiamond|#dot|#smallDot}
Parameters:
<enum>marker
<point3 by value>position
selColor The position is a point in 3d space, or 2d screen space.
<integer>flags
gizmoDontDisplay
Tells the system to not display the gizmo. It will be hit-tested, but not displayed.
gizmoDontHitTest
Tells the system to not hit-test the gizmo. It will be displayed, but not hit-tested.
gizmoActiveViewportOnly
Tells the system to only display and hit-test this gizmo in the active viewport.
gizmoUseScreenSpace
This tells the system to interpret the coordinates of the shape as device
coordinates in the viewport, not as 3d values. The values are still specified as 3d
points, but the “Z” coordinate is ignored.
gizmoUseRelativeScreenSpace
This is like gizmoUseScreenSpace, but the coordinates are specified as values from
0.0 to 1.0, and interpreted in each viewport as a percentage of the width or height
of the viewport.
<point3 by value>unselColor
<point3 by value>selColor
Remarks:
The creates a gizmo using a marker.
Prototype:
<void>addGizmoText <string>text <point3 by value>position <integer>flags <point3 by
value>unselColor <point3 by value>selColor
Parameters:
<string>text
<point3 by value>position
<integer>flags
<point3 by value>unselColor
<point3 by value>selColor
Remarks:
This creates a gizmo that is text on the screen. Note that text cannot be hit-tested or grabbed by the
mouse. It is used for display purposes only.
uvwMappingUTileManip interfaces: 561
Prototype:
<ray by value>getLocalViewRay <point2 by value>m
Parameters:
<point2 by value>m
Return Value:
This function takes a mouse position and returns the ray that passes through that mouse position
in the direction of the view. It is returned in the local coordinates of the node that owns the
manipulator target.
Prototype:
<void>updateGizmos <time>t <&TSTR>toolTip
Remarks:
Parameters:
<time>t
<&TSTR>toolTip
See Also
Scripted Manipulators (p. 97)
Interface: manip (p. 366)
radiusManip interfaces: (p. 500)
ConeAngleManip - superclass: helper (p. 277)
PlaneAngleManip - superclass: helper (p. 311)
Scripted Plug-ins (p. 1538)
sliderManipulator - superclass: helper (p. 333)
sliderManipulator interfaces: (p. 520)
uvwMappingHeightManip interfaces: (p. 551)
uvwMappingLengthManip interfaces: (p. 555)
uvwMappingUTileManip interfaces: (p. 558)
uvwMappingVTileManip interfaces: (p. 562)
uvwMappingWidthManip interfaces: (p. 565)
562 Chapter 1 | What’s New in 3ds max 4 MAXScript
uvwMappingVTileManip interfaces:
Interface: Manip
Properties:
.mouseState : enum : Read
mouseState enums: {#mouseIdle|#mouseDragging|#mouseOverManip}
Methods:
Prototype:
<void>clearGizmos()
Remarks:
This must be called at the beginning of the “updateGizmos” handler in order to clear the current
gizmo cache.
Prototype:
<void>addGizmoMesh <mesh>mesh <integer>flags <point3 by value>unselColor <point3 by
value>selColor
Parameters:
<mesh>mesh
<integer>flags
gizmoDontDisplay
Tells the system to not display the gizmo. It will be hit-tested, but not displayed.
gizmoDontHitTest
Tells the system to not hit-test the gizmo. It will be displayed, but not hit-tested.
gizmoActiveViewportOnly
Tells the system to only display and hit-test this gizmo in the active viewport.
<point3 by value>unselColor
<point3 by value>selColor
Remarks:
This creates a gizmo from a mesh (or geometry in MAX lingo). The mesh can be any arbitrary MAX
mesh, and created with the tools in MAXScript for creating meshes. One convenient way to do this
is to create an instance of a primitive and get the mesh from it.
The flags can be 0, or one or more of these values. If you want more than one flag to apply, then you
add the values together.
Prototype:
<void>addGizmoShape <Interface>gizmo <integer>flags <point3 by value>unselColor
<point3 by value>selColor
Parameters:
<Interface>gizmo
<integer>flags
gizmoDontDisplay
Tells the system to not display the gizmo. It will be hit-tested, but not displayed.
uvwMappingVTileManip interfaces: 563
gizmoDontHitTest
Tells the system to not hit-test the gizmo. It will be displayed, but not hit-tested.
gizmoActiveViewportOnly
Tells the system to only display and hit-test this gizmo in the active viewport.
gizmoUseScreenSpace
This tells the system to interpret the coordinates of the shape as device
coordinates in the viewport, not as 3d values. The values are still specified as 3d
points, but the “Z” coordinate is ignored.
gizmoUseRelativeScreenSpace
This is like gizmoUseScreenSpace, but the coordinates are specified as values from
0.0 to 1.0, and interpreted in each viewport as a percentage of the width or height
of the viewport.
<point3 by value>unselColor
<point3 by value>selColor
Remarks:
This creates a gizmo from a shape object. The gizmoShape can be created using functions from the
“manip” package, described below.
The flags can take on the same value as for “addGizmoMesh”, with two new values supported:
Prototype:
<void>addGizmoMarker <enum>marker <point3 by value>position <integer>flags <point3
by value>unselColor <point3 by value>selColor
marker enums:
{#point|#hollowBox|#plusSign|#asterisk|#xMarker|#bigBox|#circle|#triangle|#diamond
|#smallHollowBox|#smallCircle|#smallTriangle|#smallDiamond|#dot|#smallDot}
Parameters:
<enum>marker
<point3 by value>position
The position is a point in 3d space, or 2d screen space.
<integer>flags
gizmoDontDisplay
Tells the system to not display the gizmo. It will be hit-tested, but not displayed.
gizmoDontHitTest
Tells the system to not hit-test the gizmo. It will be displayed, but not hit-tested.
gizmoActiveViewportOnly
Tells the system to only display and hit-test this gizmo in the active viewport.
gizmoUseScreenSpace
This tells the system to interpret the coordinates of the shape as device
coordinates in the viewport, not as 3d values. The values are still specified as 3d
points, but the “Z” coordinate is ignored.
564 Chapter 1 | What’s New in 3ds max 4 MAXScript
gizmoUseRelativeScreenSpace
This is like gizmoUseScreenSpace, but the coordinates are specified as values from
0.0 to 1.0, and interpreted in each viewport as a percentage of the width or height
of the viewport.
<point3 by value>unselColor
<point3 by value>selColor
Remarks:
The creates a gizmo using a marker.
Prototype:
<void>addGizmoText <string>text <point3 by value>position <integer>flags <point3 by
value>unselColor <point3 by value>selColor
Parameters:
<string>text
<point3 by value>position
<integer>flags
<point3 by value>unselColor
<point3 by value>selColor
Remarks:
This creates a gizmo that is text on the screen. Note that text cannot be hit-tested or grabbed by the
mouse. It is used for display purposes only.
Prototype:
<ray by value>getLocalViewRay <point2 by value>m
Parameters:
<point2 by value>m
Return Value:
This function takes a mouse position and returns the ray that passes through that mouse position
in the direction of the view. It is returned in the local coordinates of the node that owns the
manipulator target.
Prototype:
<void>updateGizmos <time>t <&TSTR>toolTip
Remarks:
Parameters:
<time>t
<&TSTR>toolTip
uvwMappingWidthManip interfaces: 565
See Also
Scripted Manipulators (p. 97)
Interface: manip (p. 366)
radiusManip interfaces: (p. 500)
ConeAngleManip - superclass: helper (p. 277)
PlaneAngleManip - superclass: helper (p. 311)
Scripted Plug-ins (p. 1538)
sliderManipulator - superclass: helper (p. 333)
sliderManipulator interfaces: (p. 520)
uvwMappingHeightManip interfaces: (p. 551)
uvwMappingLengthManip interfaces: (p. 555)
uvwMappingUTileManip interfaces: (p. 558)
uvwMappingVTileManip interfaces: (p. 562)
uvwMappingWidthManip interfaces: (p. 565)
uvwMappingWidthManip interfaces:
Interface: Manip
Properties:
.mouseState : enum : Read
mouseState enums: {#mouseIdle|#mouseDragging|#mouseOverManip}
Methods:
Prototype:
<void>clearGizmos()
Remarks:
This must be called at the beginning of the “updateGizmos” handler in order to clear the current
gizmo cache.
Prototype:
<void>addGizmoMesh <mesh>mesh <integer>flags <point3 by value>unselColor <point3 by
value>selColor
Parameters:
<mesh>mesh
<integer>flags
gizmoDontDisplay
Tells the system to not display the gizmo. It will be hit-tested, but not displayed.
gizmoDontHitTest
Tells the system to not hit-test the gizmo. It will be displayed, but not hit-tested.
566 Chapter 1 | What’s New in 3ds max 4 MAXScript
gizmoActiveViewportOnly
Tells the system to only display and hit-test this gizmo in the active viewport.
<point3 by value>unselColor
<point3 by value>selColor
Remarks:
This creates a gizmo from a mesh (or geometry in MAX lingo). The mesh can be any arbitrary MAX
mesh, and created with the tools in MAXScript for creating meshes. One convenient way to do this
is to create an instance of a primitive and get the mesh from it.
The flags can be 0, or one or more of these value. If you want more than one flag to apply, then you
add the values together.
Prototype:
<void>addGizmoShape <Interface>gizmo <integer>flags <point3 by value>unselColor
<point3 by value>selColor
Parameters:
<Interface>gizmo
<integer>flags
gizmoDontDisplay
Tells the system to not display the gizmo. It will be hit-tested, but not displayed.
gizmoDontHitTest
Tells the system to not hit-test the gizmo. It will be displayed, but not hit-tested.
gizmoActiveViewportOnly
Tells the system to only display and hit-test this gizmo in the active viewport.
gizmoUseScreenSpace
This tells the system to interpret the coordinates of the shape as device
coordinates in the viewport, not as 3d values. The values are still specified as 3d
points, but the “Z” coordinate is ignored.
gizmoUseRelativeScreenSpace
This is like gizmoUseScreenSpace, but the coordinates are specified as values from
0.0 to 1.0, and interpreted in each viewport as a percentage of the width or height
of the viewport.
<point3 by value>unselColor
<point3 by value>selColor
Remarks:
This creates a gizmo from a shape object. The gizmoShape can be created using functions from the
“manip” package, described below.
Prototype:
<void>addGizmoMarker <enum>marker <point3 by value>position <integer>flags <point3
by value>unselColor <point3 by value>selColor
marker enums:
{#point|#hollowBox|#plusSign|#asterisk|#xMarker|#bigBox|#circle|#triangle|#diamond
|#smallHollowBox|#smallCircle|#smallTriangle|#smallDiamond|#dot|#smallDot}
uvwMappingWidthManip interfaces: 567
Parameters:
<enum>marker
<point3 by value>position
The position is a point in 3d space, or 2d screen space.
<integer>flags
gizmoDontDisplay
Tells the system to not display the gizmo. It will be hit-tested, but not displayed.
gizmoDontHitTest
Tells the system to not hit-test the gizmo. It will be displayed, but not hit-tested.
gizmoActiveViewportOnly
Tells the system to only display and hit-test this gizmo in the active viewport.
gizmoUseScreenSpace
This tells the system to interpret the coordinates of the shape as device
coordinates in the viewport, not as 3d values. The values are still specified as 3d
points, but the “Z” coordinate is ignored.
gizmoUseRelativeScreenSpace
This is like gizmoUseScreenSpace, but the coordinates are specified as values from
0.0 to 1.0, and interpreted in each viewport as a percentage of the width or height
of the viewport.
<point3 by value>unselColor
<point3 by value>selColor
Remarks:
The position is a point in 3d space, or 2d screen space. The flags are the same ones supported by
addGizmoShape.
Prototype:
<void>addGizmoText <string>text <point3 by value>position <integer>flags <point3 by
value>unselColor <point3 by value>selColor
Parameters:
<string>text
<point3 by value>position
<integer>flags
<point3 by value>unselColor
<point3 by value>selColor
Remarks:
This creates a gizmo that is text on the screen. Note that text cannot be hit-tested or grabbed by the
mouse. It is used for display purposes only.
Prototype:
<ray by value>getLocalViewRay <point2 by value>m
Parameters:
<point2 by value>m
568 Chapter 1 | What’s New in 3ds max 4 MAXScript
Return Value:
This function takes a mouse position and returns the ray that passes through that mouse position
in the direction of the view. It is returned in the local coordinates of the node that owns the
manipulator target.
Prototype:
<void>updateGizmos <time>t <&TSTR>toolTip
Remarks:
Parameters:
<time>t
<&TSTR>toolTip
See Also
Scripted Manipulators (p. 97)
Interface: manip (p. 366)
radiusManip interfaces: (p. 500)
ConeAngleManip - superclass: helper (p. 277)
PlaneAngleManip - superclass: helper (p. 311)
Scripted Plug-ins (p. 1538)
sliderManipulator - superclass: helper (p. 333)
sliderManipulator interfaces: (p. 520)
uvwMappingHeightManip interfaces: (p. 551)
uvwMappingLengthManip interfaces: (p. 555)
uvwMappingUTileManip interfaces: (p. 558)
uvwMappingVTileManip interfaces: (p. 562)
uvwMappingWidthManip interfaces: (p. 565)
UVWUnwrap interfaces:
See Also
Unwrap_UVW interfaces: (p. 530)
Float_Wire interfaces: 569
Float_Wire interfaces:
This represents the interface for individual wire controllers.
Interface: wireController
Properties:
.numWires : integer : Read
This property returns the number of wires out of this controller (i.e. the number of
dependent params).
.isMaster : boolean : Read
This property will return TRUE if the wire is a master predicate, otherwise it will return
FALSE.
.isSlave : boolean : Read
This method will return TRUE if the wire is a slave predicate, otherwise it will return
FALSE.
.isTwoWay : boolean : Read
This method will return TRUE if the wire is a two-way predicate, otherwise it will return
FALSE.
.slaveAnimation : control : Read|Write
This method returns a pointer to the slave animation controller.
This method allows you to set the slave animation controller.
Prototype:
<maxObject>getWireParent <index>index
Parameters:
<index>index
The index you wish to retrieve.
Return Value:
This method returns a pointer to the i-th dependent parameter parent.
Prototype:
<integer>getWireSubnum <index>index
Remarks:
This method returns the i-th dependent parameter subanim num in the animatable.
Parameters:
<index>index
The index of the subanim.
Return Value:
This method returns the i-th dependent parameter subanim num in the animatable.
570 Chapter 1 | What’s New in 3ds max 4 MAXScript
Prototype:
<control>getCoController <index>index
Parameters:
<index>index
The index of the controller.
Return Value:
This method returns a pointer to the i-th CoController.
Prototype:
<string>getExprText <index>index
Parameters:
<index>index
The index of the parameter.
Return Value:
This method returns the expression string of the i-th wire parameter.
Prototype:
<void>setExprText <index>index <string>text
Remarks:
This method allows you to set the expression string of the i-th wire parameter.
Parameters:
<index>index
The index of the parameter
<string>text
The expression you wish to set.
See Also
In The MAXSDK Help File
Class IBaseWireControl
Point3_Wire interfaces:
Interface: wireController
Properties:
.numWires : integer : Read
This property returns the number of wires out of this controller (i.e. the number of
dependent params).
.isMaster : boolean : Read
This property will return TRUE if the wire is a master predicate, otherwise it will return
FALSE.
Point3_Wire interfaces: 571
Parameters:
<index>index
The index of the subanim.
Remarks:
This method returns the i-th dependent parameter subanim num in the animatable.
Return Value:
This method returns the i-th dependent parameter subanim num in the animatable.
Prototype:
<control>getCoController <index>index
Parameters:
<index>index
The index of the controller.
Return Value:
This method returns a pointer to the i-th CoController.
Prototype:
<string>getExprText <index>index
Parameters:
<index>index
The index of the parameter.
572 Chapter 1 | What’s New in 3ds max 4 MAXScript
Return Value:
This method returns the expression string of the i-th wire parameter.
Prototype:
<void>setExprText <index>index <string>text
Parameters:
<index>index
The index of the parameter
<string>text
The expression you wish to set.
Remarks:
This method allows you to set the expression string of the i-th wire parameter.
See Also
In The MAXSDK Help File
Class IBaseWireControl
Rotation_Wire interfaces:
This represents the interface for individual wire controllers.
Interface: wireController
Properties:
.numWires : integer : Read
This property returns the number of wires out of this controller (i.e. the number of
dependent params).
.isMaster : boolean : Read
This property will return TRUE if the wire is a master predicate, otherwise it will return
FALSE.
.isSlave : boolean : Read
This method will return TRUE if the wire is a slave predicate, otherwise it will return
FALSE.
.isTwoWay : boolean : Read
This method will return TRUE if the wire is a two-way predicate, otherwise it will return
FALSE.
.slaveAnimation : control : Read|Write
This method returns a pointer to the slave animation controller.
This method allows you to set the slave animation controller.
Rotation_Wire interfaces: 573
Prototype:
<maxObject>getWireParent <index>index
Parameters:
<index>index
The index you wish to retrieve.
Return Value:
This method returns a pointer to the i-th dependent parameter parent.
Prototype:
<integer>getWireSubnum <index>index
Remarks:
This method returns the i-th dependent parameter subanim num in the animatable.
Parameters:
<index>index
The index of the subanim.
Return Value:
This method returns the i-th dependent parameter subanim num in the animatable.
Prototype:
<control>getCoController <index>index
Parameters:
<index>index
The index of the controller.
Return Value:
This method returns a pointer to the i-th CoController.
Prototype:
<string>getExprText <index>index
Parameters:
<index>index
The index of the parameter.
Return Value:
This method returns the expression string of the i-th wire parameter.
Prototype:
<void>setExprText <index>index <string>text
574 Chapter 1 | What’s New in 3ds max 4 MAXScript
Remarks:
This method allows you to set the expression string of the i-th wire parameter.
Parameters:
<index>index
The index of the parameter
<string>text
The expression you wish to set.
See Also
In The MAXSDK Help File
Class IBaseWireControl
Scale_Wire interfaces:
This represents the interface for individual wire controllers.
Interface: wireController
Properties:
.numWires : integer : Read
This property returns the number of wires out of this controller (i.e. the number of
dependent params).
.isMaster : boolean : Read
This property will return TRUE if the wire is a master predicate, otherwise it will return
FALSE.
.isSlave : boolean : Read
This method will return TRUE if the wire is a slave predicate, otherwise it will return
FALSE.
.isTwoWay : boolean : Read
This method will return TRUE if the wire is a two-way predicate, otherwise it will return
FALSE.
.slaveAnimation : control : Read|Write
This method returns a pointer to the slave animation controller.
This method allows you to set the slave animation controller.
Prototype:
<maxObject>getWireParent <index>index
Parameters:
<index>index
The index you wish to retrieve.
Return Value:
This method returns a pointer to the i-th dependent parameter parent.
Scale_Wire interfaces: 575
Prototype:
<integer>getWireSubnum <index>index
Remarks:
This method returns the i-th dependent parameter subanim num in the animatable.
Parameters:
<index>index
The index of the subanim.
Return Value:
This method returns the i-th dependent parameter subanim num in the animatable.
Prototype:
<control>getCoController <index>index
Parameters:
<index>index
The index of the controller.
Return Value:
This method returns a pointer to the i-th CoController.
Prototype:
<string>getExprText <index>index
Parameters:
<index>index
The index of the parameter.
Return Value:
This method returns the expression string of the i-th wire parameter.
Prototype:
<void>setExprText <index>index <string>text
Remarks:
This method allows you to set the expression string of the i-th wire parameter.
Parameters:
<index>index
The index of the parameter
<string>text
The expression you wish to set.
See Also
In The MAXSDK Help File
Class IBaseWireControl
576 Chapter 1 | What’s New in 3ds max 4 MAXScript
Chapter 2: Learning MAXScript
Welcome to Learning MAXScript. This introductory reference helps you get started using
MAXScript, the scripting language that is built into 3ds max.
Learning MAXScript can be used as an introductory reference. However, it is most useful if read
straight through as a tutorial. You can follow the examples in this reference by using drag-and-drop
or copy-and-paste to bring the code from this document into the MAXScript Listener. You can also
type in your own text and start experimenting with MAXScript as you learn it.
Getting Started
Accessing MAXScript (p. 579)
Source Code Layout (p. 580)
Entering Information into MAXScript (p. 582)
Assigning Variables (p. 585)
Mathematical Operations in MAXScript (p. 588)
Accessing MAXScript
MAXScript is the built-in scripting language for 3ds max (version 2.0 or higher.) Because of this, you
can use MAXScript only when 3ds max is running. There are several ways to access MAXScript from
within 3ds max. The easiest way is to select MAXScript Listener from the MAXScript menu. The
other way to start MAXScript is as follows:
The MAXScript Listener window is an interactive interpreter for the MAXScript language and works
similarly to a DOS command prompt window. Enter MAXScript commands in this window, and
press ENTER to execute them immediately.
Only one instance of the MAXScript Listener window can be open at a time. The Listener is a
resizable, modeless window. You can switch between it and the software as you work. If you close
the Listener window and then reopen it, any text that was in the window before it was closed
reappears.
The Listener is divided into two panes. The top (pink) pane is the Macro Recorder pane; the bottom
(white) pane is the output pane. The Macro Recorder plane is hidden when the Listener is opened;
drag the splitter bar down to open it.
When the Macro Recorder is enabled, every recordable command is displayed in the Macro Recorder
pane. The output of results from scripts is displayed in the output pane. The output of code executed
in the Macro Recorder pane is always directed to the output pane to prevent cluttering the
recordings. Both panes allow you to cut-and-paste, drag-and-drop, edit, select, and execute code. You
can resize the panes by dragging on the split bar between them.
The left end of the status bar contains a resizable Mini Listener.
If the Mini Listener is not visible, drag on the vertical split bar at the left edge of the status panel to
reveal this feature. The Mini Listener panes act as single-line sliding windows for the current line in
corresponding Listener panes. The Mini Listener panes always show what you are typing or where
the cursor is placed in the Listener panes. Conversely, anything you enter into a Mini Listener pane
is entered into the corresponding Listener pane at the current cursor position.
This line can be broken after any of the operators. MAXScript continues to read the next line,
because an operator needs another argument. For example:
a + b * c / d – e +
f * g / h
You cannot break the example line as shown next and get the same result, because the expression
on the first line is a complete expression. MAXScript considers the two lines as separate expressions,
and the second line is now syntactically wrong, because it starts with an operator.
a + b * c / d – e
+ f * g / h
If you do want to break a line at the end of a sub-expression, you can use the backslash line
continuation character: ‘\’. The previous example of an invalid break can be made valid using the
line continuation character after the ‘e’:
a + b * c / d – e \
+ f * g / h
Whenever MAXScript encounters a ‘\’ as the last character on a line (except for spaces, tabs, or
comments), it continues to read the next line as though the break were not present. Line
continuations can be useful for breaking up long or complex lines of code, making them easier
to read.
MAXScript also lets you combine multiple statements and expressions in a single line. The
statements or expressions are separated with a ‘;’, for example:
582 Chapter 2 | Learning MAXScript
Sometimes it is useful to enter comments within your script to provide guidance or context. You can
enter comments in MAXScript by preceding your comment with a double-hyphen (‘--’). As soon as
MAXScript reaches the double-hyphen, it stops evaluating the rest of that line. For example:
When MAXScript performs operations involving both float and integer-type numbers however, it
treats the integer as a float number. For example: 3 + 4.0 will return 7.0.
2. Write the word “Hello” again, this time with quotation marks, and press ENTER.
The command output is now “Hello”.
It seems that MAXScript knows the string “Hello” because it answers with a friendly “Hello”.
Actually, it merely knows that you entered a string, and the command output for strings is
always the value of the string you entered.
#( <expr> , <expr> )
This form of the array is appropriate when you would like to define one or more of the initial
elements within the array. Each value of <expr> can be a number, an expression (e.g., sin pi, 6.2^3),
or a string (e.g., “hello”). Elements do not have to be the same type of information, and there is no
limit on the number of elements you can have in an array.
Assigning Variables
In the previous lesson, you entered the string “Hello” in MAXScript, and MAXScript displayed the
same string as its command output. When you enter other strings, MAXScript displays them and
forgets about the previous ones. To make MAXScript remember the value of a string, assign it to a
variable. The general syntax for assigning a variable in MAXScript is:
variable_name = variable_value
A variable_name starts with an alphabetic character or “_” (underscore), followed by any number
of alphanumeric characters. The variable_value can be a string, a number, or any other
expression.
586 Chapter 2 | Learning MAXScript
2. You can now refer to this string variable by entering the variable’s name. Enter mystring.
MAXScript again returns the value of the string variable:
This is faster than entering the string again. MAXScript remembers this string for as long as your
MAXScript session is open, or until you change the variable’s value.
Assigning Variables 587
2. When you refer to mystring now, MAXScript uses the new value. Enter mystring.
MAXScript now displays the new variable value:
Notice that MAXScript doesn’t distinguish between lowercase and uppercase variable names
because MAXScript names are not case-sensitive.
588 Chapter 2 | Learning MAXScript
MAXScript returns the result of the calculation. This is useful for quick calculations where loading
an external calculator program doesn’t seem worth the trouble.
MAXScript also recognizes several mathematical constants. Enter pi.
You can use this value in more complex operations. For example, if you want to know the volume
of a sphere with a 2.5-inch radius, multiply the cube of the radius by pi, then multiply by 4 and
divide by 3. Enter 4/3 * pi * 2.5^3 .
For more string operations, see the String Values (p. 722) topic in the MAXScript reference.
Note: For reasons beyond the scope of this tutorial, the random command will generate the same
‘random’ numbers each time a script is run. This happens if you restart the software and run the
script, but not if you run the script over and over. If you want the values created by the random
function to change each time you start the software, you can use the seed command:
seed <number>
where <number> is any float or integer. Each time you change the seed value, MAXScript generates
new ‘random’ numbers.
Drawing a Box with MAXScript 591
Incrementing
Another useful mathematical operation that MAXScript provides is incrementing. This is a
shorthand form of assignment that can be used to modify a value in place, as shown in the following
long form examples:
x = x + 1
There are assignment operators corresponding to the four math operations (+,-,*, and /) that apply
the operation to the assignment’s destination with the result. Their syntax is:
<destination> += <expr> -- add <expr> to destination
<destination> -= <expr> -- subtract <expr> from destination
<destination> *= <expr> -- multiply destination by <expr>
<destination> /= <expr> -- divide destination by <expr>
Using this shorthand form of assignment, the previous example can be written as:
x += 1
MAXScript returns the box object name and the position of the box:
This example creates a box, and supplies three parameters: the length, width, and height of the box.
The parameter names are followed by a colon and then by the value for that parameter. You can
enter all parameters, without any punctuation between them. MAXScript returns the following
statement:
$Box:Box01 @ [0.000000, 0.000000, 0.000000].
The first part of the statement is called a pathname. A pathname in MAXScript is similar to a
pathname in Windows, such as c:\3dsmax\examples\file.max, which represents a path through a
hierarchy of directories pointing to a particular file. In MAXScript, a similar path concept is used.
However paths in MAXScript end up pointing to objects, not files. Pathnames in MAXScript always
begin with the “$” character. For more information on Pathnames, see the Pathname Literals (p. 662)
topic in the MAXScript reference.
The second part of the statement is the object name: Box01, in this case. This name appears in the
Select Object dialog when you use the Select by Name toolbar button in 3ds max. It is not the
name of your box variable, which is mybox. This variable is merely a placeholder that points to the
object, Box01.
The values inside the brackets represent the x, y, and z coordinates of the center of the box.
Modifying the Box 593
MAXScript also draws the box in the viewports, as shown in this perspective viewport:
Notice that you can use Undo (as you can with most MAXScript creation and
modification commands) to remove the box from the scene.
box to magenta. If you entered this command, click Undo to change the box back to blue.
For more information on colors, see the Color Values (p. 729) topic in the MAXScript reference.
If you want to change the scale to affect only the height and the width, but not the length, use the
following example:
mybox.scale = [1,3,2]
When you scale your original [20,20,20] box by any factor, the box’s parameters are still 20 for
width, 20 for length, and 20 for height. You can see this when you open the Modify panel. The box
parameters are not changed by the scale transformation:
Modifying the Box 597
Although altering the height and width properties of the box achieves the same result, visually, the
above scale modification is not equivalent to using the following two commands:
mybox.height = 40 -- 2 times the original 20 units
mybox.width = 60 -- 3 times the original 20 units
The reason for this is that changing the height property of the box changes the creation parameter
of the box’s height. Using the scale property to transform the height of the box does not.
Again, the effect of using either method is visually the same, but when you want to maintain the
original creation parameters of an object, so that you can alter them even after a number of different
transformations, you must use the scale property to manipulate the size of the box, not the
individual creation properties.
If you entered the last two commands, click Undo twice to change the box back to its original
height and width.
Notice that you can use the “*” character as a wildcard to see all box parameters. If you had entered
showClass “box*.*,” MAXScript would have listed the Box and the BoxGizmo classes.
The other inspector function is showProperties(). To learn more about these functions, search
for the “Class and Object Inspector Functions and Properties” topic in the MAXScript Reference.
For example:
mybox.pos = [10,0,0]
mybox.pos = [10,0,0]
mybox.pos = [10,0,0]
will only change the position of your box after the first line is executed. The second and third lines
do not affect the position of your box, as they do not change the position of the box.
If you entered the above commands, click Undo three times to move the box back to its
original position.
On the other hand, entering:
move mybox [10,0,0]
move mybox [10,0,0]
move mybox [10,0,0]
will move your box 30 units along the X-axis.
600 Chapter 2 | Learning MAXScript
If you entered the above commands, click Undo three times to move the box back to its
original position.
Applying Standard Transformations 601
In fact, this rotation could be applied to any object by writing the same line as above and replacing
mybox with the name of the object you want to rotate.
If you entered the above commands, click Undo to move the box back to its original position.
If you designate angles for more than one axis:
rot_box2 = eulerangles 30 45 60
The rotation is applied to an object, with the X-axis rotation occurring first, followed by the Y-axis
rotation, and then the Z-axis rotation.
Note: Moving, scaling, or rotating objects, or setting transform-related properties within a
coordinate system, will operate in relation to the current reference coordinate system (i.e., Local,
World, Screen), which is displayed in the main 3ds max toolbar. If you want to perform these
transformations in another coordinate system, see the Coordsys (p. 685) topic in the MAXScript
reference.
More Box Transformations 603
Any time you change a property of a 3ds max object, MAXScript immediately reflects the change in
the scene and in the user interface.
You can also create modifiers and add them to an object.
To create a modifier:
Creating a modifier is pretty simple. You use the addModifier command and specify the name of
the modifier you want to use and its appropriate parameters.
For example, to create a Twist modifier set at 30 degrees and apply it to your box, you would enter
addModifier mybox (twist angle:30)
604 Chapter 2 | Learning MAXScript
The box in your Perspective viewport is now twisted and the interface shows the new Twist modifier
in the modifier stack display, together with its parameters:
More Box Transformations 605
To change a modifier:
Changing a modifier is similar to changing a creation parameter. Again, because you used a variable
name for your object, and you added a modifier to that object variable, you now have easy access to
the new modifier properties of your object.
To change the angle of the twist modifier to 60 degrees, enter
mybox.twist.angle = 60
606 Chapter 2 | Learning MAXScript
The twist of your box is now more pronounced and the Angle parameter of the Twist modifier
displays the new value:
From here on, you can add and change other modifiers as you like. The syntax is the same for all
modifiers. To find out the names of other modifiers, search for the “Modifier : MAXWrapper” topic
in the MAXScript Reference.
If you entered the above commands, click Undo twice to bring the box back to its
original state.
Controlling Program Flow in Scripts 607
Drag the slider around, and you will see that MAXScript has animated the box, and placed keyframes
at 0 and 100.
When you use MAXScript to animate objects, the actual Animate button in the UI does not come
on, nor does the time slider move; these things happen within MAXScript.
In this example, the time was given as a simple number. If no unit is specified, MAXScript interprets
this as a frame number. You can also use one of the various time literals in the following manner:
2.5s -- 2.5 seconds
20f -- 20 frames
4800t -- 4800 ticks = 1 sec
1m3s5f -- 1 min, 3 seconds, 5 frames
1:15.5 -- SMPTE: 1 min, 15 seconds, 5 frames
Conditional Statements
Conditional statements simply tell MAXScript to perform a specified command if a certain
condition is met. For example:
if mybox.height == 10 then mybox.width = 20
This changes the width of your box to 20 if its height is equal to 10. You may have taken note of the
double equal sign used in the statement above. This is discussed at the end of this topic.
This “if...then...” statement can be expanded to include an “else” statement. For example:
if mybox.height == 10 then mybox.width = 20 else mybox.width = 10
This statement tells MAXScript to change the width of your box to 20 if its height is 10, otherwise
change the width to 10. The “if,” “then,” and “else” portions of the statement can all be on
separate lines:
if b.height == 10
then b.width = 20
else b.width = 10
If you are entering these commands into the Listener window, you may notice that the commands
are not executed line by line, as is typical of the Listener. This is because the Listener recognizes that
the “if” statement requires a “then” statement to be complete. In fact, the Listener does not execute
the statement after the “then” statement, because it does not know if you intend to include an “else”
statement. For this reason, the Listener does not execute an “if...then...” statement until you have
either entered a “then” statement or after the next line you type, following the “if...then...”
statement.
The double equal sign in the last statement, “==,” tells MAXScript to compare two values. The single
“=” sign always signifies assignment. This is common in many standard programming languages,
such as C++. There are several different conditional parameters used in MAXScript. They are
listed here:
== equal to
!= not equal to
> greater than
>= greater than or equal to
< less than
<= less than or equal to
Note: Any time MAXScript evaluates a conditional expression, the result is either true or false.
MAXScript temporarily stores the value of this result. In an “if...then” statement, MAXScript uses
this result to determine the path to follow in the statement. If the result of the “if” statement is true,
MAXScript will evaluate the “then” expression. If the result is false, MAXScript will evaluate the
“else” expression, assuming one is specified; otherwise, it will cease evaluating the conditional
statement. In some scripts, you might see the words on and off used in place of true and false,
respectively. These words are interchangeable and they mean the same thing to MAXScript.
Controlling Program Flow in Scripts 609
Loops
Loops are repetitive operations that tell MAXScript to repeat the execution of a collection of
commands. Loops are useful for working with large groups of objects, as you can make changes to
many objects with one set of commands. For example, if you wanted to make 50 boxes, you could
use a loop to execute the create command 50 times, rather than creating the boxes with 50 separate
commands. Loops are also useful for changing the properties of multiple objects.
There are several different types of loop. The first to be considered are for and while loops.
For Loops
The for loop iterates through a range of numbers, time values, or a sequenced collection of values,
such as an array or object set. Use a for loop to copy the box:
for i = 1 to 5 do
(
box_copy = copy mybox
box_copy.pos = [i * 50, 0, 0]
)
610 Chapter 2 | Learning MAXScript
Everything inside of the parentheses makes up a “block.” All loop statements must be created as a
block. This statement executes five times. Each time, a new box is created.
A for statement starts with the word ‘for’. Next, you must define how many times the statement will
repeat. In this case, you have used the variable “i” to control the loop. The line, “for i = 1 to 5”
tells MAXScript to set the variable “i” to the value 1, execute the contents of the loop statement,
then set the variable “i” to 2, execute the loop contents, and so on. The variable “i” is called the index
for the loop. Each time the loop executes, the index is incremented by 1 automatically, without
requiring any user input. Each repetition of the loop is called an iteration. To make MAXScript
increment the index by a value other than 1, insert ‘by x’ after the index statement, where x is the
amount to increment the index. For example, the following statement will set the index to 1, then 3,
then 5:
for i = 1 to 5 by 2 do
(
box_copy = copy mybox
box_copy.pos = [i * 50, 0, 0]
)
Controlling Program Flow in Scripts 611
The “do” keyword tells MAXScript to execute the following block or statement each time the loop
repeats. Note that in some loops you might see the word “in” in place of the equal sign, “=”. These
both mean the same thing in for loops, and can be used interchangeably. Note how the index was
used within the loop statement to set the position of each new box. This is a useful way to work with
multiple object creation.
For loops can also be used to build arrays and/or access values within an array. In the following
example, you use a for loop to build an array called ‘arr’:
Remember that because MAXScript is an expression-based language, you are able to use expressions
in variable assignment, as seen above in the assignment of the for loop expression to the variable,
arr. Note the ‘collect’ statement in the for loop above. This tells MAXScript to collect the results of
each iteration in an array, rather than just calculate them. In this case, you only asked MAXScript to
collect the value of the index; however, you can collect iterations of any expression.
612 Chapter 2 | Learning MAXScript
Finally, for loops can also perform iterations with the contents of an array. In the following example,
you use a for loop to access the values of the array you created in the previous example:
The ‘print’ command is a MAXScript function that displays the specified variable in the Listener
window. In this example you used ‘in’ instead of an equal sign; however, they are still both
acceptable, even when accessing values within an array.
Note: You can also access the number of elements in an array with the .count property. For
example, the previous example could have been written:
for i = 1 to arr.count do print i
This will return the same result.
The following example will return the value of a variable, incrementing the variable by –1 with each
iteration.
x=10
while x>0 do print (x-=1)
Controlling Program Flow in Scripts 613
Returns:
9
8
7
6
5
4
3
2
1
0
0
MAXScript automatically returns the final value of the loop to the Listener. In this example,
MAXScript is also instructed to return the value at each iteration of the loop; therefore, the final
value is returned twice.
Both loops repeat the do<expr> as long as the while<expr> evaluates to the value true. The do
form evaluates the do<expr> at least at least once, before evaluating the text expression at the end
of the loop. The while form evaluates the test expression at the start of the loop, and might not loop
at all.
Both forms return, as their value, the result of the do<expr> from the last successful loop iteration.
The while form returns the value undefined if the test expression immediately returns false.
For example:
x=10
do print (x-=1) while x>10
Returns:
9
undefined
However,
x=10
while x>10 do print (x-=1)
Returns:
Undefined
614 Chapter 2 | Learning MAXScript
number, color, etc.). MAXScript automatically assigns the variable a special value of “undefined”.
The first time you assign something to the variable, it will become defined by the data type that you
have assigned it to. In practice, it is always best to define variables with an initial value.
It is important to note that rad is not the only local variable in the previous example. The variable
“s” is also a local variable, and cannot be accessed outside of the parentheses. It is not necessary to
declare every variable with a “global” or “local” statement. You learned previously that you can
implicitly create a variable by simply assigning a value to it. If you do not make the “global” or
“local” distinction upon your variable, MAXScript will create the appropriate association, depending
on where the variable is defined in the script. For example if you create a variable inside a block,
MAXScript automatically treats it as a local variable. On the other hand, any variable created at the
top level of MAXScript (outside of all blocks) is always a global variable. As mentioned previously,
MAXScript does not allow for the creation of local variables outside of a block. These concepts are
presented in the following example:
for i = 1 to 5
(
global rad = 10
cyl_height = 25
c = cylinder()
c.radius = rad
c.height = cyl_height
c.pos.x = i * 25
)
s = sphere radius:rad
In this example, four variables are created: rad, cyl_height, c, and s. Because they were implicitly
created within a block, c and cyl_height are both local variables. The other two variables are both
global; s, because it was created outside of a block, and rad, because it was declared as a global
variable. For this reason, you can use rad again to define the sphere, s.
616 Chapter 2 | Learning MAXScript
MAXScript returns subtract() to let you know that it has defined the function, subtract.
The definition contains the keyword function (you can also use the word fn in place of
function), followed by the name of the function (subtract), followed by the list of variables
(x and y). The equal sign signifies the start of the body of the function. The body is the series of
statements that the function executes. Even if there is only one statement, the body of the function
must be in parentheses.
Note: Any variables created in the body of a function are local variables unless otherwise specified.
Once a function has been defined, it can be used anywhere throughout the script. Therefore, it is
useful to place function definitions at the beginning of your scripts.
In order to use a function, you simply enter the function name and the values for its variables:
Defining Custom Functions 617
This example uses what are known as positional arguments. When you call the function, you must
supply both arguments, and you must supply them in the proper order for the function to execute
properly.
The second type of arguments you can use are keyword arguments. This is what is used for all of the
object constructors in MAXScript. The function definition is the same, with the exception of
declaring the keyword arguments, or default values for the variables in a function. The following
example determines whether a number is positive, negative, or equal to zero:
function sign val:0 =
(
if val == 0
then messagebox (”Equal to 0”)
else if val > 0
then messagebox (”Greater than 0”)
else messagebox (”Less than 0”)
)
The messagebox command causes a message box to pop up on the screen, displaying the argument
in the parentheses that follow the command.
In this example, a parameter called val has been declared in the function definition. The value after
the colon is the parameter’s default value. When the function definition contains parameters like
this, they are optional in the function call. If you enter sign(), without specifying any parameters
in the function call, MAXScript uses the default value:
The “Equal to 0” message box appears, since the default value for val (0) will be used. However, if
you do define val:
sign val:-5
the “Less than 0” message appears. You can include as many keyword arguments in a function as
you need, and they can be entered in any order when calling the function. This is useful when you
consider functions such as object-creation functions, where the new object might have 20 or 30
618 Chapter 2 | Learning MAXScript
parameters associated with it. If you wanted to use positional argument functions to create the same
objects, you would have to provide all of these parameters, in the right order, each time you wanted
to call the function.
It is also possible to use both positional and keyword arguments in the same function call. In this
case, you must use positional arguments first, followed by the keyword arguments:
function mycube side position:[0, 0, 0] =
(
box length:side width:side height:side pos:position
)
This function requires you to enter the size of the cube, but the position is optional.
Structure Definitions
In addition to custom functions, you can also create custom compound values in MAXScript using
“structure definitions”. Structure definitions are a flexible data type, built of simpler data types. They
let you define the layout of a new structured type of value that you can then create and work with
in your code. The syntax for a structure definition is:
Struct <struct_name> ( <member> , <member> )
Structure definitions are a good alternative to arrays when you have a fixed, small number of
components. The code for these types of values is easier to work with since you can reference
property names rather than index numbers in arrays.
620 Chapter 2 | Learning MAXScript
The keyword max is followed by one or more words that describe the command. The available
commands can be displayed by using the “?” character in a partial max command. For example:
max time ? -- shows all the time-related commands
max sel ? -- shows all the commands with ‘sel’ in them as a substring
max ? -- shows all the commands (there are a lot)
Below is a partial list of the available commands to give you an idea of the type of 3ds max
commands you can perform with MAXScript. For a complete list, see the 3ds max Commands
(p. 1630) topic in the MAXScript reference.
To copy tutorial commands from the Listener into the script editor window:
1. Click the New Script button in the MAXScript rollout on the Display panel.
The Script Editor window appears with the title “Untitled - MAXScript”.
2. Position the Script Editor window side-by-side or below the Listener window so that you can
copy and paste text between the two windows.
3. In the Listener window, select the black command line from the Drawing a Box with MAXScript
(p. 591) topic (mybox = box length:20 width:20 height:20)
4. Press CTRL+C on your keyboard to copy the text to the Clipboard.
5. Click the Script Editor window to place the cursor in it, and press CTRL+V on your keyboard to
paste the command into the Script Editor window.
Tip: You can also drag selected text from the Listener and drop it in the Script Editor, or
vice versa.
6. Choose File > Save in the Choose File Name for Save dialog, navigate to your \Scripts directory.
Name your script file box_draw.ms and click Save.
Your script file is saved and the script editor window title changes to “box_draw.ms -
MAXScript.”
You have now saved your first script file. MAXScript uses the .ms extension for script files. It is good
general practice to save all of your script files into the scripts directory.
To load a script:
If you want to study a script before running it, open it first:
1. In the MAXScript rollout, click the Open Script button.
2. Select the script you want to study and click Open.
The Script Editor window opens. It shows the text of the script you selected. You can now read
the commands and see if you get an understanding of what the script might do when you run it.
To run a script:
1. In the MAXScript rollout, click the Run Script button.
The Choose Editor File dialog appears.
2. Select the script file you want to run, and click Open.
MAXScript immediately carries out the commands that are contained in the script file.
MAXScript executes the current command line and reflects the outcome in the Listener window
and, if appropriate, in the user interface.
3. Move the cursor to the next command line or select the next block of code from the script. Press
the number pad ENTER key again, and so on.
From here on, step through other scripts and take note of the effects. Most of the script files included
with 3ds max are very well commented and include a description about the scripts purpose. For
more information about using script files, see the Running Scripts (p. xlix) topic in the MAXScript
Reference.
As with any computer language, MAXScript features a number of lexical tokens, corresponding to
the words and numbers and punctuation that are the building blocks of English. Tokens fall into
several categories:
• Reserved ‘keywords’ that typically introduce clauses in the language, such as if, for, and
function.
• Punctuation marks and symbols that separate or group clauses or specify math operators, etc.
• Reserved global variables containing 3ds max system global variables and MAXScript predefined
global variables.
The following list of topics contains information about the above types of tokens and their syntax:
Language Reserved Keywords (p. 625)
Punctuation and Symbols (p. 627)
Reserved Global Variables (p. 628)
In order for MAXScript to easily identify the various portions of the if expression, the words if,
then and else are reserved keywords and can not be used as variable names or identifiers. So, for
example, you cannot declare a variable or function called if. The following table lists all MAXScript
reserved keywords. Click a reserved keyword to go to a description of its usage. In some cases, a
keyword may have more additional meanings, depending on its context. This information is also
summarized in the MAXScript Grammar (p. 1681) topic.
626 Chapter 3 | Reserved Keywords, Symbols, Punctuation and Variables
Reserved Keywords
about about
and Logical_Expressions
animate animate
as value_common_properties_operators_and_methods
at at_time
by For_Loop
case Case_Expression
catch Try_Expression
collect For_Loop
continue Skipping_Loop_Iterations
coordsys coordsys
do While_and_Do_Loops
else If_Expression
exitv Loop_Exit
fn Creating_Functions
for For_Loop
from
function Creating_Functions
global Scope_of_Variables
if If_Expression
in For_Loop
local Scope_of_Variables
macroscript Defining_Macro_Scripts
mapped Creating_Functions
max MAX_Commands
not Logical_Expressions
of Case_Expression
off Predefined_Globals
on Rollout_Clauses
or Logical_Expressions
parameters Scripted_Plugin_Clauses
persistent Persistent_Global_Variables
plugin Scripted_Plugins
rcmenu Scripted_Right_Click_Menus
return The_Return_Expression
rollout Utility_Clauses
Punctuation and Symbols 627
set Sticky_Contexts
struct Structure_Definition
then If_Expression
throw Try_Expression
to For_Loop
tool Scripted_Mouse_Tools
try Try_Expression
undo undo
utility Scripted_Utilities
when Change_Handlers_and_When_Constructs
where For_Loop
while While_and_Do_Loops
with Loop_Exit
( Block_Expressions
) Block_Expressions
+ Math_Expressions
* Math_Expressions
- Math_Expressions
/ Math_Expressions
^ Math_Expressions
+= Math_Assignment
-= Math_Assignment
*= Math_Assignment
/= Math_Assignment
-- Source_Code_Layout_and_Continuation_Lines
= Math_Assignment
; Source_Code_Layout_and_Continuation_Lines
<eol>
628 Chapter 3 | Reserved Keywords, Symbols, Punctuation and Variables
,
[ 2D_and_3D_Point_Literals
] 2D_and_3D_Point_Literals
: Function_Calls
‘ Names
&
.
{ BitArray_Values
} BitArray_Values
# Array_Values
== Logical_Expressions
!= Logical_Expressions
< Logical_Expressions
> Logical_Expressions
>= Logical_Expressions
<= Logical_Expressions
? Using_the_?_Symbol
$ Pathname_Literals
... Pathname_Literals
.. BitArray_Values
\ Source_Code_Layout_and_Continuation_Lines
See Also
Predefined Globals (p. 629)
3ds max System Globals (p. 630)
MAXScript System Globals (p. 640)
Variables – Assignment and Scope (p. 643)
Predefined Globals 629
Predefined Globals
The predefined global variables contain special values that are frequently used in scripts. These
variables are read-only.
true, false
Boolean values. Can be used for testing the results of comparisons and for state tests.
on, off
Synonyms for true and false, sometimes easier to read in state accesses.
pi, e
Float values that contain the standard mathematical constants’ values. They are equivalent
to 3.1415926535 and 2.718281828, respectively.
red, green, blue, white, black, orange, yellow, brown, gray
A predefined set of useful Color values.
x_axis, y_axis, z_axis
Point3 values that define normal vectors for the 3 major axes. They are equivalent to
[1, 0, 0], [0, 1, 0], and [0, 0, 1], respectively.
ok
A void value returned by some functions or expressions that don’t have a meaningful
value to return.
undefined
The initial value of all variables and array elements. MAXScript generates an error if you
try to perform any operation on the undefined value, except for checking to see if some
value is equal to it or not:
if a == undefined then print “oh, oh”
if b != undefined then print “whew!”
unsupplied
The initial value of all function keyword arguments. Keyword arguments are optional
arguments to functions. If a keyword argument is not supplied by the function caller and
the function definition does not specify a default value, MAXScript initializes the keyword
argument to unsupplied. You can test for this value to see whether a caller has supplied a
particular keyword. For more details, see the Function Calls (p. 675) topic.
dontcollect
This value is used in for loops to signal that the value is not to be collected. See the For
Loop (p. 694) topic for details.
630 Chapter 3 | Reserved Keywords, Symbols, Punctuation and Variables
backgroundImageFileName
Lets you get and set a String value that defines the viewport background image bitmap file
name. This variable contains the corresponding bitmap file name set in the Viewport
Background dialog. See Viewport Background Images (p. 1586).
cui.commandPanelOpen
Lets you get and set whether the command panel is displayed. A Boolean value - true if
the command panel is displayed, false if not displayed. See Command Panels (p. 1571).
currentMaterialLibrary
Contains a virtual array of materials and root level maps corresponding to the currently
opened material library. You can get library materials via array indexing and iterate over
them in a for loop. The array can be indexed by number, or by name or string to select by
material name. This variable is read-only. See MaterialLibrary Values (p. 795).
displayGamma
fileInGamma
fileOutGamma
Lets you get and set Float values that define the gamma preference settings. They contain
the corresponding values set in the Gamma tab of the Preferences dialog. You could use
these global variables to establish gamma for a MAXScript-created bitmap, for example:
b = bitmap 320 240 gamma:displayGamma
render camera:c to:b
This would cause the rendered bitmap to display using the current displays gamma setting
if used as a rollout bitmap or button image.
displaySafeFrames
Lets you get and set whether Show Safe Frames is on for the active viewport. A Boolean
value - true if Show Safe Frames is on, false if off.
environmentMap
Lets you get and set a TextureMap value that defines the global rendering environment
(Rendering > Environment) environment map. See Working with 3ds max Atmospherics
(p. 1345).
flyOffTime
Lets you get and set an Integer value that defines the time in milliseconds the user must
hold down on a flyout before the flyout is activated. This variable contains the
corresponding value set in the General tab of the Preferences dialog.
frameRate
Lets you get and set an Integer value that defines the current scene frame rate in frames-
per-second. This variable contains the corresponding value set in the Time Configuration
dialog. See Time Configuration Dialog (p. 1616).
globalTracks
Contains a MAXTVNode value that defines the top-level Global Tracks node in Track View.
This variable is read-only. See Track View Nodes (p. 1382).
632 Chapter 3 | Reserved Keywords, Symbols, Punctuation and Variables
hardwareLockID
Contains an Integer value that defines the 3ds max hardware lock ID. This variable is
read-only.
hotspotAngleSeparation
Contains a Float value that defines the Hot Spot/FallOff Angle Separation value. This
variable contains the corresponding value set in the Rendering tab of the Preferences
dialog. This variable is read-only.
keyboard.shiftPressed
keyboard.controlPressed
keyboard.altPressed
These variables access the current state of the keyboard shift keys and return true or
false depending on the pressed state of the key at the time the variable is read and are
read-only variables.
lightTintColor
Lets you get and set a Color value that defines the global rendering environment
(Rendering > Environment) Global Lighting Tint color. See Working with 3ds max
Atmospherics (p. 1345).
lightTintColorController
Lets you get and set a Controller value that defines the global rendering environment
(Rendering > Environment) Global Lighting Tint color controller. See Working with
3ds max Atmospherics (p. 1345).
lightLevel
Lets you get and set a Float value that defines the global rendering environment
(Rendering > Environment) Global Lighting Tint Level. See Working with 3ds max
Atmospherics (p. 1345).
lightLevelController
Lets you get and set a Controller value that defines the global rendering environment
(Rendering > Environment) Global Lighting Tint Level controller. See Working with
3ds max Atmospherics (p. 1345).
listener
Read only system global - listener edit window <WindowStream> value
localTime
Contains a String value that defines the current local date and time. This variable is read-
only. An example of the value stored in localtime is:
s = localTime
“4/14/97 10:24:57 AM”
The format of this string is controlled by the date format selected in the main Windows
Regional Settings control panel.
logsystem.quietmode
Lets you get and set whether error logging quiet mode is enabled. A Boolean value set to
true when you do not want error messages from the renderer to bring up dialog boxes. If
set to false, error messages from the renderer will bring up dialog boxes. 3ds max sets the
3ds max System Globals 633
preferences.constantReferenceSystem
Lets you get and set whether to use the same coordinate system for the Move, Rotate, and
Scale tools in the 3ds max toolbar. A Boolean value - true if Constant is on, false if off.
This variable matches the Constant check box in the General page of Customize >
Preferences.
preferences.flyOffTime
Lets you get and set an Integer value that defines the time in milliseconds the user must
hold down on a flyout before the flyout is activated. This variable contains the
corresponding value set in the General page of Customize > Preferences.
preferences.maximumGBufferLayers
Lets you get and set an Integer value that specifies the maximum number of g-buffer layers
generated during a render.
preferences.spinnerWrap
Lets you get and set a Boolean value that defines whether cursor wrapping is limited to an
area close to the spinner when you drag to adjust spinner value. This variable contains the
corresponding value set in the General page of Customize > Preferences.
preferences.useLargeVertexDots
Lets you get and set whether to use small or large dots when representing vertices as dots.
A Boolean value set to true if you when using dots to represent vertices and a large size is
desired. The value of this variable only has effect when UseVertexDots is set to true.
This variable contains the corresponding value set in the Viewports page of Customize >
Preferences.
preferences.useTransformGizmos
Lets you get and set whether to use the Transform Gizmos. A Boolean value - true if on,
false if off. This variable contains the corresponding value set in the Viewports page of
Customize > Preferences.
preferences.useVertexDots
Lets you get and set whether to represent vertices as dots. A Boolean value set to true
when you want to use dots as the representation of the vertices in a mesh. If set to false,
ticks will be used. This variable contains the corresponding value set in the Viewports page
of Customize > Preferences.
realTimePlayback
Lets you get and set whether to playback in real time mode. This variable contains the
corresponding value set in the Time Configuration dialog. A Boolean value - true if Real
Time is on, false if off. See Time Configuration Dialog (p. 1616).
renderer
Lets you switch between the draft and production renderers and test which one is active. A
Name value that accepts and contains the values #draft or #production, for example:
if renderer == #draft then ...
renderer = #production
render camera:c ...
See Controlling the Renderer (p. 1664) and Render Scene Dialog (p. 1611).
3ds max System Globals 635
renderDisplacements
Lets you get and set whether to perform displacement mapping during a render. A Boolean
value - true if displacement mapping is to be performed, false if not.
renderEffects
Lets you get and set whether to perform Render Effects after a scene render. A Boolean
value - true if Render Effects are to be performed, false if not.
renderHeight
Lets you get and set an Integer value that defines the output size height for the active
renderer. This variable contains the corresponding value set in the Render Scene dialog.
See Render Scene Dialog (p. 1611).
renderPixelAspect
Lets you get and set an Integer value that defines the output pixel aspect for the active
renderer. This variable contains the corresponding value set in the Render Scene dialog.
renderWidth
Lets you get and set an Integer value that defines the output size width for the active
renderer. This variable contains the corresponding value set in the Render Scene dialog.
See Render Scene Dialog (p. 1611).
rendOutputFilename
Lets you get and set a String value that defines the output file name for the active renderer.
This variable contains the corresponding value set in the Render Scene dialog. If this
global variable is set to ““ the Save File check box in the Render Scene dialog is unchecked.
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 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.
sceneMaterials
Contains a virtual array of materials and root level maps corresponding to the materials
and root level maps present in the scene. You can get scene materials and root level maps
via array indexing and iterate over them in a for loop. The array can be indexed by
number, or by name or string to select by material or root level map name. This variable is
read-only. See MaterialLibrary Values (p. 795).
scriptsPath
Contains a String value that defines the full directory path to the current Scripts directory.
This variable is read-only.
636 Chapter 3 | Reserved Keywords, Symbols, Punctuation and Variables
selectionSets
Contains a virtual array of all the current named node selection sets in the Named
Selection Set drop-down list on the 3ds max toolbar. You can get named selection sets via
array indexing and iterate over them in a for loop. The array can be indexed by number,
or by name or string to select by named selection sets. You can change, add and delete
Named Selection Sets by using the standard array methods on the selectionSets array.
See the SelectionSetArray Values (p. 783) topic.
showEndResult
Lets you get and set the state of the Show End Result Toggle icon in the Modify panel. A
Boolean Value – true if Show End Result is on, false if off. See the Modify Panel (p. 1572)
topic.
skipRenderedFrames
Lets you get and set whether to skip rendered frames during a render.
A Boolean Value – true if rendered frames are to be skipped, false if not.
sliderTime
Lets you get and set a Time value that defines the time associated with the 3ds max time
slider. See Time Control (p. 1580).
snapMode.active
Lets you get and set a Boolean value defining the Snap toggle state - on (true) or off
(false). This global variable is not available in 3ds max. See Status Bar Buttons (p. 1579).
snapMode.type
Lets you get and set a Name value defining whether 2D (#2D), 2.5D (#2_5D), or 3D (#3D) is
the current snap type. This global variable is not available in 3ds max. See Status Bar
Buttons (p. 1579).
subObjectLevel
Lets you get and set the sub-object level in the Modify panel if it is open. An Integer value
of zero or greater up to the number of sub-object levels supported by the currently open
modifier, typically in the order shown in the Sub-Object drop-down list. A
subObjectLevel of 0 means sub-object mode is off. If the Modify panel is not open or
sub-object level setting not permitted in the current modifier, the global contains the
value undefined. Use the numSubObjectLevels global variable to access the maximum
valid subObjectlevel value. See the Modify Panel (p. 1572) topic. For example:
b=box() -- create a box
em=edit_mesh() -- create an Edit Mesh modifier
addModifier $box01 em -- add edit mesh mod
max modify mode -- open mod panel
select $box01 -- select object box01
print subObjectLevel -- print the current subobject level
subObjectLevel = 2 -- set sub-object level to Edge
sysInfo.DesktopSize
A read only variable to get the desktop size in pixels as a <point2> value.
sysInfo.DesktopBPP
A read only variable to get the desktop color depth in bits per pixel as an <integer> value.
3ds max System Globals 637
sysInfo.MAXPriority
Get/set the 3ds max process priority as a <name> value. Valid priority values are #high,
#normal, and #low
ticksPerFrame
Contains an Integer value defining the system time resolution. This variable is read-only.
timeConfiguration.playActiveOnly
Lets you get and set whether to playback the active viewport only. This variable contains
the corresponding value set in the Time Configuration dialog. A Boolean value - true if
Active Viewport Only is on, false if off. See Time Configuration Dialog (p. 1616).
timeConfiguration.realTimePlayback
Lets you get and set whether to playback in real time mode. This variable contains the
corresponding value set in the Time Configuration dialog. A Boolean value - true if Real
Time is on, false if off. See Time Configuration Dialog (p. 1616).
timeConfiguration.useTrackBar
Lets you get and set the state of the Time Configuration dialog ‘Key Steps/Use TrackBar’
check box. A Boolean value – true if checked, false if not. See Time Configuration Dialog
(p. 1616).
trackbar.filter
Lets get and set the filter specifying which types of keys to show in the Trackbar. A Name
value - the valid values are: #all, #TMOnly, #currentTM, #object, and #mat.
trackbar.visible
Lets you get and set whether the trackbar is visible. A Boolean value - true if the trackbar
is visible, false if invisible
trackViewNodes
Contains a MAXTVNode value that defines top-level World node in Track View. This
variable is read-only. See Track View Nodes (p. 1382).
units.DisplayType
Get/set the current unit display type as a <name>. Valid unit display types are:
#Generic
#Metric
#US
#custom
units.MetricType
Get/set the current metric unit display type as a <name>. Valid metric unit display
types are:
#Millimeters
#Centimeters
#Meters
#Kilometers
638 Chapter 3 | Reserved Keywords, Symbols, Punctuation and Variables
units.USType
Get/set the current US standard unit display type as a <name>. Valid US standard unit
display types are:
#Frac_In
#Dec_In
#Frac_Ft
#Dec_Ft
#Ft_Frac_In
#Ft_Dec_In
units.USFrac
Get/set the current US fraction display type as a <name>. Valid US fraction display
types are:
#Frac_1_1
#Frac_1_2
#Frac_1_4
#Frac_1_8
#Frac_1_10
#Frac_1_16
#Frac_1_32
#Frac_1_64
#Frac_1_100
units.CustomName
Get/set the current custom unit name as a <string>
units.CustomValue
Get/set the current custom unit value as a <float>
units.CustomUnit
Get/set the current custom unit type as a <name>. Valid custom unit display types are:
units.SystemScale
Get/set the current system unit scale value as a <float>. This is the value shown in
Preference Settings, General tab, System Unit Scale group.
units.SystemType
Get/set the current system unit scale type as a <name>. This is the unit shown in
Preference Settings, General tab, System Unit Scale group. Valid system unit scale
types are:
#Inches
#Feet
#Miles
#Millimeters
#Centimeters
#Meters
#Kilometers
3ds max System Globals 639
useEnvironmentMap
Lets you get and set the global rendering environment (Rendering > Environment) Use
Map value. A Boolean value – true if Use Map is on, false if off. See Working with 3ds max
Atmospherics (p. 1345).
videoPostTracks
Contains a MAXTVNode value that defines the top-level Video Post Track View node. This
variable is read-only. See Track View Nodes (p. 1382). This variable contains the value
undefined in 3D Studio VIZ.
viewport.activeViewport
Lets you get and set the index of the active viewport. See Accessing Active Viewport Info,
Type, and Transforms (p. 1581).
viewport.numViews
Contains the number of viewports in the current viewport layout. This variable is
read-only. See Accessing Active Viewport Info, Type, and Transforms (p. 1581).
The following 3ds max system global variables are specific to 3ds max’s default scanline A-Buffer
renderer. These variables return undefined if the current renderer is not 3ds max’s default scanline
A-Buffer renderer.
scanlineRender.antiAliasFilter
Lets you get and set the anti-aliasing filter. For a list of all of the anti-aliasing filters you
can say:
showClass “*:filter*”
For example:
scanlineRender.antiAliasFilter = quadratic()
The anti-aliasing filters and their parameters are described in the 3ds max Scanline A-Buffer
Renderer Anti-Aliasing Filters (p. 1614) topic.
scanlineRender.antiAliasFilterSize
Contains a float value that defines the anti-aliasing filter size.
scanlineRender.enablePixelSampler
Lets you enables and disables global super sampling. A Boolean value - true if Disable all
Samplers is off, false if on.
640 Chapter 3 | Reserved Keywords, Symbols, Punctuation and Variables
heapSize
Lets you get and set an Integer value defining the size of the heap currently allocated to
MAXScript. MAXScript carves its own working memory (called a heap) out of the memory
that 3ds max has allocated. You can add to this heap at any time by assigning the new size
to this system variable, as in:
heapSize += 1000000 -- another meg please
See also the Memory Allocation and Garbage Collection (p. 655) topic.
inputTextColor
Lets you get and set a Color value defining the color of typed input text in Listener.
messageTextColor
Lets you get and set a Color value defining the color of error message text in Listener.
outputTextColor
Lets you get and set a Color value defining the color of output text in Listener.
options.oldPrintStyles
The printed form of all basic data value types, except for BigArray, are directly readable by
the readValue() and readExpr() functions, making it simpler to read back in values
printed to a file by MAXScript. If the pre-3ds max 4 print forms are required for
compatibility with existing scripts, you can set this variable to true.
stackLimit
The stack is region of reserved memory in which MAXScript temporarily stores status data
such as procedure and function call return addresses, passed parameters, and local
variables. This defaults to 1Mb, but you may have certain scripts that contain recursive
algorithms that will exceed this limit and so generate a runtime error. You can assign to
the stackLimit variable to increase the stack size available.
stackLimit *= 2 -- double the stack
?
A special variable that is used only in the context of the MAXScript Listener. This variable
contains the result of the last expression evaluated in the Listener. For more details, see the
Using the ‘?’ Symbol (p. xli) topic.
642 Chapter 3 | Reserved Keywords, Symbols, Punctuation and Variables
Chapter 4: Variables - Assignment and Scope
A variable is a user-defined container to which you can assign a value, and then later retrieve the
value. A variable is identified by its name, and anywhere the variable name is referenced, the value
stored in that variable is used.
In this section, the various attributes and considerations associated with variables are described.
See also
Variable Assignment (p. 643)
Scope of Variables (p. 646)
Persistent Global Variables (p. 651)
Type-Free Variables (p. 653)
Reference Assignment (p. 653)
Memory Allocation and Garbage Collection (p. 655)
Manual Garbage Collection (p. 656)
Variable Assignment
The syntax for general assignment, <assignment>, is:
<destination> = <expr>
where <destination> can be one of:
<var_name>
<property>
<array_index>
Assignment to Variables
A variable is identified with a MAXScript <var_name>, as described in the Names (p. 657) topic. If
<destination> is a var_name, it identifies the variable to be assigned a value, as shown in the
following examples:
x = 2 + 2 * 3 -- assign to variable x
y = [1, 2, 3] + pos -- assign to variable y
z = #(1, 2, “foo”, “bar”) -- assign to variable z
z = #oops -- oops, changed my mind
Assignment to Accessors
If <destination> is a <property> or an <array_index>, the assignment is to an accessor.
Accessors are constructs used to access the components in compound values, such as arrays and
3D points. There are two kinds of accessors corresponding to the two kinds of compound values in
MAXScript:
• The component values are arranged in an indexable sequence, as in arrays or strings.
• The compound value contains a fixed set of named components, as with 3D points and time
intervals.
All 3ds max objects, such as boxes, spheres, bend modifiers, or bitmap textures are treated as
compound values in this sense. All their parameters, such as height and angle, or map file name, are
accessed as named components. In MAXScript, these named components are referred to as properties.
For more information, see the Properties, Methods, Operators, and Literals (p. lxiv) topic.
Accessors have one of two forms, an <array_index>:
<operand> [ <expr> ] -- an indexed element
or a <property>:
<operand>.<var_name> -- a named property – property var_name of value in operand
Accessors are evaluated left-to-right. The first example evaluates the i‘th element of my_things,
which is presumably a nested array or an array of strings, before yielding the j‘th element of that
element.
The second example retrieves an object from an array of my_objects, then its target, then the
position of the target (a 3D point), and finally the x coordinate of that point.
An <operand> can also be a block-expression, allowing you to compute the target object to be
accessed. For example:
(instance myNode).pos=myNode.parent.pos
Create an instance of the node whose value is stored in variable myNode, and set its
position to the position of the myNode‘s parent object.
(find_table “foo”)[n - 2] = “fred”
Call function find_table with a parameter value of “foo”. The return value from the
function is presumably an array. Set element n-2 of this array to the value “fred”.
The named properties defined for the MAXScript values and classes are documented with the value
and class descriptions.
Order of Evaluation
In an assignment, <expr> is evaluated before <destination>, as can be seen in the following
example:
Script:
a=#() -- create an empty array to play with
a[(print “in <destination>“;1)]=(print “in <expr>“;10)
Output:
#() -- result line 1
“in <expr>“ -- output from <expr> side of assignment
“in <destination>“ -- output from <destination> side of assignment
10 -- result line 2
Assignment in MAXScript is itself an expression and yields the value just assigned. Therefore, you
can use assignments inside other expressions or cascade assignments, as in:
x = y = z = 0
#(1, 2, a = [0,0,1], 4)
646 Chapter 4 | Variables - Assignment and Scope
Scope of Variables
Variables have an attribute called scope, which determines where in MAXScript code a variable can
be accessed. MAXScript has two kinds of variable scope, global and local. Global variables are visible
in all running MAXScript code and hold their values until you exit 3ds max. Local variables are
directly visible to code only in the lexical scope currently in effect, and hold their values only as long
as the current scope is active. Once a scope is no longer active, you can no longer access the contents
of a variable local to that scope. This is similar to how most modern programming languages
implement variables. The conditions under which MAXScript creates a new scope are
described next.
MAXScript provides language constructs used to explicitly declare and initialize both global and
local variables. The syntax for variable declaration, <variable_decls>, is as follows:
( local | global ) <decl> { , <decl> }
where <decl> is defined as:
<var_name> [ = <expr> ] -- name and optional initial value
Examples:
global baz -- initialized to ‘undefined’
global foo=10, initialized=false -- initialized globals
local x = 1, -- continued on several lines
y = 2,
z = sqrt(123.7)
As mentioned above, local variables hold their values as long as that scope is active. In nested scopes,
this is usually a very short period – it starts when a function or loop or block expression runs and
ends when it exits. Each time the scope is entered at runtime, a new set of locals is created and then
retired when the scope is exited.
In certain situations, however, the top-level scope can remains active for extended periods and so
the locals declared at that top-level hold their values for that extended period. In particular, top-level
locals declared in scripted rollouts, utilities, plug-ins, script controllers and Macro Scripts hold their
values for as long as the rollout, utility, plug-in, or Macro Script exists. Typically, they remain in
existence until you redefine them, so for example when you define a Macro Script and run it for the
first time, the top-level scope is created and remains active over any number of subsequent
executions unless you redefine the Macro Script. At this point, the existing top-level scope is retired
and a fresh one (along with its top-level locals) is created when you next execute the Macro Script.
This lets you use top-level locals in these constructs as a kind of private global; the values they hold
remain in place over many executions but only code in that construct can see the variable and so it
does not conflict with other globals.
Note that in scripted plug-ins, a separate copy of the top-level local scope is created for each instance
of the plugin and this scope remains active while that instance remains in existence up until the end
of the current 3ds max session.
Scope of Variables 647
Note:
In 3ds max R2.x, the optional initialization value is applied to global variables only if the declaration
creates a new variable. So, for example, if you ran the following script twice, the value of x in the
second line would be 10 for the first execution, and 20 for the second execution. In 3ds max R3, the
optional initialization value is always applied to global variables.
global x = 10
print x
x=20
If you want to make the global variable initialization conditional in 3ds max R3, use a construct
similar to:
global foo; if foo == undefined do foo = 23
If you do not explicitly declare a variable, and the variable name does not exist at a higher scope,
MAXScript will create the variable the first time you use it and initialize it to hold the special value
undefined. You are not required to explicitly declare a variable, or initialize its value, before you
can use it. Variable names not explicitly declared by one of the previous statements are called
implicitly declared variables. The scope of implicitly declared variables is the MAXScript scope
context currently in effect when the variable is first used. The initial MAXScript scope context is
global, and new scope contexts are opened for the following:
• Top-level open parentheses in a script file or in the Listener
• Start of a function body
• Start of a for loop body
• Start of a utility, rollout, right-click menu, Macro Script, or tool definition
• Start of a rollout, utility, right-click menu, Macro Script, or tool event handler
• Start of a when body
Within these new scopes, newly referenced variables will be implicitly declared as local variables.
Scope contexts are nested, with the scope of a variable explicitly or implicitly declared at one scope
context level extending to all scope contexts below that level. Take for example the following script:
Script:
a=10 -- scope context: global
( b=20 -- new scope context: level 1
for i = 1 to 5 do -- new scope context: level 2
( j=random i a
k=random i b
print (j*a+k*b)
) -- end of scope context: level 2
a=a+b
) -- end of scope context: level 1
print a -- back to global scope context
print k
In this script, variable a is first used in the global scope context, and its scope includes scope contexts
global, level 1, and level 2. Variable b is first used in scope context level 1, so it is implicitly declared
as a local variable and its scope includes scope contexts level 1 and 2. Variables i and j are first used
648 Chapter 4 | Variables - Assignment and Scope
in scope context level 2, and their scope is only scope context level 2. The scope of variable k varies
depending on whether this script has been run before. The first time the script is run, variable k is
first defined at line 5, and its scope is scope context level 2. In line 11, variable k is used again.
Because the variable k defined at line 5 is no longer in scope, a new variable k is defined whose scope
is global. The second time you run the script, at line 5 MAXScript detects variable k already exists
and uses it. So the first time you run the script line 11 will print undefined, and the second time
you run the script line 11 will print the last value calculated at line 5.
Note:
The scope of the variable used as a for loop counter (variable i in the above script) is a special case.
The for loop counter variable’s scope is always the scope context created for the for loop. This is
true even if the for loop counter variable’s name has already been implicitly or explicitly declared
at a higher scope context level.
When you explicitly declare a local variable, you can reuse the same name as a variable at a higher
scope context level. If you do this, the newly declared local variable hides the outer variables with
the same name. Any reference to that variable name later in the local variable’s scope refers to the
new local variable. At the end of the local variable’s scope, the next outer variable becomes visible
again. This visibility scheme is called lexical scoping. An example of lexical scoping is shown in the
following script.
Script:
global foo = 23, x = 20 -- explicit declaration of foo and x,
-- scope is global
y = 10 -- implicit declaration of y,
-- scope is global
format “context level global: foo= %\n” foo
if x > y then
( -- top-level open parentheses - new
-- scope is created
local baz = foo + 1 -- uses the global foo
local foo = y - 1 -- declares 1st local foo, hides global foo
format “context level 1: foo= %\n” foo
b=box() -- b implicitly declared as local
b.pos.x = foo -- uses 1st local foo
if (foo > 0) then
(
local a
local foo = y - x -- a nested 2nd local foo, hides 1st local
format “ context level 2: foo= %\n” foo
a = sin foo -- uses 2nd local foo
format “a= %\n” a
) -- leave scope
b.pos.y = foo - 1.5 -- back to 1st local foo
format “context level 1: foo= %\n” foo
) -- leave scope
-- b, baz and foo no longer in scope
format “context level global: foo= %\n” foo -- back to global foo
Scope of Variables 649
Output:
20 -- result of line 1
10 -- result of line 3
context level global - foo= 23 -- output from line 5
OK -- result of line 5
context level 1: foo= 9 -- output from line 11
context level 2: foo= -10 -- output from line 18
a= -0.173648 -- output from line 20
context level 1: foo= -10 -- output from line 23
OK -- result of if expression lines 6 to 24
context level global: foo= 23 -- output from line 26
OK -- result of line 26
This might seem a strange way of over-using a single variable name, but in large programs, these
scoping rules can be useful. For example, you may add a new user-interface item and its handlers to
a utility script. By explicitly declaring the variables used in the handlers as local, you ensure these
variables are independent of any preexisting variables with the same names in the remainder of the
script.
When writing scripts, it is good programming practice to explicitly declare your local and global
variables. Implicit declaration is provided as a short-hand, typically used when working in the
Listener interactively or developing short scripts. When developing extended scripts, explicitly
declaring variables can reduce errors and improve readability of the code. It is also recommend that
you declare as local all variables unless you really want them to be global variables. There are several
reasons for this practice:
• All the variable names used in the block or function will be together, which makes it easier to
find the variable names and helps prevent using incorrect names in the script.
• If more than one script is executed at the same time (for example, you are running a scripted
utility and have a scripted controller in the scene) and both scripts use the same global variable
name, the two scripts can interfere with one another. This can cause apparently random failures
of one or both scripts.
• You are sure you are using the correct variable in the event that a variable with the same name
has already been declared at a higher scope, and you won’t inadvertently change the higher-
level variable’s value.
• Values of variables explicitly defined as local are displayed in error call stack trace-backs.
• In 3ds max R2.5, if a 3ds max class, a MAXScript method, or a MAXScript read-only global
variable has the same name as an implicitly declared local variable, a MAXScript runtime error
will be generated if an assignment to that variable name occurs. Since the variable name already
existed with a global scope, an implicitly declared local variable was not created. Since one or
more new 3ds max classes will be created by any third party plug-ins the user has loaded, you
were not be able to tell ahead of time if a variable name was a global variable name. In
3ds max R3, if the MAXScript compiler detects that the first reference to such a variable is an
assignment, it will implicitly declare a local variable, rather than leaving it as a reference to a
read-only system global. For example, executing the following expression in 3ds max R2.5
would result in a value of Box, since Box is a 3ds max object class. In 3ds R3, MAXScript detects
650 Chapter 4 | Variables - Assignment and Scope
that the first use of variable box is an assignment and creates an implicitly declared local
variable box. The result of this expression in 3ds max R3 is the value undefined.
(if false do box=10;box)
In the following script, an error was introduced by using undefined variable k in line 7. In the
output, the error call stack trace-back shows the value for variable b in function afunc and in the
block-expression calling afunc.
Script:
fn afunc =
(
local b
b = box()
for i in 1 to 10 do
for j in 1 to 10 do
instance b pos:[i*20,j*30,30*sin(k*36)]
)
--
(
global c=10
local b
b=”hello”
afunc()
)
Output:
afunc()
-- Error occurred in j loop
-- Frame:
-- k: undefined
-- j: 1
-- called in i loop
-- Frame:
-- i: 1
-- called in afunc()
-- Frame:
-- b: $Box:Box102 @ [0.000000,0.000000,0.000000]
-- called in <block>()
-- Frame:
-- b: “hello”
-- No ““*”“ function for undefined
OK
If the same script is run with lines 3 and 12 removed, the following output is generated. Because
function afunc and the block-expression are in different MAXScript scope contexts, variable b is
implicitly declared as local in each and contain different values. However, because they were
implicitly defined, they are not included in the error call stack trace-back.
Persistent Global Variables 651
Output:
afunc()
-- Error occurred in j loop
-- Frame:
-- k: undefined
-- j: 1
-- called in i loop
-- Frame:
-- i: 1
-- called in afunc()
-- Frame:
-- No ““*”“ function for undefined
OK
See also
Type-Free Variables (p. 653)
Reference Assignment (p. 653)
Visibility of Locals, Functions, Structures and User-Interface Items in Rollout Code (p. 1478)
Accessing Locals and Other Items in a Rollout from External Code (p. 1480)
and saved. If needed, you can install persistent globals in each new file in a #filePreSave callback.
See the General Event Callback Mechanism (p. 29) topic for more information.
The following methods are used to show and delete persistent globals variables:
persistents.show()
Displays a list of persistent globals and their value.
persistents.remove <var_name>
Removes the named persistent global from the persistent global pool. The variable remains
as a global variable and retains its value.
persistents.removeAll()
Removes all persistent globals from the persistent global pool. The variables remain as
global variables and retain their value.
Script:
a=”Hello world”
persistent global a
persistent global b=box()
persistents.show()
persistents.remove #a
persistents.removeall()
a
b
Output:
“Hello world”
OK
$Box:Box02 @ [0.000000,0.000000,0.000000]
a: “Hello world”
b: $Box:Box02 @ [0.000000,0.000000,0.000000]
OK
OK
OK
“Hello world”
$Box:Box02 @ [0.000000,0.000000,0.000000]
Note:
If a persistent global contains a MAXWrapper value, but the class instance is not in the scene, that
value is not stored/restored on a file save/load.
Example:
-- persistents - node only
persistent global global_array = #()
global_array[1] = b= box()
global_array[2] = bm= bend()
global_array[3] = sm= standard()
global_array[4] = fog()
global_array[5] = area()
global_array[6] = bezier_float()
global_array[7] = br= bricks()
global_array[8] = lookat()
Type-Free Variables 653
global_array[9] = blur()
global_array[10] = MapScaler()
--b.material=sm
--addmodifier b bm
--sm.diffusemap=br
persistents.show()
max hold
max fetch
persistents.show()
Remarks:
Only the box is in the array after running this script. If the commented lines are run, the material,
modifier, and map are also in the array. MAXScript does not do a full reference-tree dump when it
outputs its persistent variables, it just outputs RefIDs for MAX objects and so depends on them being
dumped as references by the main file save code.
Type-Free Variables
Variables can hold any type of value, and the value type they hold can change from assignment to
assignment. For example, you can store a point3 value, then a float value, and then an array to the
same variable. The variables in MAXScript are known as type-free variables, unlike variables in C or
Java, which can only hold values of a particular declared type. This freedom makes scripting simpler
and more exploratory.
As well as being type-free, variables in MAXScript are also type-safe. This means you cannot perform
the wrong operation on a value in a variable, as shown in the following example, where MAXScript
prints an error message following the invalid operation:
x = $Box01.position -- a point3 value
x = “foo” -- a string value
x = x + 2 -- try to add a number to a string
Error: Unable to convert 2 to type String
Reference Assignment
MAXScript uses a type of assignment called reference assignment. When you create a value, for
example by writing a literal, the memory for that value is allocated and a pointer or reference to the
value is placed into the variable rather than the value itself. If you assign that variable’s value to
another variable, the reference to that value’s memory is placed in the new variable. The same
applies to assigning a variable’s value to an array element or passing it as a function call argument;
in all cases the reference is assigned or passed. When you assign a new value to a variable or when a
variable goes out of scope, the reference that the variable contained is dropped. When your program
has dropped all references to a value’s memory, that memory becomes eligible for reclamation.
This is in contrast to value assignment in which a copy of the whole value’s memory is made and
assigned. Value assignment has one advantage over reference assignment, namely that every time a
variable or an array element is re-assigned, the old value’s memory space can be immediately
654 Chapter 4 | Variables - Assignment and Scope
reclaimed because the old value is unique and nothing else can be referring to it. With reference
assignment, the system cannot reclaim the original value’s memory space, because other variables
may still point to the same value.
Some scripting languages use a copy-based approach, such as HyperCard’s HyperTalk, but its
inefficiency as well as some value sharing problems make it inappropriate for MAXScript. This
creates the task of reclaiming memory in MAXScript. Programming languages such as C or Pascal
require that the programmer explicitly reclaim a value’s memory when it is no longer needed, and
this is one of the most difficult parts of programming in those languages. Recent variants like Java
and some advanced languages like Lisp and Smalltalk provide automatic memory reclamation.
MAXScript also provides this and it is described in the Memory Allocation and Garbage Collection
(p. 655) topic.
If you assign a variable’s value to another variable, the reference to that value’s memory is placed in
the new variable. Thus, both variables are actually referencing the exact same value. If you assign a
new value to one of the variables, that variable will contain a reference to the new value, and the
other variable will contain a reference to the old value. Normally this is the desired behavior, as you
don’t want both variables to reference the new value. However, a complication occurs if a compound
value, like a point3 or array, is referenced by more than one variable, and you assign a new value to
a component of the compound value. When you assign a value to a component of a compound
value, a new compound value is not created. Therefore any variables that reference the compound
value will still point to the same value, and will “see” the changed component value. Examples of
this behavior are shown in the following script:
Script:
(
a=”hello world” -- create a string value, put reference in a
b=a -- put string’s reference in b
format “a=%; b=%\n” a b -- and print their values
b=”thanks for the fish” -- create a string value, put reference in b
format “a=%; b=%\n” a b -- print values – they are different
b=a -- put string’s reference from a in b
a[1]=”J” -- change a component value
format “a=%; b=%\n” a b -- print values – they are the same
a=b=[10,20,30] -- assign a point3 value reference to a and b
format “a=%; b=%\n” a b -- and print their values
a.x=-100 -- change a component value
format “a=%; b=%\n” a b -- print values – they are the same
)
Output:
a=hello world; b=hello world
a=hello world; b=thanks for the fish
a=Jello world; b=Jello world
a=[10,20,30]; b=[10,20,30]
a=[-100,20,30]; b=[-100,20,30]
OK
Memory Allocation and Garbage Collection 655
In some cases, this behavior is the desired behavior, and in other cases it is not. For those cases where
it is not the desired behavior, a copy method is defined for most value types that will create a
separate copy of a value. In some cases, such as arrays and structures, the value itself may contain
compound values. The copy made is what is called a shallow copy - only a copy of the upper-level
value itself (that is, the array) is created. Copies aren’t made of compound values in the value (that
is, the elements of the array).
Names
Names are used in MAXScript to identify variables, functions, parameters, properties, and so on.
Names start with an alphabetic character or “_” (underscore), and can contain any number of
alphanumeric characters or “_”.
Examples of valid names are:
foo
bar123
this_is_a_very_long_identifier
_heresOneWithStudlyCaps
In contrast to most general purpose programming languages, MAXScript names are not case-
sensitive. For example, the names in the following list refer to the same variable in MAXScript:
BitMapTexture
bitmaptexture
BITMAPtexture
A name in a program is always interpreted as the name of a variable or parameter and it effectively
stands for the current value of that variable or parameter in any expression in which it is used. For
example, consider the following script:
i=10
j=i+5
print j
In this script, i and j are variable names. In the first line, the value 10 is assigned to variable i. In
the second line, the value 5 is added to the value stored in variable i, and then the result is stored
in variable j. In the third line, the value 15 is printed, which is the value stored in variable j.
MAXScript also allows you to work directly with names as values at runtime, as you can with
numbers and strings. To write a name value in MAXScript, you preface the name with a “#”:
#<var_name>
Name values are primarily used for symbolic parameters in function calls, and many of the built-in
functions use them as such. The allowed values specified for symbolic parameters are defined by the
function, and are documented with the function. As an example, consider the setBeforeORT()
function. Its syntax is:
setBeforeORT <controller> <ORT_type_name>
Sets the Out-of-Range (ORT) type for the controller for the time before the first key. The
<ORT_type_name> must be one of the following name values:
#constant
#cycle
#loop
#pingPong
#linear
#relativeRepeat
Name values can also be used as an index in certain Collections (p. 773). For example, the index for
a ModifierArray (p. 794) can be an integer, name, or string:
$loft01.modifiers[#Optimize] -- access modifier on object loft01 called Optimize
See also
Name Values (p. 727)
659
Quoted Names
Names set in single quotes allow you to write names that contain illegal identifier characters, such
as spaces and other punctuation. They are primarily intended for specifying 3ds max object classes
and properties that have special characters in their names.
The form is:
‘<any_char_except_quote>‘ -- for an identifier or property name
#’<any_char_except_quote>‘ -- for a name literal
‘<any_char_except_quote>‘: -- for a keyword parameter label
Examples:
snow ‘starttime(start)’:5
b.’lifetime(life)’
$box01.modifiers[#’FFD 4x4x4’]
Spaces in Names
Because of the large amount of names in 3ds max that include spaces, the underscore character (“_”)
can be used instead of a space in a name. The following is equivalent to the last line of the above
example:
$box01.modifiers[#FFD_4x4x4]
Literal Constants
MAXScript has many built-in data types: numbers, strings, names, arrays, vectors, and matrices, as
well as special data types which store the 3ds max objects such as geometry objects, splines,
materials, modifiers, etc. Some data types have special literal constant forms, where the literal
constant is a value that is keyed directly into your program where it is needed. The syntax of the
literal constant specifies both its value and data type. In MAXScript, the assignment of a literal
constant might look like this:
b=50
In this line, b is the variable name, and 50 is the literal constant of type integer assigned to b. 50 is
a literal constant because you cannot assign a value to 50, and its value cannot be changed.
See also
Number Literals (p. 660)
String Literals (p. 660)
Time Literals (p. 662)
Pathname Literals (p. 662)
2D and 3D Point Literals (p. 665)
Array Literals (p. 666)
660 Chapter 5 | Names, Literal Constants, and Expressions
Number Literals
MAXScript uses two types of numbers:
• single precision floating point
• 32 bit signed integers
These number types correspond to the two number types (Integer and Float) used internally in
3ds max. The syntax for numbers is:
[-]{<digit>}[.{<digit>}[(e | E)[+ | -]{<digit>}+] -- decimal number
0x{<hex_digit>}+ -- hexadecimal number
Examples:
123
123.45
-0.00345
1.0e-6
0x0E
.1
See also
Number Values (p. 717)
String Literals
String literals in MAXScript are one or more characters enclosed in double quotes:
“3ds max”
“October 5th, 1996”
String literals can contain any character except another plain double quote. You can include a
double quote in a string literal, as well as some useful control characters, by using a “\” (backslash)
escape character sequence. The valid escape sequences are:
\“ -- a double quote character
\n -- a newline character
\r -- a carriage return character
\t -- a TAB character
\* -- an asterisk character
\? -- a question mark character
\\ -- a single “\” character
\% -- a percent character
\x{d} -- a hexadecimal character
String Literals 661
Example:
print “foo should be quoted like this: \“foo\“ and a new line: \n”
would output:
“foo should be quoted like this: “foo” and a new line:
“
A “\” character that does not preface one of the specified characters is left as a single backslash.
You can break a string literal into several lines and the line breaks will stay in the string. For example:
“Twas brillig and the slithy tobes
did gyre and gimbol in the wabe
or something like that...”
Example:
str = “Copyright \xa9 1997, FrabWorks, Inc”
would insert a copyright sign ©. Hexadecimal a9 is the code for that symbol.
Running the following script displays in Listener the characters associated with each
hexadecimal code:
Script:
char=”0123456789abcdef”
for i=1 to char.count do
for j=1 to char.count do
( s=execute(”\“\\x”+char[i]+char[j]+”\““)
format “%% %\n” char[i] char[j] s
)
For strings that are used as file names or paths, the “/” character can be used instead of the “\\”.
MAXScript internally interprets the “/” character as a “\” character when used in a file path name
string. An example is:
scene_path = “g:/3dsmax25/scenes” -- specifies file path g:\3dsmax25\scenes
See also
String Values (p. 722)
662 Chapter 5 | Names, Literal Constants, and Expressions
Time Literals
Time is a basic data type in MAXScript. Its semantics are based on animation time in 3ds max, where
you can express time in frames, ticks or normalized time. In 3ds max, time is stored with a resolution
of 4800 ticks per second. The format for a time literal is one of:
[-]{<decimal_number>[m | s | f | t]}+ -- minutes/sec/frames/ticks
[-]{<digit>}:{<digit>}[.{<digit>}] -- SMPTE mins:secs.frame
[-]<decimal_number>n -- active segment normalized time
In the first form, the {...}+ indicates one or more repetitions, so you can string together minutes/
seconds/frames/ticks. If you do this, they must be in the specific minutes/seconds/frames/ticks
order.
The normalized time form is always relative to the current active animation time segment.
Examples:
2.5s -- 2.5 seconds
1m15s -- 1 minute 15 seconds
2m30s5f2t -- 2 minutes 30 seconds 5 frames 2 ticks
125f -- 125 frames
18.25f -- 18.25 frames
1f20t -- 1 frame 20 ticks
2:10.0 -- 2 minutes 10 seconds 0 frames (SMPTE)
0:0.29 -- 29 frames (SMPTE)
0.45n -- 0.45 normalized time (fraction of active segment)
See also
Time Values (p. 751)
Pathname Literals
Names (p. 657) identify entities such as variables and parameters inside the running MAXScript
program. If you want to identify objects by name in the 3ds max scene, you use a pathname.
Pathnames can name a single object in the scene, specify a particular object using a path through
the object hierarchy, or name sets of objects using pattern matching.
The full syntax for a pathname literal is:
<path_name> ::= $<path> | $
<path> ::= [ <objectset> ] [ / ] [ <levels> ] <level_name>
<levels> ::= <level> { / <level> }
<level> ::= <level_name>
...
<level_name> ::= { <alphanumeric > | _ | * | ? | \ }
‘{ <alphanumeric > | _ | * | ? | \ }‘
The root of a <path> can be an <objectset>, which limits the pathname searching to the object
set you specify. ObjectSets are described in the ObjectSet Values (p. 781) topic.
Pathname Literals 663
Examples:
$box01 -- object named ‘box01’
$torso/left_up_arm/left_low_arm -- hierarchy path name
$*box* -- all objects with ‘box’ in
-- the name
$torso/* -- all the direct children of
-- $torso
$helpers/d* -- all helper objects whose name
-- starts with ‘d’
All objects in a 3ds max scene are arranged in a hierarchy as presented in Track View. This is both an
important organizing scheme in 3ds max, and it suggests a MAXScript naming scheme for objects
based on the path to an object through the hierarchy. It is also very similar to path names in an
operating system’s directory structure. For example,
$dummy/head/neck
names the scene object neck whose parent is object head, which has the top-level parent
object dummy. This pathname helps you identify a specific object in a 3ds max scene, even
if several objects have the same name. If head is unique in the scene, MAXScript lets you
use the shorthand $head to refer to it regardless of its hierarchy position. Even if the
object is not uniquely named you can use the shorthand form, but it is undetermined
which of the same-named objects you will get.
Pathnames also provide a powerful way to refer to several objects at once, such as all the children of
a certain parent, or all the objects with names containing the string foot. For this, you can use
wild-card patterns, as you can with operating system shell file naming schemes. For example,
$dummy/*
names all the immediate children of dummy. The “*” character is used as a wild card. Or,
$neck*
finds all the objects, whose names start with the string neck, anywhere in the hierarchy.
You can use wild cards anywhere in a pathname. For example,
$*foot*
finds all the objects with foot anywhere in their names. The “*” wild-card character
effectively matches any number other characters.
You can also use the “?” wild-card character to match exactly one “don’t care” character. This is, the
“?” wild-card character will match any single character. For example,
$box0?
finds all the objects that begin with box0 and have exactly one character after the 0 in
their names.
Wild-card characters can also be used for specifying parent levels in a hierarchy. For example,
$dummy/*/*
names all the children of all the children of $dummy.
664 Chapter 5 | Names, Literal Constants, and Expressions
If you want to find an object and all the children of the object at any nested level, you use the special
ellipsis level name “...”, as in:
$dummy/.../box*
This refers to $dummy and all the box* children at any level below $dummy. The “...” indicates to
search the entire hierarchy below the level of the ellipsis. MAXScript lets you omit the “/” when
using “...” because it is unambiguous:
$dummy...box*
Or, in another common example,
$dummy...*
names $dummy and all the children of $dummy at any level.
If you use a wild card in an object pathname MAXScript will manipulate all matching objects at one
time. For example,
hide $*foot*
hides all objects whose names contain foot.
You can also perform automatic collection mapping, where a property for each matching object is
set. For example,
$*box*.position += [10, 10, 0]
adds [10,10,0] to the positions of all scene objects whose names contain box. For more
information, see the Collections (p. 773) topic.
You can use a shorthand form for specifying the currently selected object or objects with the
pathname syntax. A lone “$” character refers to either the currently selected object if a single object
is selected, the current selection set as an ObjectSet if more than one object is selected, or undefined
if no objects are selected. This is a useful shorthand for use in the Listener when working on
selections. For example:
$.pos = [0,0,0]
hide $
rotate $ 35 z_axis
Inside a script, it is better to use the selection ObjectSet rather than $. selection always contains
an ObjectSet regardless of the number of selected objects. Where hide $ will generate an error if no
objects are selected (because $ contains the value undefined), hide selection will not generate
an error. Due to the way that 3ds max internally processes notification signals, the $ form of
accessing selected objects is not recommended in a select change handler. To access the selected
objects, you should use the selection ObjectSet. This is because $ relies on information that has
not yet been set in the selection processing whereas selection uses a different method of accessing
selections and the information it uses has been set up.
See also
Spaces and Other Special Characters in Pathnames (p. 665)
ObjectSet Values (p. 781)
Collections (p. 773)
Spaces and Other Special Characters in Pathnames 665
See the String Literals (p. 660) topic for other escape character sequences.
Because of the large number of names in 3ds max that include spaces, the underscore character (“_”)
can be used instead of a space in a name. For example, the following two lines are equivalent:
bodyPart=$’Bip01 L UpperArm’
bodyPart=$Bip01_L_UpperArm
3D
[ <expr>, <expr>, <expr> ]
where <expr> evaluates to an Integer or Float value.
Examples:
[320, 240] -- 2D point
[10, 20, 30] -- 3D point
Expressions in a literal are evaluated when the literal is built. The following script and results show
the value stored in a Point3 when expressions are used in the literal:
Script:
a=10
b=45
[10, 20, 30]
[sin a, 2 * b, a^2 + b^2] -- can contain expressions
666 Chapter 5 | Names, Literal Constants, and Expressions
Output:
10.0 -- result of line 1
45 -- result of line 2
[10,20,30] -- result of line 3
[0.173648,90,2125] -- result of line 4
See also
Point2 Values (p. 736)
Point3 Values (p. 731)
Array Literals
An array in MAXScript is an ordered collection of values. Each element in the array can contain any
type of value, and you can index and iterate an array. You can write array literals directly in a
program or build the collection with the array functions provided in MAXScript. For details, see the
Array Values (p. 776) topic. Array literals can be expressed in two forms:
#( <expr> { , <expr> } )
#() -- empty array
Examples:
#(1, 2, 3)
#()
#(1,”foo”,#(1.2, -4,#fred),[1,2,3]) -- this one has a nested array
Expressions in an array literal are evaluated when the literal is built. The following script and results
show the values stored in an array when expressions are used in the literal:
Script:
a=10
x=45
#(1, sin x, a * 2.3) -- can contain expressions
Output:
10.0
45
#(1, 0.707107, 23.0)
Array Literals 667
Expressions
MAXScript is an expression-based language. Every construct in the language is an expression and
yields a result; this includes constructs that other languages consider statements. The simplified
syntax of the language allows you to build very expressive code. Anywhere you can write an <expr>
expression, you can write any construct in MAXScript.
A good example of this is the if construct. In statement-based languages, there is usually one syntax
for if statements and another for conditional expressions. In MAXScript, a single syntax is used for
both cases. For example, the following two lines of code are both valid, and their meaning should
be obvious:
if a > b then print c else print d
x = if a > b then c else d
You can also write the following line, containing a nested if expression and a nested assignment,
which itself is an expression:
x = if (if a > b then c else d) < e then f else (g = 23)
Each expression in the block is separated by a line break. You can also write several expressions on
one line using a “;” (semicolon) to separate them:
(print a; print b; if a > b then print “the big a”)
Block-expressions are themselves <expr> expressions. They evaluate their component expressions
in sequence and yield as their value the value of the last expression in the block.
To create classic block-structured statements, you might write:
if a > b then
(
print c
x = sqrt (c)
)
else
(
print d
x = sin (e)
)
See also
Simple Expressions (p. 669)
Context Expressions (p. 681)
Controlling Program Flow (p. 691)
Creating Functions (p. 699)
Structure Definition (p. 707)
Literal Constants (p. 659)
Variables – Assignment and Scope (p. 643)
3ds max Commands (p. 1630)
Scripted Utilities (p. 1463)
Utility Clauses (p. 1466)
Scripted Mouse Tools (p. 1531)
Scripted Right-Click Menus (p. 1514)
Scripted Plug-ins (p. 1538)
Array Literals 669
Simple Expressions
Simple expressions in MAXScript, denoted as <simple_expr>, correspond to the constructs
normally considered expressions in math and conventional programming languages, as in the
following examples:
a + b * c
sin x
The expressions are generally comprised of operands (a, b, c, and x), that are acted on by operators
(+ and *) or given as parameters to functions (sin). Simple expressions are divided into the following
groups:
See also
Operands (p. 669)
Math Expressions (p. 670)
Comparison Expressions (p. 673)
Logical Expressions (p. 674)
Function Calls (p. 675)
Block-Expressions (p. 679)
Operands
Operands, denoted as <operand> in the syntax definitions, are the references to values that
surround operators or are passed as parameters to a function. Prime examples are Literal Constants
(p. 659) and variable names. Operands are divided into two groups, Factors and Accessors.
Factors
Factors, denoted as <factor> in the syntax definitions, are references to values, where the entire
value is acted on. A factor can be a Literal Constants (p. 659), a Reserved Global Variable (p. 628), a
variable name, or an expression.
The unary minus applies the math negate operator to its operand.
-<operand> -- unary minus
Accessors
Accessors are constructs that let you access the components in compound values, such as arrays and
3D points. There are two kinds of accessors corresponding to the two kinds of compound values in
MAXScript:
• The component values are arranged in an indexable sequence, as in arrays or strings.
• The compound value contains a fixed set of named components, as with 3D points and time
intervals.
All 3ds max objects, such as boxes, spheres, bend modifiers, or bitmap textures are treated as
compound values in this sense. All of their parameters, such as height and angle, or map file name,
are accessed as named components. In MAXScript, these named components are referred to as
properties.
Accessors have one of two forms, an <array_index>:
<operand> [ <expr> ] -- an indexed element
or a <property>:
<operand>.<var_name> -- a named property
Examples:
maps[i]
selection[n+1]
position.x
bend.angle
Math Expressions
The math expressions in MAXScript correspond to the common operator expressions in
mathematics, such as add, subtract, multiply, divide, and so on. The <math_expr> constructs in
MAXScript are:
<math_operand> + <math_operand> -- standard arithmetic addition
<math_operand> - <math_operand> -- standard arithmetic subtraction
<math_operand> * <math_operand> -- standard arithmetic
-- multiplication
<math_operand> / <math_operand> -- standard arithmetic division
<math_operand> ^ <math_operand> -- exponential, raise to the power
<math_operand> as <class> -- conversion between types
Note that a math operand can be another nested math expression. This is another instance of a
recursive syntax definition which lets you create arbitrary sequences of operands and operators.
Math Assignment 671
Note also that the math unary minus is not defined here, it is one of the <operand> types described
in the Operands (p. 669) topic.
Examples:
42
2 + 2
2 * a - sin x / b -- using a function call
(a + b) * -c
2 ^ n
(n + 1) as string -- converts result to a string value
The conversion operator, as, works between selected sets of source and destination value types. Only
certain kinds of values can be converted into certain other kinds of values. These allowed
conversions are defined for each type of value, and are documented with the value type descriptions.
See also
Math Assignment (p. 671)
Precedence and Association Rules (p. 672)
Polymorphism (p. 672)
Math Assignment
MAXScript provides the C language shorthand form of assignment that can be used to modify a
value in place, as shown in the following long-form examples:
x = x + 1 -- increment x by one
$obj.pos = $obj.pos * scale -- multiply $obj.pos by scale
Corresponding to the four math operations (+, -, *, and /) are assignment operators that apply the
operation to the assignment’s destination and update the destination with the result. Their syntax is:
<destination> += <expr> -- add <expr> to destination
<destination> -= <expr> -- subtract <expr> from destination
<destination> *= <expr> -- multiply destination by <expr>
<destination> /= <expr> -- divide destination by <expr>
Using the shorthand form of assignment, the previous examples can be written as:
x += 1 -- increment x by one
$obj.pos *= scale -- multiply $obj.pos by scale
672 Chapter 5 | Names, Literal Constants, and Expressions
The evaluation order in the previous table follows standard precedence rules, where * and /
operations are evaluated before + and - operations, and where + and - operations associate to the
left (that is, operands on the left are evaluated before operands on the right) and exponentiation
operations associate to the right (that is, operands on the right are evaluated before operands on
the left).
These precedence rules define the ordering of evaluation in all expressions in MAXScript, unless
parenthesizing is used to force a different order. Expressions in parenthesis are evaluated before the
surrounding operands are applied.
The following list shows the precedence order for math expressions starting with the highest
precedence:
<operand>
<function_call>
as
^ -- right associative
* and / -- left associative
+ and - -- left associative
See also
Function Precedence (p. 677)
Polymorphism
As in mathematical expressions, MAXScript operators are polymorphic. This term means a single
operator can be used to operate on a number of different types of values and performs the
appropriate action for each type of value.
For example, a “+” operator between two integers performs integer arithmetic, between two floats it
performs real arithmetic, and between two matrices it performs a matrix addition.
MAXScript allows certain non-mathematical types to use certain math operators. For example, you
can concatenate two strings with the “+” operator:
“twas brillig” + “ and the slithy tobes”
x.name += sequence_number as string
Polymorphism 673
In some cases, you can mix operand types and MAXScript converts them appropriately. For example,
adding a float to an integer results in a float. Multiplying a 3D point by a float results in a scalar
vector product, and so on.
Internally in MAXScript the allowable operators and the actions performed by the operators are
defined for each type of value. The allowable operators and their actions are documented with the
value type descriptions.
See also
Inheritance and Polymorphism (p. lxiii)
Comparison Expressions
Using comparison expressions you can compare values of comparable types. The result is always one
of the two Boolean values, true or false. The various forms of <compare_expr> are as follows:
<compare_operand> == <compare_operand> -- equal
<compare_operand> != <compare_operand> -- not equal
<compare_operand> > <compare_operand> -- greater than
<compare_operand> < <compare_operand> -- less than
<compare_operand> >= <compare_operand> -- greater than or equal
<compare_operand> <= <compare_operand> -- less than or equal
Examples:
a > b
sin x == 0.0
a + b <= n - 1
Comparison operations have lower precedence than math operations. In the previous examples, the
sin function call and the “+” and “-” operations are performed before the comparisons.
As with math expressions, the comparison operators work on all appropriate types. Equal “==” and
not-equal “!=” operate on all types, and the relative comparisons work between comparable types.
The allowable comparison operators are documented with the value type descriptions.
674 Chapter 5 | Names, Literal Constants, and Expressions
Logical Expressions
Logical expressions combine the results of Boolean expressions, such as comparisons, to construct
complex conditional expressions. The forms of a <logical_expr> are as follows:
<logical_operand> or <logical_operand> -- true if either operand
-- is true
<logical_operand> and <logical_operand> -- true if both operands
-- are true
[ not ] <logical_operand> -- true if operand is false
Logical operators only operate on Boolean values, so each <logical_operand> must evaluate to
true or false.
Examples:
a > 0 and a < n + 1
not x and y
a and b or c and d and not e
As with math expressions, <logical_expr> is a recursive definition, meaning a logical operand can
be another logical expression. You can have arbitrary sequences containing and, or, and not, and
the order of evaluation is defined by the following precedence ordering (in decreasing order of
precedence):
not -- right associative
and -- left associative
or -- left associative
This means that in an unparenthesised logical expression, not is evaluated before and
which is evaluated before or.
Logical operators have a lower precedence than comparison operators, math, and function calls.
Therefore, these operations are always evaluated before logical operators, which follows convention.
The previous examples would be evaluated in the following order:
(a > 0) and (a < (n + 1))
(not x) and y
(a and b) or ((c and d) and (not e))
See also
Short-Circuiting Logical Expressions (p. 675)
Short-Circuiting Logical Expressions 675
In a strict language, the “sin a” evaluation of an undefined operand results in an error, and you
would need to break up the expression into two if statements:
if a != undefined then
if sin a > 0 then ...
Function Calls
A function call expression passes an optional list of arguments to a MAXScript or user-defined
function, and the value returned by the function is the function call expression’s result. A
<function_call> has one of the following forms:
<operand> { <argument> }+ -- one or more arguments
<operand> () -- no arguments
Examples:
sin a
tan2 x y
print (n + 1) to:debug
fns[i] $box01 -- get function out of array fns
move object1 [10,20,x * 3]
This syntax is unlike most programming languages which typically use parenthesized lists of
comma-separated arguments. This syntax was chosen for MAXScript for the following reasons:
• It is simpler and easier to use, particularly if a function has many optional keyword arguments.
• The language is used in a command-line window within 3ds max. Therefore this form is similar
to other command or shell languages that users might be already know.
676 Chapter 5 | Names, Literal Constants, and Expressions
All 3ds max objects, including geometric objects, splines, materials, and so on are created using
function calls. The name of the object creation function is the object’s class name. For example:
standard() -- create a standard material
bend angle:45 -- create a bend modifier
box height:20 width:40 -- create a box
See also
Positional and Keyword Arguments (p. 676)
Function Precedence (p. 677)
Code Layout (p. 678)
Special Notes about Function Calls (p. 678)
Creating Functions (p. 699)
As another example, you can create a sphere object in the 3ds max scene with no arguments:
sphere()
For those keyword arguments not specified when creating 3ds max objects, default values are used.
The default value used for each keyword argument is shown in the descriptions of the object classes.
Function Precedence
A <function_call> has a lower precedence than an <operand>, but it has a higher precedence
than all the math, comparison, and logical operations. This means you have to be careful about
correctly parenthesizing function arguments.
For example:
sin x + 1
is evaluated as:
(sin x) + 1
In general, you have to put arguments that are expressions inside parentheses, as in:
sin (x + 1)
atan2 (y - 1) (z - 1)
This rule has one exception, the unary minus. It is recognized as one type of <operand> you don’t
have to parenthesize. For example:
sin -x
is interpreted as:
sin (-x)
678 Chapter 5 | Names, Literal Constants, and Expressions
Code Layout
The end-of-line layout rules, as described in the Source Code Layout and Continuation Lines (p. lvii)
topic, mean an end-of-line indicates the end of a function call if the line ends at the end of a
complete argument.
You cannot simply break up a function call with many arguments into several lines, because each
line becomes a separate expression, almost certainly causing an error. Use the “\” continuation
character in this situation:
foo = standardMaterial twosided:on shininess:34 \
diffuseMap:baz \
opacityMap:bar \
bumpMap:boo
Block-Expressions
Block-expressions are the basic constructors for structured code. They allow you to group a sequence
of expressions and evaluate them in sequence as though they were a single expression. The syntax
for <block_expr> is:
( <expr> { (; | <eol>) <expr> } )
That is, a parenthesized sequence of expressions with each <expr> separated by either a
line break or a “;” semicolon.
MAXScript also allows empty block-expressions, (). This is useful when incrementally building code
in order to place an empty expression in a path to be filled in later. When evaluated, empty
expressions yield the value undefined.
Examples:
(
d = centre.x^2 - (p.x^2 + p.y^2)
newz = if d > 0 then sqrt d else p.z
print newz
)
if x < y then (print x; print y; u += 10; print u)
Because a block-expression is an <operand>, you can insert a block-expression anywhere you can
put an <operand>. This is unlike most languages which limit where you can put blocks of code to
only a few places. Further, because all constructs are expressions in MAXScript, a block-expression
yields a value defined to be the last <expr> in the block. This allows you to use a nested sequence
of expressions to compute an operand for some operation:
$box.pos.z =
(
d = x^2 - y^2
if d > 0 then sqrt d else z
)
Here, the result of the block-expression is the result of the final if expression, which is then assigned
to $box.pos.z.
Because the item in parentheses can be any <expr>, you can turn any construct in MAXScript into
an operand by putting it in parentheses. This allows you to write the following example, in which
the operand to be indexed is the conditional result of an if expression:
(if a > b then c else d)[n + 1]
680 Chapter 5 | Names, Literal Constants, and Expressions
As described in the Scope of Variables (p. 646) topic, top-level open parentheses in a script file or in
the Listener create a new variable scope. Any block-expressions with the top-level block-expression
do not create a new variable scope, even if the variable is explicitly declared as local in the inner
block-expression. A variable’s scope extends into any block-expressions within the variable’s scope.
If you declare a variable as local in a scope, the newly declared local variable hides any outer
variables with the same name. Any reference to that variable name later in the local variable’s scope
refers to the new local variable. At the end of the local variable’s scope, the next outer variable
becomes visible again. This is shown in the following script:
Script:
a=1
(
local a=2
(
local a=3
)
print a
)
a
Output:
1 -- result of line 1
3 -- output of line 7
3 -- result of block-expression lines 2 to 8
1 -- result of line 9
Any variable names used in a block-expression which have not been created at a higher scope level
are implicitly declared as local in the present scope. This can result in unexpected execution results
for scripts that are not set up correctly. For example, consider the following script:
(b=bend();addmodifier Objs b) -- create bend modifier and apply to objects
b.angle=10
The first time you execute this script, the following error message is generated:
-- Unknown property: “angle” in undefined
If you execute the script again, it works properly. The reason is there are actually two variables with
the name b – one is local to the block-expression and contains the bend modifier value, and the
other is global and has the value undefined. During the second execution, global b exists, so the
block-expression does not implicitly declare a new variable b, rather it uses the global variable b.
When writing scripts, it is also a good programming practice to explicitly declare as local all variables
unless you really want them to be global variables. There are several reasons for this practice:
• All the variable names used in the block or function will be together, which makes it easier to
find the variable names and helps prevent using incorrect names in the script.
• If more than one script is executing at the same time (for example, you are running a scripted
utility and have a scripted controller in the scene) and both scripts use the same global variable
Special Notes About Function Calls 681
name, the two scripts can interfere with one another. This can cause apparently random failures
of one or both scripts.
• You are sure you are using the correct variable in the event that a variable with the same name
has already been declared at a higher scope, and you won’t inadvertently change the higher-
level variable’s value.
• Values of variables explicitly defined as local are displayed in error call stack trace-backs.
• In 3ds max R2.5, if a 3ds max class, a MAXScript method, or a MAXScript read-only global
variable has the same name as an implicitly declared local variable, a MAXScript runtime error
will be generated if an assignment to that variable name occurs. Since the variable name already
existed with a global scope, an implicitly declared local variable was not created. Since one or
more new 3ds max classes will be created by any third party plug-ins the user has loaded, you
were not be able to tell ahead of time if a variable name was a global variable name. In
3ds max 4, if the MAXScript compiler detects that the first reference to such a variable is an
assignment, it will implicitly declare a local variable, rather than leaving it as a reference to a
read-only system global. For example, executing the following expression in 3ds max R2.5
would result in a value of Box, since Box is a 3ds max object class. In 3ds max 4, MAXScript
detects that the first use of variable box is an assignment and creates an implicitly declared local
variable box. The result of this expression in 3ds max 4 is the value undefined.
(if false do box=10;box)
Context Expressions
Context expressions are the parts of the MAXScript syntax that are most specifically designed for use
with 3ds max. Context expressions are mirrors of some of the most important abstractions in the
3ds max user interface - the animate button, the time-line slider, the working coordinate system,
and so on. Context expressions make it as easy to create animation and perform geometry
manipulation in MAXScript as these tools do in the user interface.
The basic idea for this is a prefix is supplied that sets up a context for the evaluation of its expression.
For example:
animate on
(
move $box01 [20, 0, 0]
rotate $box02 45 x_axis
)
682 Chapter 5 | Names, Literal Constants, and Expressions
This effectively “turns on” the animate button for the duration of its block-expression. The move
and rotate will automatically generate keyframes, just as would happen if you turned the animate
button on in the 3ds max user interface and moved objects around. Another kind of context
expression has a prefix for setting the current animation time, as though you had moved the time
slider. If we mix the two forms together, like this:
animate on
(
at time 0 $box01.position = [-100, 0, 0]
at time 100 $box01.position = [100, 0, 0]
)
Examples:
-- randomly jiggle each object in the selection around + or - 20 units
in coordsys local selection.pos = random [-20,20,20] [20,20,20]
See also
Cascading Contexts (p. 688)
Nested Contexts (p. 688)
Sticky Contexts (p. 689)
animate
The [ with ] animate <boolean_expr> context corresponds to setting the Animate button in the
3ds max user interface. Placing an expression, operation, or block-expression within an animate on
context causes keyframes to be generated whenever an animatable property of a 3ds max object is
changed, regardless of the actual state of the Animate button. Likewise, placing an expression
within an animate off context prevents keyframes from being generated whenever an animatable
property of a 3ds max object is changed. Expressions that change an animatable property of a
3ds max object, and are not within an animate context, will generate keyframes only if the Animate
button is on.
Setting the animate context on or off does not affect the state of the Animate button. The state of
the Animate button can be queried and set using the animButtonState global variable. The user
can be prevented from changing the state of the Animate button using the animButtonEnabled
global variable.
Examples:
loadheight=obj.pos.z
-- Create key at time tStart to keep object lifted until that time.
-- If tStart != 0, a key will also automatically be created at frame 0.
-- Then create a key at time tEnd to drop the object
with animate on
( at time tStart obj.pos.z=loadheight+LiftHeight
at time tEnd obj.pos.z=loadheight
)
684 Chapter 5 | Names, Literal Constants, and Expressions
at level, in
The at level <node> and in <node> contexts set the specified node to be the effective root for
any pathnames specified, or scene objects created, in the context. These contexts automatically
prefix the specified node to any pathnames in the context. They also set the specified node to be the
parent for any scene objects created in the context.
To be able to use pathnames within level contexts to name objects anywhere in the scene, you can
override the current working level by using a rooted pathname. A rooted pathname has an extra “/”
before the first-level name and indicates “start at the actual root of the object tree”. For example:
scale $/baz/* [1,1,2]
operates on the object baz in the actual top level, not just as a child of the current
working level.
You can also use this rooted pathname form to force a pathname to only consider top-level objects
when you name a single object. For example:
$foo
looks throughout the whole scene, at all levels for an object named foo, but,
$/foo
will only look for a top-level object named foo.
Examples:
in $mannequin01...LClav...hand -- set context to hand
$mannequin01.spine.LClav.arm.hand
( rotate $thumb1 15 y_axis -- rotate hand’s child
-- thumb
rotate $finger11 10 y_axis -- rotate hand’s child
-- first finger
PalmCenter=$finger21.parent.pos -- get hand’s position
PalmCenter+=(LHandPos-$finger21.pos)/2. -- calculate center of
-- palm
dummy name:”palmLink” pos:PalmCenter -- create a dummy there,
-- dummy is a child of
-- the hand
)
in $dummy
( sphere name:”ear1” pos:[10,10,10] -- create automatically as
-- children of $dummy
sphere name:”ear2” pos:[-10,10,10]
scale $foo/* [1,1,2] -- look for ‘foo’ as a child
-- of $dummy
)
at time 685
at time
The at time <time> context corresponds to the 3ds max time slider. Any animatable property
references will yield their interpolated values for the specified time. If the Animate button is on, or
the script is also in an animate on context, keyframes are generated at the specified time when an
animatable property of a 3ds max object is changed.
Setting an at time context does not affect the 3ds max time slider. The time associated with the
time slider can be queried and set using the sliderTime global variable.
Examples:
-- generate a keyframed animation of $foo randomly chasing $baz
animate on
for t in 0 to 100 by 5 do
at time t
$foo.pos = $baz.pos + random [-10,-10,-10] [10,10,10]
coordsys
The [ in ] coordsys <coordsys_spec> context corresponds to the current reference coordinate
system list in the main 3ds max toolbar. Prefixing an expression, operation, or block-expression with
a coordsys context causes 3D coordinate operations to be interpreted in the specified coordinate
system. Moving, scaling, or rotating objects, or setting transform-related properties within a
coordsys context operate in relation to the given coordsys. Accessing coordinate properties such
as position, center, rotation axis, and so on, within a coordsys context causes those values to be
delivered relative to the given coordsys.
The following forms are supported:
[ in ] coordsys world
use the world space coordinate system
[ in ] coordsys local
use the object’s local coordinate system
[ in ] coordsys parent
use the object’s parent’s coordinate system
[ in ] coordsys grid
use the active grid’s coordinate system
[ in ] coordsys screen
use the currently active viewport’s coordinate system
[ in ] coordsys <node>
use the specified node’s local coordinate system - this is equivalent to the “pick”
coordinate system capability in the 3ds max user interface
[ in ] coordsys <matrix3>
use the coordinate system specified by the given 3D matrix
686 Chapter 5 | Names, Literal Constants, and Expressions
Examples:
-- randomly jiggle each object in the selection around +/- 20 units
in coordsys local selection.pos = random [-20,20,20] [20,20,20]
about
The about <center_spec> context is the MAXScript equivalent of the rotate/scale transform
center list on the main 3ds max toolbar. It defines the center point about which any scale or rotation
operation is performed within its context. Note that, like the center list in 3ds max, this sets only
the center point for the operation, not the axis. The axis is taken from the current working
coordinate system set using the coordsys context expression:
about selection
rotates/scales about the center of the current selection
about pivot
rotates/scales about each object’s pivot point
about coordsys
rotates/scales about the center of the current working coordinate system set using the
coordsys context expression
about <node>
rotates/scales about the pivot point of the given object
about <matrix3>
rotates/scales about the center of the coordinate system specified by the given 3D matrix
about <point3>
rotates/scales about the given point with coordinate system and axes taken from the
current working coordinate system.
Examples:
-- rotate all the boxes 30 degrees about the y_axis of $foo
about $foo rotate $box* 30 y_axis
undo
The undo <boolean> context provides control over whether scripted scene changes will be
undoable. By default, the operations performed in MAXScript are undoable. This means that
scene-modifying commands typed in the Listener are undoable by default. Making this a
context-controlled activity allows you to decide when the undo overhead is to be taken.
Example:
undo on
(
delete $box*
delete $sphere*
clearUndoBuffer()
)
The undoable operations appear as items labeled “MAXScript” in the 3ds max Undo menu. It is
important to note that the granularity of the undoable operations is at the level of entire undo
clauses. In the previous example, one entry is added to the Undo stack containing both deletes as a
single operation. Choosing undo for this entry in the Undo menu causes both deletes to be undone.
Therefore, you can control the granularity of an undo by choosing the appropriate undo block
expression groupings.
You can invoke an undo from MAXScript with the max command:
max undo
When you script very large scene changes, you should consider turning undo off as it is quite easy
to fill up the Undo stack and consume substantial amounts of memory. Disabling undo can improve
performance in this situation. If the actions your script performs could interfere with entries already
in the Undo stack, you should explicitly clear the Undo stack before enabling undo. An entry in the
Undo stack generally expects the scene to be in the state it was when the entry was placed in the
Undo stack. If you interrupt the storing of Undo stack entries, and modify the scene in an
incompatible way (such as deleting an object that an entry assumes is still around), a 3ds max crash
is likely if you then try to perform an undo.
Using the following functions you can control the undo and scene save states in 3ds max:
clearUndoBuffer()
empties the Undo stack, both providing a way to reset the undo state and another way to
control the save-changes requester.
setSaveRequired <boolean>
lets you set the 3ds max system “dirty” flag. If this flag is set or there are entries in the
Undo stack, you are asked if you want to save the scene file on a File > New or File > Reset.
getSaveRequired()
returns true if the 3ds max system “dirty” flag is set to true or if the Undo buffer is not
empty. If the Undo buffer if not empty, this function will still return true, even if you just
called setSaveRequired false.
688 Chapter 5 | Names, Literal Constants, and Expressions
Normally, if there are entries in the Undo stack when the scene is closed, 3ds max will prompt with
a save-changes requester. In some cases, where you are controlling undo in MAXScript, you may
want to force the need for a save-changes prompt.
Cascading Contexts
You can cascade a set of context prefixes, optionally separated by commas, onto one subject
expression, effectively applying all the contexts (in order) to the subject expression. For example:
animate on, at time (t+1), with undo off, coordsys local
(
...
)
All the context forms are true expressions, yielding the value of their subject expression, so:
pos0 = at time 35 $box01.position
pos1 = at time 75 $box01.position
assigns the box01 position at time’s 35 and 75 to variables pos0 and pos1. This is
particularly useful with the at time context, as you can very easily do across-time
computations. The operand to an at time context can be any valid time value (numbers
are taken as frames for convenience), including sub-frame times down to the tick level.
The animation system in 3ds max will interpolate animated parameters at these fine levels
so you can easily do sub-frame simulation computations.
Nested Contexts
All context expressions remember the prior setting of the context when they are set, and restore the
original setting when the expression completes. Therefore, you can nest context clauses in any way
you want, including contexts of the same type to override an outer setting.
Example:
with animate on, at time t
(
move ... -- all these place keys
rotate ...
animate off -- turn off animate for a bit
(
move ... -- working maneuvers, these don’t effect animation
rotate ...
) -- animate on is restored here
scale ... -- place keys again
...
)
Sticky Contexts 689
Further, all the contexts are dynamically scoped. Any code inside a context expression, any functions
that code calls, and functions they call down to any level, are executed in the current prevailing
context. So, a function can move an object and place keyframes at a certain time when called from
one client and do no keyframing when called from another client, depending on how the callers
have set up the contexts. Of course, the called function can explicitly set its own contexts if it wants
to, overriding those that may have been set up by the caller.
Sticky Contexts
You can force the settings of contexts such as coordsys, animate, time, and so on, to be “sticky.”
The settings will stay active for any code execution that follows, up until the point you change them
or override them with a context prefix for an expression. This is particularly useful when working
in the Listener, allowing you to set a context and then perform several interactive operations in that
context without prefixing each with the desired context construct. Establishing a sticky context is
accomplished with the set construct:
set <context>
where <context> is one of the MAXScript context prefixes: animate, time, in,
coordsys, about, level, or undo.
Example:
set animate on
set time 30f
move $foo [80,0,0]
scale $baz [1,1,3]
$bar.bend.angle += 23
...
set animate off
set time off
This turns animate on and sets the current time to frame 30 after which any number of interactive
operations can be performed that will generate animation at frame 30. The modes are then returned
to default. As shown in this example, certain the MAXScript contexts permit syntactic variants to
make the set construct read clearly. In particular, these are:
set time <value> | off -- variant of at time <time>
set level <node> -- variant of at level <node>
The time context can be set to off, signifying the current value of the 3ds max time slider is to
be used.
All the set constructs are expressions that yield the context setting that was in force at the time the
new context was set. This allows you to simulate the standard nested forms of these constructs by
storing the old context in a variable and using that to restore the context later. For example:
oc = set coordsys parent -- remember old coordsys
rotate $foo (quat 30 z_axis)
...
set coordsys oc -- restore it
690 Chapter 5 | Names, Literal Constants, and Expressions
You can also force several of the contexts back to their default states by specifying #default as their
parameter. The set constructs for which you can specify #default are: animate, in, coordsys,
and level.
When using the set undo on construct to enable the undoing of scripted changes in the Listener,
undo granularity is a top-level expression. Every time you evaluate an expression or sequence of
selected expressions with the ENTER or Number-Pad ENTER key, a single entry is added to the
Undo stack.
Chapter 6: Controlling Program Flow
MAXScript has several <expr> expression forms used to explicitly control the flow of execution.
They are:
<if_expr>
<case_expr>
<do_loop>
<while_loop>
<for_loop>
<loop_exit>
<try_expr>
These expression forms correspond to the standard control constructs found in many programming
languages. Each is described in its own topic:
If Expression (p. 692)
Case Expression (p. 693)
While and Do Loops (p. 694)
For Loop (p. 694)
Loop Exit (p. 697)
Try Expression (p. 697)
Additionally, there are several constructs for implicitly controlling program flow. The when
construct is used for scripting general change handlers, so you can write scripts that respond to user
operations such as object moves, vertex edits, object deletions, name changes, and so on. Callback
mechanisms are used to have a function called when certain specific events occur. See the Change
Handlers and When Constructs (p. 1650) topic for more information. The on construct is used when
scripting rollouts or tools or plugins, so the script can respond to events, often user-generated, in
those constructs. See the Utility and Rollout Properties, Methods, and Event Handlers (p. 1474) topic for
more information.
692 Chapter 6 | Controlling Program Flow
If Expression
The if expression is used to conditionally execute an expression based on the result of a boolean
test expression. The syntax for an <if_expr> is one of:
if <expr> then <expr> [else <expr> ]
if <expr> do <expr>
Examples:
if a > b do (print d; print e)
a = (if d == 0 then 0 else a / d)
The first <expr> is a test expression that must evaluate to true or false, such as a comparison or
logical expression. If the result is true, the then or do <expr> is evaluated and its value is returned
as the result of the <if_expr>. If the result is false, the optional else <expr> is evaluated and
its value is returned as the result of the <if_expr>. If there is no else or the do form is used, the
<if_expr> returns the value undefined.
The do form is provided particularly for use during interactive sessions in the MAXScript Listener.
When you enter expressions for immediate evaluation into the Listener, MAXScript determines if
your expression is complete and then evaluates it. If you use the optional else form in the Listener
and you want to omit the else <expr>, MAXScript continues to “wait and see” if you enter an
else <expr>. The line break after the then <expr> is legal and does not cause MAXScript to
evaluate the current line right away. As an example, if the following script is entered in Listener, the
first line will not evaluate until you enter the second line:
if match x y then print x
print “hello”
When you use the optional else form inside a block or another expression, MAXScript can
determine from the code that follows it if you omitted the optional else. Use the do form for if
statements without an else as top-level commands in the Listener:
if match x y do print x
As described in the Expressions (p. 667) topic, anywhere you can write an <expr> expression, you
can write any construct in MAXScript. In statement-based languages, there is usually one syntax for
if statements and a separate one for conditional expressions. In MAXScript, a single syntax is used
for both cases. For example, the following two lines of code are both valid, and their meaning should
be obvious:
if a > b then print c else print d
x = if a > b then c else d
You can also write the following line, containing a nested if expression and a nested assignment,
which is itself an expression:
x = if (if a > b then c else d) < e then f else (g = 23)
Case Expression 693
Case Expression
The case expression is used to select an expression to be evaluated from a set of labeled expressions
based on a test value compared against the labels.
Only the first expression whose label matches the test expression is evaluated. All labels must be
comparable to the test expression. Labeled expressions can be block-expressions, so you can use the
case expression as a case statement, choosing between blocks of code to execute.
The syntax for <case_expr> is:
case [ <expr> ] of ( <cases> )
where <expr> is the test expression and <cases> is a sequence of labeled expressions:
<factor>: <expr>
default: <expr>
Examples:
new_obj = case copy_type.state of
(
2: copy $foo
3: instance $foo
default: reference $foo
)
A special label, default, can be optionally used to tag the expression that will be evaluated if no
other labels match the test expression. If the default label is not used, and no label matches the
test expression, the case expression returns a value of undefined.
The labels are <factors> - elements such as number literals, name literals, string literals, variables,
or block-expressions. When a case expression is evaluated, the test expression is evaluated once,
then each label expression is evaluated in order until one is found that compares equally to the test
expression value. The expression it labels is then evaluated and this becomes the result of the case
expression. No further labels are evaluated or tested.
The test expression is optional. If it is not supplied, the labels are expected to be Boolean values or
expressions, and the first label evaluated as true determines the chosen case. In this variant, it is
common to use expressions as labels, so be sure to parenthesize them. For example:
case of
(
(a > b): print “a is big”
(b < c): print “b is little”
(c <= d*3): ...
default: ...
)
694 Chapter 6 | Controlling Program Flow
Both loops repeat the do <expr> as long as the while <expr> evaluates to the value true. The do
form evaluates the do <expr> at least once, evaluating the test expression at the end of each loop.
The while form evaluates the test expression at the start of each loop and may not loop at all.
Both forms return as their value the result of the do <expr> from the last successful loop iteration.
The while form will return the value undefined if the test expression immediately returns false.
Examples:
while x > 0 do
( print x
x -= 1
)
do
( exchanged=false
for i=1 to imax do
( j=i+gap
if (compare array[j] array[i]) do
(swap array[j] array[i]; exchanged=true)
)
) while exchanged
See also
Skipping Loop Iterations (p. 696)
Loop Exit (p. 697)
For Loop
The for loop iterates through a range of numbers, time values, or a sequenced collection of values,
such as an array or object set. The syntax for the for loop is:
for <var_name> ( in | = ) <sequence> ( do | collect ) <expr>
where <var_name> is the name of the loop index variable that holds the loop value, and
<sequence> is the source of values for the loop. The <sequence> can be one of the
following:
<expr> to <expr> [ by <expr> ] [where <expr> ]
<expr> [ where <expr> ]
For Loop 695
Examples:
for i = 1 to 10 do print i -- sequence numbers
for item in table1 do x = x + item.height -- sequence an array
for t in 0f to 100f by 5f do ... -- sequence time (given as
-- frames, here)
bigones = for obj in $box* -- you can sequence pathnames!
where obj.height > 100 collect obj -- collect the big boxes into
-- an array
The first <sequence> form is the standard number loop, the first <expr> value is the start value,
the to <expr> value is the limit value and the optional by <expr> value is the loop value
increment. The allowable value types are integer, float and time. If the by value isn’t given it
defaults to 1.
The second form of <sequence> takes a sequencable collection, such as an array (p. 666) or ObjectSet
(p. 781), and iterates through all its values, assigning successive elements in the collection to the
loop value each time through the loop. MAXScript contains several sequence collections, including
PathName values (p. 780), the current selection set, the children of a node, and the stack of modifiers
on an object. See also the Collections (p. 773) topic for caveats when using a collection in a for loop.
Each <sequence> source form takes an optional where <expr> which must evaluate to true or
false. The where expression is evaluated at the beginning of each loop and only executes the loop
body for that loop value if the where expression is true.
The do <expr> form simply evaluates the body expression once for each value in the sequence. The
loop variable is visible to the code in the body expression as though it was declared locally and
initialized to the successive loop values each time. When the do <expr> form of a for loop is used
as an expression, its return value is always OK.
The collect <expr> form gathers the expression values from the loop iterations and stores them
in an array, which is then yielded as the value of the overall for loop. This, for example, is a good
way to gather procedural selections of objects from a scene. If the where expression is used with the
collect form of the for loop, only the values from those iterations for which the where expression
is true are collected. This can be used to collect a filtered sub-set of the iterated values. You can also
achieve this collection filtering in a for loop that does not use a where expression by yielding the
special value dontCollect for those iterations that should not be added to the collection.
As described in the Scope of Variables (p. 646) topic, a for loop creates a new scope context. The for
loop index variable’s scope is always the extent of the for loop, even if another variable of the same
name already exists. Once the for loop exits, the for loop index variable is no longer accessible.
The scope of any variables created in a for loop is always the extent of the for loop. This is shown
in the following example:
696 Chapter 6 | Controlling Program Flow
Script:
obj=$box01
avg_pos=[0,0,0]
offset_pos=[100,100,0]
for obj in $* do -- new for loop index variable obj
-- created even though a variable named
-- obj already exists, scope is for loop
( pos=obj.pos-offset_pos -- new variable pos created, scope is for
-- loop offset_pos already exists outside
-- for loop, its value will be used
avg_pos += pos -- avg_pos already exists outside for
-- loop, its value will be used
) -- for loop index since variable obj goes
-- out of scope
avg_pos /= $*.count
See also
Skipping Loop Iterations (p. 696)
Loop Exit (p. 697)
Examples:
for i=1 to 8 do (if i == 5 do continue; print i) -- prints 1..4, 6..8
If a continue is executed in a for ... collect loop, the expression result for that loop iteration
is not collected in the array of body values.
Example:
for i=1 to 8 collect (if i == 5 do continue; i) -- returns #(1, 2, 3, 4, 6, 7, 8)
Loop Exit 697
Loop Exit
MAXScript provides an exit construct for breaking out of for, do, and while loops prematurely,
even though the loop test expression is still true. This is often useful to simplify the loop test
expression, and still use error or other complex termination tests in the body <expr> of the loop.
Its syntax is:
exit [with <expr> ]
Example:
while x < y do
( local delta = x - y
if delta <= 0 then exit -- time to bail
$foo.pos.x = compute_x (foo / delta)
x += 0.1
)
The optional with <expr> lets you specify what the overall value of the loop expression should be
if the loop exits prematurely. If you don’t specify an exit value, the loop returns the value
undefined upon exit.
Exiting a for ... do loop using a with <expr> results in a value of OK.
Exiting a for ... collect loop using a with <expr> results in the array of body values collected
up to the point of exit.
Try Expression
MAXScript provides simple exception-handling with the try expression, a simplified form of the
C++ exception-handling scheme. The try expression lets you bracket a piece of code and catch any
runtime errors. This allows you to respond appropriately or take corrective action, rather than let
MAXScript halt the execution of your script and print an error message. The syntax for the try
expression is:
try <protected_expr> catch <on_err_expr>
The <protected_expr> is executed and any errors that occur are trapped and the
<on_err_expr> is executed. If the <protected_expr> is a block-expression, the block-
expression stops executing at the point of the error. If there are no errors in the protected
expression, the <on_err_expr> is not executed. This is a very simple error-trapping
scheme, but limited heavily by the fact that you cannot get at any error codes or
information about the error that occurred.
698 Chapter 6 | Controlling Program Flow
Example:
f = openFile “foo.dat”
try
while not eof f do read_some_data f
catch
( messageBox “bad data in foo.dat”
results = undefined
)
close f
In this example, any errors in reading or processing the data in the read_some_data() function
are trapped, then a Message box is displayed and some clean-up is done. This is a good example of
a use for the simple error-trapping.
There is also an associated function, throw(), which can be used to generate your own runtime
error and pass on an error you caught when doing some interim clean-up, or do a non-local jump.
It has the form:
throw <error_message_string> [ <value> ]
throw()
If you have no intervening catches in your script, calling throw() with error message arguments
will cause a runtime error to be signaled and MAXScript will report the error message using its
standard error reporting. The optional second argument can be any value you want printed with the
error message, perhaps the object involved in the error. This second argument can not be specified
if the throw is in the body of a catch() and will generate a compile error if present.
If the try/catch is within another try expression, calling throw() will cause the catch expression
associated with the outer try expression to be executed. If you have no intervening catches in your
script, calling throw() will cause MAXScript to continue running the script from just after the top-
most set of parenthesis surrounding the try/catch, or will stop the currently running script if there
are no parenthesis surrounding the try/catch.
If you want to catch an error, perhaps to do some clean-up processing, and then pass the error on to
outer handlers or MAXScript for error reporting, you can call throw() with no arguments. This
throws the current error again and must only be done inside a catch expression. For example:
Script:
try
( i=10
try ( i.x=1 ) -- will generate a run-time error
catch
( print “Bad Error” -- error message printed
try (i.pos=[0,0,0]) -- will also generate a run-time error
catch (throw()) -- throw() will cause outer catch
-- to execute
)
)
catch (print “Really Bad Error Occurred”) -- error message printed
Chapter 7: Creating Functions
Functions are defined in MAXScript using the function definition expression. The syntax for
<function_def> is:
[mapped] (function | fn) <name> { <parameter> } = <expr>
in which <name> is the name of the function. The optional sequence of <parameter>s
can be one of:
<name>
<name>: [ <operand> ] -- keyword parameter with
-- optional default value
and the <expr> after the ‘=’ (equal sign) is the body of the function.
The function <name> is actually used to name a variable into which a value representing the
function is placed. When you call a function by using its name, you are accessing its definition in a
variable of that name. The scope of the function name variable is the current MAXScript scope.
The parameters for a function are either positional or keyword. Positional parameters are defined with
a simple <name> and must be placed before any keyword parameters. Keyword parameters have a ‘:’
(colon) after the name and an optional default value. The caller of the function can optionally
supply keyword arguments in any order. Those not supplied will be set to the default value given, or
the special value unsupplied if a default value is not given.
Using the mapped prefix on a function definition marks this function to be automatically mapped
over collections. This means the function will be automatically called repeatedly on the elements of
a collection if the collection is given as the first argument to the function. This allows you to define
scripted functions that behave in a similar manner to the mapped built-in functions, such as copy,
delete, move, and so on, which can be applied to an object set, path name pattern, or array. See the
Collections (p. 773) topic for more information.
700 Chapter 7 | Creating Functions
Examples:
function add a b = a + b
A scripted function returns as its value the value of the body <expr>. If the body is a block-
expression, the function evaluates to the value of the last expression in the block.
A function can be called recursively (that is, the function can call itself), as is the factorial
function in the previous examples.
If you need to locate the source of a scripted function, you can use the showSource() function. It
displays a script Editor containing the source file in which the function was defined and positioned
at the function’s definition. The form is:
showSource <fn>
This is useful for browsing definitions if you are working on many scripted functions, that were
perhaps defined in several script files loaded with fileIn() or Run Script in the MAXScript
utility.
See also
Function Variables (p. 701)
Function Parameters (p. 702)
The Return Expression (p. 705)
Special Notes about Function Calls (p. 678)
Function Variables 701
Function Variables
When you define a function, the following events occur:
• The function definition is evaluated, creating a function value.
• The function <name> is used to declare a new variable with that name.
• The function value is placed into that variable.
• The function value is returned as the result of the function definition expression.
Because the function itself is a value stored in a variable, you not only can call the function through
the function name variable. By simply referring the function’s variable you can also assign the
function value to another variable, store it in an array, or pass it as an argument to another function.
Example:
-- some 3D surface functions
fn saddle x y = sin x * sin y
fn sombrero x y = cos (x^2 + y^2) / (1 + (x^2 + y^2))
print (saddle 1 1) -- try one out
surface_functions[1] = saddle -- store the functions in an array
surface_functions[2] = sombrero
z = (surface_functions[i]) 10 10 -- call one of them from within
-- the array
build_math_mesh sombrero -- pass one in to a higher-order
-- function
The scope of a function variable is the current MAXScript scope context. The variables used inside a
function have a local scope, unless the variable was already defined at a higher scope or is declared
as global in the function. An exception to this is the function parameter variables, which always
have a local scope.
When writing scripts, it is good programming practice to explicitly declare your local and global
variables. Implicit declaration is provided as a short-hand, typically used when working in the
Listener interactively or developing short scripts. When developing extended scripts, explicitly
declaring variables can reduce errors and improve readability of the code. It is also recommend that
you declare as local all variables unless you really want them to be global variables. The reasons for
this are described in the Scope of Variables (p. 646) topic.
If a function variable is assigned to another variable, a reference to the function value is stored in
that variable. Thus while a function variable may no longer be in scope, the function itself still is if
the variable it is assigned to has a scope that extends outside the current MAXScript scope context.
702 Chapter 7 | Creating Functions
Examples:
fn funcA which =
( if which == 1 then
fn saddle x y = sin x * sin y
else
fn sombrero x y = cos (x^2 + y^2) / (1 + (x^2 + y^2))
)
myfunc=funcA 2
z=myfunc 10 10
In the above example, the scope of variables saddle and sombrero is local to funcA, and the
variables are out of scope outside the function. The return value of funcA is either the function value
saddle() or sombrero(), and is assigned to variable myfunc. As also can be seen in this example,
you can define a function within any expression.
See also
Scope of Variables (p. 646)
Function Calls (p. 675)
Function Parameters
The parameters to a function are implicitly declared as local variables at the head of the function
body, and are initialized with the arguments given by the caller. The parameters have a scope that
extends to the end of the function body <expr>. They can be assigned to and hidden by nested local
variables with the same name, as can other local variables.
Keyword parameters can be given default values in the function definition, implicitly making them
optional to the caller. If the caller does not supply one of the keyword arguments, it is initialized to
the default value upon function entry. The default values are specified after the ‘:’ (colon).
If a keyword parameter is defined with no default value and is not supplied by the caller, it is
initialized to the special value unsupplied. You can check for this value in the body of your
function and handle missing required keyword argument errors accordingly.
Example:
fn foo a b: c: d: =
(
if c == unsupplied then print “Where’s the c: argument??”
...
)
As described in the Reference Assignment (p. 653) topic, MAXScript uses an assignment called reference
assignment. In a function, each parameter variable contains a reference to the value passed to the
function by the caller. Assigning to a parameter variable places a new reference in the parameter
variable, and has no effect on the variable values in the caller - it is an entirely local action. An
exception to this is if the parameter value is a compound value such as an 3D Point, string, or array,
and you assign a new value to one of the components of the compound value. In this case, the
Function Parameters 703
variable’s reference does not change, and the changed compound value will still be referenced by
the variable in the caller.
While in some cases you may want a function to return multiple values, it typically is not a good
practice to do this by assigning to the components of a parameter variable compound value. To
manipulate a compound value passed as a parameter, a compound value needs to be created in the
caller and passed to the function, which can give results as shown in this example:
Script:
fn getXYZset val =
( val.x=random -100 100
val.y=random 100 100
val.z=random val.x val.y
)
( v1=[0,0,0]
v4=v1
getXYZSet v1
format “v1= %; v4= %\n” v1 v4
getXYZSet v4
format “v1= %; v4= %\n” v1 v4
)
Output:
getXYZset() -- result lines 1 to 5
v1= [-84,100,78.1224]; v4= [-84,100,78.1224] -- output line 10
v1= [10,100,18.6575]; v4= [10,100,18.6575] -- output line 12
OK -- result lines 6 to 12
Note that it appears the value for both variables v1 and v4 are set in the calls to getXYZset, even
though only one variable is being passed. The reason for this is in line 8 variable v4 is initialized to
the value of v1. What actually occurs is that in line 7 a reference to a Point3 value of [0,0,0] is
created, and this reference is stored in v1. In line 8, that same reference is retrieved from v1 and
assigned to v4. Rather than storing two different values, both v1 and v4 reference the same value.
When you set the components of the compound value in getXYZset, the reference to the Point3
value is not being changed, and both variables still reference that value.
704 Chapter 7 | Creating Functions
The proper way to return multiple values from a function is to have the return value of the function
be an array or a structure. For example:
Script:
fn readDataFile filename =
( f=openfile filename
data=#()
avg=0
nVals=0
while not eof f do
( val = readvalue f
append data val
avg += val
nVals += 1
)
close f
#(data,(avg/nVals))
)
result=readDataFile “c:\\datafiles\\run1.dat”
data=result[1]
avg=result[2]
Normally, if you are writing a function that is operating on a compound value which is passed as a
parameter, you should make a copy of the value. This prevents the value in the caller from
inadvertently being changed. For example:
Script:
fn uppercase instring =
( local upper, lower, outstring
upper=”ABCDEFGHIJKLMNOPQRSTUVWXYZ”
lower=”abcdefghijklmnopqrstuvwxyz”
outstring=copy instring -- operate on copy of instring
for i=1 to outstring.count do
( j=findString lower outstring[i]
if j != undefined do outstring[i]=upper[j]
)
return outstring
)
The Return Expression 705
If a return expression is evaluated in the course of running a function body, the function exits
immediately and yields the value given in the return <expr>.
Note that it is unnecessary and somewhat inefficient to place a return expression at the end of a
function body to return an expression value. Instead, simply place the result expression at the end
of a function body.
If a return <expr> is used in a mapped function and a collection is passed as the first argument to
the function, the value returned will be OK rather than <expr>.
As a special case, you can exit a script controller’s script using a return <expr>.
Example:
fn find_root twod_fn =
(
local root, last_root
while true do
(
...
if abs(root - last_root) < epsilon then return root
...
)
)
706 Chapter 7 | Creating Functions
Chapter 8: Structure Definition
You can create your own compound values in MAXScript using structure definitions. Structure
definitions let you define the layout of new ‘classes’ of values that you can then create and work
with in your code. The syntax for a structure definition is:
struct <struct_name> ( <member> { , <member> } )
where each <member> can be one of:
<name> [ = <expr> ] -- name and optional initial value
<function_def>
Example:
struct person (name, height, age, sex)
defines a new ‘person’ class. You create values of this class using the ‘person’ constructor:
bill = person name:”Bill” height:72 age:34 sex:#male
creates an instance of the person class, storing the instance in variable bill.
Member name is initialized to the string value “Bill”, height to the integer value
72, age to the integer value 34, and sex to the name value #male.
joe = person name:”Joseph” sex:#male
creates an instance of the person class, storing the instance in variable joe.
Member name is initialized to the string value “Joseph” and sex to the name
value #male. Since the height and age members are not assigned values, and do
not have optional initial values supplied in the structure definition, they default
to a value of undefined.
You access structured values using the standard property accessing syntax in MAXScript:
bill.age -> 34
joe.age -> undefined
joe.age = bill.age - 4
Structure definitions are useful as an alternative to arrays when you have a fixed, usually small
number of independent components and the code to work with them is much clearer when they
can be referenced by property name, rather than by index number.
708 Chapter 8 | Structure Definition
As with function definitions, a structure definition actually creates a value to represent the
definition and stores it in a variable of the same name as the structure. You can therefore store the
structure definitions in other compound objects or pass them as function arguments The
classOf() function returns this structure definition value when applied to these values, so you can
use it to test the definition of structure instances at runtime. For example:
classOf bill -> person
The struct value constructors are just like function calls and take positional argument initializers
as well as keyword initializers. The elements of the new struct are filled-in in order from any
positional arguments and then by name from any keyword arguments.
For example, given the following struct definition,
struct foo (name, age, height, hair=”brown”)
Output:
#Struct:test( -- result line 1
pos1:<data>,
pos2:<data>)
#test(pos1:[1,2,3], pos2:[4,5,6]) -- result line 2
#test(pos1:[1,2,3], pos2:[4,5,6]) -- result line 3
10 -- result line 4
#test(pos1:[10,2,3], pos2:[4,5,6]) -- result line 6
Defining Local Functions in Structures 709
This defines a structure definition foo with 3 elements named a, b, and c, and two local functions,
bar and baz. You can access these functions as properties of either the structure definition value
itself or an instance of the foo structure:
p = foo.baz q -- access as property of the structure definition value
foo.bar x y
f = foo 2 3 4
f.bar x y -- access as property of the structure instance
Local functions declared in a structure definition can make references to the member data variables
defined in the structure, such that when that member function in some instance of the structure is
called, the references access the members of that instance. This allows you to initialize and maintain
data structures for the structure functions within the structure itself. An example of including
functions that use members of the structure is shown in the following script.
Script:
struct RandVals
( RndVals=#(), ptr, seedVal,
fn generateRV num fromVal toVal =
( if seedVal != undefined do seed seedVal
RndVals=for i=1 to num collect random fromVal toVal
ptr=1
RndVals
),
fn deleteRv =
( RndVals=#()
ptr=undefined
undefined
),
fn getNextRV =
( if Nvals == 0 do return undefined
val=RndVals[ptr]
ptr += 1
if ptr > RndVals.count do ptr=1
val
),
fn sortRV = (sort RndVals),
710 Chapter 8 | Structure Definition
Output:
#Struct:RandVals( -- result of struct def lines 1 to 29
generateRV:<fn>,
sortRV:<fn>,
RndVals:<data>,
deleteRv:<fn>,
getNextRV:<fn>,
seedVal:<data>,
setSeed:<fn>,
setPointer:<fn>,
ptr:<data>)
#RandVals(RndVals:#(), ptr:undefined, seedVal:undefined) -- result line 30
12345 -- result line 31
#(23, 59, 79, 68, 17, 72, 84, 16, 89, 72) -- result line 32
23 -- result line 33
#(16, 17, 23, 59, 68, 72, 72, 79, 84, 89) -- result line 34
true -- result line 35
16 -- result line 36
undefined -- result line 37
In this script, the structure has 3 data members and 6 function members. Note the references to the
structure data members in the generateRV() function. In line 30, an instance of the RndVals
structure is created and stored in variable MyRandomVals. In line 31, the setSeed() function in the
structure instance is called, which initializes the random seed variable by storing the specified value
in data member seedVal in the structure instance. In line 32, the generateRV() function in the
structure instance is called, which initializes the random number using the seed value specified by
setSeed(), sets up and stores an array of random numbers in data member RndVals, updates data
member ptr, and then returns the random number array.
Local functions defined in structures are not stored in every instance of the structure. The local
function is stored once in the structure definition and references to them in the instances refer to
their definitions in the structure definition.
Structure Inherited Methods 711
The Value class is the root class for all MAXScript classes. It supplies methods and operators that any
class can use.
As described in the Properties, Methods, Operators, and Literals (p. lxiv) topic, each class can specify
external interfaces for the class. These external interfaces are broken up into the following
categories:
• Literals: Any literal form for objects of the class.
• Constructors: The various ways you can create objects of the class.
• Properties: Accessible parameters for objects of the class.
• Operators: Defines the math and other symbolic operators that are defined on values in
the class.
• Methods: Defines all the functions you can call for objects of the class.
In the description of each class in MAXScript, each of these external interfaces are documented.
In the syntax forms given for methods, operators, and properties, the types of argument or property
values are specified using the <type_name> convention, in which type_name describes the type of
value that is allowable for that argument or property. You can, of course, use an arbitrary expression
for these values, as long as it evaluates to a value of the right type. For example, <boolean> means
either the true or false Boolean values.
Also indicated for function calls are those that are automatically mapped over collections. This
means that the function will be automatically called repeatedly on the elements of a collection if
the collection is given as the first argument to the function. See the Collections (p. 773) topic for more
information.
714 Chapter 9 | Values
Prints single value to Listener or optional filestream (p. 763), stringstream (p. 766), or
windowstream (p. 767), followed by a line break. If the argument value is a Collection
(p. 773), and #noMap is not specified, each value in the collection is printed out on a
separate line. If #noMap is specified, the collection value is printed out on a single line. The
printed form of all basic data value types, except for BigArray, are directly readable by the
readValue() and readExpr() functions, making it simpler to read back in values
printed to a file by MAXScript. If the pre-3ds max R3 print forms are required for
compatibility with existing scripts, you can set the system global variable
options.oldPrintStyles to true.
format <format_string> { <value> } [ to:<stream> ]
Prints one or more values to Listener or optional filestream, stringstream, or
windowstream, using the format string as a template. The format string is a string that can
contain plain text to print interspersed with the ‘%’ (percent) metacharacter. Each
occurrence of a ‘%’ is replaced by the printed representation of the successive argument
values following the format string. For example:
format “name:%, pos:%\n” obj.name obj.pos
classOf <value>
Returns the value’s class. Each type of value has its own class. If the value is a Node value,
classOf() returns the class of the world state object (the state of the node at the top of its
stack). See the Node : MAXWrapper (p. 820) topic for more information.
Note:
To avoid a conflict between a user class value in global variable named ‘rollout’ and MAXScript
reserved word ‘rollout’ which always introduces a rollout definition the class variable name for a
rollout is RolloutClass.
So, for a rollout foo you’d now say “if classOf foo == RolloutClass”.
superClassOf <value>
Returns the value’s superclass. A value’s superclass is the class from which the value’s class
was derived.
isKindOf <value> <class>
Returns true if value has given class or inherits from class.
isStructDef <value>
Returns true if the value is a structure definition
isStruct <value>
Returns true if the value is a structure instance
isController <value>
Returns true if the value is a controller
getHashValue <value> <Integer oldHaskValue>
If the value is one of the supported value types, returns an integer hash value that is a
factor of the value and oldHaskValue. If the value type is not supported, returns a value of
undefined. The supported value types are:
Float
Integer
String
BitArray
Point3
Ray
Quat
AngAxis
EulerAngles
Matrix3
Point2
Color
Arrays containing any of the above value types
716 Chapter 9 | Values
Output:
$Box:Box01 @ [-74.353745,0.000001,-19.931978]
“Box01”
Material #1:Standard
“Material #1”
The printed results above also reflect the result of a <value> as string operation, that is the result
is a string representation of the object rather than the object name.
classOf, superClassOf, and isKindOf
The following table shows the hierarchy of classes and superclasses for a variable that contains a
reference to a 3ds max Box object (i.e., b=box()).
The isKindOf() and classOf() functions are useful for filtering objects from a set. For example,
either of the following will collect all objects of class box into variable allBoxes:
allBoxes=for obj in $* where (isKindOf obj box) do collect obj
allBoxes=#()
for obj in $* do (if classOf obj == box then append allBoxes obj)
Number Values 717
One of the named parameters to the interactive node selection functions is filter, which allows
you to specify a function that returns a value of true if an object can be selected. The classOf,
superClassOf, and isKindOf functions are frequently used in these functions. For example, the
following function limits the choices to shape objects:
fn shape_filt obj = isKindOf obj Shape
For an example of such a usage, see the Pickbutton (p. 1504) topic.
Number Values
Integer : Number
Float : Number
The Number class provides standard arithmetic capabilities to MAXScript. The two Number types,
Integer and Float, can be freely intermixed and MAXScript will convert as necessary. They both
support all the following operators and methods. Also see the Number Literals (p. 660) topic.
Literals:
[-]{<digit>}[.{<digit>}[(e | E)[+ | -]{<digit>}+] -- decimal number
0x{<hex_digit>}+ -- hexadecimal number
718 Chapter 9 | Values
Example Literals:
123
123.45
-0.00345
1.0e-6
0x0E
0xFFE0
.1
Operators:
<number> + <number>
<number> - <number>
<number> * <number>
<number> / <number>
Standard arithmetic operations. If both numbers are integers, the result is a non-rounded
integer. If one or both numbers are floats, both arguments are widened to floats and the
result is a float.
<number> ^ <number>
Raise the first number to the power given by the second number. If the first number is an
integer, the result is a rounded integer.
- <number>
unary minus
<number> == <number>
<number> != <number>
<number> > <number>
<number> < <number>
<number> >= <number>
<number> <= <number>
Standard number comparison operations.
<number> as <class>
Converts the number to an instance of the given class. Allowed classes are:
Float
Integer
String
Time (number taken as frames)
Methods:
copy <number>
Creates a new copy of the number value. This method exists primarily to support
copying arrays.
abs <number>
Returns the absolute value of the number. The result is the same type as the argument.
mod <number1> <number2>
Modulo arithmetic, the remainder when number1 is divided by number2. The result is
always a float.
Number Values 719
ceil <number>
Returns the nearest whole number greater than or equal to number. The result is always
a float.
floor <number>
Returns the nearest whole number less than or equal to number. The result is always
a float.
acos <number>
asin <number>
atan <number>
atan2 <number> <number>
cos <number>
cosh <number>
sin <number>
sinh <number>
tan <number>
tanh <number>
Standard trigonometric functions. Angles are represented in degrees. The result is always
a float.
exp <number>
log <number>
log10 <number>
pow <number> <number>
sqrt <number>
Standard transcendental functions. The result is always a float.
random <number> <number>
Returns a pseudo random number inclusively between the two arguments. Return value
type is the type of the first argument.
seed <number>
Reseeds the random number generator using the specified value.
degToRad <number>
Returns the conversion of the number from degrees to radians. The result is always a float.
radToDeg <number>
Returns the conversion of the number from radians to degrees. The result is always a float.
bit.and <integer1> <integer2>
Returns the <integer> result of AND-ing the bits in integer1 and integer2
bit.or <integer1> <integer2>
Returns the <integer> result of OR-ing the bits in integer1 and integer2
bit.xor <integer1> <integer2>
Returns the <integer> result of XOR-ing the bits in integer1 and integer2
bit.not <integer1>
Returns the <integer> result of flipping the bits in integer1
720 Chapter 9 | Values
When you display or print a Float, MAXScript prints the value to the 6th significant digit. The
following table shows examples of values stored to a MAXScript variable, the value as stored, and
the value as displayed.
Examples:
The following script shows the use of various literals, constructors, properties, operators, and
methods of the Number class.
Script:
-- numbers test bed
i=10 -- assign integers to variables
j=20
i/j -- integer divide, result is integer
i=i as float -- convert i to a float
i/j -- float divide, result is float
i += 1 -- increment i by 1
if i < j do i=2.^3 -- if i is less than j, set i to 2 to the 3rd power
mod j i -- return remainder of j divided by i
cos 30.0 -- return cosine of 30 degrees
sqrt j -- return square root of j
seed 12345 -- seed the random number generator
for k=1 to 5 do print (random i j) -- print out 3 random numbers
722 Chapter 9 | Values
Output:
10 -- result of line 2
20 -- result of line 3
0 -- result of line 4 (10/20)
10.0 -- result of line 5
0.5 -- result of line 6 (10./20)
11.0 -- result of line 7
8.0 -- result of line 8 (2.^3)
4.0 -- result of line 9
0.866025 -- result of line 10
4.47214 -- result of line 11 (sqrt 20)
OK -- result of line 12
10.7775 -- output from line 13 (random 8. 20)
15.0183
17.4467
16.1027
10.1344
OK -- result of line 13
String Values
The String class defines the characteristics of character strings. The character strings can be of
any length.
Literal:
“<characters>”
See the String Literals (p. 660) topic for a description of String literals.
Constructors:
<value> as string
Converts any value into its string representation.
Properties:
<string>.count : Integer, read-only
The number of characters in the string.
Operators:
<string> + <string>
Returns a new string that is the concatenation of the two strings.
<string> == <string>
<string> != <string>
<string> > <string>
<string> < <string>
<string> >= <string>
<string> <= <string>
Standard lexical string comparisons (case sensitive). To perform a case insensitive
comparison, first convert the strings to Name values.
<string>[<index_number>]
Returns indexed character as a single-character string, index starts at 1.
String Values 723
<string>[<index_number>] = <single_character_string>
Sets indexed character to character given.
<string> as <class>
Converts the string to an instance of the given class. You can convert a string into a Name
value using the as operator, for example:
“Foo” as name -- returns #foo
You can also convert strings to numbers using the as operator. For example:
“123.4” as float -- returns 123.4
You can use any of the Number classes as a target class - Number, Float, or Integer. If you
use Number, the appropriate class will be used depending on the syntax of the number in
the string.
You can convert a string to a StringStream value using the as operator. For example:
“$box01” as stringstream -- returns the string as a stringstream
Converting a string to a StringStream value allows you to read through a string using the
MAXScript’s text file I/O operations. See the StringStream Values (p. 766) topic for a
description of StringStreams.
Methods:
copy <string>
Creates a new copy of the string value. For example:
newstr = copy oldstr
The new value contains a copy of the text contents of the copied string, and is
independent of the copied string.
execute <string>
Compiles and evaluates the contents of the string as a MAXScript expression and returns
the result of the evaluation. For example:
execute “2 + 2” -- yields the value 4
str = “$foo.ffd_2x2x2.control_point_” +
n as string + “ = [1,1,1]”
execute str
The result of an execute() call is the result of the last expression in the string argument.
724 Chapter 9 | Values
You can use execute() as a temporary work-around to the current limitation in naming
scene objects - there is currently no way to name an object using a computed name. For
example:
obj = execute (”$foo/” + child_name)
would retrieve the child of $foo named in the variable child_name. Here’s a more
complex example:
side = “left”
finger = 2
limb = “arm”
obj = execute (”$torso/” + limb + “/” +
side + “/finger/” +
finger as string)
The scope of variables used in the evaluated string is global and not the scope in effect
when the execute() method is executed. So if you call execute() within a function,
scripted utility, or anywhere where the scope is not global, you will need to explicitly
specify the scope of any variables used in the string that is executed. In the following
example, the scope of variable posObj is local to utility myUtil, so the string needs to
specify the variable’s name as being in myUtil’s scope:
Utility myUtil “My Utility”
(
...
local posObj
...
fn test obj =
( local i, j, thisCont
...
thisCont=execute (”myUtil.posObj.’”+j+”‘pos.controller”)
...
)
In general, you cannot access locals from outside of an object, except for top-level locals in
rollouts, utilities, tools and plug-ins (because they are semi-permanent and are stored with
these objects). Function parameters and locals are dynamic and stack-based and not
accessible as properties of the function definition.
For more information on variable scope, see the Scope of Variables (p. 646) and Accessing
Locals and Other Items in a Rollout from External Code (p. 1480) topics.
GetTextExtent <string>
Returns a Point2 value containing the size of the string in pixels if it was displayed in a
command panel.
findString <string> <search_string>
Returns the index of search_string in string or undefined if not found. For example:
findString “Thanks for all the fish!” “all” -- returns 12
String Values 725
would return
#(”MAX”,”Script”,”is”,”dead”,”funky”)
Examples:
The following script shows the use of various literals, constructors, properties, operators, and
methods of the String class.
726 Chapter 9 | Values
Script:
-- strings test bed
fn uppercase instring = -- beginning of function definition
( local upper, lower, outstring -- declare variables as local
upper=”ABCDEFGHIJKLMNOPQRSTUVWXYZ” -- set variables to literals
lower=”abcdefghijklmnopqrstuvwxyz”
--
-- create an unique copy of the string referenced by instring, and store
-- reference to unique copy in outstring
outstring=copy instring
--
-- increment from 1 to number of character in string
for i=1 to outstring.count do
--
-- see if the single character at index i in outstring is present in string lower
-- If so, j equals position in string lower. If not, j equals undefined
( j=findString lower outstring[i]
--
-- if character was found in lower, replace with corresponding character in upper
if (j != undefined) do outstring[i]=upper[j]
)
outstring -- value of outstring will be returned as function result
)-- end of fn uppercase
--
s1=”AbCdEfGh” -- set variable to literal
s2=uppercase s1 -- call function uppercase, passing s1 as parameter
if s1 == s2 do print “strings s2 and s3 are the same” -- compare strings
if s1 != s2 do print “strings s1 and s2 are different”
--
theObject=”sphere” -- set variable to literal
theRadius= (random 10. 100.) as string -- convert number to string
-- concatenate strings and execute string
myObject=execute (theObject + “ radius:” + theRadius)
Output:
uppercase() -- result to function definition
“AbCdEfGh” -- result of line 24
“ABCDEFGH” -- result of line 25
undefined -- result of line 26 - strings not equal,
-- and no else expression in if expression
“strings s1 and s2 are different” -- output from line 27
“strings s1 and s2 are different” -- result of line 27
“sphere” -- result of line 29
“75.4091” -- result of line 30
$Sphere:Sphere01 @ [0.0,0.0,0.0] -- result of line 32. Execute function
-- created a sphere object
Name Values 727
Name Values
The Name class defines the characteristics of names. Names are primarily used as parameters in
function calls to signify one of a set of options.
Literal:
#<var_name>
See the Names (p. 657) topic for a description of Name literals.
Constructors:
<string> as name
Converts a String value into a name
Operators:
<name> == <name>
<name> != <name>
<name> < <name>
<name> > <name>
<name> <= <name>
<name> >= <name>
Comparison of names is caseless alphabetic. Among other things, this allows arrays of
names to be sorted using the array sort function.
Examples:
The following script shows the use of various literals, constructors, and operators of the Name class.
Script:
-- name test bed
name1=#Hello -- set variable to name literal
name2=”HELLO” as name -- convert string to name
if name1 == name2 do print “names are equal” -- compare the names
box_props=getpropnames box -- get the properties of box class
sort box_props -- sort the property names
Output:
#Hello -- result of line 2
#Hello -- result of line 3
“names are equal” -- output from line 4
“names are equal” -- result of line 4
-- following are the results of lines 5 and 6
#(#height, #length, #lengthsegs, #width, #widthsegs, #mapCoords, #heightsegs)
#(#height, #heightsegs, #length, #lengthsegs, #mapCoords, #width, #widthsegs)
728 Chapter 9 | Values
BooleanClass Values
The BooleanClass class defines the characteristics of values that can only have one of two states.
Literals:
true
false
on -- equivalent to true
off -- equivalent to false
Operators:
not <boolean>
true if boolean=false, false if boolean=true
<boolean> and <boolean>
true if both boolean values are true
<boolean> or <boolean>
true if either boolean value is true
Notes:
The boolean and and or evaluations are non-strict. This means that only the first boolean may be
evaluated to determine the overall result:
• If the first operand is false in an and expression, the result must be false, therefore, the second
operand is not evaluated.
• If the first operand is true in an or expression, the result must be true, therefore, the second
operand is not evaluated.
This saves execution time and enables useful shorthand notation. For example, if you want to
calculate ‘sin a’ if the value of variable ‘a’ isn’t undefined, you could use the example below:
if a != undefined and sin a > 0 then ..
Examples:
The following script shows the use of various literals and operators of the BooleanClass class.
Script:
-- boolean test bed
bool1=true -- set variables to boolean literals
bool2=on
if bool1 and bool2 do print “booleans are equal” -- compare the booleans
-- define an “exclusive or” function - returns true if only one of the
-- inputs is true
fn xor b1 b2 = (not (b1 and b2)) and (b1 or b2)
xor false false -- evaluate 4 combinations of inputs to xor
xor false true
xor true false
xor true true
Color Values 729
Output:
true -- result of line 2
true -- result of line 3
“booleans are equal” -- output from line 4
“booleans are equal” -- result of line 4
xor() -- function definition
false -- result of line 8
true -- result of line 9
true -- result of line 10
false -- result of line 11
Color Values
All the places that colors turn up in MAXScript (such as wireColor, light color, etc.) are represented
by instances of the Color class. You can also use Point3 values as color specifiers.
Literals:
red
green
blue
white
black
orange
yellow
brown
gray
predefined MAXScript globals
Constructors:
color <r> <g> <b> [ <a> ]
r,g,b and optional alpha are float values in the range 0 to 255
<point3> as color
interprets x as r, y as g, z as b
Properties:
<color>.red or .r : Float
<color>.green or .g : Float
<color>.blue or .b : Float
<color>.alpha or .a : Float
color component properties
<color>.hue or .h : Float
<color>.saturation or .s : Float
<color>.value or .v : Float
derived properties
730 Chapter 9 | Values
Operators:
<color> == <color>
<color> != <color>
<color> + <color_or_number>
<color> - <color_or_number>
<color> * <color_or_number>
<color> / <color_or_number>
Channel-by-channel math operations. Numbers operate on r,g,b,a channels equally.
- <color>
unary minus
Methods:
copy <color>
Creates a new copy of the color value. For example:
newClr = copy oldClr
The new value contains a copy of the input color value, and is independent of the input
color value.
random <from_color> <to_color>
Returns a random color between the given colors. The alpha component of the result will
always be 255.
composite <color1> <color2>
Composites color1 over color2 through color1’s alpha. This function is equivalent to:
color1 + color2*((255. - color1.alpha)/255.)
-- 3D Noise Functions
noise3 <color>
noise4 <color> <phase_float>
turbulence <color> <frequency_float>
fractalNoise <color> <H_float> <lacunarity_float> <octaves_float>
See the Point3 Values (p. 731) topic for a description of the noise functions.
Notes:
The component values of a Color value (r, g, b, and a) are normally in the range 0.0 to 255.0.
However values outside this range are permissible. When color values outside the normal range are
used in 3ds max, 3ds max clamps the values to the range of 0.0 to 255.0.
Examples:
The following script shows the use of various literals, constructors, properties, operators, and
methods of the Color class.
Point3 Values 731
Script:
-- color test bed
magenta=color 255 255 0 255 -- create colors using constructors
aqua = [0, 255, 255] as color
aqua.v /= 2. -- reduce “strength” of aqua color
aqua
aqua.alpha=128 -- set aqua to 50% opacity
aqua
lightGray=white/4 -- create light gray color by dividing
-- each component of white by 4
composite aqua lightGray -- composite light gray over aqua
random black white -- generate a random color
Output:
(color 255 255 0) -- result of line 2. Note that if
-- alpha=255 it is not displayed
(color 0 255 255) -- result of line 3
127.5 -- result of line 4 - value property of aqua
(color 0 127.5 127.5) -- result of line 5 - color of aqua
128 -- result of line 6 - alpha property of aqua
(color 0 127.5 127.5,128) -- result of line 7 - color of aqua
(color 63.75 63.75 63.75) -- result of line 8 - each component divided by 4
(color 31.75 159.25 159.25 159.75) -- result of line 10
(color 170.944 109.543 74.1957) -- result of line 11
Point3 Values
The Point3 class defines the characteristics of points in 3D space. These values are also known as 3D
vectors, and contain 3 component floating point numbers. All the coordinates passed to and from
3ds max are in these values. See also 2D and 3D Point Literals (p. 665).
Literals:
[ <expr>, <expr>, <expr> ]
Example Literals:
[x, y, z]
[10, 10, 10]
[sin x, cos y, tan z]
x_axis -- equivalent to [1,0,0]
y_axis -- equivalent to [0,1,0]
z_axis -- equivalent to [0,0,1]
Constructors:
point3 <x> <y> <z>
<color> as point3
732 Chapter 9 | Values
Properties:
<point3>.x : Float -- the x coordinate
<point3>.y : Float -- the y coordinate
<point3>.z : Float -- the z coordinate
Operators:
<point3> == <point3>
<point3> != <point3>
<point3> + <point3_or_number>
<point3> - <point3_or_number>
<point3> * <point3_or_number>
<point3> / <point3_or_number>
Standard vector arithmetic. If the second operand is a number, the operation is performed
on each component of the value.
<point3> * <matrix3>
Transforms point3 into the coordinate system specified by matrix3.
<point3> * <quat>
rotates point3
- <point3>
unary minus
Methods:
copy <point3>
Creates a new copy of the point3 value. For example:
newPos = copy oldPos
The new value contains a copy of the input point3 value, and is independent of the input
point3 value.
length <point3>
Returns the length of the vector.
dot <point3> <point3>
Returns the vector dot product.
cross <point3> <point3>
Returns the vector cross product.
normalize <point3>
Returns the point3 value normalized such that the vector length equals 1.
distance <point3> <point3>
Returns the distance between the points - length of (point 2 – point 1).
random <point3> <point3>
Generates a pseudo-random point between the given points.
arbAxis <point3>
Returns a Matrix3 value representing an arbitrary axis system using point3 as the
“up” direction.
Point3 Values 733
matrixFromNormal <point3>
Returns a Matrix3 value with the normal specified by the given point as the Z axis. The
translation portion of the Matrix3 value will be [0,0,0]. The components of the scale
portion are the inverse of the values required to normalize the point3 value. For example,
MatrixFromNormal [0,0,1]
MatrixFromNormal [0,1,1]
will return
(matrix3 [1,0,0], [0,1,0], [0,0,1], [0,0,0])
(matrix3 [0,-0.707107,0.707107] [1.41421,0,0] [0,1,1] [0,0,0])
-- 3D Noise Functions
noise3 <point3>
A floating point noise function over 3D space, implemented by a pseudo-random tricubic
spline. The return value is in the range -1.0 to +1.0. Given the same point3 value, the
noise3() function always returns the same value.
noise4 <point3> <phase_float>
The same function as noise3 in which the phase can be varied using the second parameter.
The return value is in the range -1.0 to +1.0.
turbulence <point3> <frequency_float>
This is a simple fractal-loop turbulence built on top of the noise3 function. The second
parameter controls the frequency of the turbulence. The return value is in the range 0.0 to
+1.0.
fractalNoise <point3> <H_float> <lacunarity_float> <octaves_float>
This is a fractal function of 3D space implemented using fractional Brownian motion. The
function is homogeneous and isotropic. It returns a float.
The parameters are as follows:
point3 - The point in space at which the noise is computed.
H_float - The fractal increment parameter in the range [0,1]. When H_float is 1 the
function is relatively smooth; as H_float goes to 0, the function approaches white noise.
lacunarity_float - The gap between successive frequencies, best set at 2.0.
octaves_float - The number of frequencies in the function.
All the noise functions are based on code and algorithms in the book “Texturing and Modeling:
A Procedural Approach”, Musgrave, Peachey, Perlin and Worley. Academic Press,
ISBN: 0-12-228760-6.
734 Chapter 9 | Values
Examples:
The following script shows the use of various literals, constructors, properties, operators, and
methods of the Point3 class.
The following script was written as a test bed for the noise functions. This script displays a 2
dimensional slice of the noise function output as a bitmap. By changing the noise parameters in
lines 4 through 10, and specifying which noise function to evaluate in line 12, you can see the effects
of changes in the parameters and using different noise functions.
Script:
-- noise functions test bed
b_width=320 -- specify size of bitmap
b_height=320
size=10. -- total distance covered by each row and column
z=0. -- z coordinate of 2D slice
phase=0.5 -- noise4 parameter
frequency=10. -- turbulence parameter
fract_interval=.5 -- fractalNoise parameters
lacunarity=2.
octaves=5
--
whichfunc=1 -- 1 = noise3; 2 = noise4; 3 = turbulence; 4 = fractalNoise
--
b=bitmap b_width b_height -- create the bitmap
for h=0 to (b_height-1) do -- step through each row of the bitmap
( h_norm=(h as float/(b_height-1))*size -- calculate y coordinate
row = for w=0 to (b_width-1) collect -- collect row of pixel colors
( w_norm=(w as float/(b_width-1))*size -- calculate x coordinate
noise_val = case whichfunc of -- store result of selected function
( 1: noise3 [w_norm, h_norm , z]
2: noise4 [w_norm, h_norm , z] phase
3: turbulence [w_norm, h_norm , z] frequency
4: fractalNoise [w_norm, h_norm , z] fract_interval lacunarity octaves
)
noise_val = 0.5*(1.+noise_val) -- convert output range to 0. to 1.
white*noise_val -- and multiply by color white
)
setpixels b [0,h] row -- store row of pixels in bitmap
)
display b -- display bitmap in VFB
Point3 Values 735
Output:
The following figures show the bitmap generated by the above script for each noise function type.
noise3
noise4
turbulence
736 Chapter 9 | Values
fractalNoise
Point2 Values
The Point2 class defines the characteristics of points in 2D space. This class is a 2D version of Point3
and is used in utility rollout positioning parameters and for accessing Bitmap values, etc. See also 2D
and 3D Point Literals (p. 665).
Literals:
[ <expr>, <expr> ]
Example Literals:
[x, y]
[10, 20]
[sin x, cos x]
Constructors:
point2 <x> <y> -- x and y are numbers
<point3> as point2 -- created from the x and y components of the point3
Properties:
<point2>.x : Float
<point2>.y : Float
Operators:
<point2> == <point2>
<point2> != <point2>
<point2> + <point2_or_number>
<point2> - <point2_or_number>
<point2> * <point2_or_number>
<point2> / <point2_or_number>
Standard vector arithmetic. If the second operand is a number it does scalar arithmetic on
vector.
- <point2>
unary minus
Ray Values 737
Methods:
copy <point2>
Creates a new copy of the point2 value. For example:
newPoint = copy oldPoint
The new value contains a copy of the input point2 value, and is independent of the input
point2 value.
random <point2> <point2>
Generates a pseudo-random point between the given points.
length <point2>
Returns the length of the vector.
distance <point2> <point2>
Returns the distance between the points - length of (point 2 – point 1).
normalize <point2>
Returns the point2 value normalized such that the vector length equals 1.
Ray Values
The Ray class defines the characteristics of a ray in 3D space. A ray has two Point3 components, one
defining a start position and the other a direction vector for the ray.
Constructors:
ray <pos_point3> <dir_point3>
Returns a new ray with given position and direction vector.
<node> as ray
Takes a scene object that has a target, such as a tape measure or a target camera and returns
a ray from the object to the target. Returns undefined if the object has no target.
Properties:
<ray>.pos : Float
<ray>.position : Float -- pos and position are synonyms
<ray>.dir : Point3 -- unit normalized direction vector
Methods:
copy <ray>
Creates a new copy of the ray value. For example:
newRay = copy oldRay
The new value contains a copy of the input ray value, and is independent of the input
ray value.
738 Chapter 9 | Values
Quat Values
The Quat class provides a compact representation for orientation in three space and provides
methods to perform Quaternion algebra. Quaternions are used to store object rotations in 3ds max.
A quaternion is made up of four terms: a real scalar part which specifies the amount of rotation and
an imaginary vector part which defines the axis of rotation. If the quaternion is normalized, the
scalar term equals the cosine of half the angle of rotation, the vector term is the axis of rotation, and
the magnitude of the vector term equals the sine of half the angle of rotation.
Interpolation between two key frame orientations is much easier using quaternions and produces
smooth and natural motion. Unlike Euler angles, no numerical integration is necessary; quaternions
provide an analytic result (no approximations).
Rotations in MAXScript follow the right-hand-rule, namely positive angles rotate counter-clockwise
about positive axes, consistent with the convention in the 3ds max UI.
Constructors:
quat <x_float> <y_float> <z_float> <w_float>
The x, y, z values make up the vector portion. w is the angle of rotation about the vector.
quat <degrees_float> <axis_point3>
<angleaxis> as quat
<eulerangle> as quat
<matrix3> as quat -- extracts the rotation component as a quat
Properties:
<quat>.w : Float
<quat>.x : Float
<quat>.y : Float
<quat>.z : Float
quaternion complex components as Floats
<quat>.angle : Float
<quat>.axis : Point3
derived properties - an angle in degrees and a rotation axis
Operators:
<quat> + <quat>
<quat> - <quat>
<quat> * <quat_or_number>
<quat> / <number>
- <quat>
Quaternion algebra
<quat> * <matrix3>
Quaternion algebra using rotation portion of the matrix3
<quat> == <quat>
<quat> != <quat>
<quat> as <class>
quats can convert to Matrix3’s, Angleaxis’s, Eulerangle’s
Quat Values 739
Methods:
copy <quat>
Creates a new copy of the quat value. For example:
newQuat = copy oldQuat
The new value contains a copy of the input quat value, and is independent of the input
quat value.
isIdentity <quat>
Returns true if the quaternion is equal to the identity quaternion (x=y=z=0.0; w=1.0).
normalize <quat>
Returns a normalized quat, dividing each term of the input quat by a scale factor such that
the resulting sum of the squares of all parts equals unity.
inverse <quat>
Returns the inverse of the quaternion (1/q).
conjugate <quat>
Returns the conjugate of a quaternion.
logN <quat>
Returns the natural logarithm of UNIT quaternion.
exp <quat>
Returns the exponentiated quaternion (where q.w=0).
slerp <start_quat> <end_quat> <number>
Returns a spherical linear interpolation of UNIT quaternions. As number goes from 0 to 1,
the returned value goes from start_quat to end_quat.
LnDif <p_quat> <q_quat>
Returns the “log difference” of two quaternions as:
logN ((inverse p_quat)*q_quat)
AngleAxis Values
The AngleAxis class provides a representation for orientation in 3D space using an angle in degrees
and a rotation axis. This class is similar to a quaternion, except that a normalized quaternion only
represents -PI to +PI rotation. Angles can be greater than 360 and so specify multiple revolutions,
unlike quaternions. Rotations follow the right-hand-rule.
Constructors:
angleaxis <degrees_float> <axis_point3>
<quat> as angleaxis
<eulerangle> as angleaxis
<matrix3> as angleaxis
extracts the rotation component as an angleaxis
Operators:
<angleaxis> == <angleaxis>
<angleaxis> != <angleaxis>
<angleaxis> as <class>
AngleAxis can convert to Matrix3’s, Quat’s, Eulerangle’s
Properties:
<angleaxis>.angle : Float
<angleaxis>.axis : Point3
<angleaxis>.numrevs : Integer
Methods:
copy <angleaxis>
Creates a new copy of the angleaxis value. For example:
newAngleAxis = copy oldAngleAxis
The new value contains a copy of the input angleaxis value, and is independent of the
input angleaxis value.
random <angleaxis> <angleaxis>
Random rotation in degrees, but uses quat Slerp, so loses multiple revolution angles.
742 Chapter 9 | Values
EulerAngles Values
The EulerAngles class provides a representation for orientation in 3D space using rotation angles in
degrees about each axis. Angles can be greater than 360 and so specify multiple revolutions.
Rotations follow the right-hand-rule.
Constructors:
eulerAngles <x_degrees> <y_degrees> <z_degrees>
<quat> as eulerAngles
<angleAxis> as eulerAngles
<matrix3> as eulerAngles
Extracts the rotation component as an eulerAngles.
Operators:
<eulerAngles> == <eulerAngles>
<eulerAngles> != <eulerAngles>
<eulerAngles> as <class>
eulerAngles can convert to Matrix3, Quat, angleAxis values
Properties:
<eulerAngles>.x : Float
<eulerAngles>.y : Float
<eulerAngles>.z : Float
Rotation about each primary axis in float degrees
Methods:
copy <eulerAngles>
Creates a new copy of the eulerAngles value. For example:
newEulerAngles = copy oldEulerAngles
The new value contains a copy of the input eulerAngles value, and is independent of the
input eulerAngles value.
random <eulerAngles> <eulerAngles>
Random rotation between the eulerAngles, but uses quat Slerp, so loses multiple
revolution angles.
EulerAngles Values 743
Matrix3 Values
The Matrix3 class implements a 4x3 3D transformation matrix object. The transform matrix is a 3D
homogeneous matrix typically used to hold object coordinate systems and transformations.
Constructors:
matrix3 <row1_point3> <row2_point3> <row3_point3> <row4_point3>
matrix from row vectors
matrix3 0
zero matrix
matrix3 1
identity matrix
<quat> as matrix3
<angleaxis> as matrix3
<eulerangles> as matrix3
rotation matrices
rotateXMatrix <number> -- all angles in degrees
rotateYMatrix <number>
rotateZMatrix <number>
rotation matrices
transMatrix <point3>
translation matrix
scaleMatrix <point3>
scale matrix
rotateYPRMatrix <yaw_number> <pitch_number> <roll_number>
Returns a Matrix3 value for use as a rotation transformation by specifying yaw, pitch and
roll angles. All angles are in degrees.
matrixFromNormal <point3>
Returns a Matrix3 value with the normal specified by the given point as the Z axis. The
translation portion of the Matrix3 value will be [0,0,0]. The components of the scale
portion are the inverse of the values required to normalize the point3 value. For example,
MatrixFromNormal [0,0,1]
MatrixFromNormal [0,1,1]
will return
(matrix3 [1,0,0], [0,1,0], [0,0,1], [0,0,0])
(matrix3 [0,-0.707107,0.707107] [1.41421,0,0] [0,1,1] [0,0,0])
Matrix3 Values 745
Operators:
<matrix3> + <matrix3>
<matrix3> - <matrix3>
<matrix3> * <matrix3>
<matrix3> as <class>
Matrix3’s can convert to Quat’s, AngleAxis, EulerAngles using the matrix’s rotation
component
Properties:
<matrix3>.row1 : Point3
<matrix3>.row2 : Point3
<matrix3>.row3 : Point3
<matrix3>.row4 : Point3
<matrix3>.translation : Point3
read/write access to rows. Row4 is the translation.
<matrix3>.rotationpart : Quat, read-only
<matrix3>.translationpart : Point3, read-only
<matrix3>.scalerotationpart : Quat, read-only
<matrix3>.scalepart : Point3, read-only
access to various transforms, with the remaining transforms zero-ed out.
<matrix3>.determinantsign : Integer, read-only
returns sign of the matrix’s determinant
Methods:
copy <matrix3>
Creates a new copy of the matrix3 value. For example:
newMatrix3 = copy oldMatrix3
The new value contains a copy of the input matrix3 value, and is independent of the input
matrix3 value.
isIdentity <matrix3>
Returns true if the matrix is equal to the identity matrix.
inverse <matrix3>
Returns the inverse of the matrix.
xformMat <transform_matrix3> <space_matrix3>
Returns the transform matrix transformed into a particular space. For example, say you
have a rotation you want to apply, but you want to perform the rotation in another
coordinate system. To do this, you typically transform into the space of the coordinate
system, then apply the transformation, and then transform out of that coordinate system.
This method transformats matrix transform_matrix3 into the space of matrix
space_matrix3. The resulting matrix3 value is calculated as space_matrix3 *
transform_matrix3 * inverse(space_matrix3).
746 Chapter 9 | Values
false, and the code behaves the old way. If the matrix3 parameter is a single matrix, this
function returns the transformed matrix. If the parameter is an array of matrices, this
function returns the value OK. In both cases, the input matrix3 value(s) are replaced with
the transformed matrix value(s).
preTranslate <matrix3> <point3> -- mapped function
Applies an incremental translation transformation to the input matrix or matrices. This is
equivalent to multiplying on the LEFT by the transform. If the matrix3 parameter is a
single matrix, this function returns the transformed matrix. If the parameter is an array of
matrices, this function returns the value OK. In both cases, the input matrix3 value(s) are
replaced with the transformed matrix value(s).
preRotateX <matrix3> <number> -- mapped functions -- all angles in degrees
preRotateY <matrix3> <number>
preRotateZ <matrix3> <number>
preRotate <matrix3> <quat>
Applies an incremental rotation transformation to the input matrix or matrices. This is
equivalent to multiplying on the LEFT by the transform. If the matrix3 parameter is a
single matrix, this function returns the transformed matrix. If the parameter is an array of
matrices, this function returns the value OK. In both cases, the input matrix3 value(s) are
replaced with the transformed matrix value(s).
preScale <matrix3> <point3> [ <boolean> ] -- mapped function
Applies an incremental scale transformation to the input matrix or matrices. This is
equivalent to multiplying on the LEFT by the transform. If <boolean> is true, the
translation component is scaled. If <boolean> is false the translation component is
unaffected. If not specified, the boolean defaults to false. If the matrix3 parameter is a
single matrix, this function returns the transformed matrix. If the parameter is an array of
matrices, this function returns the value OK. In both cases, the input matrix3 value(s) are
replaced with the transformed matrix value(s).
Related Methods:
getEulerMatAngleRatio <matrix3_1> <matrix3_2> \
<eulerAngles1> <eulerAngles2> \
[angle:<eulertype_integer>]
When converting a series of matrix3 values to eulerAngles values, it is possible for sign
flips to occur in the eulerAngles values. This is due to the fact that one single matrix3
value can be expressed through many different eulerAngles values. This flip can be
detected by based on the eulerAngles/matrix3 ratio. The eulerAngles/matrix3 ratio is the
relation of the angle difference in eulerAngles space to the angle difference in matrix3
space. If this ratio is bigger than PI the rotation between the two matrix3 to eulerAngles
conversions. This method returns the eulerAngles/matrix3 Angle ratio between the two
matrix3 to eulerAngles conversions as a float value. The actual detection of the flip is
dependent on the amount of rotation in between conversions. The smaller the amount of
rotation, the more accurate the detection is. The parameters to this method are:
748 Chapter 9 | Values
matrix3_1 and matrix3_2 are the previous and current transform matrix values.
eulerAngles1 and eulerAngles2 are the previous and current converted
rotation angles.
The optional eulertype_integer specifies the order of application of the angles. If
not specified, XYZ ordering is used. Its value can be any of the following:
1 - XYZ
2 - XZY
3 - YZX
4 - YXZ
5 - ZXY
6 - ZYX
7 - XYX
8 - YZY
9 - ZXZ
Because accessors are themselves operands, these definitions are recursive, which means
that you can string accessors together:
<BigMatrix>[<int_row>][<int_column>] -- returns float value of indexed row and column
<BigMatrix>[<int_row>][<int_column>] = <float_value> -- sets value in the matrix
Methods:
invert <BigMatrix>
Inverts the matrix in place, i.e., the input BigMatrix itself is modified. The return value is
also the inverted matrix. Note that this method only works if this matrix is “square”, i.e. if
m = n.
BigMatrix Values, BigMatrixRowArray Values 749
transpose <BigMatrix>
Returns the transpose of <BigMatrix>, i.e. result BigMatrix[i][j] =
BigMatrix[j][i].
clear <BigMatrix>
Frees all the elements and sets the matrix size to be 0x0
setSize <BigMatrix> <rows> <columns>
Deletes the current elements and sets the size of the matrix to rows x columns.
identity <BigMatrix> -- mapped function
If the number of rows and columns are equal, this method sets the matrix to the identity
(diagonal elements = 1, all other elements = 0). If the number of rows and columns are not
equal, it does nothing. If the parameter is an array of matrices, this function returns the
value OK. In both cases, the input BigMatrix value(s) are set to the identity.
Notes:
A BigMatrix object is a compound object, similar to an array of arrays. All of the BigMatrix methods
operate directly on the components of the input BigMatrix. As described in the Reference Assignment
(p. 653) topic, this can cause complications to occur if a BigMatrix object referenced by more than
one variable. If you assign a new value to an element of the matrix, or use any of the BigMatrix
methods, the same object is still referenced by the variables. This can be seen in the following
example.
Script:
bm1=bigmatrix 2 2
for i=1 to 2 do for j=1 to 2 do bm1[i][j]=random 0 10
bm2=bm1
invert bm1
bm2
Output:
#BigMatrix( -- result of line 1, contents of bm1
[0.00,0.00],
[0.00,0.00]
)
OK -- result of line 2
#BigMatrix( -- result of line 3, contents of bm2
[4.00,6.00],
[4.00,9.00]
)
#BigMatrix( -- result of line 4, contents of bm1
[0.75,-0.50],
[-0.33,0.33]
)
#BigMatrix( -- result of line 5, contents of bm2
[0.75,-0.50],
[-0.33,0.33]
)
750 Chapter 9 | Values
Box2 Values
The Box2 class describes a 2D rectangular region using integer coordinates. The Box2 class provides
methods that return individual coordinates of the box, scale and translate it, retrieve its center,
modify its size, and determine if points are inside the box. Box2 values are primarily used in the
viewport graphics methods described in the Viewport Drawing Methods (p. 1592) topic.
Constructors:
Box2 <x_integer> <y_integer> <w_integer> <h_integer>
Constructs a Box2 with the upper left corner at [x,y] with width w and height h.
Box2 <upperleft_point2> <lowerRight_point2>
Constructs a Box2 object from the specified corners.
Properties:
<Box2>.x : Integer
<Box2>.y : Integer
<Box2>.w : Integer
<Box2>.h : Integer
<Box2>.left : Integer, alias of x property
<Box2>.right : Integer
<Box2>.top : Integer, alias of y property
<Box2>.bottom : Integer
<Box2>.center : Point2, read-only
The right property is calculated as right = x + w – 1. The bottom property is
calculated as bottom = y + h – 1. Setting the right or bottom property will normally
change the w and h properties, respectively. However, if right is set less than left, the
right and left values will be swapped, and then the new value will be used as the left
value. Likewise, if bottom is set less than top, the bottom and top values will be swapped,
and then the new value will be used as the top value.
Operators:
<Box2> == <Box2>
<Box2> != <Box2>
Standard comparison operators. Two Box2 values are equal if all of their component values
are equal.
Methods:
scale <Box2> <float>
Scales the coordinates of the box about the center of the box.
translate <Box2> <point2>
Translates the coordinates of the box by the distance specified.
contains <Box2> <point2>
Determines if the point2 value is contained within the Box2. Returns true if the point is
inside the Box2 or on the Box2 edge; otherwise false.
rectify <Box2>
Adjusts the coordinates of the box such that top < bottom and left < right.
Time Values 751
empty <Box2>
Sets the Box2 to a special “empty” value.
isEmpty <Box2>
Returns true if the Box2 contains the special “empty” value, false otherwise.
Time Values
The Time class implements animation time in MAXScript. Time values reflect the properties of
animation time in 3ds max. Resolution is in ticks, with 4800 ticks per second. You can work with
time as ticks, frames, h.m.s, or normalized time.
You can intermix numbers and time values in time computations defined below. The rule is that
numbers are always interpreted as frame counts, with floating point numbers specifying fractional
frames. The numbers are always converted to tick-based time values internally and so have an
ultimate resolution of 4800 ticks per second.
You can do time arithmetic and comparisons using numbers as well as time values and convert
between time and (frame) numbers using the as operator. See also Time Literals (p. 662).
Literals:
[-]{<decimal_number>[m | s | f | t]}+ -- minutes/sec/frames/ticks
[-]{<digit>}:{<digit>}[.{<digit>}] -- SMPTE mins:secs.frame
[-]<decimal_number>n -- active segment normalized time
Example Literals:
2.5s -- 2.5 seconds
1m15s -- 1 minute 15 seconds
2m30s5f2t -- 2 minutes 30 seconds 5 frames 2 ticks
125f -- 125 frames
17.25f -- 17.25 frames
1f20t -- 1 frame 20 ticks
2:10.0 -- 2 minutes 10 seconds 0 frames (SMPTE)
0:0.29 -- 29 frames (SMPTE)
Constructor:
normTime <float> -- time from normal fraction
Properties:
<time>.ticks : Time as ticks
<time>.frame : Time as frames
<time>.normalized : Time as normalized fraction of active segment
752 Chapter 9 | Values
Operators:
<time> + <time>
<time> - <time>
- <time>
<time> * <number>
<time> / <number>
scale time
<time> == <time>
<time> != <time>
<time> > <time>
<time> >= <time>
<time> < <time>
<time> <= <time>
<time> as <class>
You can coerce a time to a Number - you get the time in ticks.
Methods:
random <time> <time>
abs <time>
Examples:
sliderTime = 30
t2 = n as time
if currentTime == 45 then ...
Some of the examples above refer to system global variables. See the 3ds max System Globals (p. 630)
topic for more details.
Interval Values
An Interval class represents an interval of time. It has two time value components, start and end.
The time values can be numbers or Times, numbers being interpreted as frame counts.
Constructor:
interval <start_time> <end_time>
Properties:
<interval>.start : Time
<interval>.end : Time
Undefined Value 753
Examples:
t = animationRange.start + 5
Some of the examples above refer to system global variables. See the 3ds max System Globals (p. 630)
topic for more details.
Undefined Value
The Undefined class implements the value used in uninitialized variables and array members. There
is one distinguished instance of the Undefined class in the reserved system variable undefined.
Constructor:
undefined
Examples:
-- check to see if MyLight has a target
if MyLight.target != undefined then
-- distance from light to target
dist=distance MyLight.pos MyLight.target.pos
else
-- distance from light to [0,0,0]
dist=length MyLight.pos
Ok Value
The Ok class implements the void value returned by some functions and expressions that don’t have
a meaningful value to return. There is one distinguished instance of the OK class in the reserved
system variable OK.
Unsupplied Value
The Unsupplied class implements the value used to initialize unsupplied keyword parameters to
functions. There is one distinguished instance of the Unsupplied class in the reserved system
variable unsupplied. You can test to see whether a caller has supplied an optional keyword
argument by comparing it with unsupplied.
Constructor:
unsupplied
Examples:
fn walk_tree obj parent: =
( if parent == unsupplied then
...
else
...
...
)
DontCollect Value
The dontCollect value is used in for loops to signal that the value is not to be collected. See For
Loop (p. 694) for details. dontCollect is a separate distinguished instance of the Undefined class,
and so will fail in the way the undefined value does if used in computations.
Constructor:
dontCollect
Examples:
-- collect all spheres with radius less than 5
little_spheres =
for i in $* collect
if classOf i == sphere and i.radius < 5 then i else dontCollect
DontCollect Value 755
Bitmap Values
The Bitmap class provides storage of and low-level access to 3ds max bitmaps.
Bitmaps can be temporary objects that are resident only in memory, or they can be associated with
a file on disk. Those bitmaps associated with files have a non-null .fileName property and are
either load-only or save-only, but not both (this is with respect to file I/O; all bitmaps in memory
can have their pixels modified by the setPixel() functions). You make load-only bitmaps with the
openBitmap() and selectBitmap() functions. You make temporary or save-only bitmaps with
the bitmap() constructor, or with the render(), copy(), or getChannelAsMask() functions. To
make them savable, they must have a valid file name, supplied either on the constructor with a
fileName: parameter or by setting the .fileName property.
Constructors:
bitmap <width <height> [ filename:<filename_string> ] \
[ numframes:<integer> ] \
[ color:<color> ] \
[ gamma:<float> ] \
[ pixelAspect:<float> ]
Creates an empty bitmap. The bitmap value returned is a savable bitmap.
The filename: parameter allows you to set the name of the file the bitmap will be saved
to using the save method. Specifying an existing bitmap file name does not load the
contents of the bitmap file into the bitmap value.
The numframes: parameter allows you to create a multi-frame bitmap.
The color: parameter allows you to set the initial color of all pixels in the bitmap. For
example:
b = bitmap 320 240 color:white
The gamma: parameter allows you to set the gamma for the newly created bitmap. For
example:
b = bitmap 320 240 gamma:1.9
render camera:c to:b
The pixelAspect: parameter allows you to set the pixel aspect for the newly created
bitmap.
Note that it is not possible to change the gamma or pixel aspect of a bitmap once created,
though you can copy one bitmap into a newly created one that has a different gamma or
pixel aspect to achieve this effect.
openBitMap <filename_string>
Returns a bitmap value containing the contents of the specified bitmap file. If the specified
bitmap file does not exist, a runtime error is generated. The bitmap value returned is a
load-only bitmap.
756 Chapter 9 | Values
selectBitMap [ caption:<open_dialog_title_string> ]
This method displays a Image Input selection browser for the user to select a bitmap file.
Returns a bitmap value containing the contents of the selected bitmap file, or the value
undefined if the user presses Cancel in the browser. The bitmap value returned is a
load-only bitmap.
copy <bitmap>
Copies an existing bitmap, creating an unique instance of the bitmap. If the source bitmap
is load-only, the bitmap value returned is a temporary bitmap value, with a null filename
and just one frame. If the source is a multi-frame file, it snaps the current frame into the
new copy, which becomes frame 0.
Properties:
<bitmap>.filename : String
Lets you get or set the file name associated with the bitmap.
<bitmap>.palette : Array
Yields an array of 256 colors (a bug in the current 3ds max SDK prevents working with
paletted files of other than 256 entries). Take care accessing this array with colors indexes
retrieved by the getIndexedPixels() function described below, because these indexes
are 0-based and MAXScript array indexes are 1-based. Yields undefined if the bitmap is
not paletted. Currently you cannot create a paletted bitmap in MAXScript, however you
can read and write to a pre-existing paletted bitmap.
<bitmap>.frame : Integer
Get and set the current frame number in a multi-frame file. Setting this property is
permitted only on load-only bitmaps. The frame number is 0-based for inherently multi-
frame files, such as .avi and .mov.
<bitmap>.numframes : Integer
The number of frames in a multi-frame file, yields 1 for a single image file.
<bitmap>.height : Integer, read-only
Returns bitmap’s height in pixels.
<bitmap>.width : Integer, read-only
Returns bitmap’s width in pixels.
<bitmap>.gamma : Float, read-only
Returns bitmap’s gamma value.
<bitmap>.aspect : Float, read-only
Returns the bitmap’s pixel aspect. Note that this is the aspect of the pixel, not the aspect of
the bitmap image.
Methods:
display <bitmap>
Opens a virtual frame buffer (VFB) displaying the image. Changes to the bitmap are not
automatically displayed to the VFB. To update the VFB, you need to call this function
again. Setting the frame property does cause the VFB to update. Each bitmap has its own
VFB, i.e., if you display two different bitmaps, two VFBs will be displayed.
DontCollect Value 757
unDisplay <bitmap>
Close the VFB associated with the bitmap if open.
save <bitmap> [frame:<integer>]
Saves current state of the bitmap. Make sure the file name has been set first. When saving
multi-frame image files, the effect of the frame: keyword parameter is different
depending on the type of output file. Inherently multi-frame files, such as .avi and .mov,
ignore the frame: parameter and always write to the next output file frame in sequence
on each save(); you cannot randomly write frames or rewrite frames already saved.
Saving image sequences (such as .bmp, jpg, .tga) requires supplying the frame: parameter
and causes the frame number to be appended to the output file name for each frame saved.
This effectively generates a sequence of image files suitable for building an IFL. The output
file remains open until you call close on the bitmap.
The save() function can only be called on a savable bitmap. You will get a runtime error
if you attempt to save a bitmap opened with openBitmap() or selectBitmap().
close <bitmap>
Closes the bitmap file associated with the bitmap if it is open for output. A bitmap file is
opened for output when you call save on the bitmap value the first time. If a VFB
associated with the bitmap is open, it will be closed. This function also frees all memory
allocated by the bitmap, including the internal pixel frame buffer. If you are generating
many bitmaps, say in a rendering loop, you can use the close() function to free these
often large amounts of memory, that won’t otherwise be released until the next garbage
collection.
copy <source_bitmap> <dest_bitmap>
Copies the source bitmap to the destination bitmap. If the size of the two bitmaps is
different, the image will be scaled to fit the destination bitmap.
gotoFrame <bitmap> <frame>
Position multi-frame file (avi, flc, etc.) to frame frame. This method is permitted only on
load-only bitmaps. The frame number is 0-based for inherently multi-frame files, such as
.avi and .mov. Updates VFB if open.
getPixels <bitmap> <coord_point2> <num_pixels>
Retrieve a sequence of pixels from a row in the bitmap as an array of color values. The
coord_point2 argument specifies the starting pixel coordinate with [0,0] at the top-left-
hand pixel. The .x component of the Point2 coordinate is the column, and the .y
component is the row. The sequence must come from one row only; you cannot retrieve a
sequence of pixels that spans multiple rows. Using any out of-bounds coordinates or
retrieving over row boundaries will fail and yield an empty array.
setPixels <bitmap> <coord_point2> <color_value_array>
Sets the sequence of pixels in a row in the bitmap starting at the Point2 coordinate to the
values in the given array. The .x component of the Point2 coordinate is the column, and
the .y component is the row. The number of pixels to set is taken from the size of the
array. As with getPixels(), you cannot set pixel sequences across a row boundary.
758 Chapter 9 | Values
If the bitmap contains the requested channel, the returned value is always an array of
values, one for each layer present in the channel at that pixel, ordered from front to back.
If the bitmap does not contain the requested channel, the function returns the value
undefined. Typically, you get bitmaps containing channels by opening .rla files or using
the MAXScript render() function with the channels: parameter supplied. You will get
multiple values in the array if the front objects have any transparency. For example:
getChannel bm [x,y] #zDepth
might return:
#(-354.413, -354.467, -355.271, -1e+030)
indicating there is a front surface with non-zero transparency at depth -354.413, another
at -354.467 and a final one at -355.271. The –1e+30 value represents the background image
plane. You could retrieve the #node channel (if it was generated) to get the actual scene
objects at those depths, eg:
getChannel bm [x,y] #node
DontCollect Value 759
might return:
#($Sphere:Sphere02 @ [-4.7,24.3,0.0], $Sphere:Sphere02 @ [-
4.7,24.3,0.0],$Sphere:Sphere01 @ [-8.3,56.2,5.7])
The type of values returned in the array depend of the channel, as follows:
#zDepth : <float>
#matID : <integer>
#objectID : <integer>
#UVCoords : <point2>
#normal : <point3>
#unClamped : <color>
#coverage : <float>
#node : <node>
#shaderColor : <color>
#shaderTransparency : <color>
#velocity : <point2>
#weight : <color>
See the 3ds max Software Development Kit Help file for information on the data stored in
the g-buffer channels.
getChannelAsMask <bitmap> <chan_name> [to:<bitmap>] \
[fileName:”filename_string”] [pixelAspect:<float>] \
[gamma:<float>] [layer:<integer>] [invert:<boolean>] \
[node:<node> | objectID:<integer> | matID:<integer>] \
[velocity:#angle | #magnitude] | [angle:<float>]
Builds and returns a separate 8-bit gray-level bitmap, suitable for use as a mask in
materials, maps, effects, and so on. This bitmap corresponds roughly to the display you see
in the visual frame buffer if you select a g-buffer channel to view. In addition, you can
cause this mask to be masked itself to a selected node, object ID or material ID. The
parameters are as follows:
<bitmap>
The source bitmap containing the source g-buffer channel data.
<chan_name>
The channel from which to generate a mask. The chan_name values are as described
for the getChannel() method. Note that the mask is a single 8 bit value while the
channel may be a complex value of some kind. In each case, a mapping to 8 bits is
performed. Unless noted differently below, this mapping is the same mapping as in
used by 3ds max to generate monochrome images in the Virtual Frame Buffer.
to:<bitmap>
Specifies an existing bitmap to write the mask into. Its width and height must match
the source bitmap.
fileName:”filename_string”
Specifies the file name associated with the generated bitmap.
gamma:<float>
Specifies the generated bitmap’s gamma value.
760 Chapter 9 | Values
pixelAspect:<float>
Specifies the generated bitmap’s pixel aspect. Note that this is the aspect of the pixel,
not the aspect of the bitmap image.
layer: <integer>
Specifies the channel layer of the source bitmap to extract data from. Defaults to 1.
invert:<boolean>
If true, inverts the generated bitmap. Defaults to false.
node:<node>
objectID:<integer>
matID:<integer>
Specifies a sub-mask. If one of these parameters is supplied, the generated mask is
clipped to contain data only in pixels where the given node, objectID or materialID is
visible. To use this sub-masking, you must ensure the #node, #objectID or #matID
channel is present in the source bitmap. Further, if the #coverage channel is present
in the source bitmap, the sub-mask is anti-aliased by the coverage data.
velocity:#angle | #magnitude
angle:<float>
These parameters can only be specified if the selected channel is #velocity. The
default velocity parameter value is #magnitude. These parameters control the
generated bitmap as follows:
velocity:#angle
Generated bitmap pixel values are proportional to angle of pixel movement
direction, with an angle of direction of 0 degrees (horizontal to the right)
mapping to a luminance value of 0, 180 degrees mapping to a luminance value of
127, and 360 degrees mapping to a luminance value of 255.
velocity:#magnitude
Generated bitmap pixel values are proportional to velocity magnitude. High
velocities are darker than low velocities.
angle:<float>
Generated bitmap pixel values are proportional to movement direction deviation
from the given angle, with a luminance value of 255 at the exact angle and falling
off to a luminance value of 0 at 10 degrees from the specified angle. The specified
angle is relative to 0 being horizontal to the right.
Related Methods:
setSilentMode <boolean>
Sets Silent mode on or off. If Silent mode is off, any errors occurring during bitmap input
or output will result in an error message dialog being displayed by the 3ds max bitmap I/O
routines. If Silent mode is on, error message dialogs are not displayed. Returns a boolean
signifying the prior Silent mode state.
The Silent mode state is an internal 3ds max state, and other 3ds max plug-ins can turn
this state on or off. It is recommended that if you use this method that you turn the state
on or off saving the return value, perform the bitmap input or output, and then restore the
state to its original value.
DontCollect Value 761
silentMode()
Returns a boolean signifying the Silent mode state.
selectSaveBitMap [ caption:<open_dialog_title_string> ]
Displays a 3ds max bitmap save dialog and returns the fully-specified file path name as a
string. Returns undefined if the user cancels out of the bitmap save dialog.
freeSceneBitmaps()
Frees up all the memory used by the image file bitmap caches. This is useful if memory is
fragmented with a lot of different bitmaps and you want to have just the ones currently
active reloaded.
getBitmapOpenFileName caption:<title> filename:<seed_filename_string>
getBitmapSaveFileName caption:<title> filename:<seed_filename_string>
Displays the bitmap file selection dialog. Both functions return a fully-specified file path
name or undefined if the user cancels out. If an existing file name is selected using the
getBitmapSaveFileName() function, a File Exists/Confirm Overwrite dialog will be
displayed. Note: The getBitmapOpenFileName() function does not require that an existing
file name be selected - i.e., a file name is returned if the user types a file name that does not
exist. If necessary, you should check the file name that is returned to ensure the file exists.
Notes:
When you open a bitmap file, an entire frame is loaded into memory. When you are finished
processing a bitmap, it is a good idea to either call close() on the bitmap or assign the value
undefined to the variable storing the bitmap value, and then manually run garbage collection
(gc()), so that it’s memory can be released. Another technique for conserving memory when using
the render() or getChannelAsMask() functions repeatedly is to use the to:<bitmap> keyword
argument which allows those functions to overwrite an existing bitmap’s pixel image with the new
rendering or mask.
There currently is no access to the properties associated with the bitmap output plug-ins. This means
that you cannot set the codec used for .avi files, nor the setup parameters for .rla and .tga files. The
properties used are the properties that were last used when saving that file type in 3ds max.
Examples:
The following script shows how to properly create and save a multi-frame image file.
762 Chapter 9 | Values
Script:
theTeapot=teapot() -- something to render
animate on at time 10 \ -- set animate and time context
rotate theTeapot 180 z_axis -- rotate the teapot
cam=targetcamera pos:[200,0,100] \ -- camera pointed at teapot
target:theTeapot
renderFrames=#{1,3,5..12} -- specify frames to render
b=bitmap 160 120 filename:”c:\\t.avi” -- create a new bitmap
for i = 1 to renderFrames.count do -- loop though renderFrames
( if renderFrames[i] then -- if supposed to render frame...
( at time i -- set time context
render 160 120 camera:cam to:b -- render to bitmap frame
save b -- save each frame as you advance
) -- if you save AFTER the loop,
-- just the last frame is saved.
)
close b -- close the output file. This will
-- also get rid of the reference to
-- the bitmap value and free its
-- memory.
Output:
$Teapot:Teapot01 @ [0,0,0] -- result of line 1
OK -- result of lines 2 and 3
$Target_Camera:Camera01 @ [200,0,100] -- result of lines 4 and 5
#{1, 3, 5..12} -- result of line 6
BitMap:c:\t.avi -- result of line 7
OK -- result of for loop, lines 8 to 15
OK -- result of line 16
The following script reads a bitmap file, and outputs a script to Listener that implements a function
that will recreate the same bitmap. This function can then be copied into your script. This is useful
for building button images in MAXScript, so that you don’t need to distribute bitmap files along
with your script.
Script:
(
b=selectbitmap() -- open image file browser
bname=”bitmap_”+(getfilenamefile b.filename) -- build name from filename
w=b.width -- get properties of bitmap
h=b.height
format “----------\nfn load_% = (\n” bname -- start defining function
format “local %=bitmap % %\n” bname w h -- create bitmap in function
-- write out a function that unpacks an integer into a pixel color
format “fn unpack val = for p in val collect (r=p/256^2; g=p/256-r*256; b=mod p
256; color r g b)\n”
for r=0 to h-1 do -- for each row in the bitmap
-- have function write the column of pixels to the bitmap
( format “setpixels % [0,%] (unpack #(” bname r
pixels=getpixels b [0,r] w -- read in the column of pixels
for c=1 to w do -- loop through each pixel
FileStream Values 763
Output:
----------
fn load_bitmap_convert = (
local bitmap_convert=bitmap 4 4
fn unpack val = for p in val collect (r=p/256^2; g=p/256-r*256; b=mod p 256; color
r g b)
setpixels bitmap_convert [0,0] (unpack #(12632256, 12632256, 12632256, 12632256))
setpixels bitmap_convert [0,1] (unpack #(255, 255, 255, 255))
setpixels bitmap_convert [0,2] (unpack #(255, 255, 255, 255))
setpixels bitmap_convert [0,3] (unpack #(255, 12632256, 12632256, 12632256))
return bitmap_convert
)
----------
Also see the example in the Point3 Values (p. 731) topic for another usage of class Bitmap.
Stream Values
Stream values are used to format and hold character data. You can read and write character data to
Stream values. The types of Stream values are:
FileStream Values (p. 763)
StringStream Values (p. 766)
WindowStream Values (p. 767)
FileStream Values
A FileStream class implements text file input and output in MAXScript. A FileStream value
represents an open text file in MAXScript. Text file I/O is performed by calling functions on the
FileStream value.
Constructors:
createFile <filename_string>
creates a new file and returns a <filestream> value. If the specified file cannot be
created, the value undefined is returned.
764 Chapter 9 | Values
execute <filestream>
read and evaluate all the expressions left in the file.
The differences between the above methods can be seen in the following example. In this
example, a stringstream value is created that contains a string containing two expressions
– random 0. 1. and random red blue. The readValue, readExpr, and execute
methods are then used with the stringstream as the argument.
Script:
s=stringstream “random 0. 1.;random red blue”
readvalue s -- read and evaluate the first value
readvalue s -- read and evaluate the second value
seek s 0 -- position at beginning of stringstream
readexpr s -- read and evaluate the first expression
readexpr s -- read and evaluate the second expression
seek s 0 -- position at beginning of stringstream
execute s -- evaluate all expressions
Output:
StringStream:”random 0. 1.;random red blue” -- result line 1
random() -- result line 2 (evaluated “random”)
0.0 -- result line 3 (evaluated “0.”)
OK -- result line 4
0.448042 -- result line 5 (evaluated “random 0. 1.”)
(color 86.476 0 163.24) -- result line 6 (evaluated “random red blue”)
OK -- result line 7
(color 30.2417 0 143.636) -- result line 7 (evaluated all expressions,
-- returns result of last expression)
Associated Methods:
print <value> to: <filestream>
format <fmt_string> { <value> } to: <filestream>
See the Value Common Properties, Operators, and Methods (p. 714) topic for a description of
these methods.
See also
External File Methods (p. 1645)
File Name Parsing (p. 1644)
Standard Open and Save File Dialogs (p. 1643)
766 Chapter 9 | Values
StringStream Values
The StringStream class allows you to construct and parse strings using all the text file I/O functions.
For example, you can set up a StringStream and build it up by performing prints and formats to it,
just as you would to a text file. Conversely, you can convert a String into a StringStream and then
work through it using functions like readLine(), readValue(), skipToString(), etc. Since
Strings are easily converted to and from StringStreams, this is often a convenient way to work on
large, complex strings.
The StringStream class can be used in conjunction with the AppData accessing functions for storing
and retrieving large and complex amounts of script-generated data permanently within a 3ds max
scene file.
Constructors:
stringStream <initial_string>
<string> as stringStream
convert existing String to StringStream.
See also the String Literals (p. 660) and String Values (p. 722) topics.
Operators:
<stringstream> as string
convert StringStream to a String
Methods:
copy <stringstream>
create a separate copy of the StringStream
Associated Methods:
print <value> to:<stringstream>
format “<fmt_string>“ {values} to:<stringstream>
The print() and format() functions provide a way to build up a StringStream a piece at
a time. As with text file output, each call to print or format appends to existing text, the
StringStream dynamically grows as needed. Note that you can reposition output streaming
using the seek() function documented below.
The following functions are identical to the text file input functions available for text FileStream
values. See the FileStream Values (p. 763) class documentation for details. When called on
StringStream instances, they read progressively through the string extracting successive values and
lines and characters, etc.
readValue <stringstream>
readExpr <stringstream>
readLine <stringstream>
readChar <stringstream>
readChars <stringstream> <number>
readDelimitedString <stringstream> <string>
skipToString <stringstream> <string>
skipToNextLine <stringstream>
execute <stringstream>
WindowStream Values 767
filePos <stringstream>
seek <stringstream> <pos>
eof <stringstream>
close <stringstream>
flush <stringstream>
The close() and flush() functions are provided for consistency with file I/O but are not
necessary for StringStreams and do nothing if called.
WindowStream Values
The WindowStream class allows you to output strings to a script Editor window. This is useful for
directing output to a separate window for ease of inspection, editing, or later saving to a file.
Constructors:
newScript()
Opens an empty script Editor window and returns a WindowStream value.
Associated Methods:
print <value> to:<windowstream>
format “<fmt_string>“ {values} to:<windowstream>
Output to a WindowStream is inserted at the current cursor position in that window.
Notes:
When using the format() function with a WindowStream, a new line in the Editor window is not
displayed until an end-of-line character (“\n”)is output.
Examples:
debug = newScript()
...
print $foo to:debug
...
format “name is %\n” obj.name to:debug
MAXKey Values
Certain controllers (keyframeable controllers) store their animation values as keys. As seen by
MAXScript, keys are stored in a MAXKeyArray. The MAXKeyArray for a keyframeable controller is
accessed via the .keys property of the controller.
For more information on MAXKeyArrays, see the MAXKeyArray Values (p. 793) topic.
See also
MAXKey Common Properties, Operators, and Methods (p. 768)
Working with MAXKey Values (p. 769)
768 Chapter 9 | Values
Properties:
For keys associated with all keyframeable controller types, the following properties are accessible:
<key>.time Time -- time value or number (interpreted as frames)
<key>.selected Boolean -- specifies whether the key is selected. Read/write
access.
The .time property is read-only for the keys for some controllers, and read/write for the keys of
other controllers. The controller type description specifies whether the .time property is read-only
or read/write. For controllers where the key .time property is read/write, the following properties
are also available:
<key>.value varies -- class determined by its containing controller
Methods:
copy <key>
Creates a copy of the key value. This copy is not independent of the original key, as a key
value always references a key in a controller. This method exists primarily to support
copying of arrays.
The keys on Bézier, TCB, and Barycentric Morph controllers have additional properties and
methods. See the Bezier Controller Keys (p. 1310), TCB Controller Keys (p. 1335), and Barycentric Morph
Controller Keys (p. 1308) topics for details.
See also
MAXKeyArray Values (p. 793)
Controller Common Properties, Operators, and Methods (p. 1289)
Value Common Properties, Operators, and Methods (p. 714)
Working with MAXKey Values 769
In some cases, the actual value stored in a key is not the value shown in the command panels, shown
in Track View, the value returned by the .value property of the key, or the value returned when
accessing the property to which the key’s controller is assigned. Instead, a scaling factor is applied
to the key’s value before the value is made “visible”. For example, percentages are normally
displayed with a range of 0-100, rotation angles are in degrees, colors are [0-255,0-255,0-255]. The
unscaled key values for percentages are normally in a range of 0-1, rotation angles in radians, and
colors are [0-1,0-1,0-1].
In the description of properties for each class, the scaling factor, if any, is identified for each property.
Take for example the following properties for the PArray class:
<PArray>.X_Spin_Vector Float default: 1.0 -- animatable
<PArray>.Spin_Time_Variation Float default: 0.0 -- animatable, percentage
<PArray>.Spin_Phase Float default: 0.0 -- animatable, angle
<PArray>.viewPercent Float default: 10.0 -- percentage
The .X_Spin_Vector property does not apply any scaling to its controller keys. The
.Spin_Time_Variation property applies percentage scaling to its controller keys (displayed as
percentage, stored as fraction). The .Spin_Phase property applies angle scaling to its controller
keys (displayed as degrees, stored as radians). The .viewPercent property is stored internally with
a percentage scaling factor, but since this property is not animatable, this scaling it invisible to
MAXScript.
Normally this scaling is not of concern when programming in MAXScript, but there are two cases
where it must be taken into account. The first is when using script controllers, and is described in
the Script Controllers (p. 1329) topic.
770 Chapter 9 | Values
The second case is when one controller is applied as the controller for two or more properties. The
scaling is an attribute of the animatable property, not the controller, so in (the admittedly rare)
situations in which a controller is shared by several animatables that have different scaling,
unexpected results will occur if you do not take into account the scaling factor. An example of this
is shown in the following script, where the same controller is shared between three differently scaled
properties.
Script:
obj=PArray()
cont=bezier_float()
obj.X_Spin_Vector.controller=cont
obj.Spin_Time_Variation.controller=cont
obj.Spin_Phase.controller=cont
obj.X_Spin_Vector=1
obj.X_Spin_Vector -- no scaling
obj.Spin_Time_Variation -- percentage
obj.Spin_Phase -- angle
Output:
$PArray:PArray03 @ [0,0,0] -- result line 1
Controller:Bezier_Float -- result line 2
Controller:Bezier_Float -- result line 3
Controller:Bezier_Float -- result line 4
Controller:Bezier_Float -- result line 5
1 -- result line 6
1.0 -- result line 7, unscaled
100.0 -- result line 8, percentage scaled, 1 = 100%
57.2958 -- result line 9, angle scaled, 1 radian = 57.2958
degrees
If you do assign the same controller to properties with different scaling factors, you should take care
to access the .value property through the correct animatable property - this provides a scaling
context for the access operation.
ArrayParameter Values
Certain plug-ins in 3ds max store parameter data in a form that is accessible by MAXScript as
ArrayParameters. As such, you can access the parameter data by index and iterate over the
parameter data.
Constructors:
<MAXWrapper>.parameter
Where the parameter contains an ArrayParameter.
Properties:
<ArrayParameter>.count
Returns the number of values in the ArrayParameter. Read-only in most cases, with
exceptions noted in the MAXWrapper object description where an adjustable
ArrayParameter is used.
Working with MAXKey Values 771
Operators:
<ArrayParameter>[<integer>]
Returns element of ArrayParameter. Indexes start at 1.
<ArrayParameter>[<integer>] = <value>
Sets element of ArrayParameter to value.
Notes:
Each ArrayParameter can only contain data of a certain type (for example, Float), or a controller that
matches that data type. The showProperties() function indicates these array parameters as
<type> array, for example, int array, texmap array, etc.
A plug-in can also define parameter names which point to specific entries in one of its
ArrayParameters. For example, mapAmounts is a property of Standard materials containing an
ArrayParameter. Each element in this ArrayParameter contains the map amount for one of the map
channels. For easier access in a script, the Standard .ambientMapAmount property is provided as an
alias for mapAmounts[1] (along with aliases for all the other common maps). You can access the
controller for the ambientMapAmount alias either via the .controller property on the alias or on
the .mapAmounts[1] property. For example, either:
$foo.material.ambientMapAmount.controller
or
$foo.material.mapAmounts[1].controller
will get the controller on the ambient map amount material property.
Examples:
The following script shows the use of showProperties() to show the data type for elements of
ArrayParameters, access to ArrayParameter elements, and a case of a plug-in defining parameter
names which point to a specific entry in one of its ArrayParameters.
Script:
m=CompositeMaterial() -- create a Composite material
showproperties m -- show the properties for the material
m.amount -- show value of parameter amount
m.amount[1] *= .5 -- reduce the value for one element
m=standard() -- create a Standard material
showproperties m -- show it’s properties
m.ambientMapAmount=13 -- set the value for one element via its alias
m.mapAmounts[1] -- and show the element was changed
772 Chapter 9 | Values
Output:
compositematerial:Composite -- result line 1
.materialList (Material : material array -- output line 2
.mixType (Composite Type) : int array -- ArrayParameter elements are
integer
.mapEnables (Map Enable) : bool array -- ArrayParameter elements are
boolean
.amount : float array -- ArrayParameter elements are
float
OK -- result line 2
#(100, 100, 100, 100, 100, 100, 100, 100, 100, 100) -- result line 3
50.0 -- result line 4
Standardmaterial:Standard -- result line 5
.mapEnables (Map Enables) : bool array -- pruned output line 6
.maps : texmap array
.mapAmounts (Map Amounts) : percent array
.ambientMap (alias for maps[0])
.ambientMapAmount (alias for mapAmounts[0])
.ambientMapEnable (alias for mapEnables[0])
.bumpMap (alias for maps[8])
.bumpMapAmount (alias for mapAmounts[8])
.bumpMapEnable (alias for mapEnables[8])
13 -- result line 7
13.0 -- result line 8
Chapter 10: Collections
Many of the values you work with in MAXScript are sequenced collections, notably arrays, wild-card
pathname selections, and the built-in object sets. In the manner of most operating system shell
command languages, MAXScript will automatically apply appropriate operations to each of the
members in these target collections.
Examples:
hide $lights/key* -- hide all the ‘key’ lights in the scene
$box*.position = [0,0,0] -- recenter all boxes
delete dead_objects -- delete all the objects in the array
-- ‘dead_objects’
obj.pos.keys.intangent=#fast -- set in tangent to fast for all obj’s position keys
lights.value *= 0.8 -- turn down all the lights 20%
MAXScript determines whether to perform a mapped operation by looking at the first argument to
a function or the target in a property assignment to see if it is a sequenced collection. In the case of
a function call, it also looks to see if the function is of the appropriate kind, evaluates all the other
argument expressions once only. MAXScript then calls the function on each of the members of the
first argument collection passing along the other evaluated arguments. In the case of a property
assignment, it evaluates the right-hand-expression once only and assigns the value to the named
property of each of the elements in the target value collection.
This means that every element in the collection must be a valid target for the function or have the
named property in question. If MAXScript comes across an inappropriate target it will report an error
and stop the automatic operation.
Except for certain common properties, MAXScript currently only allows automatic collection
mapping of property assignment one level deep. For example, the following will perform collection
mapping across the objects ObjectSet:
objects.pos = [0,0,0] -- move all objects to world center
774 Chapter 10 | Collections
If the last level specified is one of the following component names, the automatic collection
mapping is performed on the preceeding property:
.angle
.b
.blue
.axis
.controller
.g
.green
.isAnimated
.keys
.r
.red
.track
.x
.x_rotation
.y
.y_rotation
.z
.z_rotation
For example:
objects.pos.z = 0.0 -- move all objects to world XY plane
This behavior of calling a function on all the elements of a collection is known as mapping in
computer science. In the description of each collection type, you will find those kinds of sequenced
collections that can be mapped over identified as mappable. In the descriptions of the various
functions and operators throughout this document, those that act on each element in a collection
are labeled mapped. In general, the functions that are mapped are those that have some side-effect
on the value they take, such as moves, and deletes and hides. Others, like the test function
isHidden(), are not mapped because it would be pointless.
All mapped functions defined by MAXScript, such as copy(), delete(), or move(), take an
optional last argument, #noMap. This causes the functions not to be mapped when called on
collection arguments such as arrays. When used with copy() on arrays in particular, this will return
a top-level copy of the array itself and not perform an individual copy() on each element of
the array.
You can make your own mapped scripted functions by preceding the function definition with the
reserved word mapped, for example:
mapped function rand_color x = (x.wireColor = random black white)
This causes such functions to be automatically called repeatedly on the elements of a collection if a
collection is given as the first argument to the function. The #noMap argument is not applicable to
user-written functions.
775
As described in the For Loop (p. 694) topic, a for loop can be set up to iterate through a collection
set assigning successive elements in the collection to the loop value each time through the loop. For
loops can also be set up to return an array collection set as its result.
Examples:
for item in table1 do x = x + item.height -- sequence an array
When iterating through a collection set using a for loop, or when passing a collection to a mapped
function, care must be taken not to reorder or remove elements in the collection set within the for
loop or function. Take for an example a script that is supposed to convert all of the selected splines
into NURBS curves. Two scripts that do not execute properly are:
for obj in selection do ( convertToNURBSCurve obj)
convertToNURBSCurve selection
The reason neither of these lines execute properly is that the convertToNURBSCurve() function
clears the current selection. So only the first spline is passed to convertToNURBSCurve() and
converted. Since convertToNURBSCurve() is a built-in function, there is no way to modify this
behavior. To get around this problem, you need to first “snapshot” the selection collection set as an
array using the as operator, or use the getCurrentSelection() function, which returns the
current selection set as an array. Two scripts that execute properly are:
for obj in (selection as array) do ( convertToNURBSCurve obj)
convertToNURBSCurve (getCurrentSelection())
Collection Types
Array Values (p. 776)
PathName Values (p. 780)
ObjectSet Values (p. 781)
SelectionSet Values (p. 785)
SelectionSetArray Values (p. 783)
NodeChildrenArray Values (p. 785)
VertexSelection Values (p. 786)
FaceSelection Values (p. 788)
EdgeSelection Values (p. 790)
776 Chapter 10 | Collections
Array Values
An array is a variable length indexable sequence of values. The values in an array can be of any type.
Array values are mappable.
Literals:
#(<value>, <value>, ...)
#() -- an empty array
See also Array Literals (p. 666).
Constructors:
<collection> as array
Convert collection to an array.
Properties:
<array>.count : Integer, read-only
Returns number of elements in array.
Operators:
<array>[<integer>]
Returns element of array. Indexes start at 1.
<array>[<integer>] = <value>
Sets element of array to value, growing array as necessary.
<array> + <collection>
Like join except a completely new array is constructed containing all the elements of the
first and second operands
For example:
a = #(1,2,3,4)
join a #(5,6,7,8)
(cameras as array) + lights
props = getPropNames Node
join props getPropNames (classOf $foo)
join props getPropNames $foo $dynamicOnly
sort props
Array Values 777
Methods:
append <array> <value>
Append value to array, growing it as necessary.
copy <array> [#noMap] -- mapped
Creates a copy of all the elements in the array. Returns a value of OK. If #noMap is specified,
the copy made is what is called a shallow copy - only a copy of the upper-level value itself
(that is, the array value) is created. Copies aren’t made of values stored in the array, rather
a reference to the same value is stored in both array values.
deleteItem <array> <number>
Delete element indexed by number from array, shrinking it in size by 1.
join <array> <collection>
Appends all the elements of the second argument to the array (first) argument.
sort <array>
Sorts the elements of the array into ascending order. All the elements must be comparable.
findItem <array> <value>
Does a MAXScript ‘==’ comparison between elements in the array and the target object
and then returns the index of the first occurrence of the given value in the array or zero if
the value is not in the array.
Values such as Point3s and Strings match if they have the same contents.
insertItem <value> <array> <integer>
Inserts the value at the specified index in the array, growing the array if necessary
qsort <array> <function> [start:<integer>] [end:<integer>] [user-defined key args
passed to function]
Sorts the array using the specified function for element-by-element comparison. The
comparison function must take 2 values as arguments, and return a number < 0 if the first
value is less than thesecond value, 0 if the values are equivalent, and a number > 0 if the
first value is greater than the second value. The entire array is sorted unless a start or end
value is specified.
For example, the following script generates 10 random positions, and then sorts the
positions based on their distance from [0,0,0]:
positions=for i=1 to 10 collect (random [0,0,0] [100,100,0])
qsort positions (fn distFrom0 v1 v2 = (length v1)-(length v2))
778 Chapter 10 | Collections
All key arguments are now passed to the comparison function. This allows you to do
things like an indexed sort:
fn compareFN v1 v2 valArray: =
(local v1i = valArray[v1]
local v2i = valArray[v2]
(length v1i)-(length v2i)
)
positions=for i=1 to 10 collect (random [0,0,0] [100,100,0])
indexArray = for i = 1 to positions.count collect i
qsort indexArray compareFN valArray:positions
for i = 1 to positions.count do print positions[indexArray[i]]
Output:
#() -- result of line 1
#() -- result of line 2
#(33, 47, 31) -- output from line 6, i=1
#(4, 52, 39) -- output from line 6, i=2
#(52, 36, 23) -- output from line 6, i=3
OK -- result of for loop, lines 3 to 8
#(52, 36, 23) -- 3 lines of output from line 7
#(52, 36, 23)
#(52, 36, 23)
OK -- result of line 9
Array Values 779
As can be seen in the output lines 7 to 9, all the elements of array RandomSets contain the same
values, which is not the result as expected from the output shown on lines 3 to 5. The reason the
same values are stored in each element of RandomSets is only one array value is actually ever created
for RandomSet (in line 2), and line 5 of the script is only changing the elements of that array value.
Thus each element of RandomSets is actually pointing at the exact same value. The easiest fix for
the above script is to move line 2 into the for i loop expression, thereby creating a new array value
which will then be stored in RandomSets.
Script:
RandomSets=#()
for i=1 to 3 do
( RandomSet=#() -- create a new array value for RandomSet
for j=1 to 3 do
RandomSet[j]=random 1 100
print RandomSet #nomap
RandomSets[i]=RandomSet
)
print RandomSets
Output:
#()
#(89, 27, 88)
#(87, 87, 10)
#(74, 27, 64)
OK
#(89, 27, 88)
#(87, 87, 10)
#(74, 27, 64)
OK
You can convert object sets and wild-card pathnames to arrays using the as operator. This has the
effect of taking a “snapshot” into the array of the current objects in the set or those matched by the
pathname, so that you can then later work on that collection of objects without worrying if the set
or match has changed. This is similar to named selection sets in the 3ds max user interface, and can
be used, for example, to keep track of selections as you work interactively with MAXScript. If the
user deletes from the scene any of the objects in the array, you will get an error if you try to map
operations over the array.
Examples:
sel1 = selection as array
boxes_at_load = $box* as array
snap_children = $torso...* as array
original_cameras = cameras as array
780 Chapter 10 | Collections
PathName Values
PathNames provide the mechanism for naming objects in the 3ds max scene. See also the Pathname
Literals (p. 662) topic. Pathname values are mappable.
Example Literals:
$box01
$torso/left_upper_arm/left_lower_arm
$*box*
$torso/*
$torso...*
Properties:
<pathname>.center : Point3, read-only
Returns center of bounding box of all objects in pathname.
<pathname>.max : Point3, read-only
Returns maximum corner of bounding box.
<pathname>.min : Point3, read-only
Returns minimum corner of bounding box.
<pathname>.count : Integer, read-only
Returns number of objects in set. This property is only valid for wild-carded pathnames,
i.e., a pathname that could contain more than one scene object.
Operators:
<pathname>[<integer>] -- accesses member of collection. Indexes start at 1.
<pathname> as array -- converts pathname collection to an array
Associated Methods:
isDeleted <MAXWrapper_object>
This function yields the result true if the object has been deleted and false if it still
exists in the scene. Using the function only makes sense in situations where references to
3ds max objects are held in variables or arrays or passed as parameters and you want to
determine whether the object has been deleted from the scene. Performing an operation
on a deleted 3ds max object referenced in a variable or array otherwise generates an
exception. Any kind of 3ds max object can be tested in this way, scene objects, modifiers,
controllers, materials, etc.
For example:
myBoxes = $box* as array -- store list of all boxes in array myBoxes
...
-- <one or more objects in the selection are deleted
-- by the user or other scripts>
...
for obj in myBoxes
where not isDeleted obj do
move obj [10,0,0]
ObjectSet Values 781
Notes:
The order of sequencing is consistent in a stable scene but somewhat arbitrary - it depends on how
3ds max stores its object hierarchy internally which is affected mostly by order of additions and
deletions to and from the scene.
MAXScript lets you set up a ‘working level’ in the 3ds max scene hierarchy that affects pathnames
and coordinate systems and object creation. You do this with a <level_expr>, one of the many
context expressions that are described in the Context Expressions (p. 681) topic.
Examples:
a = $*feet*[i] -- retrieves the i’th object in the *feet*’s
-- place $foo’s pivot point at the max corner of the set of ‘box*’ objects.
$foo.pivot = $box*.max
in $dummy
(
sphere name:”ear1” pos:[10,10,10] -- create as children of $dummy
sphere name:”ear2” pos:[-10,10,10]
scale $foo/* [1,1,2] -- looks for ‘foo’ as a child of $dummy
)
ObjectSet Values
ObjectSets represent the main scene object categories in 3ds max. The “constructors” below are all
reserved system variables. ObjectSet values are mappable.
Constructors:
objects -- all the objects
geometry -- the standard 3ds max categories...
lights
cameras
helpers
shapes
systems
spacewarps
selection -- the current selection
Properties:
<objectset>.center : Point3, read-only
Returns center of bounding box of all objects in set.
<objectset>.max : Point3, read-only
Returns maximum corner of bounding box.
782 Chapter 10 | Collections
Associated Methods:
clearSelection()
Clears current scene node selection.
deselect <PathName>
Deselects given node(s). For example:
deselect $box*
The lights and cameras object sets include the target objects, if any, for the lights and cameras. If
you want to change a property value for all the lights or cameras, you will need process each object
in the ObjectSet individually, testing to make sure it is a light or camera. For example, to increase
the multiplier property value for all lights, you would say:
for obj in lights do
if iskindof obj light do
obj.multiplier *= 1.3
Examples:
s = selection[1] -- grab the first object in the
-- current selection
move camera[2] [x, y, z + 10] -- move the second camera
SelectionSetArray Values
The SelectionSetArray class has only one instance, selectionSets, which is an array of all the named
selection sets in the current scene. The named selection sets correspond to the selection sets in the
Named Selection Set drop-down list on the 3ds max toolbar. Also see the SelectionSet Values (p. 785)
topic. SelectionSet values are mappable.
Constructors:
selectionSets
Properties:
<selectionsetarray>.count : Integer, read-only
Returns number of named selection sets.
Operators:
<selectionsetarray>[<set_name>]
Accesses member of collection by named selection set name. set_name can be either a
String or Name value.
<selectionsetarray>[<set_index_integer>]
Accesses member of collection by index number. Indexes start at 1.
<selectionsetarray>[<set_name>] = <node_array>
Create or replace named selection set with name set_name, which can be either a String
or Name value. node_array must be an array of nodes.
Methods:
deleteItem <selectionsetarray> <set_name>
Delete the named selection set with name set_name, which can be either a String or
Name value.
784 Chapter 10 | Collections
Associated Methods:
getNumNamedSelSets()
Returns number of named selection sets as an integer.
getNamedSelSetName <set_index_integer>
Returns name of the indexed named selection set as a string. <set_index_integer> is 1
based.
getNamedSelSetItemCount <set_index_integer>
Returns name of the indexed named selection set as a string. <set_index_integer> is 1
based.
getNamedSelSetItem <set_index_integer> <node_index_integer>
Returns indexed node in the indexed named selection set as a node.
<set_index_integer> and <node_index_integer> are 1 based.
Examples:
You access an individual selection set by indexing the selectionSets array with its name or index:
set1 = selectionSets[”my set 1”]
You can then use that set just as you would use any other object set in MAXScript, such as selection,
objects, lights, etc. For example,
move set1 [10,0,0]
moves all the objects in the set across 10 in x.
You can use strings or MAXScript names (starting with #) interchangeably as indexes for the
selectionSets array, or you can use an integer as an index if you want to loop over all the sets,
for example:
selectionSets[#set2].wireColor = red
for i in 1 to selectionSets.count do
saveNodes selectionSets[i] (”set” + i as string + “.max”)
You can change, add and delete new Name Selection Sets by using the standard array methods on
the selectionSets array:
selectionSets[”new set”] = selection -- snap the current selection
selectionSets[”old spheres”] = $sphere* -- all the current objects named
-- “sphere*”
selectionSets[#foo] = #(obj1, obj2, obj3)
deleteItem selectionSets “old set” -- delete the set named “old set”
SelectionSet Values 785
SelectionSet Values
A SelectionSet represents the named scene node selection sets in the Named Selection Sets
drop-down list in the 3ds max toolbar. Also see the SelectionSetArray Values (p. 783) topic.
SelectionSet values are mappable.
Constructors:
selectionSets[<set_name>] -- set by string or name value
selectionSets[<index>] -- set by order in drop-down list
Operators:
<selectionset>[<integer>] -- retrieve nth object in set
Properties:
<selectionset>.center : Point3, read-only
Returns center of bounding box of all objects in set.
<selectionset>.max : Point3, read-only
Returns maximum corner of bounding box.
<selectionset>.min : Point3, read-only
Returns minimum corner of bounding box.
<selectionset>.count : Integer, read-only
Returns number of objects in set.
Notes:
Unlike ObjectSet, you cannot use SelectionSet as the root of a pathname.
The order of sequencing is consistent in a stable scene but somewhat arbitrary - it depends on how
3ds max stores its object hierarchy internally which is effected mostly by order of additions and
deletions to and from the scene.
NodeChildrenArray Values
A NodeChildrenArray represents the direct children of a scene node as a virtual array. As such, you
can iterate over the children, apply mapped functions to them and obtain certain properties such as
count and bounding box info. Also see the General Node Properties (p. 836) topic. NodeChildrenArray
values are mappable.
Constructors:
<node>.children
Properties:
<nodechildrenarray>.center : Point3, read-only
Returns center of bounding box of children.
<nodechildrenarray>.max : Point3, read-only
Returns maximum corner of bounding box.
786 Chapter 10 | Collections
Methods:
append <nodechildrenarray> <node>
Makes the specified node a child of the node NodeChildrenArray was constructed from.
deleteItem <nodechildrenarray> <node>
Removes specified node as a child of the node NodeChildrenArray was constructed from.
Notes:
Unlike ObjectSets, you cannot use NodeChildrenArray as the root of a pathname.
The order of sequencing is consistent in a stable scene but somewhat arbitrary - it depends on how
3ds max stores its object hierarchy internally which is effected mostly by order of additions and
deletions to and from the scene.
VertexSelection Values
A VertexSelection represents a set of vertices for a scene mesh node as a virtual array. As such, you
can access a vertex by index, iterate over the vertices, and apply mapped functions to the vertices.
See also Editable_Mesh (p. 1041). The VertexSelection array is dynamic, i.e., its contents will change
as the vertices or selected vertices of the mesh node change. VertexSelection values are mappable.
Constructors:
<mesh>.selectedVerts -- the currently selected vertices of the mesh object
<mesh>.verts -- all of the vertices of the mesh object, read-only
Properties:
<vertexselection>.count : Integer, read-only
Returns the number of vertices in the VertexSelection array.
<vertexselection>.selSetNames : Array of names, read-only
Returns an array of names of the current vertex-level named selection sets for the object
the VertexSelection is associated with.
The following properties are present for singleton selections (of the form $foo.verts[n]):
<vertexselection>.index : Integer, read-only
Returns the index of the selected element in the mesh, e.g.,
$foo.selectedVerts[2].index
returns the vertex index of the 2nd vertex in the current selection.
VertexSelection Values 787
<vertexselection>.pos : Point3
Returns or sets the position of the selected element in the mesh, e.g.,
$foo.verts[i].pos = $baz.verts[j].pos + [10,0,0]
Note that iterating over a selection yields singleton selections in the loop body:
sv = for i in $foo.selectedVerts collect i.index
sv contains selected vertices as array
Operators:
<mesh>.selectedVerts = (<array> | <bitarray>)
Selects the specified vertices.
<vertexselection>[<integer>]
Retrieves the indexed vertex as a singleton VertexSelection. Index starts at 1
<vertexselection>[<integer>] = <point3>
Sets the position of the indexed vertex.
<vertexselection>[(<integer_array> | <bitarray>)]
Retrieves the indexed vertices as a VertexSelection. Index starts at 1.
<vertexselection>[(<#name> | <string>)]
Retrieves the vertex-level named selection set, where the name of the named selection set
can be specified as a name or string value.
<vertexselection>[(<#name> | <string>)] = (<vertexselection> | <integer_array> |
<bitarray>)
Sets the vertex-level named selection set to the specified vertices. The name of the named
selection set can be specified as a name or string value, and the vertices can be specified as
an array, bitArray, or a VertexSelection from the same object.
Methods:
move <vertexselection> <point3>
Moves the vertices in the VertexSelection.
select <vertexselection>
Selects the vertices in the VertexSelection.
deselect <vertexselection>
Deselects the vertices in the VertexSelection.
delete <vertexselection>
Deletes the vertices in the VertexSelection.
append <vertexselection> (<vertexselection> | <integer>)
Appends the vertex or vertices to the VertexSelection.
findItem <vertexselection> (<vertexselection[<integer>] | <integer>)
Returns the selection index of the matching item or 0 if not found. The item is selection
index or singleton VertexSelection.
788 Chapter 10 | Collections
Examples:
-- move vertices in ‘mouth’ named selection set
move $foo.verts[#mouth] [0,0,10]
-- select vertices in ‘front verts’ set
select $baz.verts[”front verts”]
-- set ‘baz’ named selection set to given vertices
$foo.verts[#baz] = #(1,3,4,5,10)
-- set ‘cursel’ set to current selection
$baz.verts[#cursel] = $baz.selectedVerts
-- all the names of the vertex-level named selection sets for object $foo
$foo.verts.selSetNames
-- print out all vertex-level named selection sets
for n in $.verts.selSetNames do print $.verts[n]
FaceSelection Values
A FaceSelection represents a set of faces for a scene mesh node as a virtual array. As such, you can
access a face by index, iterate over the faces, and apply mapped functions to the faces. See also
Editable_Mesh (p. 1041). The FaceSelection array is dynamic, i.e., its contents will change as the faces
or selected faces of the mesh node change. FaceSelection values are mappable.
Constructors:
<mesh>.selectedFaces -- the currently selected faces of the mesh object
<mesh>.Faces -- all of the faces of the mesh object, read-only
Properties:
<faceselection>.count : Integer, read-only
Returns the number of faces in the FaceSelection array.
<faceselection>.selSetNames : Array of names, read-only
Returns an array of names of the current face-level named selection sets for the object the
FaceSelection is associated with.
The following property is present for singleton selections (of the form $foo.faces[n]):
<faceselection>.index : Integer, read-only
Returns the index of the selected element in the mesh, e.g.,
$foo.selectedFaces[2].index
returns the face index of the 2nd face in the current selection.
Note that iterating over a selection yields singleton selections in the loop body:
sf = for i in $foo.selectedFaces collect i.index
sf contains selected faces as array
Operators:
<mesh>.selectedFaces = (<array> | <bitarray>)
Selects the specified faces.
<faceselection>[<integer>]
Retrieves the indexed face as a singleton FaceSelection. Index starts at 1.
FaceSelection Values 789
<faceselection>[<integer>] = <point3>
Sets the vertices of the indexed face to the vertex indices specified in the point3 value.
<faceselection>[(<integer_array> | <bitarray>)]
Retrieves the indexed faces as a FaceSelection. Index starts at 1.
<faceselection>[(<#name> | <string>)]
Retrieves the face-level named selection set, where the name of the named selection set
can be specified as a name or string value.
<faceselection>[(<#name> | <string>)] = (<faceselection> | <integer_array> |
<bitarray>)
Sets the face-level named selection set to the specified faces. The name of the named
selection set can be specified as a name or string value, and the faces can be specified as an
array, bitArray, or a FaceSelection from the same object.
Methods:
move <faceselection> <point3>
Moves the faces in the FaceSelection.
select <faceselection>
Selects the faces in the FaceSelection.
deselect <faceselection>
Deselects the faces in the FaceSelection.
delete <faceselection>
Deletes the faces in the FaceSelection.
append <faceselection> (<faceselection> | <integer>)
Appends the face(s) to the FaceSelection.
findItem <faceselection> (<faceselection[<integer>] | <integer>)
Returns the selection index of the matching item or 0 if not found. The item is selection
index or singleton FaceSelection.
Examples:
-- move faces in ‘mouth’ named selection set
move $foo.faces[#mouth] [0,0,10]
-- select faces in ‘front faces’ set
select $baz.faces[”front faces”]
-- set ‘baz’ named selection set to given faces
$foo.faces[#baz] = #(1,3,4,5,10)
-- set ‘cursel’ set to current selection
$baz.faces[#cursel] = $baz.selectedFaces
-- all the names of the face-level named selection sets for object $foo
$foo.faces.selSetNames
-- print out all face-level named selection sets
for n in $.faces.selSetNames do print $.faces[n]
790 Chapter 10 | Collections
EdgeSelection Values
An EdgeSelection represents a set of edges for a scene mesh node as a virtual array. As such, you can
access an edge by index, iterate over the edges, and apply mapped functions to the edges. See also
Editable_Mesh (p. 1041). The EdgeSelection array is dynamic, i.e., its contents will change as the
edges or selected edges of the mesh node change. EdgeSelection values are mappable.
Constructors:
<mesh>.selectedEdges -- the currently selected edges of the mesh object
<mesh>.Edges -- all of the edges of the mesh object, read-only
Properties:
<edgeselection>.count : Integer, read-only
Returns the number of edges in the edge array.
<edgeselection>.selSetNames : Array of names, read-only
Returns an array of names of the current edge-level named selection sets for the object the
EdgeSelection is associated with.
The following property is present for singleton selections (of the form $foo.edges[n]):
<edgeselection>.index : Integer, read-only
Returns the index of the selected element in the mesh, e.g.,
$foo.selectedEdges[2].index
returns the edge index of the 2nd edge in the current selection.
Note that iterating over a selection yields singleton selections in the loop body:
se = for i in $foo.selectedVerts collect i.index
se contains selected edges as array
Operators:
<mesh>.selectedEdges = (<array> | <bitarray>)
Selects the specified edges.
<edgeselection>[<integer>]
Retrieves the indexed edge as a singleton EdgeSelection. Index starts at 1
<edgeselection>[(<integer_array> | <bitarray>)]
Retrieves the indexed edges as a EdgeSelection. Index starts at 1.
<edgeselection>[(<#name> | <string>)]
Retrieves the edge-level named selection set, where the name of the named selection set
can be specified as a name or string value.
<edgeselection>[(<#name> | <string>)] = (<faceselection> | <integer_array> |
<bitarray>)
Sets the edge-level named selection set to the specified edges. The name of the named
selection set can be specified as a name or string value, and the edges can be specified as an
array, bitArray, or a EdgeSelection from the same object.
BitArray Values 791
Methods:
move <edgeselection> <point3>
Moves the edges in the EdgeSelection.
select <edgeselection>
Selects the edges in the EdgeSelection.
deselect <edgeselection>
Deselects the edges in the EdgeSelection.
delete <edgeselection>
Deletes the edges in the EdgeSelection.
append <edgeselection> (<edgeselection> | <integer>)
Appends the edge(s) to the EdgeSelection.
findItem <edgeselection> (<edgeselection[<integer>] | <integer>)
Returns the selection index of the matching item or 0 if not found. The item is selection
index or singleton EdgeSelection.
Examples:
-- move edges in ‘mouth’ named selection set
move $foo.edges[#mouth] [0,0,10]
-- select edges in ‘front edges’ set
select $baz.edges[”front edges”]
-- set ‘baz’ named selection set to given edges
$foo.edges[#baz] = #(1,3,4,5,10)
-- set ‘cursel’ set to current selection
$baz.edges[#cursel] = $baz.selectedEdges
-- all the names of the edge-level named selection sets for object $foo
$foo.edges.selSetNames
-- print out all edge-level named selection sets
for n in $.edges.selSetNames do print $.edges[n]
BitArray Values
The MAXScript BitArray class provides direct access to 3ds max’s SDK BitArray class. The SDK
BitArray is used throughout 3ds max to compactly encode selections as a string of bits.
Literals:
#{ <selection> } -- these are curly-brackets
For example, #{1, 5, 10..200, 302} says that the bits 1, 5, 10 to 200, and 302 are “turned on”.
When used in connection with selections in 3ds max (such as vertex or face or control vertex)
the “on” bits imply the elements or sub-objects with those indexes are selected.
792 Chapter 10 | Collections
Properties:
<bitarray>.count : Integer, read-only
Returns the largest possible index held in the BitArray at that point in time. This value is
independent of whether any particular indexes are selected or not. BitArrays grow
dynamically as needed to accommodate the indexes used on it, just as with arrays.
Operators:
<bitarray>[<integer>] -- yields true if selected, else false
<bitarray>[<integer>] = <boolean> -- sets or clears indexed bit
<bitarray> + <bitarray> -- union (”OR” operation)
<bitarray> - <bitarray> -- difference
-<bitarray> -- invert the bitarray
Methods:
append <bitarray> <integer>
Adds index to bitarray, growing bitarray if necessary.
join <bitarray> <bitarray>
Union (”OR” operation) of the two bitarrays.
findItem <bitarray> <integer>
Yields index <integer> if selected, 0 otherwise.
deleteItem <bitarray> <integer>
Clears the index selection.
copy <bitarray>
Creates an independent copy of the bitarray.
Notes:
BitArrays can be used interchangeable with ordinary #(...) arrays (p. 776) of index numbers where
ever a selection array is applicable, such as in mesh sub-object selections, for example:
$foo.verts[#{20..1023}] -- selects all vertices between 20 and 1023
You can sequence over BitArrays with a for-loop, which yields a sequence of index numbers
corresponding to the currently selected items.
for i in #{2..200} do print i -- print the numbers between 2 & 200
You can perform an “AND” operation between two BitArrays by inverting the difference between
them. For example:
a=#{1..5}
b=#{3..10}
c=-(a-b) -- result in c is #{3..5}
MAXKeyArray Values 793
MAXKeyArray Values
A MAXKeyArray represents all the keyframe keys in a 3ds max controller track. See also the MAXKey
Values (p. 767), Working with MAXKey Values (p. 769), and Controller Common Properties, Operators, and
Methods (p. 1289) topics. MAXKeyArray values are mappable.
Constructors:
<node>.<animatable_property>.keys
The key array can be accessed using the keys property on an animated 3ds max object
property. Examples:
$foo.position.keys
$foo.twist.angle.keys
If the 3ds max object parameter is not yet animated (i.e., no controller has been assigned
to the parameter), a value of undefined is returned.
<controller>.keys
The key array can be accessed using the keys property on a controller. Examples:
$foo.position.controller.keys
$foo[3][1].keys
Properties:
<key_array>.count : Integer, read-only
Returns the number of keys in the key array.
Operators:
<key_array>[<index_integer>]
Returns a MAXKey (p. 767) value representing the indexed key in the key array. Indexes
start at 1.
Methods:
append <key_array> <key>
Appends key to key array.
deleteItem <key_array> <index_integer>
Deletes the indexed key. Key indexes are 1-based.
addNewKey <key_array> <time> [ #select ]
Adds a new key to the key array at the time specified. The value for the new key is the
interpolated controller value at the specified time. The new key is also selected if the
#select optional argument is specified. The value for the new key is the interpolated
controller value at that time. addNewKey() will not add a key if a key already exists at the
specified time. The return value in this case is the key located at the specified time.
deleteKeys <key_array> [ #allKeys ] [ #selection ]
Deletes keys from the controller according to the optional symbolic argument supplied.
#allKeys (default): deletes all keys in the controller.
#selection: deletes the currently selected keys
794 Chapter 10 | Collections
MAXNoteKeyArray Values
A MAXNoteKeyArray represents all the note keys in a 3ds max note track. This value is described in
Note Track Access (p. 816). MAXNoteKeyArray values are mappable.
ModifierArray Values
A ModifierArray represents the modifiers present on a scene node as an array. As such, you can access
a modifier by index, iterate over the modifiers, and apply mapped functions to the modifiers. See
also Modifiers (p. 1095). ModifierArray values are mappable.
Constructors:
<node>.modifiers
Properties:
<modifierarray>.count : Integer, read-only
Returns the number of modifiers in the modifier array.
MaterialLibrary Values 795
Operators:
<modifierarray>[<integer>]
Retrieves indexed modifier. Index is 1-based with 1 being the modifier on the top of the
modifier stack.
<modifierarray>[( <name> | <string> )]
Retrieves named modifier using modifier name as string or name.
MaterialLibrary Values
A MaterialLibrary contains a table of materials as an array. The 3ds max system global variables
currentMaterialLibrary and sceneMaterials contain MaterialLibrary instances. System
global variable meditMaterials strictly speaking is not a MaterialLibrary value, rather it is a virtual
array of the materials in the Material Editor sample slots. In most cases, meditMaterials can be
considered a MaterialLibrary value, with the exception that you can assign a material or textureMap
value to a meditMaterials element. MaterialLibrary values are mappable.
Constructors:
currentMaterialLibrary -- system global
sceneMaterials -- system global, the materials in the scene
meditMaterials -- system global, the materials in material editor
materialLibrary { <material> }
Creates a temporary material library. You can add materials to this library with the append
function, but there is currently no way to save it or make it the current library.
Properties:
<mat_lib>.count : Integer, read-only
Returns the number of materials in the library.
Operators:
<mat_lib>[ <integer> | <name> | <string> ]
Retrieves a material from the material library. Material libraries can be indexed just like
arrays with an integer index, or by using the material name as a Name or String value.
<mat_lib>[ <integer> | <name> | <string> ] = ( <material> | <textureMap> )
Assigns the specified material or textureMap to the material library. Material libraries can
be indexed just like arrays with an integer index, or by using the material name as a Name
or String value. If the material library is indexed by an index value, and the index value is
larger than the size of the material library, a runtime error is generated. If the material
library is indexed by a material name, and the material name is not already present in the
material library, the material or textureMap is appended to the material library.
meditMaterials[<slot_index_integer>]
Returns the material or textureMap in the indexed material editor slot. Valid
<slot_index_integer> values are 1 through 24.
796 Chapter 10 | Collections
Methods:
append <mat_lib> <material>
Append the specified material to the material library. This method is not applicable to the
meditMaterials material library.
deleteItem <mat_lib> ( <integer> | <name> | <string> )
Delete the specified material from the material library. The material can be specified as the
indexed material in the material library, as a String, or as a Name. This method is not
applicable to the meditMaterials material library.
findItem <mat_lib> <material>
Returns the index of the material in the material library or zero if the material is not in the
material library.
Associated Methods:
getMeditMaterial <slot_index_integer>
Returns the top level material or textureMap in the specified material editor slot. Valid
<slot_index_integer> values are 1 through 24. For example:
foo = getMeditMaterial 3
fileSaveMatLib()
If the current material library has been saved previously (has been named) this method
saves the material library to the same file. Otherwise it displays the standard Save File As
dialog to allow the user to save the current material library.
getMatLibFileName()
Returns the current material library file name as a String value.
Examples:
You can use the standard array indexing accessors to get and set materials in the library.
MaterialLibraries also allow you to use name and string literals as indexes to get at materials in them
by name:
$foo.material = currentMaterialLibrary[”Rough Gold”]
for m in sceneMaterials do print m.name
append currentMaterialLibrary $baz.material
NURBSSet Values
A NURBSSet is used rto create NURBS objects, or retrieve data from existing NURBS objects. The
NURBSSet acts as a container for the various NURBSObject derived entities (points, curves, surfaces)
used to make up the set. This value is described in NURBSSet : Value (p. 1450). NURBSSet values are
mappable.
798 Chapter 10 | Collections
Chapter 11: 3ds max Objects
The <pattern_string> argument is a string containing a wild-card pattern for matching against
global variables. The pattern form is:
<variable_name_pattern_string[:class_name_pattern_string]>
800 Chapter 11 | 3ds max Objects
that is, a global variable name pattern optionally followed by a ‘:’ and a class name pattern. If the
optional class name pattern is given, it restricts the printout to globals containing values of the
specified classes. The apropos() function assumes a wild-card ‘*’ at the start and end of each
pattern, implying a ‘contains’ pattern match. The pattern strings can contain name characters and
‘*’s and ‘?’s.
The output consists of the global variable name, a tag in () indicating if the variable is a system or
const (unchangeable) variable and the class of the value currently in it, followed by a printed
representation of that value.
Examples:
apropos “light” -- any variables with ‘light’ in the variable name
apropos “:float” -- any variables containing float values
apropos ““ to:f -- dump all variables to the stream f
apropos “controller:super” -- the list of controller superclasses
apropos “foo:control” -- any variables whose name contains ‘foo’
-- and that contain controller classes
showClass:
The showClass() function prints information about a specified 3ds max class or classes. It has the
following form:
showClass <pattern_string> [ to:<stream> ]
where <pattern_string> is a string containing a wild-card pattern to match against
3ds max class names, superclass names and property names, and the optional
to:<stream> keyword argument specifies a Stream Value (p. 763) to output the display to.
The pattern string has this form:
“<class_name>[ :<superclass_name> ][ .<property_name> ]”
Class and Object Inspector Functions 801
Examples:
showClass “path*” -- all 3ds max classes starting ‘path’
showClass “noise.*” -- all the accessible properties on the
-- Noise texture map
showClass “*:mod*” -- all the modifier classes
showClass “*.*rad*” -- all the classes with a property name
-- containing ‘rad’
showClass “*.*” to:f -- everything, out to a file
showClass “*:*controller*” -- all the classes that have
-- “controller” in their superclass
-- name
In the output from the last example, the controllers include 3ds max’s core controllers and any
3rd-party plug-in controllers. In some cases, embedded controllers for some complex plug-ins may
be visible in the showClass() listing (such as for character studio and HyperMatter). You should
not attempt to create and use these controllers individually, this may result in system exceptions.
If you leave out the superclass pattern (the ‘:’ part), it matches all superclasses. If you leave out the
property pattern (the ‘.’ part), you only get class names printed.
Note:
This function only displays matching MAXWrapper classes (nodes, modifiers, materials, etc.), not
the foundation classes in MAXScript (float, integer, array, point3, etc.).
The following shows examples of the output of showClass():
Script:
showclass “box*” -- show all classes whose name starts with “box”
showclass “box.*” -- show all properties for class box
Output:
Box : GeometryClass {10,0} -- start of output from line 1
BoxGizmo : helper {3bc31904,67d74ec9}
OK -- result returned from line 1
Box : GeometryClass {10,0} -- start of output from line 2
.height : float
.length : float
.lengthsegs : integer
.width : float
.widthsegs : integer
.mapCoords : boolean
.heightsegs : integer
OK -- result returned from line 2
showProperties:
The showProperties() function is used to display the properties for a specific object that is an
instance of one of the MAXWrapper classes. It can be used in place of showClass() in situations
where you have an actual object in hand. Unlike showClass(), it can display the dynamic properties
(p. 805) that may appear in individual objects as you work on them in the scene, such as the sub-
controllers in a list controller or the animated control points in an FFD modifier.
802 Chapter 11 | 3ds max Objects
Note:
When the 3ds max entity specified is a node (for example $box01), this function only displays the
properties of base object. It does not show the properties of the transform controllers, modifiers, or
materials applied to the object. To display the properties for one of these objects, that object must
be specified as the 3ds max entity as shown in the above examples.
The following shows examples of the output of showProperties:
Script:
b=box() -- create a box
ffd_mod=ffdBox() -- create a ffdBox modifier
addmodifier b ffd_mod -- apply ffdBox modifier to the box
showproperties b -- show all properties for the box
showproperties ffd_mod -- show all properties for the ffdBox modifier
Output:
$Box:Box07 @ [0.0000,0.0000,0.0000] -- result from line 1
FFD_box__4x4x4:FFD(box) 4x4x4 -- result from line 2
OK -- result from line 3
.height : float -- start of output from line 4
.length : float
.lengthsegs : integer
.width : float
.widthsegs : integer
.mapCoords : boolean
.heightsegs : integer
OK -- result from line 4
.dispLattice (Lattice) : boolean -- start of output from line 5
.dispSource (Source Volume) : boolean
.deformType (<unknown>) : integer
.falloff : float
Class and Object Inspector Functions 803
.tension : float
.continuity : float
.inPoints (Inside Points) : boolean
.outPoints (Outside Points) : boolean
.offset : float
.lattice_transform : transform
OK -- result from line 5
getPropNames:
The getPropNames() function is similar to showProperties(), except it returns the property
names for a specific object as an array. Unlike showProperties(), you can specify whether to
return only the names of dynamic properties (p. 805) of the object.
The getPropNames function has the form:
getPropNames <maxwrapper_obj> [ #dynamicOnly ]
The getPropNames() function returns an array of the property names accessible on the object. For
example, if a FFD(Box) modifier with animated control points is applied to a sphere,
getPropNames $sphere01.’FFD(box) 4x4x4’
could yield:
#(#dispLattice, #dispSource, #deformType, #falloff, #tension, #continuity,
#inPoints, #outPoints, #offset, #Lattice_Transform, #Control_Point_49,
#Control_Point_50, #Control_Point_51, #Control_Point_52, #Control_Point_53)
Note:
When the 3ds max entity specified is a node (for example $box01), this function only returns the
properties of base object. It does not return the properties of the transform controllers, modifiers, or
materials applied to the object. To return the properties for one of these objects, that object must be
specified as the 3ds max entity as shown in the above examples.
If you call getPropNames() on MAXWrapper classes such as Box, Line, or Bend, it will return the
properties common to all instances of that class. If you call getPropNames() on a 3ds max entity,
it will return the properties currently defined for that entity. If you add the optional keyword
#dynamicOnly to the getPropNames() call for an entity, it returns the dynamic properties unique
to that instance.
For example,
getPropNames $sphere01.’FFD(box) 4x4x4’ #dynamicOnly
could yield:
#(#Lattice_Transform, #Control_Point_49, #Control_Point_50, #Control_Point_51,
#Control_Point_52, #Control_Point_53)
Note that the property names for the lattice transform and control points which was returned by
the previous example is not returned when #dynamicOnly is specified. These properties are unique
to the specific FFD modifier.
804 Chapter 11 | 3ds max Objects
As a special case, you can also call getPropNames() on the superclass ‘Node’ to get the list of
properties common to all scene nodes such as .position, .name, or .wireColor. For example:
getPropNames node
The property name can be either a name, for example #length, or a string, for example “length”,
so you can construct property names with string operations.
Examples:
getProperty foo #x -- equiv. to foo.x
setProperty $foo “radius” 23 -- equiv. to $foo.radius = 23
getProperty $foo.ffd_2x2x2 (”control_point_” + n as string)
The getPropNames() function can be used in conjunction with the getProperty() function to
implement object ‘dumping’ tools that can iterate over all the properties of an arbitrary object and
output them as required. For example,
for p in getPropNames $foo do
format “% = %\n” p (getProperty $foo p)
Similar functions for accessing and setting the values of property-assigned controllers are:
getPropertyController <value> <string_or_name>
setPropertyController <value> <string_or_name> <controller>
Get and set the controller assigned to the named property of the value. If no controller has been
assigned to the property, a value of undefined is returned.
SubAnims and ParamBlocks:
3ds max stores all of properties for objects in structures called subAnims. In some cases, a subAnim
will contain nested subAnims. An example of this can be seen with the Standard material. If you
apply a Standard material to an 3ds max object, and then expand the object’s tracks in Track View
to display the material, you will see three Track View nodes - Parameters, Maps, and Shader. Each of
these nodes is a subAnim defined in the Standard material’s class. Expanding the tracks for these
three nodes, you will see various properties listed. These properties are defined in each of the nested
subAnims in a structure called a ParamBlock.
MAXScript automatically finds animatable properties in all ParamBlocks associated with an object.
To access these properties, you use the same nesting as shown in Track View when referencing those
properties in MAXScript. For example, you would access the Ambient Color property in a Standard
material in MAXScript as:
$box01.material.shader.diffuse_color
Dynamic Properties 805
For more information about accessing animatable properties in MAXScript, see also Indexed Access to
Animatable Properties in 3ds max Objects (p. 806).
The properties accessible on the various kinds of values is documented for each class. Many of the
foundation classes in MAXScript (such as point3, color, etc.) support a special kind of nested-
property assignment which allows sub-properties on object properties, such as the .x, .y, and .z
coordinates in a node’s .position property, to be individually and directly set. See the Nested Object
Properties (p. 815) topic for details.
Dynamic Properties
In addition to the properties listed in the reference, MAXScript provides access to the dynamic
properties in 3ds max entities, those properties that are specific to an individual object and depend
on the operations you’ve performed on that object in the 3ds max scene. These includes such things
as animatable modifier sub-objects like gizmos and FFD control points and sub-controllers like those
in a List controller or P/R/S Transform or Path controller.
These correspond to the many animatable parameters and sub-objects that you see in the Track View
for an object; if you can see them in the Track View they will be visible as either static or dynamic
properties in the MAXScript value that corresponds to that object.
The property name you specify is matched against the sub-animatable name (as it would be seen in
the Track View or sub-object drop-down) using the standard MAXScript conventions of mapping
spaces to ‘_’ underscores and ignoring case when dealing with 3ds max class and property names.
You can also simply leave out the spaces in any dynamic property names.
Example:
p = $foo.bend.center
$baz.taper.gizmo.rotation = quat 30 z_axis
$foo.pos.controller.bezier_position = [10,0,0]
Because these properties are dynamic and may change as controllers are replaced and sub-objects
become animated, they may vary from object to object and so are not reported in the properties
section of the showClass() function output. Instead, you can use the built-in function
showProperties() which will display the accessible properties on a 3ds max entity including the
currently visible dynamic properties. Both functions are described in the Class and Object Inspector
Functions (p. 799) topic.
806 Chapter 11 | 3ds max Objects
You cannot set subAnims with the index operator, this is a read-only access.
-- SubAnim Class
MAXScript defines a SubAnim class, instances of which provide a general representation for sub-
animatables. Whenever you use the index operator on a 3ds max object, it returns a SubAnim
instance. For example:
$box01[3] -> SubAnim:Transform
The third subAnim in a node is typically the transform track.
Properties:
<subAnim>.value : Value
The current value of the track subAnim, equivalent to <controller>.value. Returns
undefined if no appropriate value exists or the track has not yet been assigned a
Indexed Access to Animatable Properties in 3ds max Objects 807
controller. The .value property yields the value at the current MAXScript time. You can
assign to this value to set the track’s value at that time.
<subAnim>.controller : Controller
The controller for the track SubAnim. Returns undefined if a controller has not yet been
assigned or if the SubAnim is not animatable. You can assign a new controller to a track by
assigning to the .controller property of its subAnim.
<subAnim>.keys : KeyArray, read-only
Yields the key array for that track or undefined if not keyable or a controller has not yet
been assigned. This property is read-only.
<subAnim>.isAnimated : Boolean, read-only
Yields true if there is an animated controller present. This property is read-only.
<subAnim>.object : MAXWrapper, read-only
Yields the subAnim object, or undefined if not assigned. This property is read-only. The
.object property may return any kind of MAXWrapper object, depending on what the
parent object decides to put there. For example, <node>[1].object is the visibility
controller or undefined if not yet assigned, <node>[2].object contains the bindings of
any space warps bound to the node, or undefined if none have been bound,
<node>[3].object is the transform controller, <node>[4].object is the node’s object,
either the modified object if there are modifiers present or the base object if not,
<node>[5].object is the material assigned to the node or undefined if no material has
been assigned, and <node>[6].object is the Image Motion Blur Multiplier controller or
undefined if not yet assigned,. For example:
b = box()
b[4].object -- returns a reference to the Box base object
yields the rotation track subAnim since <node>[3] is always the transform track and the
second track in it is always the rotation track. Indexing a SubAnim always yields another
SubAnim. For those familiar with SubAnims in the 3ds max SDK, it should be noted that
808 Chapter 11 | 3ds max Objects
MAXWrapper : Value
The MAXWrapper class is the superclass of all classes in MAXScript that represent 3ds max objects,
such as scene nodes, modifiers, materials, etc. MAXWrapper values contain references to the
associated 3ds max objects that allow it keep track of the object. This allows MAXScript to know
when a 3ds max object is transformed, deleted by the user, or its properties are changed.
The properties, operators, and methods that are common to all classes derived directly from the
MAXWrapper class are described in the MAXWrapper Common Properties, Operators, and Methods
(p. 809) topic.
The following classes are derived directly from the MAXWrapper class. Other classes are derived from
these classes, and inherit the properties and methods defined for the MAXWrapper class.
MAXWrapper Common Properties, Operators, and Methods 809
See also
Node (p. 820)
Modifier and SpacewarpModifier (p. 1095)
Material (p. 1203)
Atmospheric (p. 1337)
Controllers (p. 1300)
Render Effect (p. 1347)
<MAXWrapperobject>.classID
<maxclass>.classID
The classID property retrieves the internal 3ds max Class ID of the MAXWrapper classes
and objects. The value returned is an array containing two numbers, PartA and PartB of
the 3ds max internal class ID. For a MAXWrapper object, the value returned is the Class ID
of the class the object is an instance of. For example,
Box.classID -- returns #(16, 0)
b=box()
b.classID -- returns #(16, 0)
The combination of the PartA and PartB numbers is guaranteed to be unique for
each class.
<MAXWrapperObject>.superClassID
<maxclass>.superClassID
Retrieves the 3ds max superclass ID of the MAXWrapper classes and objects.
Methods:
copy <MAXWrapper_object>
The copy() function is implemented by all the 3ds max objects available in MAXScript,
such as scene objects, controllers, modifiers, materials, etc. You can use this function to
make a clone of the source object, for example in situations where you want individual
copies or you want to make a shared object unique. For example:
addModifier $foo $baz.bend
will give foo a separate clone of the bend modifier on baz. Any changes to the bend
modifier on foo will not affect baz and vice versa.
In the next example, we set up several objects all sharing a single rotation controller:
c = bezier_rotation()
$foo.rotation.controller = c
$baz.rotation.controller = c
$bar.rotation.controller = c
When the MAXWrapper object is not a scene node, the copy is only created in MAXScript
memory. When the MAXWrapper object is a scene node, a new scene node is created
which is visible and accessible by the user in the 3ds max viewports.
MAXWrapper Common Properties, Operators, and Methods 811
exprForMAXObject <MAXWrapper_object>
Returns a string containing a MAXScript expression that will ‘name’ the specified
MAXWrapper object using property access and indexes as needed. For example, if you
have in variable m a bend modifier on a scene object named “foo”, then:
exprForMAXObject m
This method is an exposure of an internal method that macro recorder uses, and its output
will vary depending on the macro recorder options.
b=box()
--> $Box:Box02 @ [0.000000,0.000000,0.000000]
c=b.pos.controller
--> Controller:Bezier_Position
exprformaxobject c
--> “$Box02.pos.controller”
bm=bend()
--> Bend:Bend
addmodifier b bm
--> OK
exprformaxobject bm
--> “$Box02.modifiers[#Bend]”
Here, changing the macro recorder options from “Explicit scene object names” to
“Selection-relative scene object names”, yeilds:
exprformaxobject bm
--> “$.modifiers[#Bend]”
creates an instance of a Box. This box will not appear in the 3ds max viewports, as it is not
a node. It only contains the geometry associated with the Box object. You can get at the
mesh representation of these instanced objects with the mesh property, which yields a
TriMesh value.
replaceInstances <old_MAXWrapper> <new_MAXWrapper>
Replaces all instances of the old MAXWrapper with the new MAXWrapper. Old and new
MAXWrapper must have the same superclass.
Minimal error checking, use with extreme caution.
812 Chapter 11 | 3ds max Objects
-- Dependencies
An important internal mechanism in 3ds max defines the dependency relationship between
3ds max objects. For example, a material depends on its various maps, a path controller depends on
its percent controller, a scene node depends on its base object, etc. The following method returns
the MAXWrapper objects that depend on a specified MAXWrapper object.
refs.dependents <MAXWrapper_object>
Returns an array of the other 3ds max MAXWrapper objects depend on the specified
MAXWrapper object. The specified MAXWrapper object can be any MAXWrapper object,
such as a scene node, controller, material, modifier, etc.
For example:
refs.dependents $foo.material.diffuseMap
could return:
#(Material_#3, Material_#2, Map_#2:Noise, Material_#1)
which shows that the diffuseMap in $foo is referenced in material #1, material #2, material
#3, and noise TextureMap #2.
Example:
The following example shows several objects being created, and sets up controllers on the objects
which depend on other objects.
Script:
theSphere=sphere () -- create a sphere
theCone=cone radius1:0 radius2:20 -- create a cone
theHelix=helix height:100 pos:[100,100,0] -- create a helix
theCone.target=theSphere -- assign theSphere as target of theCone
-- a lookat controller is automatically
-- assigned to theCone
-- assign path controller to theSphere, path to follow is the helix
theSphere.position.controller=path path:theHelix
refs.dependents theSphere -- show dependents of the sphere
refs.dependents theCone -- show dependents of the cone
refs.dependents theHelix -- show dependents of the helix
Output:
$Sphere:Sphere02 @ [0,0,0] -- result line 1
$Cone:Cone02 @ [0,0,0] -- result line 2
$Helix:Helix02 @ [100,100,0] -- result line 3
$Sphere:Sphere02 @ [0,0,0] -- result line 4
Controller:Path -- result line 8
#(Controller:Look_At, $Cone:Cone02 @ [0,0,0]) -- result line 9
#() -- result line 10
-- following is output of line 11
#(Controller:Path, Controller:Position_Rotation_Scale, $Sphere:Sphere02 @ [0,0,0],
Controller:Look_At, $Cone:Cone02 @ [0,0,0])
Access to MAXWrapper AppData 813
See also
Access to MAXWrapper AppData (p. 813)
Nested Object Controller Functions (p. 814)
Nested Object Properties (p. 815)
Note Track Access (p. 816)
AppData in its full generality allows the C++ plug-in developer to store arbitrary binary data with an
object. This is not directly possible with MAXScript, so the approach taken is to store and retrieve
AppData text strings that can be built-up or parsed into complex MAXScript objects using a
StringStream Value (p. 766). For example, to store some numbers in an array on a scene node, you
might do the following:
ss = StringStream ““
for v in data_values do print v to:ss
setAppData $foo 1 ss
and read them back after the scene has been saved and reloaded as follows:
ss = StringStream (getAppData $foo 1)
data_values = #()
while not eof ss do
append data_values (readValue ss)
The above functions can be called on any 3ds max object collection (such as a wild-card pathname
or object set or array of objects ) and will recursively apply to all animation within those objects. For
more information see Time and Key Functions on Object Hierarchies (p. 1299) and Controller Time
Functions (p. 1292).
Nested Object Properties 815
Examples:
insertTime $box01.xform 0f 10f
-- all keys after 0f in all controllers in the XForm modifier are moved by 10f
insertTime $box01 0f 10f
-- all keys after 0f in box01 are moved (transform, creation, modifiers)
selectKeys $box02.xform.gizmo.rotation.controller 0f 100f
-- selects keys in 0-100f. If controller is Euler, will select x, y and z keys
deleteTime $box* 10f 10f
-- delete 10f at frame 10 in all keys in all objects named $box* (works with
-- any pathname or array of objects)
insertTime $box03.children 0f 10f
-- inserts time in all controllers of all children of $box03
reduceKeys $box01.modifiers
-- applies key reductions to all controllers in all modifiers in $box01 (leaves
-- transform and creation parameters alone)
If you first get the intermediate value into some variable and then set the property on that value,
the change will not be reflected in the original object, the connection is only maintained within a
single cascaded property access. For example:
p = $foo.pos -- get foo’s position as a ‘detached’ point3
p.x += 23 -- set the x prop of that point, it doesn’t know
-- about foo anymore, foo’s pos is not changed
In this case, you would have to explicitly re-assign the free-standing point to $foo’s position to affect
$foo:
$foo.pos = p -- set foo’s new position
In general, any property on a MAXWrapper object that is itself a foundation compound value such
as a Point3 or Quat will yield a free-standing value when simply accessed and supports object sub-
property assignment in cascaded property assignment.
816 Chapter 11 | 3ds max Objects
See also
Notetrack Values (p. 816)
MAXNoteKeyArray Values (p. 817)
MAXNoteKey Values (p. 818)
Working with Note Tracks (p. 818)
Notetrack Values
The following methods are related to creating, adding, deleting Note tracks. See the
MAXNoteKeyArray Values (p. 817) and MAXNoteKey Values (p. 818) topics for information on
accessing the contents of Note tracks.
Constructor:
notetrack <name_string>
Creates a new, empty note track with the specified name. The name is only used to
differentiate different note tracks in MAXScript but is not visible in 3ds max.
Properties:
<noteTrack>.keys MAXNoteKeyArray
<noteTrack>.name String
Methods:
getNoteKeyTime <notetrack> <index>
Returns the time of indexed note key.
getNoteKeyIndex < notetrack > <time>
Returns the index of the note key at the specified time.
Associated Methods:
addNoteTrack <MAXWrapper_object> <NoteTrack>
Adds a new note track to the MAXWrapper object.
deleteNoteTrack <MAXWrapper_object> <NoteTrack>
Deletes specified note track from the MAXWrapper object.
MAXNoteKeyArray Values 817
hasNoteTracks <MAXWrapper_object>
Deletes specified note track from the MAXWrapper object.
numNoteTracks <MAXWrapper_object>
Returns the number of note tracks applied to the MAXWrapper object as an integer.
getNoteTrack <MAXWrapper_object> <index_integer>
Returns the indexed note track applied to the MAXWrapper object. Index is 1-based.
MAXNoteKeyArray Values
A MAXNoteKeyArray represents all the note keys in a 3ds max note track. See also MAXNoteKey
Values (p. 818) and Notetrack Values (p. 816). MAXNoteKeyArray values are mappable.
Constructors:
<NoteTrack>.keys
The note key array can be constructed by accessing the keys property on the note track.
Example:
nt=getNoteTrack $foo.position.controller 1 -- get first note track on
controller
ntk=nt.keys -- note key array for note track
Properties:
<NoteKeyArray>.count : Integer, read-only
returns the number of objects in set
Operators:
<NoteKeyArray>[<index_integer>] -- accesses member of collection. Indexes start
at 1.
Methods:
addNewNoteKey <NoteKeyArray> <time>
Adds a new note key to the note key array at the time specified. The value for the new note
key is a null string. Returns the note key added.
deleteNoteKeys <NoteKeyArray> ( #allKeys | #selection )
Deletes note keys from the note key array according to the optional symbolic argument
supplied.
#allKeys: deletes all keys in the note key array.
#selection: deletes the currently selected note keys
deleteNoteKey <NoteKeyArray> <index_integer>
Deletes the indexed note key. Key indexes are 1-based.
sortNoteKeys <NoteKeyArray>
Re-sorts note keys according to their times. Some MAXNoteKey operations can result in
out of order note keys and this function must be called to correctly order note keys.
818 Chapter 11 | 3ds max Objects
Associated Methods:
getNoteKeyTime <notetrack> <index>
Returns the time of indexed note key.
getKeyIndex < notetrack > <time>
Returns the index of the note key at the specified time.
MAXNoteKey Values
Note tracks store their notes as MAXNoteKeys. As seen by MAXScript, note keys are stored in a
MAXNoteKeyArray. The MAXNoteKeyArray for a note track is accessed via the keys property of the
note track.
For more information on MAXNoteKeyArrays, see the MAXNoteKey Values (p. 818) topic.
Constructor:
addNewNoteKey <MAXNoteKeyArray> <time> [ #select ]
Adds a new note key to the note track at the time specified. The new note key is also
selected in the track view if the #select optional argument is specified. The value for the
new note key is a null string.
<MAXNoteKeyArray>[<index_integer>]
Properties:
<MAXNoteKey>.time Time -- time value or number (interpreted as frames)
<MAXNoteKey>.selected Boolean -- specifies whether the key is selected. Read/
write access.
<MAXNoteKey>.value String -- string contained in the note key
Output:
$Sphere:Sphere02 @ [0.0,0.0,0.0] -- result line 1
Notetrack:PosNT1 -- result line 3
Notetrack:PosNT2 -- result line 4
OK -- result line 5
OK -- result line 6
2 -- result line 7
true -- result line 8
#Note key(1 @ 20f) -- result line 10
#Note key(2 @ 40f) -- result line 11
Notetrack: -- result line 13
#keys(20f, 40f) -- result line 14
“Yo What’s Up” -- result line 16
10 -- result line 17
true -- result line 18
OK -- result line 19
2 -- result line 20
#keys(10f, 20f) -- result line 21
OK -- result line 24
OK -- result line 25
OK -- result line 26
OK -- result line 27
820 Chapter 11 | 3ds max Objects
Node : MAXWrapper
Nodes represent 3ds max scene objects such as geometry, cameras, shapes, etc. Each kind of 3ds max
scene object is represented by a class that inherits from Node.
The classes derived directly from the Node class are described in the Node Subclasses (p. 849) topic.
Other classes are derived from these classes, and inherit the properties and methods defined for the
Node class.
The properties, operators, and methods that are common to all classes derived directly from the
Node class are described in the Node Common Properties, Operators, and Methods (p. 820) topic.
The Node class is derived from the MAXWrapper class, and inherits the properties and methods
defined for that class. These properties and methods are described in the MAXWrapper Common
Properties, Operators, and Methods (p. 809) topic.
The position and rotation values are relative to the current active grid if ‘coordsys grid’ is
the current working coordinate system.
A <node_constructor> is one of the scene node classes listed in Node Subclasses (p. 849),
such as box, sphere, quadPatch, splineShape, etc. For example:
b = box name:”foo” position:[10,10,10] height:20
Working with Note Tracks 821
All of the node constructors can take the above optional keyword arguments, along with
any of general node properties or any of the properties for the particular node class as
keyword arguments.
The name keyword can be used to specify the name for the created node. 3ds max allows
the same name to be used for more than one node.
The prefix keyword can be used in place of the name keyword argument to specify the
start of the node name from which 3ds max will generate a unique name by adding a
series of digits, as it does when creating objects interactively.
For example:
for i in 1 to 100 do sphere prefix:”baz”
creates 100 spheres, giving each a unique name beginning with “baz”, such as
$baz01, $baz02, $baz03, etc.
The material keyword can be used to apply the specified material to the created node.
The target keyword can be used to automatically apply a LookAt controller to the node’s
transform track, and set the specified node as the LookAt target.
The transformation arguments, pos, scale, rotation, and pivot, are applied to the new
object in the order they are specified in the constructor call, so you can control transform
order. The pos, scale, and rotation arguments are mutually exclusive with the
transform argument which can be used as an alternative way to set the node’s complete
transform matrix in one go.
Note: Exercise care if you specify the target keyword. When you specify a target object,
3ds max stores with the target object the last object it was assigned as a target of. If you
delete the target object, the behavior of 3ds max is to also delete the object looking at it. If
the target object is a targetobject class object, deleting an object looking at it will also
delete the target object, even if another object is also looking at it.
Properties:
See the General Node Properties (p. 836) and Node Transform Properties (p. 841) topics for details about
the properties accessible on scene nodes.
Methods:
Most node methods are automatically mapped over node collections.
IsValidNode <var>
Returns true if <var> is a node value, and the node has not been deleted. Otherwise, it
returns false.
move <node> <point3> -- mapped
scale <node> <point3> -- mapped
rotate <node> <angle> <axis_point3> -- mapped -- angle in degrees
rotate <node> <quat> -- mapped
rotate <node> <eulerangles> -- mapped
all the transform operations operate in the current working coordinate system. See Context
Expressions (p. 681).
822 Chapter 11 | 3ds max Objects
getTMController <node>
Returns the transform controller for the node.
bindSpaceWarp <node> <spacewarp_node>
Binds the scene node to the space warp object scene node. Space warp bindings show up in
the modifier stack and can be accessed like any other modifier. Use the
deleteModifier() function to unbind objects from space warps. See the Modifier and
SpacewarpModifier (p. 1095) topic for more information about working with the modifier
stack.
getPolygonCount <node>
Returns a 2 element array containing the current number of faces for the node in the first
element, and the current number of vertices for the node in the second element. The
number of faces and vertices returned are the number that would be present if the node
was converted to a mesh object.
isShapeObject <node>
Returns true if the node is a shape object, false otherwise
numSurfaces <node>
Returns the number of parametric surfaces in the object. At the current time, Loft objects
are the only objects where more than one surface is present (ie. loft of a donut).
isSurfaceUVClosed <node> <surface_index_integer>
Returns a 2 element array indicating if the parametric surface is closed in the U and V
dimensions (ie. a torus is closed in both U and V). Note that not all objects have this
method implemented, and will return a default value of #(true, true).
getTransformAxis <node> <index>
Returns the transform axis of the indexed axis system of the node as a <matrix3> value.
Normally a node justhas 1 transform axis. In some cases (like being in the Local Reference
Coordinate System, in object SO mode, and having multiple SO selected), multiple
transform axes exist. If index > the number of transform axis, the transform for the first
transform axis is returned.
The transform returned by this method can be used in an “in coordsys” context and an
“about” context to move, rotate, or scale an object about the current 3ds max UI Reference
Coordinate System and Center.
824 Chapter 11 | 3ds max Objects
For example:
fn axisRotate obj rotation =
(local axis
local objA = if classof obj == objectSet or classof obj == array then obj
else #(obj)
if getCoordCenter() != #local then
(axis = getTransformAxis objA[1] 0
for obj1 in objA do in coordsys axis about axis rotate obj1 rotation
)
else
(for obj1 in objA do
(axis = getTransformAxis obj1 0
in coordsys axis about axis rotate obj1 rotation
)
)
)
invalidateTM <node>
Invalidates the node’s transformation matrix cache.
invalidateTreeTM <node>
Invalidates the node’s transformation matrix cach and notify the node’s subtree that the
transformation matrix has changed.
The following MAXScript function can be used to force an update of an object whose
transform is partially controlled by a scripted controller (such as a script controller on the
position track):
mapped fn TMInvalidate obj =
(at time (currenttime-1) obj.transform
nodeInvalRect obj
invalidateTreeTM obj
redrawViews()
)
invalidateWS <node>
Invalidates the node’s world space cache.
getNodeByName <string> exact:<boolean>
Returns first <node> with the specified name. String case is insensitive unless
exact:true.
Default is exact:false
snapshotAsMesh <node>
Returns world state of node as a <mesh> value.
Working with Note Tracks 825
getInheritanceFlags <node>
setInheritanceFlags <node> (#all | #none | <bitarray>) keepPos:<boolean>
Get and set the inheritance flags for the specified node as an <bitarray>. If a bit is on,
the corresponding inheritance is turned on. The order of the bits is:
#{POS_X,POS_Y,POS_Z,ROT_X,ROT_Y,ROT_Z,SCALE_X,SCALE_Y,SCALE_Z}
If keepPos:false is specified, the node may move when an inheritance is turned on
or off.
getTransformLockFlags <node>
setTransformLockFlags <node> (#all | #none | <bitarray>)
Get and set the transform lock flags for the specified node as an <bitarray>. If a bit is on,
the corresponding transform lock is turned on. The order of the bits is:
#{POS_X,POS_Y,POS_Z,ROT_X,ROT_Y,ROT_Z,SCALE_X,SCALE_Y,SCALE_Z}
-- Render-Related Methods
getInheritVisibility <node>
Returns true if the node inherits the visibility of its parent object (if any), false if not.
setInheritVisibility <node> <boolean>
Sets whether the node inherits the visibility of its parent object (if any). If <boolean> is
true, node inherits visibility. If <boolean> is false the node does not inherit visibility.
getVisController <node>
Returns an instance of the node’s visibility controller. Returns undefined if the node does
not have a visibility track.
getImageBlurMultController <node>
Returns the node’s Image Motion Blur Multiplier controller. Returns undefined if not
Image Motion Blur Multiplier controller has been assigned to the node.
setImageBlurMultiplier <node> <time> <number>
Sets the node’s Image Motion Blur Multiplier value at the specified time to the specified
value
setImageBlurMultController <node> <controller>
Sets the node’s Image Motion Blur Multiplier controller to the specified controller
setMotBlur <node> <integer>
Sets which type of motion blur to use for node. If <integer> = 1, None. If <integer> =
2, Object Motion Blur. If <integer> = 3, Image Motion Blur.
setRenderable <node> <boolean>
Sets whether the node is renderable. If <boolean> is true, node is renderable. If
<boolean> is false the node is not renderable.
getRenderID <node>
Returns the RenderID of the node. A value of 65535 is returned if the scene has not yet
been rendered, or the node is not renderable. The RenderIDs of the nodes are output to the
NODE_RENDER_ID g-buffer channel by the renderer.
setRenderID <node> <integer>
Sets the RenderID of the node to the specified value. This value is not “sticky” - it is not
saved with the scene, and it will be replaced by the renderer when the next render occurs.
826 Chapter 11 | 3ds max Objects
-- Group-Related Methods
group <node> [ name:<string> ] [ prefix:<string> ] \
[ select:<boolean> ] -- mapped
Makes a group of the given nodes and returns the group node. You can optionally specify
the group name or group name prefix. Not specifying a name or specifying a group name
prefix ensures that the group name assigned is unique. Specifying select:true selects
the group after it is made.
For example:
group $box* name:”boxes”
makes a group of all box*’s named “boxes”.
group selection
groups current selection.
ungroup <group_head_node> -- mapped
Ungroups one level of a group node.
For example:
ungroup $group01
ungroups group $group01
explodeGroup <group_head_node> -- mapped
Ungroups all levels in a group node.
isGroupHead <node>
Returns true if node is group head, false otherwise.
isGroupMember <node>
Returns true if node is in a group, false otherwise.
isOpenGroupMember <node>
Returns true if <node> is a member of a group, and that group is open.
isOpenGroupHead <node>
Returns true if <node> is the head of a group, and that group is open.
setGroupOpen <group_head_node> <boolean>
Sets whether the group is set as open or closed. If <boolean> is true, the group is set as
open. If <boolean> is false the group is closed.
Working with Note Tracks 827
*** Use the following methods with care. You can place nodes in states that are impossible to
accomplish using the 3ds max user interface. ***
setGroupMember <node> <boolean>
Sets whether the node is a group member or not. If <boolean> is true, node is set as a
group member. If <boolean> is false, and the node is a group member, the node is set as
not being a group member and is unlinked from the group head.
Note: If you set a node to be a group member using this method, you need to set the node
to be a child of a group head. Otherwise, the node name is not shown in the Select By
Name dialog. For example:
setGroupHead $dummy01 true
append $group03.children $dummy01
-- check to see if group is open. Open group and test member of group
isOpenGroupHead $MyGroup -- returns false
setGroupHeadOpen $MyGroup true
isOpenGroupMember $sphere01 -- returns false
-- create a new set of spheres, append the group to the set, and then group them all
NewSpheres=for i=1 to 3 collect sphere pos:(random [-100,-100,0] [100,100,0])
append NewSpheres $MyGroup
group NewSpheres name:”BiggerGroup”
-- open the group head, test member of group, and then close the groups.
setGroupHeadOpen $BiggerGroup true
isOpenGroupMember $MyGroup
setGroupHeadOpen $MyGroup false
setGroupHeadOpen $BiggerGroup false
828 Chapter 11 | 3ds max Objects
the node is currently selected and open in the Modify panel at the desired sub-object level.
You can use the 3ds max System global variable, subObjectLevel to test and set the level
for the object currently open in the Modify panel. For example:
max modify mode -- open mod panel
select $box01 -- select box01 into mod panel
subObjectLevel = 3 -- subobject level to Face
addModifier $box01 (ffd_2x2x2()) -- add FFD mod to those faces
If <node> is a collection, an instance of the modifier is placed on each of the nodes in the
collection. Unlike interactively applying a modifier to a selection, the position and size of
each modifier instance’s gizmo corresponds to position and size of the node the modifier
instance is applied to. To apply a modifier to a collection in the same manner that 3ds max
applies modifiers, use the modPanel.addModToSelection() method described in the
Modify Panel (p. 1572) topic.
Also see the Modifier and SpacewarpModifier (p. 1095) topic for more details.
deleteModifier <node> <modifier_or_index> -- mapped
Lets you delete modifiers from the modifier stack. Takes either a modifier value which is
present on the <node> stack, or an index specifying the index of the modifier to delete,
counting from the top of the stack.
collapseStack <node> -- mapped
Collapses the modifiers out of a stack, leaving a resultant editable mesh as the base object
of the node(s). If there are no modifiers in the stack when this is called, no action is taken.
If you want to force an object to be an editable mesh, use the function convertToMesh().
-- Node Modifier Transform Context Methods
getModContextTM <node> <modifier>
Returns a Matrix3 value giving the modifier’s context transform for the local coordinates
used in modifier sub-object gizmos. Accessing the transform properties of a modifier sub-
object such as a gizmo or a center in MAXScript yields values that are relative to that
modifier’s context transform, equivalent to the values shown in track view for those
properties. If the modifier is not operating on a sub-object selection, such as a face or
vertex selection, or if the modifier was interactively applied to an object selection, this
context TM is the local coordinate space of the object itself. However, if the modifier is
operating on either an object selection set or a sub-object selection, the context transform
gives the position and orientation of that selection, and so you can use the
getModContextTM() function to get the world-space transform properties of any of its
sub-objects.
Working with Note Tracks 831
The kinds of classes you can convert objects to are the generic editable forms including
Mesh, SplineShape, NURBSCurve, NURBSSurface, etc.
convertTo <node> <class> -- mapped
This function is a general form of the existing specific conversion functions such as
convertToMesh(), convertToSplineShape(), etc. For example,
convertToSplineShape() can be written:
convertTo $circle01 SplineShape
If the conversion is not supported, the function returns the value undefined.
832 Chapter 11 | 3ds max Objects
where p0, p1, and p2 are the positions of the vertices of the triangle. The Point3 returned
by this method has the barycentric coordinate stored in its three component values. The
coordinate is relative to the triangular face that was intersected. Barycentric coordinates
can also be used to interpolate any quantity whose value is known at the vertices of the
triangle.
Following is an example of finding the UV coordinates at the intersection point:
Script:
s = sphere material:(standardMaterial diffuseMap:(checker()))
showTextureMap s.material s.material.diffuseMap on
--
-- Add a normal modifier to make the sphere into a mesh
addModifier s (normalModifier())
r = ray [-100,5,0] (s.center-[-100,5,0])
--
-- Get the Intersection details
arr = (intersectRayEx s r)
--
-- Create a dummy at the point of intersection
dummy pos:(arr[1]).pos
--
-- Get the texture face
tf = getTVFace s arr[2]
--
-- Get the UVW verts of the face
tv1 = getTVert s tf.x
834 Chapter 11 | 3ds max Objects
Associated Methods:
uniqueName <prefix>
Generates a unique scene node name from a prefix string by adding a series of digits, in
the same manner the 3ds max does as you create objects in the scene. This name is only
guaranteed to be unique until the next scene node creation. For example:
$foo.name = uniqueName “foo”
See also
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
General Node Properties (p. 836)
Node Transform Properties (p. 841)
Node User-Defined Properties and Methods (p. 848)
Nested Object Properties (p. 815)
Class and Object Inspector Functions (p. 799)
Dynamic Properties (p. 805)
Node Subclasses (p. 849)
NURBS Node Properties and Methods (p. 1397)
Setting the this property has the effect of detaching <node> from its original parent and
attaching it as a child of the specified node.
You can detach an object and make it a top-level object by assigning undefined to the
parent property:
$foo.parent = undefined
You can get the number of children via the count property:
num_children = $foo.children.count
You cannot directly set a child by indexing into NodeChildrenArray, but you can
append new children using the append() function and delete children using the
deleteItem() function:
$foo.children[$foo.children.count+1]=$baz -- does not work
append $foo.children $baz -- works
deleteItem $foo.children $baz -- removes $baz as child
The ordering of child indexes corresponds to the ordering shown in the 3ds max hierarchy
view, which is the order in which the children were added to the parent.
<node>.mesh TriMesh
For scene nodes or base objects that are Editable Mesh objects, or are convertable to
Editable Mesh objects, this property yields a TriMesh containing a copy of the source
object’s mesh after any modifiers have been applied, but before any space warps have been
applied. This property is read-only unless the scene node or base object is an Editable Mesh
object, in which case the specified TriMesh replaces the base object. See the Editable_Mesh :
GeometryClass and TriMesh : Value (p. 1041) topic for more information on TriMesh and
Editable Mesh.
838 Chapter 11 | 3ds max Objects
The controller for this property is stored in the 1st subAnim of the node. You can access
this controller as:
<node>[1].controller -- the visibility controller
You can also get a node’s visibility controller using the getVisController() method.
<node>.inheritVisibility Boolean default: true
Get or set whether the node inherits the visibility of its parent object (if any). This
property parallels the Inherit Visibility property in an object’s right-click Object Properties
dialog.
<node>.renderable Boolean default: true
Get or set whether the node is renderable.
<node>.renderOccluded Boolean default: false
Get or set whether to Render Occluded Objects behind the node. This property parallels
the Render Occluded Objects property in an object’s right-click Object Properties dialog.
<node>.motionBlurOn Boolean default: true
Get or set whether motion blur is enabled for the object. This property parallels the
Motion Blur Enabled property in an object’s right-click Object Properties dialog.
<node>.motionBlurOnController Controller default: undefined
Get or set the motion blur on/off controller used for the node.
<node>.motionBlur Name default: #none
Get or set the type of motion blur to be used for the node. Valid parameter values are:
#none, #object, and #image. For backward compatibility, this property can also be set to
false for none or true for object motion blur. This property parallels the Motion Blur
type specified in an object’s right-click Object Properties dialog.
Node Transform Properties 841
You can also get and set a node’s imageMotionBlurMultiplier controller using the
getImageBlurMultController() and setImageBlurMultController() methods.
<node>.rcvcaustics Boolean default: true
Get or set whether the node receives caustics. Caustics are not supported by the 3ds max
scanline renderer.
<node>.generatecaustics Boolean default: false
Get or set whether the node generates caustics. Caustics are not supported by the 3ds max
scanline renderer.
<node>.rcvGlobalIllum Boolean default: true
Get or set whether the node receives global illumination. Global illumination is not
supported by the 3ds max scanline renderer.
<node>.generateGlobalIllum Boolean default: false
Get or set whether the node generates global illumination. Global illumination is not
supported by the 3ds max scanline renderer.
<node>.rotation : Quat
842 Chapter 11 | 3ds max Objects
<node>.objectOffsetPos : Point3
<node>.objectOffsetRot : Quat
<node>.objectOffsetScale : Point3
Node geometry’s position, rotation, and scale offset from the pivot in world coordinates.
<node>.objectTransform : Matrix3, read-only
Node geometry’s offset in world coordinates.
See also
Using Node Transform Properties (p. 843)
Using Node Transform Properties 843
Unlike the Node Transform Matrix, the Object-Offset Transform Matrix is not inherited by children
of the node.
Using Node Transform Properties 845
This matrix could be used, for example, if you have a mesh object and wanted to get the world space
coordinate of one of its vertices. You could do this by taking the vertex coordinate in object space
and multiplying it by the Object Transform Matrix.
Using the Node Transforms in MAXScript
The node transform properties are derived from and modify the values of the transform controllers
associated with the node, they are not associated directly with the node’s main transformation
matrix. This has a number of consequences:
1. Assigning to a transform property (such as pos or rotation) with animation enabled plants
keyframes only in the associated controller. If you modify the node’s transform matrix directly,
keyframes are generated for all the transform controllers for that node.
2. Rotation properties and in fact all rotation-related functions in MAXScript reflect the direction
convention used in the 3ds max user interface. This convention is the right-hand rule, namely,
positive angles rotate counter-clockwise about positive axes. Internally, however, 3ds max stores
rotations in node matrices using the left-hand rule. It is important to remember this inversion
when working directly with node transform matrices using the transform and
objectTransform properties. You’ll need to invert rotations (for example, by multiplying axes
by [-1,-1,-1] or using the inverse() function on quaternions) when mixing them with 3ds max
and MAXScript standard rotations.
3. Certain controllers, such as the path controller with bank or follow enabled, affect the rotation
of a node by adjusting the node’s transform matrix directly and this rotation is not reflected in
rotation controller values. This means, in this example for instance, that bank and follow
rotations are not directly accessible through the rotation property, you need to access them
directly in the node’s transformation matrix using something like:
r = $foo.transform.rotationPart
which returns a quaternion. Remember, however, that the 3ds max rotation direction
convention is not reflected when directly accessing a transform matrix, so to use this value in
other rotation operations you would need to invert it:
$baz.rotation = inverse r
A node’s transform property contains the Node Transform Matrix, and reflects the position,
rotation, and scale of the node’s pivot point. Accessing the pivot property will return the same
value as the pos property. Setting the pivot property will move the pivot point location to the
specified coordinates, however the node’s geometry will not be moved.
846 Chapter 11 | 3ds max Objects
Output:
DumpXForms() -- function definition
RotatePivotOnly()-- function definition
transform: (matrix3 [1,0,0], [0,1,0], [0,0,1], [75,75,0]) -- initial transforms
position : [75,75,0]
rotation : (quat 0 0 0 1)
pivot : [75,75,0]
objectoffsetpos : [0,0,0]
objectoffsetrot : (quat 0 0 0 1)
objectoffsetscale: [1,1,1]
objecttransform : (matrix3 [1,0,0], [0,1,0], [0,0,1], [75,75,0])
vert 1 (local) : [-12.5,-12.5,0]
vert 1 (world1) : [62.5,62.5,0]
vert 1 (world2) : [62.5,62.5,0]
transform: (matrix3 [1,0,0], [0,1,0], [0,0,1], [50,50,0]) -- transforms after
move
position : [50,50,0]
rotation : (quat 0 0 0 1)
pivot : [50,50,0]
objectoffsetpos : [25,25,0]
objectoffsetrot : (quat 0 0 0 1)
objectoffsetscale: [1,1,1]
objecttransform : (matrix3 [1,0,0], [0,1,0], [0,0,1], [75,75,0])
vert 1 (local) : [-12.5,-12.5,0]
vert 1 (world1) : [62.5,62.5,0]
vert 1 (world2) : [62.5,62.5,0]
transform: (matrix3 [0.819152,0.573576,0], [-0.573576,0.819152,0], [0,0,1],
[50,50,0]) -- transforms after rotate
position : [50,50,0]
rotation : (quat 0 0 0.300706 0.953717)
pivot : [50,50,0]
objectoffsetpos : [34.8182,6.13939,0]
objectoffsetrot : (quat 0 0 0.300706 0.953717)
objectoffsetscale: [1,1,1]
objecttransform : (matrix3 [1,0,0], [0,1,0], [0,0,1], [75,75,0])
vert 1 (local) : [-12.5,-12.5,0]
vert 1 (world1) : [62.5,62.5,0]
vert 1 (world2) : [62.5,62.5,0]
848 Chapter 11 | 3ds max Objects
Node Subclasses
In the following node subclasses, the properties listed can all be specified as optional constructor
keyword arguments with defaults as shown, along with the common keyword arguments for all
node constructors, listed in the Node : MAXWrapper (p. 820) topic. The property listings show name,
type and Constructor default value. The following list displays the 3ds max node subclasses:
GeometryClass (p. 850)
Shape (p. 944)
Light (p. 966)
Camera (p. 974)
Helper (p. 977)
SpacewarpObject (p. 992)
850 Chapter 11 | 3ds max Objects
GeometryClass : Node
The following list shows the 3ds max geometry class objects:
-- Standard Primitives
Box (p. 853)
Cone (p. 858)
Cylinder (p. 859)
Geosphere (p. 862)
Plane (p. 867)
Pyramid (p. 869)
Sphere (p. 872)
Teapot (p. 875)
Torus (p. 875)
Tube (p. 878)
-- Extended Primitives
Capsule (p. 855)
ChamferBox (p. 856)
ChamferCyl (p. 857)
C_Ext (p. 854)
Gengon (p. 861)
Hedra (p. 863)
L_Ext (p. 865)
OilTank (p. 866)
Prism (p. 868)
RingWave (p. 870)
Spindle (p. 873)
TargetObject (p. 874)
Torus_Knot (p. 877)
-- Compound Objects
OldBoolean (p. 887)
Boolean2 (p. 887)
Conform (p. 889)
Connect (p. 889)
Loft (p. 890)
Morph (p. 891)
Node User-Defined Properties and Methods 851
Example:
$foo - $baz
$sphere01 + $sphere02 + $sphere03 + $sphere04
The Boolean operators change the first operand to be the result of the operation and leave the
second operand untouched. So, in the first example, the $foo node is changed to an Editable Mesh
object containing the result of the difference operation. In the second example, $sphere01 is
successively unioned with each of the other spheres - $sphere01 contains the compound result and
the other spheres are left standing.
Note that unlike the Boolean compound object in 3ds max, this operation destructively modifies the
first operand - you cannot retrieve the original first operand after the Boolean operation is
performed. You can effectively keep the first operand by using a copy function, for example,
result = (copy $foo) - $baz
will put a modified copy of $foo into the variable result, leaving the original $foo
unchanged.
Box : GeometryClass
Constructor:
box ...
Properties:
<Box>.length Float default: 25.0 -- animatable
Sets the length of the box object.
<Box>.width Float default: 25.0 -- animatable
Sets the width of the box object.
<Box>.height Float default: 25.0 -- animatable
Sets the height of the box object.
<Box>.lengthsegs Integer default: 1 -- animatable, alias:
Length_Segments
Sets the number of divisions along the length of the object.
<Box>.widthsegs Integer default: 1 -- animatable, alias: Width_Segments
Sets the number of divisions along the width of the object.
<Box>.heightsegs Integer default: 1 -- animatable, alias:
Height_Segments
Sets the number of divisions along the height of the object.
<Box>.mapcoords Boolean default: false
When on, generates coordinates for applying mapped materials to the box.
854 Chapter 11 | 3ds max Objects
See also
GeometryClass Common Properties, Operators, and Methods (p. 852)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
C_Ext : GeometryClass
Constructor:
c_ext ...
See also
GeometryClass Common Properties, Operators, and Methods (p. 852)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Capsule : GeometryClass
Constructor:
capsule ...
Properties:
<Capsule>.radius Float default: 15.0 -- animatable
The radius of the capsule.
<Capsule>.height Float default: 25.0 -- animatable
The height of the capsule.
<Capsule>.heighttype Integer default: 1
Set what .height specifies:
Overall
Centers (not including domed caps)
<Capsule>.sides Integer default: 24 -- animatable
Sets the number of sides around the capsule. Higher numbers shade and render as true
circles with Smooth on. Lower numbers create regular polygonal objects with Smooth off.
<Capsule>.heightsegs Integer default: 1 -- animatable; alias:
height_segments
The number of divisions along the capsule’s major axis.
<Capsule>.smooth Boolean default: true -- animatable
When on, blends the faces of the capsule, creating a smooth appearance in rendered views.
<Capsule>.smooth_on Integer default: 1 -- animatable
Smooth_on is an integer alias of smooth:
OFF
ON
<Capsule>.sliceon Boolean default: false -- animatable
Turns on/off the Slice function.
<Capsule>.slice_on Integer default: 0 -- animatable
Slice_on is an integer alias of sliceon:
OFF
ON
856 Chapter 11 | 3ds max Objects
See also
GeometryClass Common Properties, Operators, and Methods (p. 852)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
ChamferBox : GeometryClass
Constructor:
chamferBox ...
Properties:
<ChamferBox>.length Float default: 0.1 -- animatable
The length of the object.
<ChamferBox>.width Float default: 0.1 -- animatable
The width of the object.
<ChamferBox>.height Float default: 0.1 -- animatable
The height of the object.
<ChamferBox>.Fillet Float default: 0.01 -- animatable
Slices off the edges of the chamferbox. The higher the number, the more filleted the
chamferbox becomes.
<ChamferBox>.Length_Segments Integer default: 1 -- animatable
The number of divisions along the length of the object.
<ChamferBox>.Width_Segments Integer default: 1 -- animatable
The number of divisions along the width of the object.
<ChamferBox>.Height_Segments Integer default: 1 -- animatable
The number of divisions along the height of the object.
<ChamferBox>.Fillet_Segments Integer default: 3 -- animatable
The number of segments in the filleted edges of the box. Adding fillet segments increases
the edge roundness.
ChamferCyl : GeometryClass 857
Note:
The Generate Mapping Coordinates and Smooth properties are not accessible to MAXScript in
3ds max 4.
See also
GeometryClass Common Properties, Operators, and Methods (p. 852)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
ChamferCyl : GeometryClass
Constructor:
chamferCyl ...
Properties:
<ChamferCyl>.radius Float default: 0.0 -- animatable
The radius of the chamfered cylinder.
<ChamferCyl>.height Float default: 0.0 -- animatable
The dimension along the central axis. Negative values create the chamfered cylinder below
the construction plane.
<ChamferCyl>.Fillet Float default: 0.0 -- animatable
Slices off the edges of the chamfered cylinder. The higher the number, the more filleted
the cylinder becomes.
<ChamferCyl>.Height_Segments Integer default: 1 -- animatable
The number of divisions along the corresponding axis.
<ChamferCyl>.Fillet_Segments Integer default: 1 -- animatable
The number of segments in the filleted edges of the box. Adding fillet segments curves the
edges, producing a chamfered cylinder.
<ChamferCyl>.sides Integer default: 12 -- animatable
The number of sides around the chamfered cylinder. Higher numbers shade and render as
true circles with Smooth on. Lower numbers create regular polygonal objects with
Smooth off.
<ChamferCyl>.Cap_Segments Integer default: 1 -- animatable
The number of concentric divisions along the center of the chamfered cylinder’s top and
bottom
<ChamferCyl>.Smooth Boolean default: true -- animatable
When on, blends the faces of the chamfered cylinder, creating a smooth appearance in
rendered views.
858 Chapter 11 | 3ds max Objects
See also
GeometryClass Common Properties, Operators, and Methods (p. 852)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Cone : GeometryClass
Constructor:
cone ...
Properties:
<Cone>.radius1 Float default: 15.0 -- animatable, alias: Radius_1
The first radius of the cone.
<Cone>.radius2 Float default: 0.0 -- animatable, alias: Radius_2
The second radius of the cone.
<Cone>.height Float default: 25.0 -- animatable
Height along the central axis. Negative values create the cone below the construction
plane.
<Cone>.heightsegs Integer default: 5 -- animatable, alias:
Height_Segments
The number of divisions along the cone’s major axis.
Cylinder : GeometryClass 859
See also
GeometryClass Common Properties, Operators, and Methods (p. 852)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Cylinder : GeometryClass
Constructor:
cylinder ...
Properties:
<Cylinder>.radius Float default: 15.0 -- animatable
The radius of the cylinder.
<Cylinder>.height Float default: 25.0 -- animatable
Height along the central axis. Negative values create the cylinder below the construction
plane.
<Cylinder>.heightsegs Integer default: 1 -- animatable, alias:
Height_Segments
The number of divisions along the cylinder’s major axis.
860 Chapter 11 | 3ds max Objects
See also
GeometryClass Common Properties, Operators, and Methods (p. 852)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Gengon : GeometryClass 861
Gengon : GeometryClass
Generic polygon.
Constructor:
gengon ...
Properties:
<Gengon>.sides Integer default: 5 -- animatable
The number of sides around the gengon. Higher numbers shade and render as true circles
with Smooth on. Lower numbers create regular polygonal objects with Smooth off.
<Gengon>.radius Float default: 0.0 -- animatable
The radius of the gengon.
<Gengon>.Fillet Float default: 0.0 -- animatable
The width of the fillet area.
<Gengon>.height Float default: 0.0 -- animatable
Height along the central axis. Negative values create the gengon below the construction
plane.
<Gengon>.Side_Segments Integer default: 1 -- animatable
The number of divisions around the gengon.
<Gengon>.Height_Segments Integer default: 1 -- animatable
The number of divisions along the gengon’s major axis.
<Gengon>.Fillet_Segments Integer default: 1 -- animatable
The number of divisions for the edge filleting. The higher this setting, the rounder the
fillet appears.
Note:
The Generate Mapping Coordinates and Smooth properties are not accessible to MAXScript in
3ds max R4.
See also
GeometryClass Common Properties, Operators, and Methods (p. 852)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
862 Chapter 11 | 3ds max Objects
Geosphere : GeometryClass
Constructor:
geosphere ...
Properties:
<GeoSphere>.creationMethod Integer default: 1 -- alias: Creation_Method
Sets the creation method:
Diameter (Draws a geosphere from edge to edge.)
Center (Draws a geosphere from the center out.)
<GeoSphere>.typeInPos Point3 default: [0,0,0]
The point3 position of the geosphere.
<GeoSphere>.typeInRadius Float default: 25.0
The radius of the geosphere.
<GeoSphere>.radius Float default: 25.0 -- animatable
The radius of the geosphere.
<GeoSphere>.segs Integer default: 4 -- animatable, alias:
segments
The total number of faces in the geosphere. The number of faces in a geosphere is equal to
the sides of the base polyhedron times the segments squared.
Lower segment values work best. Using the maximum segment value of 200 can generate
up to 800,000 faces, impairing performance.
<GeoSphere>.baseType Integer default: 2 -- alias: Base_Type
Sets the type of basic geometry for the geosphere:
Tetra (Based on a four-sided tetrahedron. The triangular facets can vary in shape and size.
The sphere can be divided into four equal segments.)
Octa (Based on an eight-sided octahedron. The triangular facets can vary in shape and size.
The sphere can be divided into eight equal segments.)
Icosa (Based on a 20-sided icosahedron. The facets are all equally sized equilateral
triangles. The sphere can be divided into any number of equal segments, based on
multiples and divisions of 20 faces.)
<GeoSphere>.smooth Boolean default: true -- animatable
When on, applies smoothing groups to the surface of the sphere.
<GeoSphere>.hemisphere Boolean default: false -- animatable
When on, creates a half-sphere.
<GeoSphere>.baseToPivot Boolean default: false -- alias: Base_to_Pivot
Sets the pivot point location. When on, the pivot is at the bottom of the sphere. When off,
the pivot is at the center of the sphere. This option has no effect when Hemisphere is on.
<GeoSphere>.mapCoords Boolean default: false -- alias:
Generate_mapping_coords
When on, applies default mapping coordinates to the geosphere.
Hedra : GeometryClass 863
See also
GeometryClass Common Properties, Operators, and Methods (p. 852)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Hedra : GeometryClass
Constructor:
hedra ...
Properties:
<Hedra>.family Integer default: 0
Sets the type of polyhedron to create:
Tetra (Creates a tetrahedron)
Cube/Octa (Creates a cubic or octahedral polyhedron, depending on parameter settings.)
Dodec/Icos (Creates a dodecahedron or icosahedron, depending on parameter settings.)
Star1 (Creates a star-like polyhedra.)
Star2 (Creates a different star-like polyhedra.)
<Hedra>.p Float default: 0.0 -- animatable, alias: Q_Value
<Hedra>.q Float default: 0.0 -- animatable, alias: P_Value
Interrelated parameters that provide a two-way translation between the vertices and facets
of a polyhedron. They share the following:
• Range of possible values is 0.0 through 1.0.
• The combined total of the P and Q values can be equal to or less than 1.0.
• Extremes occur if either P or Q is set to 1.0; the other is automatically set to 0.0.
• Midpoint occurs when both P and Q are 0.
In the simplest terms, P and Q change the geometry back and forth between vertices and
facets. At the extreme settings for P and Q, one parameter represents all vertices, the other
represents all facets. Intermediate settings are transition points, with the midpoint an even
balance between the two parameters.
<Hedra>.scalep Float default: 1.0 -- animatable
Controls the axis of reflection for the p facet of a polyhedron.
<Hedra>.scaleq Float default: 1.0 -- animatable
Controls the axis of reflection for the q facet of a polyhedron.
<Hedra>.scaler Float default: 1.0 -- animatable
Controls the axis of reflection for the r facets of a polyhedron.
<Hedra>.P_Scale Float default: 100.0
Controls the axis of reflection for the p facet of a polyhedron.
864 Chapter 11 | 3ds max Objects
See also
GeometryClass Common Properties, Operators, and Methods (p. 852)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
L_Ext : GeometryClass 865
L_Ext : GeometryClass
Constructor:
l_ext ...
See also
GeometryClass Common Properties, Operators, and Methods (p. 852)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
866 Chapter 11 | 3ds max Objects
OilTank : GeometryClass
Constructor:
oilTank ...
Properties:
<OilTank>.radius Float default: 0.0 -- animatable
The radius of the oiltank.
<OilTank>.height Float default: 0.0 -- animatable
The height along the central axis. Negative values create the oiltank below the
construction plane.
<OilTank>.Cap_Height Float default: 0.0 -- animatable
Sets the height of the convex caps. The minimum value is 2.5% of the Radius setting. The
maximum value is the Radius setting, unless the absolute value of the Height setting is less
than the double Radius setting, in which case cap height cannot exceed half of the
absolute value of the Height setting.
<OilTank>.blend Float default: 0.0 -- animatable
When greater than 0, creates a bevel at the edge of the caps.
<OilTank>.sides Integer default: 12 -- animatable
Sets the number of sides around the oiltank. To create a smoothly rounded object, use a
higher number of sides and turn Smooth on. To create an oiltank with flat sides, use a
lower number of sides and turn Smooth off.
<OilTank>.Height_Segments Integer default: 1 -- animatable
Sets the number of divisions along the oiltank’s major axis.
<OilTank>.Smooth_On Integer default: 1 -- animatable
Turn on/off smooth:
OFF
ON
<OilTank>.Slice_On Integer default: 0 -- animatable
Turn on/off slice:
OFF
ON
<OilTank>.Slice_From Float default: 0.0 -- animatable, angle
Sets the starting angle (on the local Z-axis) for slicing.
<OilTank>.Slice_To Float default: 0.0 -- animatable, angle
Sets the angle (on the local Z-axis) to slice to.
Note:
The Generate Mapping Coordinates property is not accessible to MAXScript in 3ds max 4.
Plane : GeometryClass 867
See also
GeometryClass Common Properties, Operators, and Methods (p. 852)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Plane : GeometryClass
Constructor:
plane ...
Properties:
<Plane>.typeinCreationMethod Integer default: 0 -- alias: Creation_Method
Set the creation method:
Rectangle (Creates the plane primitive from one corner to the diagonally opposite corner,
interactively setting different values for length and width.)
Square (Creates a square plane where length and width are equal.)
<Plane>.typeinPos Point3 default: [0,0,0]
Position of the plane in the World Space Coordinate system.
<Plane>.typeinLength Float default: 25.0
Length of the plane object.
<Plane>.typeinWidth Float default: 25.0
Width of the plane object.
<Plane>.length Float default: 25.0 -- animatable
Length of the plane object.
<Plane>.width Float default: 25.0 -- animatable
Width of the plane object.
<Plane>.lsegs Integer default: 4 -- animatable, alias:
Length_Segments
Number of divisions along the length of the plane object.
<Plane>.wsegs Integer default: 4 -- animatable, alias:
Width_Segments
Number of divisions along the width of the plane object.
<Plane>.density Float default: 1.0 -- animatable
Specifies the factor by which the number of segments in both length and width are
multiplied at render time.
<Plane>.renderScale Float default: 1.0 -- animatable, alias:
Render_Scale
Specifies the factor by which both length and width are multiplied at render time. Scaling
is performed from the center outward.
868 Chapter 11 | 3ds max Objects
See also
GeometryClass Common Properties, Operators, and Methods (p. 852)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Prism : GeometryClass
Constructor:
prism ...
Properties:
<Prism>.side1Length Float default: 25.0 -- animatable, alias: Side_1_Length
Sets the length of triangle’s first side.
<Prism>.side2Length Float default: 25.0 -- animatable, alias: Side_2_Length
Sets the length of triangle’s second side.
<Prism>.side3Length Float default: 25.0 -- animatable, alias: Side_3_Length
Sets the length of triangle’s third side.
<Prism>.height Float default: 10.0 -- animatable
The height of the prism’s central axis.
<Prism>.side1Segs Integer default: 1 -- animatable, alias: Side_1_Segments
The number of divisions along the first side.
<Prism>.side2Segs Integer default: 1 -- animatable, alias: Side_2_Segments
The number of divisions along the second side.
<Prism>.side3Segs Integer default: 1 -- animatable, alias: Side_3_Segments
The number of divisions along the third side.
<Prism>.heightsegs Integer default: 1 -- animatable, alias: Height_Segments
The number of divisions along the central axis.
<Prism>.mapCoords Boolean default: false
When on, sets up the required coordinates for applying mapped materials to the prism.
Pyramid : GeometryClass 869
See also
GeometryClass Common Properties, Operators, and Methods (p. 852)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Pyramid : GeometryClass
Constructor:
pyramid ...
Properties:
<Pyramid>.width Float default: 25.0 -- animatable
The width of the pyramid.
<Pyramid>.depth Float default: 25.0 -- animatable
The depth of the pyramid.
<Pyramid>.height Float default: 25.0 -- animatable
The height of the pyramid.
<Pyramid>.widthsegs Integer default: 1 -- animatable, alias:
Width_Segments
The number of divisions along the width of the pyramid.
<Pyramid>.depthSegs Integer default: 1 -- animatable, alias:
Depth_Segments
The number of divisions along the depth of the pyramid.
<Pyramid>.heightsegs Integer default: 1 -- animatable, alias:
Height_Segments
The number of divisions along the height of the pyramid.
<Pyramid>.mapCoords Boolean default: false
When on, sets up required coordinates for applying mapped materials to the pyramid.
See also
GeometryClass Common Properties, Operators, and Methods (p. 852)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
870 Chapter 11 | 3ds max Objects
RingWave : GeometryClass
Constructor:
ringwave ...
See also
GeometryClass Common Properties, Operators, and Methods (p. 852)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Sphere : GeometryClass
Constructor:
sphere ...
Properties:
<Sphere>.radius Float default: 25.0 -- animatable
The radius of the sphere.
<Sphere>.segs Integer default: 16 -- animatable, alias: segments
The number of polygonal divisions for the sphere.
<Sphere>.smooth Boolean default: true -- animatable
When on, blends the faces of the sphere, creating a smooth appearance in rendered views.
<Sphere>.hemisphere Float default: 0.0 -- animatable
Increasing values progressively “cut off” the sphere, starting at the base, to create a partial
sphere. Values range from 0.0 to 1.0. The default is 0.0, producing a full sphere. A setting
of 0.5 produces a hemisphere, and 1.0 reduces the sphere to nothing.
<Sphere>.chop Integer default: 0
Sets whether the hemisphere is ‘chopped’ or ‘squashed’:
Chop (Reduces the number of vertices and faces in the sphere by “chopping” them out as
the hemisphere is cut off.)
Squash (Maintains the number of vertices and faces in the original sphere, “squashing” the
geometry into a smaller and smaller volume toward the top of the sphere. Since the
geometry is maintained, you can use different versions of a squashed sphere for morph
objects.)
<Sphere>.slice Boolean default: false
When on, uses the From and To angles to create a partial sphere. The effect is similar to
lathing a semicircular shape fewer than 360 degrees.
<Sphere>.sliceFrom Float default: 0.0 -- animatable, angle, alias:
Slice_From
The start angle (on the local Z-axis) for slicing.
Spindle : GeometryClass 873
See also
GeometryClass Common Properties, Operators, and Methods (p. 852)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Spindle : GeometryClass
Constructor:
spindle ...
Properties:
<Spindle>.radius Float default: 0.0 -- animatable
The radius of the spindle.
<Spindle>.height Float default: 0.0 -- animatable
The height of the spindle, along the central axis. Negative values create the spindle below
the construction plane.
<Spindle>.Cap_Height Float default: 0.0 -- animatable
The height of the conical caps. The minimum value is 0.1; the maximum value is 1/2 the
absolute value of the Height setting.
<Spindle>.blend Float default: 0.0 -- animatable
When greater than 0, creates a bevel at the edge of the caps.
<Spindle>.sides Integer default: 12 -- animatable
The number of sides around the spindle. Higher numbers shade and render as true circles
with Smooth on. Lower numbers create regular polygonal objects with Smooth off.
<Spindle>.Cap_Segments Integer default: 5 -- animatable
The number of concentric divisions along the center of the spindle’s top and bottom.
<Spindle>.Height_Segments Integer default: 1 -- animatable
The number of divisions along the spindle’s major axis.
874 Chapter 11 | 3ds max Objects
See also
GeometryClass Common Properties, Operators, and Methods (p. 852)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
TargetObject : GeometryClass
The generic target for cameras, spotlights, tape measure helpers, etc. In MAXScript, you must
explicitly construct a target for those objects that need one. For example:
c = targetCamera pos:[x,y,z] target:(targetObject pos:[xt, yt, zt])
Constructor:
targetObject ...
Properties:
There are no additional properties for TargetObject.
See also
GeometryClass Common Properties, Operators, and Methods (p. 852)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Teapot : GeometryClass 875
Teapot : GeometryClass
Constructor:
teapot ...
See also
GeometryClass Common Properties, Operators, and Methods (p. 852)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Torus : GeometryClass
Constructor:
torus ..
Properties:
<Torus>.segs Integer default: 24 -- animatable, alias: segments
The number of radial divisions around the torus. By reducing this number, you can create
polygonal rings instead of circular ones.
876 Chapter 11 | 3ds max Objects
See also
GeometryClass Common Properties, Operators, and Methods (p. 852)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Torus_Knot: GeometryClass 877
Torus_Knot: GeometryClass
Constructor:
torus_knot ...
See also
GeometryClass Common Properties, Operators, and Methods (p. 852)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Tube : GeometryClass
Constructor:
tube ...
Properties:
<Tube>.radius1 Float default: 25.0 -- animatable, alias: Radius_1
The first radius for the tube.
<Tube>.radius2 Float default: 20.0 -- animatable, alias: Radius_2
The second radius for the tube.
Note: The larger radius specifies the outside radius of the tube, while the smaller specifies
the inside radius.
<Tube>.height Float default: 50.0 -- animatable
The dimension along the central axis. Negative values create the tube below the
construction plane.
Tube : GeometryClass 879
See also
GeometryClass Common Properties, Operators, and Methods (p. 852)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Damper : GeometryClass
Constructor:
damper ...
Note:
The Reference End Point objects cannot be specified in MAXScript in 3ds max R4.
See also
GeometryClass Common Properties, Operators, and Methods (p. 852)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Spring : GeometryClass
Constructor:
spring ...
Manual Segments (When this option is chosen, length of the spring contains a fixed
number of segments, no matter how many turns in the spring. Thus, as you increase the
number of turns, you must manually increase the number of segments to maintain a
smooth curve.)
<Spring>.Segments_Per_Turn Integer default: 16 -- animatable
The number of segments in each 360-degree turn of the spring.
<Spring>.Segments_Along_Turn Integer default: 16 -- animatable
The total number of manual segments in the spring.
<Spring>.Smooth_Spring Integer default: 0
Set smoothing method for spring:
All (All surfaces are smoothed.)
None (No smoothing is applied.)
Sides (Smoothing runs along the length of the wire, but not around its perimeter.)
Segments (Smoothing runs around the perimeter of the wire, but not along its length.)
<Damper>.Renderable_Spring Integer default: 1
When on, the object appears in the rendering; when off, the object does not appear:
Not renderable
Renderable
<Spring>.Wire Integer default: 0 -- animatable
Set the shape of the wire:
Round
Rectangular
D-Section
<Spring>.Generate_Mapping_Coordinates Integer default: 0
Turn on/off generate texture coordinates
OFF
ON
<Spring>.Round_Wire_Diameter Float default: 0.2 -- animatable
The diameter of the wire.
<Spring>.Round_Wire_Side_Count Integer default: 6 -- animatable
The number of sides that make up the cross section of the round wire.
<Spring>.Rectangular_Wire_Width Float default: 0.2 -- animatable
Determines the width of the rectangular cross section.
<Spring>.Rectangular_Wire_Depth Float default: 0.2 -- animatable
Determines the depth of the rectangular cross section.
<Spring>.Rectangular_Wire_Fillet_Size Float default: 0.0 -- animatable
When combined with .Rectangular_Fillet_Sides, this lets you fillet (round) the
corners of the cross section.
Spring : GeometryClass 885
Extension Only (Provides contractive force when its length is greater than the specified
Free Length.)
Both (Provides both expansive and contractive force, depending on the variation from
Relaxed Hgt.)
<Spring>.Generate_Texture_Coordinates Integer default: 0
Turn on/off generate texture coordinates:
OFF
ON
Note:
The Reference End Point objects cannot be specified in MAXScript in 3ds max R4.
See also
GeometryClass Common Properties, Operators, and Methods (p. 852)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
OldBoolean : GeometryClass
Constructor:
OldBoolean compound objects are not constructable by MAXScript. Boolean objects created in
previous versions of 3ds max use this class when they are loaded, and then the OldBoolean
object is automatically converted to the new Boolean2 class. See the Boolean2 (p. 887) topic for
a constructable boolean object.
Boolean2 : GeometryClass
Constructor:
boolObj.createBooleanObject <operand_A> [ <operand_B> <add_method> <mat_method> ]
Creates a Boolean2 object using node <operand_A> and an optional node <operand_B>.
<add_method> specifies how <operand_B> is to be used as follows:
1 - instance, operand is an instance of the original node
2 - reference, operand is a reference to original node
3 - copy, operand is a copy of original node
4 - move, original node should be deleted
<mat_method> specifies how the materials of the two operands are to be handled as
follows:
1 - combines materials without changing them or the ID’s
2 - matches ID’s to materials, then combines materials
3 - matches materials to ID’s, then combines them
4 - discards original material, uses new node’s instead
5 - discards new node’s material, uses original
Properties:
The following properties are available only after the boolean2 object has been created. The
values shown for the properties are those for a boolean2 object created from two spheres. The
operand transforms are in the local coordinate system of the boolean2 object.
<bool_obj>.Sphere02 SubAnim default: SubAnim:Sphere02
<bool_obj>.Operand_A_Transform SubAnim default: SubAnim:Operand_A_Transform
<bool_obj>.Sphere01 SubAnim default: SubAnim:Sphere01
<bool_obj>.Operand_B_Transform SubAnim default: SubAnim:Operand_B_Transform
Methods:
boolObj.setOperandB <bool_obj> <operand_B> <add_method> <mat_method>
sets operand B. The values for <add_method> and <mat_method> are describe above.
boolObj.getOperandSel <bool_obj> <integer>
boolObj.setOperandSel <bool_obj> <integer> <boolean>
these methods get and set whether operand_A and operand_B are selected in the Operands
list. <integer> = 1 - operand_A, 2 - operand_B
888 Chapter 11 | 3ds max Objects
boolObj.getBoolOp <bool_obj>
boolObj.setBoolOp <bool_obj> <integer>
these methods get and set the boolean Operation Type. Valid values are:
1 - Union
2 - Intersection
3 - Subtraction (A-B)
4 - Subtraction (B-A)
5 - Cut
boolObj.getBoolCutType <bool_obj>
boolObj.setBoolCutType <bool_obj> <integer>
these methods get and set the boolean Cut Type. The value for this property only has an
effect if the Operation Type is Cut. The Cut Types are:
1 - Refine
2 - Split
3 - Remove Inside
4 - Remove Outside
boolObj.getDisplayResult <bool_obj>
boolObj.setDisplayResult <bool_obj> <boolean>
these methods get and set whether Results or Operands are displayed. If true, Result is
displayed. If false, Operands are displayed.
boolObj.getShowHiddenOps <bool_obj>
boolObj.setShowHiddenOps <bool_obj> <boolean>
these methods get and set whether Results + Hidden Operands are displayed. If true,
Results + Hidden Operands are displayed. If false, the Results or Operands as specified
using boolObj.SetDisplayResult() are displayed.
boolObj.getUpdateMode <bool_obj>
boolObj.setUpdateMode <bool_obj> <integer>
these methods get and set the Update mode as follows:
1 - Always
2 - When Rendering
3 - Manually
boolObj.getOptimize <bool_obj>
boolObj.setOptimize <bool_obj> <boolean>
these methods get and set whether vertices are to be welded on the boolean result
See also
GeometryClass Common Properties, Operators, and Methods (p. 852)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Conform : GeometryClass 889
Conform : GeometryClass
Constructor:
Conform compound objects are not constructable by MAXScript in 3ds max 4.
Properties:
<Conform>.Projection_Distance Float default: 1.0 -- animatable
The distance a vertex in the Wrapper object will move from its original location if it does
not intersect the Wrap-To object.
<Conform>.Standoff_Distance Float default: 1.0 -- animatable
The distance maintained between the vertex of the Wrapper object and the surface of the
Wrap-To object
The following properties are available only after the conform object has been created. The values
shown for the properties are those for a conform object created from two spheres. The operand
transforms are in the local coordinate system of the conform object.
<Conform>.S_Sphere02 SubAnim default: SubAnim:S_Sphere02
<Conform>.Operand_A_Transform SubAnim default: SubAnim:Operand_A_Transform
<Conform>.D_Sphere01 SubAnim default: SubAnim:D_Sphere01
<Conform>.Operand_B_Transform SubAnim default: SubAnim:Operand_B_Transform
See also
GeometryClass Common Properties, Operators, and Methods (p. 852)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Connect : GeometryClass
Constructor:
Connect compound objects are not constructable by MAXScript in 3ds max 4.
Properties:
<Connect>.segments Integer default: 0 -- animatable
The number of segments in the connecting bridge.
<Connect>.tension Float default: 0.5 -- animatable
Controls the curvature in the connecting bridge. A value of 0 provides no curvature, while
higher values create curves that attempt to more smoothly match the surface normals on
either end of the connecting bridge.
890 Chapter 11 | 3ds max Objects
The following properties are available only after the connect object has been created. The values
shown for the properties are those for a connect object created from two spheres. Similar
SubAnims would be created if additions operands were used. The operand transforms are in the
local coordinate system of the connect object.
<Connect>.Op_0__Sphere02 SubAnim default: SubAnim:Op_0__Sphere02
<Connect>.Op_0_Transform SubAnim default: SubAnim:Op_0_Transform
<Connect>.Op_1__Sphere01 SubAnim default: SubAnim:Op_1__Sphere01
<Connect>.Op_1_Transform SubAnim default: SubAnim:Op_1_Transform
See also
GeometryClass Common Properties, Operators, and Methods (p. 852)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Loft : GeometryClass
Constructor:
Loft compound objects are not constructable by MAXScript in 3ds max 4.
Properties:
<Loft>.Def_Scale_X SubAnim default: SubAnim:Def_Scale_X
<Loft>.Def_Scale_Y SubAnim default: SubAnim:Def_Scale_Y
<Loft>.Def_Twist SubAnim default: SubAnim:Def_Twist
<Loft>.Def_Teeter_X SubAnim default: SubAnim:Def_Teeter_X
<Loft>.Def_Teeter_Y SubAnim default: SubAnim:Def_Teeter_Y
<Loft>.Def_Bevel SubAnim default: SubAnim:Def_Bevel
<Loft>.Def_Fit_X SubAnim default: SubAnim:Def_Fit_X
<Loft>.Def_Fit_Y SubAnim default: SubAnim:Def_Fit_Y
These SubAnims contain the deformation curves of the loft object. You cannot create or access
points in these curves unless the point is animated. In this case, you can access the animated
point position as a SubAnim of the property.
The following properties are available only after the loft object has been created. The values
shown for the properties are those for a loft object created from an ellipse (the path) and a circle
(the shape).
<loft>.ellipse SubAnim default: SubAnim:Ellipse
<Loft>.circle SubAnim default: SubAnim:Circle
These SubAnims contain the parameters of the path and shape objects, respectively. If multiple
shapes are used in a loft, each of these shape objects will have a corresponding SubAnim.
Morph : GeometryClass 891
See also
GeometryClass Common Properties, Operators, and Methods (p. 852)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Morph : GeometryClass
Constructor:
createMorphObject <source_node>
Modification of Morph objects, including setting the morph keys and adding morph
targets, is performed using methods associated with the Morph controller. See the
MorphController (p. 1302) topic for a description of these methods.
Properties:
The following properties are available only after the morph object has been created. The values
shown for the properties are those for a morph object created from three spheres.
<Morph>.M_Sphere01 SubAnim default: SubAnim:M_Sphere01
<Morph>.M_Sphere02 SubAnim default: SubAnim:M_Sphere02
<Morph>.M_Sphere03 SubAnim default: SubAnim:M_Sphere03
<Morph>.Morph Barycentric_Morph_Controller default:
Controller:Barycentric_Morph_Controller
See also
GeometryClass Common Properties, Operators, and Methods (p. 852)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Scatter : GeometryClass
Constructor:
Scatter compounds are not constructable by MAXScript in 3ds max 4.
Properties:
<Scatter>.Duplicates Integer default: 1 -- animatable
The number of scattered duplicates of the source object.
<Scatter>.Base_Scale Float default: 100.0 -- animatable,
percentage
Alters the scale of the source object, affecting each duplicate identically. This scale occurs
before any other transforms.
892 Chapter 11 | 3ds max Objects
Note:
Many properties associated with Scatter are not accessible to MAXScript in 3ds max 4.
ShapeMerge : GeometryClass 893
See also
GeometryClass Common Properties, Operators, and Methods (p. 852)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
ShapeMerge : GeometryClass
Constructor:
ShapeMerge compound objects are not constructable by MAXScript in 3ds max 4.
Properties:
<ShapeMerge>.Operation_Type Integer default: 1
Set the shapemerge operation type:
Cookie Cutter (Cuts the shape out of the mesh object’s surface.)
Merge (Merges the shape with the surface of the mesh object.)
<ShapeMerge>.Remove_Interior_Exterior Integer default: 0
Reverses the effect of Cookie Cutter or Merge. With the Cookie Cutter option, the effect is
obvious. When Invert is off, the shape is a hole in the mesh object. When Invert is on, the
shape is solid and the mesh is missing. When you’re using Merge, Invert reverses the sub-
object mesh selection.
Invert OFF
Invert ON
<ShapeMerge>.Output_Sub_Mesh_Selection Integer default: 0
Sets which selection level is output:
None (Outputs the full object.)
Vertex (Outputs the vertices defined by the spline of the shape.)
Edge (Outputs the edge of the merged shape.)
Face (Outputs the faces within the merged shape.)
The following properties are available only after the ShapeMerge object has been created. The
values shown for the properties are those for a ShapeMerge object created from a sphere and a
circle. SubAnims similar to the Circle01 SubAnim would be created if additions operands were
used. The operand transforms are in the local coordinate system of the ShapeMerge object.
<ShapeMerge>.mesh__sphere01 SubAnim default: SubAnim:Mesh__Sphere01
<ShapeMerge>.mesh_transform SubAnim default: SubAnim:Mesh_Transform
<ShapeMerge>.shape_1__circle01 SubAnim default: SubAnim:Shape_1__Circle01
<ShapeMerge>.shape_1_transform SubAnim default: SubAnim:Shape_1_Transform
894 Chapter 11 | 3ds max Objects
See also
GeometryClass Common Properties, Operators, and Methods (p. 852)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Terrain : GeometryClass
Constructor:
Terrain()
Properties:
<Terrain>.Form Integer default: 1
Set the terrain form:
Graded Surface (Creates a graded surface of the mesh over the contours.)
Graded Solid (Creates a graded surface with skirts around the sides and a bottom surface.
This represents a solid that is visible from every direction.)
Layered Solid (Creates a “wedding cake” or laminated solid similar to cardboard
architectural models.)
<Terrain>.stitchBorder Boolean default: false
Turn on/off stitch border.
<Terrain>.retriangulate Boolean default: false
Turn on/off retriangulate.
<Terrain>.display Integer default: 0
Select the type of display for the terrain object:
Terrain (Displays only the triangulated mesh over the contour line data.)
Contours (Displays only the contour line data of the terrain object.)
Both (Displays both the triangulated mesh and the contour line data of the terrain object.)
<Terrain>.update Integer default: 0
Set update settings for the terrain object:
Always (Updates the terrain object immediately when you change an operand, including
the original object of an instanced or referenced operand.)
When Rendering (Updates the terrain object when you render the scene or when you force
an update. With this option, viewports won’t show current geometry unless you.)
Manually (Updates the terrain object when you force an update.)
Terrain : GeometryClass 895
Note:
The following properties of terrain compound objects cannot be operated on with MAXScript in
3ds max R4. However, they can be used by MAXScript in 3D Studio VIZ.
<Terrain>.numOps Integer default: 0
The number of contour operands. Read-only.
<Terrain>.horizSimplification Integer default: 0
horizSimplification = 0 – No Simplification; 1 – Use 1/2 of Points; 2 - Use 1/4 of Points; 3 –
Interpolate Points * 2; 4 - Interpolate Points * 4
<Terrain>.vertSimplification Integer default: 0
vertSimplification = 0 - No Simplification; Use 1/2 of Lines; 2 - Use 1/4 of Lines
The following properties are available only after the terrain object has been created. The values
shown for the properties are those for a terrain object created from three circles. The operand
transforms are in the local coordinate system of the terrain object.
<Terrain>.Op_0__Circle01 SubAnim default: SubAnim:Op_0__Circle01
<Terrain>.Op_0_Transform SubAnim default: SubAnim:Op_0_Transform
<Terrain>.Op_1__Circle02 SubAnim default: SubAnim:Op_1__Circle02
<Terrain>.Op_1_Transform SubAnim default: SubAnim:Op_1_Transform
<Terrain>.Op_2__Circle03 SubAnim default: SubAnim:Op_2__Circle03
<Terrain>.Op_2_Transform SubAnim default: SubAnim:Op_2_Transform
Note:
All properties other than Form are not accessible in 3ds max.
Methods:
The following methods are available in 3DS VIZ:
terrainOps.addOperand <terrain> <node>
Appends a node as a contour operand to the terrain. Note this is done in ‘Move’ mode, so
the the supplied node is deleted after the addition. To simulate other modes, use
appropriate MAXScript functions. For example,
terrainOps.addOperand $terrain01 (instance $line03)
See also
GeometryClass Common Properties, Operators, and Methods (p. 852)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Awning : GeometryClass
Constructor:
awning ...
Properties:
<Awning>.height Float default: 0.0 -- animatable
<Awning>.width Float default: 0.0 -- animatable
<Awning>.depth Float default: 0.0 -- animatable
<Awning>.Horizontal_Frame_Width Float default: 2.0 -- animatable
<Awning>.Vertical_Frame_Width Float default: 2.0 -- animatable
<Awning>.Frame_Thickness Float default: 0.5 -- animatable
<Awning>.Glazing_Thickness Float default: 0.25 -- animatable
<Awning>.Rail_Width Float default: 1.0 -- animatable
<Awning>.Number_of_Panels Integer default: 1
<Awning>.Percent_Open Integer default: 0 -- animatable
<Awning>.Generate_Mapping_Coords Boolean default: false
See also
GeometryClass Common Properties, Operators, and Methods (p. 852)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
BiFold : GeometryClass
Constructor:
bifold ...
Properties:
<BiFold>.height Float default: 0.0 -- animatable
<BiFold>.width Float default: 0.0 -- animatable
<BiFold>.depth Float default: 0.0 -- animatable
<BiFold>.Double_Doors Integer default: 0
Double_Doors = 0 - false; 1 - true
<BiFold>.Flip_Swing Boolean default: false
<BiFold>.Flip_Hinge Boolean default: false
<BiFold>.open Float default: 0.0 -- animatable
<BiFold>.Create_Frame Boolean default: true
<BiFold>.Frame_Width Float default: 2.0 -- animatable
<BiFold>.Frame_Depth Float default: 1.0 -- animatable
<BiFold>.Door_Offset Float default: 0.0 -- animatable
<BiFold>.Generate_Mapping_Coords Boolean default: false
<BiFold>.Leaf_Thickness Float default: 2.0 -- animatable
<BiFold>.Stiles_Top_Rail Float default: 4.0 -- animatable
898 Chapter 11 | 3ds max Objects
See also
GeometryClass Common Properties, Operators, and Methods (p. 852)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Casement : GeometryClass
Constructor:
casement ...
Properties:
<Casement>.height Float default: 0.0 -- animatable
<Casement>.width Float default: 0.0 -- animatable
<Casement>.depth Float default: 0.0 -- animatable
<Casement>.Horizontal_Frame_Width Float default: 2.0 -- animatable
<Casement>.Vertical_Frame_Width Float default: 2.0 -- animatable
<Casement>.Frame_Thickness Float default: 0.5 -- animatable
<Casement>.Glazing_Thickness Float default: 0.25 -- animatable
<Casement>.Panel_Width Float default: 1.0 -- animatable
<Casement>.Number_of_Casements Integer default: 1
Number_of_Casements = 1 - One; 2 - Two
<Casement>.Percent_Open Integer default: 0 -- animatable
<Casement>.Opens_to_Inside Boolean default: false
<Casement>.Generate_Mapping_Coords Boolean default: false
Fixed : GeometryClass 899
See also
GeometryClass Common Properties, Operators, and Methods (p. 852)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Fixed : GeometryClass
Constructor:
fixed ...
Properties:
<Fixed>.height Float default: 0.0 -- animatable
<Fixed>.width Float default: 0.0 -- animatable
<Fixed>.depth Float default: 0.0 -- animatable
<Fixed>.Horizontal_Frame_Width Float default: 2.0 -- animatable
<Fixed>.Vertical_Frame_Width Float default: 2.0 -- animatable
<Fixed>.Frame_Thickness Float default: 0.5 -- animatable
<Fixed>.Glazing_Thickness Float default: 0.25 -- animatable
<Fixed>.Rail_Width Float default: 1.0 -- animatable
<Fixed>.Number_of_Panels_Horizontally Integer default: 1
<Fixed>.Number_of_Panels_Vertically Integer default: 1
<Fixed>.Chamfered_Profile Boolean default: false
<Fixed>.Generate_Mapping_Coords Boolean default: false
See also
GeometryClass Common Properties, Operators, and Methods (p. 852)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Pivot : GeometryClass
Constructor:
pivot ...
Properties:
<pivot>.height Float default: 0.0 -- animatable
<pivot>.width Float default: 0.0 -- animatable
<pivot>.depth Float default: 0.0 -- animatable
<pivot>.Double_Doors Integer default: 0
Double_Doors = 0 - false; 1 - true
900 Chapter 11 | 3ds max Objects
See also
GeometryClass Common Properties, Operators, and Methods (p. 852)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Pivoted : GeometryClass
Constructor:
pivoted ...
Properties:
<Pivoted>.height Float default: 0.0 -- animatable
<Pivoted>.width Float default: 0.0 -- animatable
<Pivoted>.depth Float default: 0.0 -- animatable
<Pivoted>.Horizontal_Frame_Width Float default: 2.0 -- animatable
<Pivoted>.Vertical_Frame_Width Float default: 2.0 -- animatable
<Pivoted>.Frame_Thickness Float default: 0.5 -- animatable
<Pivoted>.Glazing_Thickness Float default: 0.25 -- animatable
<Pivoted>.Rail_Width Float default: 1.0 -- animatable
<Pivoted>.Vertical_Rotation Boolean default: false
<Pivoted>.Percent_Open Integer default: 0 -- animatable
<Pivoted>.Generate_Mapping_Coords Boolean default: false
Projected : GeometryClass 901
See also
GeometryClass Common Properties, Operators, and Methods (p. 852)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Projected : GeometryClass
Constructor:
projected ...
Properties:
<projected>.height Float default: 0.0 -- animatable
<projected>.width Float default: 0.0 -- animatable
<projected>.depth Float default: 0.0 -- animatable
<projected>.Horizontal_Frame_Width Float default: 2.0 -- animatable
<projected>.Vertical_Frame_Width Float default: 2.0 -- animatable
<projected>.Frame_Thickness Float default: 0.5 -- animatable
<projected>.Glazing_Thickness Float default: 0.25 -- animatable
<projected>.Rail_Width Float default: 1.0 -- animatable
<projected>.Middle_Height Float default: 0.0 -- animatable
<projected>.Bottom_Height Float default: 0.0 -- animatable
<projected>.Percent_Open Integer default: 0 -- animatable
<projected>.Generate_Mapping_Coords Boolean default: false
See also
GeometryClass Common Properties, Operators, and Methods (p. 852)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
SlidingDoor : GeometryClass
Constructor:
slidingDoor ...
Properties:
<SlidingDoor>.height Float default: 0.0 -- animatable
<SlidingDoor>.width Float default: 0.0 -- animatable
<SlidingDoor>.depth Float default: 0.0 -- animatable
<SlidingDoor>.Flip_Swing Boolean default: false
<SlidingDoor>.Flip_Hinge Boolean default: false
<SlidingDoor>.open Float default: 0.0 -- animatable
<SlidingDoor>.Create_Frame Boolean default: true
902 Chapter 11 | 3ds max Objects
Note:
The Double_Doors property is not used by SlidingDoor.
See also
GeometryClass Common Properties, Operators, and Methods (p. 852)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
SlidingWindow : GeometryClass
Constructor:
slidingWindow ...
Properties:
<SlidingWindow>.height Float default: 0.0 --
animatable
<SlidingWindow>.width Float default: 0.0 --
animatable
<SlidingWindow>.depth Float default: 0.0 --
animatable
<SlidingWindow>.Horizontal_Frame_Width Float default: 2.0 --
animatable
<SlidingWindow>.Vertical_Frame_Width Float default: 2.0 --
animatable
QuadPatch : GeometryClass 903
See also
GeometryClass Common Properties, Operators, and Methods (p. 852)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
QuadPatch : GeometryClass
Constructor:
quadpatch ...
Properties:
<QuadPatch>.length Float default: 25.0 -- animatable
The patch length.
<QuadPatch>.width Float default: 25.0 -- animatable
The patch width.
<QuadPatch>.lengthsegs Integer default: 1 -- animatable, alias:
Length_Segments
The number of facets along the length of the grid.
<QuadPatch>.mapCoords Boolean default: false
When on, applies mapping coordinates to the grid.
<QuadPatch>.widthsegs Integer default: 1 -- animatable, alias:
Width_Segments
The number of facets along the width of the grid.
904 Chapter 11 | 3ds max Objects
See also
GeometryClass Common Properties, Operators, and Methods (p. 852)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
TriPatch : GeometryClass
Constructor:
TriPatch ...
Properties:
<TriPatch>.length Float default: 25.0 -- animatable
The length of the patch.
<TriPatch>.width Float default: 25.0 -- animatable
The width of the patch.
<TriPatch>.mapCoords Boolean default: false
When on, applies mapping coordinates to the grid.
See also
GeometryClass Common Properties, Operators, and Methods (p. 852)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Blizzard : GeometryClass
Constructor:
blizzard ...
See also
Particle System Common Properties, Operators, and Methods (p. 905)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
PArray : GeometryClass 913
PArray : GeometryClass
Constructor:
parray ...
Mesh (Displays the particles as mesh objects. This results in slower viewport redraws.)
Bbox (For instanced geometry only, this displays each instanced particle, whether a single
object, a hierarchy, or a group, as a bounding box.)
<PArray>.viewPercent Float default: 10.0 --
percentage, alias: Percentage_Displayed
The percentage of particles displayed in the viewport.
-- Particle Generation
<PArray>.quantityMethod Integer default: 0
Set the method by which the number of particles is determined over time:
Use Rate (Specifies a fixed number of particles emitted per frame.)
Use Total (Specifies a total number of particles formed over the life of the system.)
Tip: Generally, Use Rate is best for a continuous flow of particles, like a trail of pixie dust,
while Use Total is better for bursts of particles over a short period of time.
<PArray>.Birth_Rate Integer default: 10 --
animatable
The number of particles emitted per frame.
<PArray>.Total_Number Integer default: 100
The total number of particles to be emitted.
<PArray>.speed Float default: 10.0 --
animatable
The velocity of the particle at birth, along the normal, in units traveled per frame.
<PArray>.Speed_Variation Float default: 0.0 --
animatable, percentage
Percentage of variation to the speed of emission for each particle.
<PArray>.Divergence_Angle Float default: 10.0 --
animatable, angle
Applies an angular degree of variation by which each particle’s velocity can vary from the
emitter normal.
<PArray>.Emitter_Start Time default: 0f
The frame at which particles begin to exist in the scene.
<PArray>.Emitter_Stop Time default: 30f
The last frame at which particles are emitted.
<PArray>.Display_Until Time default: 100f
Time at which all particles will disappear, regardless of other settings.
<PArray>.life Time default: 30f --
animatable
The lifespan of each particle from the time of creation.
<PArray>.Life_Variation Time default: 0f --
animatable
The number of frames by which the life of each particle can vary from the norm.
PArray : GeometryClass 915
Spawn on Collision (Spawn effects take place upon collision with a bound deflector.)
Spawn on Death (Spawn effects take place at the end of each particle’s life.)
Spawn Trails (Particles are spawned from existing particles at each frame of that
particle’s life.)
<PArray>.Die__X_frames_after_collision Time default: 0f --
animatable
The life, in frames, that the particle will persist after the collision. Setting this to 0 (the
default) causes particles to vanish immediately after the collision.
<PArray>.Die__X_frames_after_collision_variation Float default: 0.0 --
animatable, percentage
Varies the Persist value of each particle, when Persist is greater than 0. This lets you
“feather” the dying off of the particle density.
<PArray>.Spawn_Generations Integer default: 1
The number of spawns beyond the original particle generation. For example, if this is set
to 1, and you’re spawning at death, one spawning will occur beyond the original lifespan
of each particle.
<PArray>.Spawn_Affects Integer default: 100
The percentage of particles that will spawn. Reducing this reduces the number of particles
that produce spawned particles.
<PArray>.Spawn_Multiplier Integer default: 1
Multiplies the number of particles spawned at each spawning event.
<PArray>.Spawn_Multiplier_Variation Float default: 0.0 --
percentage
Percentage range by which the Multiplier value will vary, frame by frame.
<PArray>.Spawn_Direction_Chaos Float default: 0.0 --
animatable, percentage
The amount by which the direction of the spawned particle can vary from the direction of
the parent particle. A setting of 0 means no variance. A setting of 100 causes the spawned
particle to travel in any random direction. A setting of 50 causes the spawned particle to
deviate from its parent’s path by up to 90 degrees.
<PArray>.Spawn_Speed_Chaos Float default: 0.0 --
animatable
Random percentage range of scaling of the spawned particles relative to their parents, and
dependent on the options below.
<PArray>.spawnSpeedType Integer default: 0
Sets the type of speed applied to spawn particles:
Slow (Applies the .spawn_Speed_Chaos value randomly to slow the speed of the
spawned particles.)
Fast (Randomly speeds up particles based on the .spawn_Speed_Chaos value.)
Both (Some particles speed up, while others slow down, based on the
.spawn_Speed_Chaos value.)
922 Chapter 11 | 3ds max Objects
See also
Particle System Common Properties, Operators, and Methods (p. 905)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
PCloud : GeometryClass 923
PCloud : GeometryClass
Constructor:
pcloud ...
-- Particle Generation
<PCloud>.quantityMethod Integer default: 0
Set the method by which the number of particles is determined over time:
Use Rate (Specifies a fixed number of particles emitted per frame.)
Use Total (Specifies a total number of particles formed over the life of the system.)
Tip: Generally, Use Rate is best for a continuous flow of particles, like a trail of pixie dust,
while Use Total is better for bursts of particles over a short period of time.
<PCloud>.Birth_Rate Integer default: 10 --
animatable
The number of particles emitted per frame.
<PCloud>.Total_Number Integer default: 100
The total number of particles to be emitted.
<PCloud>.speed Float default: 0.0 --
animatable
The velocity of the particle at birth, along the normal, in units traveled per frame.
<PCloud>.Speed_Variation Float default: 0.0 --
animatable, percentage
Percentage of variation to the speed of emission for each particle.
<PCloud>.motionType Integer default: 0
Set the particle’s motionType
Random Direction (This option emits particles in random directions.)
Enter Vector (The direction of the particles is determined by a vector defined by the three
X, Y, and Z vectors.)
Reference Object (Emits particles in the direction of the local Z axis of a specified object.)
<PCloud>.Direction_Vector_X Float default: 1.0 --
animatable
The particle direction vectors for the X-axis.
<PCloud>.Direction_Vector_Y Float default: 0.0 --
animatable
The particle direction vectors for the Y-axis.
<PCloud>.Direction_Vector_Z Float default: 0.0 --
animatable
The particle direction vectors for the Z-axis.
<PCloud>.motionReferenceObject Node default: undefined
The object used as the reference object.
<PCloud>.directionVariation Float default: 0.0 --
animatable, percentage, alias: Speed_Direction_Variation
Percentage of variation to the direction when you choose either the Direction Vector or
Reference Object option.
<PCloud>.Emitter_Start Time default: 0f
The frame at which particles begin to exist in the scene.
PCloud : GeometryClass 925
Special (Each particle consists of three intersecting 2D squares. These are effective when
you use a face-map material, optionally along with an opacity map, to create the effect of a
three-dimensional particle.)
Facing (Renders each particle as a square that always faces the view. Use with an
appropriate opacity map for bubbles or snowflakes.)
Constant (Provides a particle that remains the same size, in pixels, specified by the size
value. This size never changes, regardless of its distance from the camera. Note that this
particle type can only be displayed in the viewports as a dot or a tick. If you turn on this
option while Mesh is selected, the viewport display is automatically switched to Ticks.)
Tetra (Renders each particle as a mapped tetrahedron, whose tail points toward the normal
vector of the emission, and whose head points away. Use Tetra particles for raindrops or
sparks.)
SixPoint (Renders each particle as a six-pointed, two-dimensional star.)
Sphere (Renders each particle as a sphere.)
<PCloud>.Metaparticle_Tension Float default: 1.0 --
animatable
Determines the tightness of the particles, with regard to their tendency to blend with
other particles. The higher the Tension, the harder the blobs, and the harder it is for them
to merge.
<PCloud>.Metaparticle_Tension_Variation Float default: 0.0 --
animatable, percentage
The percent of variation of the Tension effect.
<PCloud>.metaballRenderCoarsness Float default: 0.5 --
alias: Metaparticle_Coarseness
The coarseness for metaparticles in the rendered scene.
<PCloud>.metaballViewCoarsness Float default: 1.0
The coarseness for the viewport display.
<PCloud>.metaballAutoCoarsness Boolean default: true
When this is on, the rendering coarseness is automatically set, based on the size of the
particles, and the viewport coarseness is set to about twice that of the rendering
coarseness.
<PCloud>.instancingObject Node default: undefined
The object which is instanced.
<PCloud>.instanceSubTree Boolean default: false
Turn this on when you want to include the linked children of the picked object in the
particle. If the picked object is a group, all children of the group are included.
<PCloud>.instanceKeyOffsetType Integer default: 0
Set the animation offset keying:
None (Each particle duplicates the timing of the original object. As a result, the animation
of all particles will be identically timed.)
PCloud : GeometryClass 927
Birth (The firstborn particle is an instance of the current animation of the source object at
the moment of that particle’s birth. Each subsequent particle then use the same start time
for the animation.)
Random (This option is the same as None when Frame Offset is set to 0. Otherwise, each
particle is born using the same animation as the source object at the time of birth, but
with a random offset of frames, based on the .instanceFrameOffset value.)
<PCloud>.instanceFrameOffset Integer default: 0 --
alias: Animation_Offset_Amount
The property value is the UI value times the number of ticks per frame. The number of
ticks per frame is accessible via the ticksPerFrame system global variable.
<PCloud>.mappingType Integer default: 0
Specifies how a mapped material affects the particles:
Time (Maps particles over time.)
Distance (Maps particles over a distance.)
<PCloud>.Mapping_Time_Base Time default: 30f --
animatable
The number of frames from the birth of the particle that it takes to complete one mapping
of the particle.
<PCloud>.Mapping_Distance_Base Float default: 100.0 --
animatable
The distance, in units, from the birth of the particle that it takes to complete one mapping
of the particle.
<PCloud>.materialSource Integer default: 0
Updates the material carried by the particle system, using the source specified:
Icon (The particles use the material currently assigned to the particle system icon.)
Instanced Geometry (The particles use the material assigned to the instanced geometry.)
-- Rotation and Collision
<PCloud>.Spin_Time Time default: 0f --
animatable
The number of frames for one rotation of a particle. If set to 0, no rotation takes place.
<PCloud>.Spin_Time_Variation Float default: 0.0 --
animatable, percentage
The percent of variation of the Spin Time.
<PCloud>.Spin_Phase Float default: 0.0 --
animatable, angle
The initial particle rotation, in degrees.
<PCloud>.Spin_Phase_Variation Float default: 0.0 --
animatable, percentage
The percent of variation of the Phase.
<PCloud>.spinAxisType Integer default: 0
The spin axis for the particles:
928 Chapter 11 | 3ds max Objects
Spawn on Collision (Spawn effects take place upon collision with a bound deflector.)
Spawn on Death (Spawn effects take place at the end of each particle’s life.)
Spawn Trails (Particles are spawned from existing particles at each frame of that
particle’s life.)
<PCloud>.Die__X_frames_after_collision Time default: 0f --
animatable
The life, in frames, that the particle will persist after the collision. Setting this to 0 (the
default) causes particles to vanish immediately after the collision.
<PCloud>.Die__X_frames_after_collision_variation Float default: 0.0 --
animatable, percentage
Varies the Persist value of each particle, when Persist is greater than 0. This lets you
“feather” the dying off of the particle density.
<PCloud>.Spawn_Generations Integer default: 1
The number of spawns beyond the original particle generation. For example, if this is set
to 1, and you’re spawning at death, one spawning will occur beyond the original lifespan
of each particle.
<PCloud>.Spawn_Multiplier Integer default: 1
Multiplies the number of particles spawned at each spawning event.
<PCloud>.Spawn_Direction_Chaos Float default: 0.0 --
animatable, percentage
The amount by which the direction of the spawned particle can vary from the direction of
the parent particle. A setting of 0 means no variance. A setting of 100 causes the spawned
particle to travel in any random direction. A setting of 50 causes the spawned particle to
deviate from its parent’s path by up to 90 degrees.
<PCloud>.Spawn_Speed_Chaos Float default: 0.0 --
animatable
Random percentage range of scaling of the spawned particles relative to their parents, and
dependent on the options below.
<PCloud>.spawnSpeedType Integer default: 0
Sets the type of speed applied to spawn particles:
Slow (Applies the .spawn_Speed_Chaos value randomly to slow the speed of the
spawned particles.)
Fast (Randomly speeds up particles based on the .spawn_Speed_Chaos value.)
Both (Some particles speed up, while others slow down, based on the
.spawn_Speed_Chaos value.)
<PCloud>.spawnInheritVelocity Boolean default: false
When on, spawned particles inherit the speed of their parents, in addition to the effect of
the .spawn_Speed_Chaos value.
<PCloud>.spawnSpeedFixed Boolean default: false
When on, uses the .spawn_Speed_Chaos value as a set value, rather than as a range
applied randomly to each particle.
Snow : GeometryClass 931
See also
Particle System Common Properties, Operators, and Methods (p. 905)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Snow : GeometryClass
Constructor:
snow ...
Note: This class is not available in 3D Studio VIZ.
Properties:
<Snow>.viewportcount Integer default: 100
Maximum number of particles displayed in viewports at any given frame.
<Snow>.rendercount Integer default: 100
Maximum number of particles that can appear in a single frame when you render it.
<Snow>.flakesize Float default: 2.0 -- animatable, alias: Flake_Size
Size of a particle in the active units.
932 Chapter 11 | 3ds max Objects
See also
Particle System Common Properties, Operators, and Methods (p. 905)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Spray : GeometryClass
Constructor:
spray …
Note: This class is not available in 3D Studio VIZ.
Properties:
<Spray>.viewportcount Integer default: 100
Maximum number of particles displayed in viewports at any given frame.
<Spray>.rendercount Integer default: 100
Maximum number of particles that can appear in a single frame when you render it.
<Spray>.dropsize Float default: 2.0 -- animatable, alias: Drop_Size
Size of a particle in the active units.
<Spray>.speed Float default: 10.0 -- animatable
Initial velocity of each particle as it leaves the emitter. Particles travel at this speed unless
they are affected by a particle system space warp.
<Spray>.variation Float default: 2.0 -- animatable
Varies the initial speed and direction of particles. The greater the Variation, the broader the
area of snowfall.
<Spray>.display Integer default: 0
Set how particles are displayed in viewports:
Drops (streaks)
Dots
Ticks
934 Chapter 11 | 3ds max Objects
See also
Particle System Common Properties, Operators, and Methods (p. 905)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
SuperSpray : GeometryClass 935
SuperSpray : GeometryClass
Constructor:
superSpray ...
-- Particle Generation
<SuperSpray>.quantityMethod Integer default: 0
Set the method by which the number of particles is determined over time:
Use Rate (Specifies a fixed number of particles emitted per frame.)
Use Total (Specifies a total number of particles formed over the life of the system.)
Tip: Generally, Use Rate is best for a continuous flow of particles, like a trail of pixie dust,
while Use Total is better for bursts of particles over a short period of time.
<SuperSpray>.Birth_Rate Integer default: 10 --
animatable
The number of particles emitted per frame.
<SuperSpray>.Total_Number Integer default: 100
The total number of particles to be emitted.
<SuperSpray>.speed Float default: 10.0 --
animatable
The velocity of the particle at birth, along the normal, in units traveled per frame.
<SuperSpray>.Speed_Variation Float default: 0.0 --
animatable, percentage
Percentage of variation to the speed of emission for each particle.
<SuperSpray>.Emitter_Start Time default: 0f
The frame at which particles begin to exist in the scene.
<SuperSpray>.Emitter_Stop Time default: 30f
The last frame at which particles are emitted.
<SuperSpray>.Display_Until Time default: 100f
Time at which all particles will disappear, regardless of other settings.
<SuperSpray>.life Time default: 30f --
animatable
The lifespan of each particle from the time of creation.
<SuperSpray>.Life_Variation Time default: 0f --
animatable
The number of frames by which the life of each particle can vary from the norm.
<SuperSpray>.subsampleCreationTime Boolean default: false
When on, enables the addition of a time offset to the equations of motion that prevents
puffing in time.
<SuperSpray>.subsampleEmitterTranslation Boolean default: true
If the object-based emitter is moving in space, particles are created at integral times at
positions along the geometry’s path between renderable positions. This prevents puffing
in space.
<SuperSpray>.subsampleEmitterRotation Boolean default: true
If the emitter is rotating, turn this on to avoid puffing and produce smooth spiral effects.
<SuperSpray>.size Float default: 1.0 --
animatable
The target size for all particles in the system.
SuperSpray : GeometryClass 937
Tetra (Renders each particle as a mapped tetrahedron, whose tail points toward the normal
vector of the emission, and whose head points away. Use Tetra particles for raindrops or
sparks.)
SixPoint (Renders each particle as a six-pointed, two-dimensional star.)
Sphere (Renders each particle as a sphere.)
<SuperSpray>.Metaparticle_Tension Float default: 1.0 --
animatable
Determines the tightness of the particles, with regard to their tendency to blend with
other particles. The higher the Tension, the harder the blobs, and the harder it is for them
to merge.
<SuperSpray>.Metaparticle_Tension_Variation Float default: 0.0 --
animatable, percentage
The percent of variation of the Tension effect.
<SuperSpray>.metaballRenderCoarsness Float default: 0.5 --
alias: Metaparticle_Coarseness
The coarseness for metaparticles in the rendered scene.
<SuperSpray>.metaballViewCoarsness Float default: 1.0
The coarseness for the viewport display.
<SuperSpray>.metaballAutoCoarsness Boolean default: true
When this is on, the rendering coarseness is automatically set, based on the size of the
particles, and the viewport coarseness is set to about twice that of the rendering
coarseness.
<SuperSpray>.instancingObject Node default: undefined
The object which is instanced.
<SuperSpray>.instanceSubTree Boolean default: false
Turn this on when you want to include the linked children of the picked object in the
particle. If the picked object is a group, all children of the group are included.
<SuperSpray>.instanceKeyOffsetType Integer default: 0
Set the animation offset keying:
None (Each particle duplicates the timing of the original object. As a result, the animation
of all particles will be identically timed.)
Birth (The firstborn particle is an instance of the current animation of the source object at
the moment of that particle’s birth. Each subsequent particle then use the same start time
for the animation.)
Random (This option is the same as None when Frame Offset is set to 0. Otherwise, each
particle is born using the same animation as the source object at the time of birth, but
with a random offset of frames, based on the .instanceFrameOffset value.)
<SuperSpray>.instanceFrameOffset Integer default: 0 --
alias: Animation_Offset_Amount
The property value is the UI value times the number of ticks per frame. The number of
ticks per frame is accessible via the ticksPerFrame system global variable.
SuperSpray : GeometryClass 939
See also
Particle System Common Properties, Operators, and Methods (p. 905)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
NURBSSurf : GeometryClass
NURBSSurfs are NURBS surface objects defined by CVs (control vertices). All NURBS objects are
created through the special NURBS descriptor classes (see Working with NURBS (p. 1384)) and the
NURBSSurf class is used typically in object class testing with the classOf() function. Scene objects
created as NURBSSurf objects in the 3ds max user interface have the class NURBSSurf.
Constructor:
NURBSNode <nurbs_set> ...
See Creating New NURBS Objects (p. 1389) for details.
Properties:
Properties for NURBSSurf objects are accessed through a NURBSSet descriptor object. See
Working with NURBS (p. 1384) for more details.
See also
NURBS Node Properties and Methods (p. 1397)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Point_Surf : GeometryClass
Point_Surfs are NURBS surface objects defined by interpolated points. All NURBS objects are created
through the special NURBS descriptor classes (see Working with NURBS (p. 1384)) and the Point_Surf
class is used typically in object class testing with the classOf() function. Scene objects created as
Point Surface objects in the 3ds max user interface have the class Point_Surf.
Constructor:
NURBSNode <nurbs_set> ...
See Creating New NURBS Objects (p. 1389) for details.
944 Chapter 11 | 3ds max Objects
Properties:
<Point_Surf>.thickness Float default: 1.0 -- animatable
Rendered thickness of the surface.
<Point_Surf>.sides Integer default: 12 -- animatable
Rendered sides of the surface.
<Point_Surf>.angle Float default: 0.0 -- animatable
The rotational position of the cross-section in the renderer.
Other properties for Point Surfaces are accessed through a NURBSSet descriptor object. See
Working with NURBS (p. 1384) for more details.
See also
NURBS Node Properties and Methods (p. 1397)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Shape : Node
The following list shows the 3ds max shape class objects:
--Splines
Arc (p. 949)
Circle (p. 950)
Donut (p. 951)
Ellipse (p. 953)
Helix (p. 954)
Line (p. 955)
NGon (p. 957)
Rectangle (p. 958)
Section (p. 959)
Star (p. 960)
Text (p. 962)
--NURBS Curves
CV_Curve (p. 964)
Point_Curve (p. 965)
Shape Common Properties, Operators, and Methods 945
Interpolation Methods
There are a number of interpolation functions that operate on shape scene objects. They provide
capabilities such as stepping along a curve within a shape getting coordinates on the curve, getting
curve lengths or determining the closest point on a curve to a given coordinate. These are useful for
placing cloned objects along a curve or keeping a set of objects in formation near a ‘spine’ curve as
it animates, etc.
The interpolators all take a shape scene object (for example, a line), an optional curve number in
case there are several curves in the shape, defaulting to 1, and a parameter in the range 0.0 to 1.0,
that specifies a spot on the curve as a proportion along its length. There are two types of interpolator
provided:
• One interpolator matches the 3ds max Path controller in which the percentage along the path
is not uniform, but weighted by the vertex spacing. This simple interpolation is interpolating
based on parameter space. If a spline has 4 segments, the first segment is parameter values 0-
0.25, the second 0.25-0.5, the third 0.5-0.75 and the fourth 0.75-1.0. This is regardless of the
length of each segment.
• Another interpolator that gives you a uniform interpolation along the length of the curve. This
interpolation normalizes the parameter space to distance along the length of a spline. So
parameter space 0 is the start, 1.0 is the end and 0.5 is halfway along the actual length of the
curve.
The non-uniform Path interpolator in 3ds max gives rise to the varying velocity of a path-animated
object when the path has unevenly spaced control points. The arc-length interpolators provided
here give a uniform placing along the curve no matter how uneven the control point placement.
The advantage of the Path interpolator is that it is computationally much more efficient than a
uniform arc-length interpolator. The length interpolator uses some caches to speed it up, but you
have to help manage them in the way described below.
The optional steps: keyword argument for the methods listed below lets you specify the integration
steps. The default steps value is 5 times the curve’s 3ds max unit length, which usually is more than
enough. For example, if a curve has a length of 100 3ds max units, the default step size would be
500. The interpolation algorithm has an accuracy of no better than + or - (1/steps) 3ds max units.
These methods employ a cache to speed up their operation in the common case where you step
946 Chapter 11 | 3ds max Objects
gradually along a single curve. The cache remembers the state for the last point on the curve and
picks up there if you call again on the same curve at the same animation time. This can
exponentially speed up interpolation processing. However, MAXScript does not have a way of
knowing if you’ve edited the curve from one call to the next, so you have to be sure to reset the cache
with the resetLengthInterp() method if the user can edit the curve between calls in your code.
All coordinates are in the current coordinate system.
pathInterp <shape> [ <curve_num> ] <parameter>
Return a point3 coordinate on the numbered curve (defaults to 1) corresponding to the
parameter value (0.0 to 1.0) that matches the 3ds max Path controller percentage (vertex-
based) interpolation.
lengthInterp <shape> [ <curve_num> ] <parameter> [ steps:<integer> ]
Return a point3 coordinate on the numbered curve (defaults to 1) corresponding to the
parameter value (0.0 to 1.0) that is that fraction along the curve’s total length.
resetLengthInterp()
Clear length interpolation cache. Use this if the curve you are length-interpolating along
might have been edited between calls.
curveLength <shape> [ <curve_num> ]
Return the arc length of the numbered curve. This length does not reflect any transform
level scaling performed on the shape.
pathTangent <shape> [ <curve_num> ] <parameter>
Return the tangent direction vector at the 3ds max Path (vertex-based) interpolated point
along the specified curve. You can use this function, for example, to set an object’s
direction to follow the curve.
lengthTangent <shape> [ <curve_num> ] <parameter> [ steps:<integer> ]
Return the tangent direction vector at the arc-length-interpolated point along the
specified curve. You can use this function to set an object’s direction to follow the curve.
nearestPathParam <shape> [ <curve_num> ] <point3> [ steps:<integer> ]
Return the interpolation parameter value (0.0 to 1.0) corresponding to the point along the
curve that is closest to the given <point3> coordinate. The parameter is given as a
3ds max Path (vertex-based) interpolation parameter value. You can then use pathInterp
with this value to find the nearest point’s coordinates, or use one of the following
functions for converting between arc-length parameters and 3ds max Path percentage
parameters.
pathToLengthParam <shape> [ <curve_num> ] <parameter> [ steps:<integer> ]
Return the uniform arc-length length parameter corresponding to the given 3ds max Path
(vertex-based) parameter for this curve.
lengthToPathParam <shape> [ <curve_num> ] <parameter> [ steps:<integer> ]
Return the 3ds max Path (vertex-based) parameter corresponding to the given uniform arc-
length parameter for this curve.
Spline Shape Common Properties, Operators, and Methods 947
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Shapes - Splines
The following list shows the 3ds max spline shape class objects:
Arc (p. 949)
Circle (p. 950)
Donut (p. 951)
Ellipse (p. 953)
Helix (p. 954)
Line (p. 955)
NGon (p. 957)
Rectangle (p. 958)
Section (p. 959)
Star (p. 960)
So, looking in the Object Properties dialog, $.renderable=false turns off renderable at the node level.
To turn off the spline’s renderable property, you need to say $.baseobject.renderable=false.
Methods:
The following methods are defined for 3D Studio VIZ.
applyOffset <spline_shape_node> <offset_float>
For each spline in the shape, makes a copy of the spline, offset on all sides to the distance
in units specified by offset_float. If a spline is open, the resulting spline and its outline
will make a single closed spline. Negative offset_float values create an offset spline to
the left of the spline (as the spline is drawn from its start to its finish). The
spline_shape_node is converted to a SplineShape (Editable Spline) if it is not already a
SplineShape.
measureOffset <spline_shape_node> <point3>
Returns a Float value whose absolute value is the distance from point3 to the closest
point on a spline in the shape. The sign of the value is positive if the point3 position is to
the left of the spline (as the spline is drawn from its start to its finish). The value returned
by this method can usually be used as the offset_float parameter in applyOffset()
to have an offset spline pass through the point3 position. If the closest point on a spline
in the shape is an endpoint of an open spline, the offset spline will not pass through the
point3 position.
trimextend <fixed_node_array> <alterable_node_array> \
[trim: <boolean> ] [extend: <boolean>] [infinite: <boolean>] \
[project: #view | #3D | #grid]
If trim is true (the default), …otherwise …If extend is true (the default), …otherwise …If
infinite is false (the default), … , otherwise …Project can be one of the following Name
values:
#view (the default) –
#3D –
#grid -
Broken. Document when working.
See also
Shape Common Properties, Operators, and Methods (p. 945)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Arc : Shape 949
Arc : Shape
Constructor:
arc ...
Properties:
<Arc>.radius Float default: 25.0 -- animatable
The arc radius.
<Arc>.from Float default: 45.0 -- animatable
Location of the start point as an angle measured from the local positive X axis.
<Arc>.to Float default: 135.0 -- animatable
Location of the end point as an angle measured from the local positive X axis.
<Arc>.pie Boolean default: false
When on, creates a closed spline in the form of a pie. The start point and end point are
connected to the center with straight segments.
<Arc>.reverseBooleandefault: false
When on, the direction of the arc spline is reversed, and the first vertex is placed at the
opposite end of an open arc. As long as the shape remains an original shape (and not an
editable spline), you can switch its direction by toggling reverse. Once the arc is
converted to an editable spline, you can use Reverse at the Spline sub-object level to
reverse direction.
<Arc>.steps Integer default: 6
Number of divisions between each vertex.
<Arc>.optimize Boolean default: true
When on, removes unneeded steps from straight segments in the spline.
<Arc>.adaptive Boolean default: false
When on, sets the number of steps for each spline to produce a smooth curve. Straight
segments always receive 0 steps.
<Arc>.angle Float default: 0.0 -- animatable
The rotational position of the cross-section in the renderer.
<Arc>.thickness Float default: 1.0 -- animatable
Diameter of the rendered spline.
<Arc>.sides Float default: 12.0 -- animatable
Sets the number of sides for the spline mesh in the renderer. A value of 4 will give you a
square cross section, for example.
<Arc>.viewport_thickness Float default: 1.0
Diameter of the viewport spline.
<Arc>.viewport_sides Integer default: 12
Sets the number of sides for the spline mesh in the viewports. A value of 4 will give you a
square cross section, for example.
<Arc>.viewport_angle Float default: 0.0
The rotational position of the cross-section in the viewports.
950 Chapter 11 | 3ds max Objects
See also
Spline Shape Common Properties, Operators, and Methods (p. 947)
Shape Common Properties, Operators, and Methods (p. 945)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Circle : Shape
Constructor:
circle ...
Properties:
<Circle>.radius Float default: 25.0 -- animatable
The radius of the circle.
<Circle>.steps Integer default: 6
The number of divisions between each vertex.
<Circle>.optimize Boolean default: true
When on, removes unneeded steps from straight segments in the spline.
<Circle>.adaptive Boolean default: false
When on, adaptive sets the number of steps for each spline to produce a smooth curve.
Straight segments always receive 0 steps.
<Circle>.angle Float default: 0.0 -- animatable
The rotational position of the cross-section in the renderer.
<Circle>.thickness Float default: 1.0 -- animatable
Diameter of the rendered spline.
Donut : Shape 951
See also
Spline Shape Common Properties, Operators, and Methods (p. 947)
Shape Common Properties, Operators, and Methods (p. 945)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Donut : Shape
Constructor:
donut ...
Properties:
<Donut>.radius1 Float default: 35.0 -- animatable
Sets the radius of the first circle.
<Donut>.radius2 Float default: 25.0 -- animatable
Sets the radius of the second circle.
<Donut>.steps Integer default: 6
The number of divisions between each vertex.
952 Chapter 11 | 3ds max Objects
See also
Spline Shape Common Properties, Operators, and Methods (p. 947)
Shape Common Properties, Operators, and Methods (p. 945)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Ellipse : Shape 953
Ellipse : Shape
Constructor:
ellipse ...
Properties:
<Ellipse>.length Float default: 25.0 -- animatable
The size of the Ellipse along the local Y axis.
<Ellipse>.width Float default: 35.0 -- animatable
The size of the Ellipse local X axis.
<Ellipse>.steps Integer default: 6
The number of divisions between each vertex.
<Ellipse>.optimize Boolean default: true
When on, removes unneeded steps from straight segments in the spline.
<Ellipse>.adaptive Boolean default: false
When on, Adaptive sets the number of steps for each spline to produce a smooth curve.
Straight segments always receive 0 steps.
<Ellipse>.angle Float default: 0.0 -- animatable
The rotational position of the cross-section in the renderer.
<Ellipse>.thickness Float default: 1.0 -- animatable
Diameter of the rendered spline.
<Ellipse>.sides Float default: 12.0 -- animatable
Sets the number of sides for the spline mesh in the renderer. A value of 4 will give you a
square cross section, for example.
<Ellipse>.viewport_thickness Float default: 1.0
Diameter of the viewport spline.
<Ellipse>.viewport_sides Integer default: 12
Sets the number of sides for the spline mesh in the viewports. A value of 4 will give you a
square cross section, for example.
<Ellipse>.viewport_angle Float default: 0.0
The rotational position of the cross-section in the viewports.
<Ellipse>.DisplayRenderMesh Boolean default: false
When on, displays the mesh generated by the spline in the viewports.
<Ellipse>.UseViewportSettings Boolean default: false
When on, displays the mesh generated by the Viewport settings.
<Ellipse>.DisplayRenderSettings Boolean default: true
When on, displays the mesh generated by the render settings.
<Ellipse>.renderableBoolean default: true
When on, the spline is displayed in the rendered scene.
<Ellipse>.mapCoordsBoolean default: false
Turn this on to apply mapping coordinates. The U coordinate wraps once around the
thickness of the spline; the V coordinate is mapped once along the length of the spline.
954 Chapter 11 | 3ds max Objects
See also
Spline Shape Common Properties, Operators, and Methods (p. 947)
Shape Common Properties, Operators, and Methods (p. 945)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Helix : Shape
Constructor:
helix ...
Properties:
<Helix>.radius1 Float default: 35.0 -- animatable
The radius for the Helix start.
<Helix>.radius2 Float default: 15.0 -- animatable
The radius for the Helix end.
<Helix>.height Float default: 25.0 -- animatable
The height of the Helix.
<Helix>.turns Float default: 2.0 -- animatable
The number of turns the Helix makes between its start and end points.
<Helix>.bias Float default: 0.0 -- animatable
Forces the turns to accumulate at one end of the helix. A bias of -1.0 forces the turns
towards the start of the helix, a bias of 0.0 evenly distributes the turns between the ends,
and a bias of 1.0 forces the turns towards the end of the helix.
<Helix>.direction Integer default: 0
Set the direction the helix turns:
Clockwise
Counterclockwise
<Helix>.angle Float default: 0.0 -- animatable
The rotational position of the cross-section in the renderer.
<Helix>.thickness Float default: 1.0 -- animatable
Diameter of the rendered spline.
<Helix>.sides Float default: 12.0 -- animatable
Sets the number of sides for the spline mesh in the renderer. A value of 4 will give you a
square cross section, for example.
<Helix>.viewport_thickness Float default: 1.0
Diameter of the viewport spline.
Line : Shape 955
See also
Spline Shape Common Properties, Operators, and Methods (p. 947)
Shape Common Properties, Operators, and Methods (p. 945)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Line : Shape
Constructor:
line ...
Properties:
<Line>.steps Integer default: 6
The number of divisions between each vertex.
<Line>.optimize Boolean default: true
When on, removes unneeded steps from straight segments in the spline.
<Line>.adaptive Boolean default: false
When on, adaptive sets the number of steps for each spline to produce a smooth curve.
Straight segments always receive 0 steps.
<Line>.angle Float default: 0.0 -- animatable
The rotational position of the cross-section in the renderer.
<Line>.thickness Float default: 1.0 -- animatable
Diameter of the rendered spline.
956 Chapter 11 | 3ds max Objects
See also
Spline Shape Common Properties, Operators, and Methods (p. 947)
Shape Common Properties, Operators, and Methods (p. 945)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
NGon : Shape 957
NGon : Shape
Constructor:
ngon ...
Properties:
<NGon>.radius Float default: 25.0 -- animatable
The NGon radius.
<NGon>.scribe Integer default: 0
Sets whether the NGon is:
Circumscribed (Radius is measured from the center to the sides of the NGon)
Inscribed (Radius is measured from the center to the corners of the NGon)
<NGon>.sides Integer default: 6 -- animatable
Number of sides and vertices used by the NGon.
<NGon>.corner_Radius Float default: 0.0 -- animatable
Degree of rounding to apply to the corners of the NGon. A setting of 0 specifies a standard
unrounded corner.
<NGon>.circular Boolean default: true -- animatable
When on, specifies a circular NGon.
<NGon>.steps Integer default: 6
The number of divisions between each vertex.
<NGon>.optimize Boolean default: true
When on, removes unneeded steps from straight segments in the spline.
<NGon>.adaptive Boolean default: false
When on, adaptive sets the number of steps for each spline to produce a smooth curve.
Straight segments always receive 0 steps.
<NGon>.angle Float default: 0.0 -- animatable
The rotational position of the cross-section in the renderer.
<NGon>.radiusFloat default: 1.0 -- animatable
<NGon>.thickness Float default: 1.0 -- animatable
Radius of the rendered spline.
<NGon>.sides Float default: 12.0 -- animatable
Sets the number of sides for the spline mesh in the renderer. A value of 4 will give you a
square cross section, for example.
<NGon>.viewport_thickness Float default: 1.0
Diameter of the viewport spline.
<NGon>.viewport_sides Integer default: 12
Sets the number of sides for the spline mesh in the viewports. A value of 4 will give you a
square cross section, for example.
<NGon>.viewport_angle Float default: 0.0
The rotational position of the cross-section in the viewports.
958 Chapter 11 | 3ds max Objects
See also
Spline Shape Common Properties, Operators, and Methods (p. 947)
Shape Common Properties, Operators, and Methods (p. 945)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Rectangle : Shape
Constructor:
rectangle ...
Properties:
<Rectangle>.length Float default: 10.0 -- animatable
The size of the rectangle along the local Y axis.
<Rectangle>.width Float default: 25.0 -- animatable
The size of the rectangle along the local X axis.
<Rectangle>.Corner_Radius Float default: 0.0 -- animatable; alias:
cornerRadius
Creates rounded corners. When set to 0, the rectangle contains 90-degree corners.
<Rectangle>.steps Integer default: 6
The number of divisions between each vertex.
<Rectangle>.optimize Boolean default: true
When on, removes unneeded steps from straight segments in the spline.
<Rectangle>.adaptive Boolean default: false
When on, adaptive sets the number of steps for each spline to produce a smooth curve.
Straight segments always receive 0 steps.
<Rectangle>.angle Float default: 0.0 -- animatable
The rotational position of the cross-section in the renderer.
Section : Shape 959
See also
Spline Shape Common Properties, Operators, and Methods (p. 947)
Shape Common Properties, Operators, and Methods (p. 945)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Section : Shape
Constructor:
section ...
Properties:
<Section>.length Float default: 0.0 -- animatable
The length of the displayed section rectangle.
<Section>.width Float default: 0.0 -- animatable
The width of the displayed section rectangle.
960 Chapter 11 | 3ds max Objects
Note:
The Section Parameters rollout item properties are not accessible to MAXScript in 3ds max 4.
A bug prevents a Section shape from being properly collapsed to a SplineShape in some cases. This
only happens when a Section shape is created inside a loop and is being converted to a SplineShape.
To collapse to a SplineShape, a viewport redraw must be performed after the Section shape is created.
An example of creating contour lines from an object is:
Script:
meshSelected = sphere() -- object to create contours of
minZ = meshSelected.min.z -- get min and max Z positions
maxZ = meshSelected.max.z
numLevels = 10 -- the number of contours
delta = (maxZ - minZ) / (numLevels + 1) -- the number of steps
for currentZ = minZ to maxZ by delta do -- start loop...
( s = section pos:[0, 0, currentZ] -- create Section
max views redraw -- this line needed to get around bug
convertToSplineShape s -- convert Section to SplineShape
s.renderable = true -- set to renderable
)
See also
Spline Shape Common Properties, Operators, and Methods (p. 947)
Shape Common Properties, Operators, and Methods (p. 945)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Star : Shape
Constructor:
star ...
Properties:
<Star>.radius1 Float default: 25.0 -- alias: Radius_1
The radius of the inner vertices of the star.
<Star>.radius2 Float default: 12.0 -- alias: Radius_2
The radius of the outer vertices of the star.
<Star>.points Integer default: 6 -- alias: numPoints
The number of points on the star. The valid range is from 3 to 100.
<Star>.distort Float default: 0.0 -- alias: Distortion
Rotates the outer vertices about the center of the star. This produces a saw-tooth affect.
<Star>.fillet1Floatdefault: 0.0
Rounds the inner vertices (the valleys) of the star.
Star : Shape 961
<Star>.fillet2Floatdefault: 0.0
Rounds the outer vertices (the points) of the star.
<Star>.steps Integer default: 6
The number of divisions between each vertex.
<Star>.optimize Boolean default: true
When on, removes unneeded steps from straight segments in the spline.
<Star>.adaptive Boolean default: false
When on, adaptive sets the number of steps for each spline to produce a smooth curve.
Straight segments always receive 0 steps.
<Star>.angle Float default: 0.0 -- animatable
The rotational position of the cross-section in the renderer.
<Star>.thickness Float default: 1.0 -- animatable
Radius of the rendered spline.
<Star>.sides Float default: 12.0 -- animatable
Sets the number of sides for the spline mesh in the renderer. A value of 4 will give you a
square cross section, for example.
<Star>.viewport_thickness Float default: 1.0
Diameter of the viewport spline.
<Star>.viewport_sides Integer default: 12
Sets the number of sides for the spline mesh in the viewports. A value of 4 will give you a
square cross section, for example.
<Star>.viewport_angle Float default: 0.0
The rotational position of the cross-section in the viewports.
<Star>.DisplayRenderMesh Boolean default: false
When on, displays the mesh generated by the spline in the viewports.
<Star>.UseViewportSettings Boolean default: false
When on, displays the mesh generated by the Viewport settings.
<Star>.DisplayRenderSettings Boolean default: true
When on, displays the mesh generated by the render settings.
<Star>.renderableBoolean default: true
When on, the spline is displayed in the rendered scene.
<Star>.mapCoords Boolean default: false
Turn this on to apply mapping coordinates. The U coordinate wraps once around the
thickness of the spline; the V coordinate is mapped once along the length of the spline.
Note:
The Fillet_Radius_1 and Fillet_Radius_2 properties are not accessible to MAXScript in 3ds max 4.
In order to access the points property for Star, you need to access the property via the baseobject
property of the node. This is because points is also a property name for all nodes, and conflicts with
the Star’s points property. For example:
MyStar.baseobject.points=10 -- set number of Star points to 10
962 Chapter 11 | 3ds max Objects
See also
Spline Shape Common Properties, Operators, and Methods (p. 947)
Shape Common Properties, Operators, and Methods (p. 945)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Text : Shape
Constructor:
text ...
Properties:
<text>.font String default: “Arial”
Choose from a list of all fonts available to 3ds max.
<text>.italic Boolean default: false
Turn on/off italicized text.
<text>.underline Boolean default: false
Turn on/off underlined text.
<text>.alignmentIntegerdefault: 1
Sets the alignment of text:
Align Left (Aligns text to the left side of its bounding box.)
Center (Aligns text to the center of its bounding box.)
Align Right (Aligns text to the right side of its bounding box.)
Justify (Spaces all lines of text to fill the extents of the bounding box.)
<text>.size Float default: 100.0 -- animatable
Te text height where the height measuring method is defined by the active font.
<text>.kerning Float default: 0.0 -- animatable
The kerning (the distance between letters).
<text>.leading Float default: 0.0 -- animatable
The leading (the distance between lines).
<text>.text String default: “3ds max Text”
The text displayed in the viewport.
<text>.steps Integer default: 6
The number of divisions between each vertex.
<text>.optimize Boolean default: true
When on, removes unneeded steps from straight segments in the spline.
<text>.adaptive Boolean default: false
When on, adaptive sets the number of steps for each spline to produce a smooth curve.
Straight segments always receive 0 steps.
Text : Shape 963
See also
Spline Shape Common Properties, Operators, and Methods (p. 947)
Shape Common Properties, Operators, and Methods (p. 945)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
964 Chapter 11 | 3ds max Objects
CV_Curve : Shape
CV_Curves are NURBS curve objects defined by CVs (control vertices). All NURBS objects are created
through the special NURBS descriptor classes (see Working with NURBS (p. 1384)) and the CV_Curve
class is used typically in object class testing with the classOf() function. Scene objects created as
CV Curve shape objects in the 3ds max user interface have the class CV_Curve.
Constructor:
NURBSNode <nurbs_set> ...
See Creating New NURBS Objects (p. 1389) for details.
Properties:
<CV_Curve>.angle Float default: 0.0 -- animatable
The rotational position of the cross-section in the renderer.
<CV_Curve>.thickness Float default: 1.0 -- animatable
Diameter of the rendered curve.
<CV_Curve>.sides Float default: 12.0 -- animatable
Sets the number of sides for the curve mesh in the renderer. A value of 4 will give you a
square cross section, for example.
<CV_Curve>.renderableBoolean default: true
When on, the curve is displayed in the rendered scene.
<CV_Curve>.mapCoordsBoolean default: false
Turn this on to apply mapping coordinates. The U coordinate wraps once around the
thickness of the curve; the V coordinate is mapped once along the length of the curve.
Additional Properties for CV curves are accessed through a NURBSSet descriptor object. See
Working with NURBS (p. 1384) for more details.
See also
Shape Common Properties, Operators, and Methods (p. 945)
NURBS Node Properties and Methods (p. 1397)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Point_Curve : Shape 965
Point_Curve : Shape
Point_Curves are NURBS curve objects defined by interpolated points. All NURBS objects are
created through the special NURBS descriptor classes (see Working with NURBS (p. 1384)) and the
Point_Curve class is used typically in object class testing with the classOf() function. Scene
objects created as Point Curve shape objects in the 3ds max user interface have the class
Point_Curve.
Constructor:
NURBSNode <nurbs_set> ...
See Creating New NURBS Objects (p. 1389) for details.
Properties:
<Point_Curve>.angle Float default: 0.0 -- animatable
The rotational position of the cross-section in the renderer.
<Point_Curve>.thickness Float default: 1.0 -- animatable
Diameter of the rendered curve.
<Point_Curve>.sides Float default: 12.0 -- animatable
Sets the number of sides for the curve mesh in the renderer. A value of 4 will give you a
square cross section, for example.
<Point_Curve>.renderableBoolean default: true
When on, the curve is displayed in the rendered scene.
<Point_Curve>.mapCoordsBoolean default: false
Turn this on to apply mapping coordinates. The U coordinate wraps once around the
thickness of the NURBS curve; the V coordinate is mapped once along the length of the
curve.
Additional properties for point curves are accessed through a NURBSSet descriptor object. See
Working with NURBS (p. 1384) for more details.
See also
Shape Common Properties, Operators, and Methods (p. 945)
NURBS Node Properties and Methods (p. 1397)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
966 Chapter 11 | 3ds max Objects
Light : Node
The following list shows the 3ds max light class objects:
DirectionalLight (p. 970)
FreeSpot (p. 971)
OmniLight (p. 972)
TargetSpot (p. 973)
TargetDirectionalLight (p. 972)
See also
Light Common Properties, Operators, and Methods (p. 966)
If Ray Traced Shadows are being used (raytracedShadows = true), the shadow properties are:
<light>.raytraceBias Float default: 0.2 -- animatable
Moves the shadow toward or away from the shadow-casting object (or objects). If the Bias
value is too low, shadows can “leak” through places they shouldn’t, produce moire
patterns or making out-of-place dark areas on meshes. If Bias is too high, shadows can
“detach” from an object. If the Bias value is too extreme in either direction, shadows
might not be rendered at all.
<light>.maxDepth Integer default: 7 -- animatable
Adjusts the depth of the quadtree used by the raytracer. Greater quadtree depth values can
improve ray-tracing time at the cost of memory use. However, there is a depth value where
the performance improvement is offset by the time it takes to generate the quadtree itself.
This depends on the geometry of the scene.
Note:
Setting includelist or excludelist sets the other to undefined.
Assigning a Projector TextureMap adds a subAnim to the properties list. The properties of the
subAnim are the properties of the TextureMap.
The Attenuation Parameters/Decay/Show and Shadow Parameters/Map/Enable properties are not
accessible by MAXScript in 3ds max 4.
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
DirectionalLight : Light
Constructor:
directionalLight ...
Properties:
<DirectionalLight>.aspect Float default: 1.0 -- animatable,
alias: Aspect_Ratio
The aspect ratio for the rectangular light beam.
<DirectionalLight>.falloff Float default: 45.0 -- animatable
The size of a light’s falloff. The Falloff value is measured in 3ds max units.
<DirectionalLight>.showCone Boolean default: false
Turns display of the cone on or off.
<DirectionalLight>.hotspot Float default: 43.0 -- animatable
The size of a light’s cone. The Hotspot value is measured in 3ds max units.
FreeSpot : Light 971
See also
Light Common Properties, Operators, and Methods (p. 966)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
FreeSpot : Light
Constructor:
freeSpot ...
Properties:
<Freespot>.aspect Float default: 1.0 -- animatable, alias:
Aspect_Ratio
The aspect ratio for the rectangular light beam.
<Freespot>.falloff Float default: 45.0 -- animatable
The angle of a light’s falloff. The Falloff value is measured in degrees.
<Freespot>.showCone Boolean default: false
Turns display of the cone on or off.
<Freespot>.hotspot Float default: 43.0 -- animatable
The angle of a light’s cone. The Hotspot value is measured in degrees.
<Freespot>.overShoot Boolean default: false
When on, the light casts light in all directions. However, projections and shadows occur
only within its falloff cone.
<Freespot>.coneShape Integer default: 1 -- alias: lightShape
The shape of the falloff and hotspot areas:
Circle
Rectangle
972 Chapter 11 | 3ds max Objects
See also
Light Common Properties, Operators, and Methods (p. 966)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
OmniLight : Light
Constructor:
omniLight ...
Properties:
There are no additional properties for OmniLight.
See also
Light Common Properties, Operators, and Methods (p. 966)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
TargetDirectionalLight : Light
Constructor:
targetDirectionalLight ...
Properties:
<TargetDirectionallight>.aspect Float default: 1.0 -- animatable,
alias: Aspect_Ratio
The aspect ratio for the rectangular light beam.
<TargetDirectionallight>.falloff Float default: 45.0 -- animatable
The angle of a light’s falloff. The Falloff value is measured in degrees.
<TargetDirectionallight>.showCone Boolean default: false
Turns display of the cone on or off.
<TargetDirectionallight>.hotspot Float default: 43.0 -- animatable
The angle of a light’s cone. The Hotspot value is measured in degrees.
<TargetDirectionallight>.overShoot Boolean default: false
When on, the light casts light in all directions. However, projections and shadows occur
only within its falloff cone.
TargetSpot : Light 973
See also
Light Common Properties, Operators, and Methods (p. 966)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
TargetSpot : Light
Constructor:
targetSpot ...
Properties:
<Targetspot>.aspect Float default: 1.0 -- animatable, alias:
Aspect_Ratio
The aspect ratio for the rectangular light beam.
<Targetspot>.falloff Float default: 45.0 -- animatable
The angle of a light’s falloff. The Falloff value is measured in degrees.
<Targetspot>.showCone Boolean default: false
Turns display of the cone on or off.
<Targetspot>.hotspot Float default: 43.0 -- animatable
The angle of a light’s cone. The Hotspot value is measured in degrees.
<Targetspot>.overShoot Boolean default: false
When on, the light casts light in all directions. However, projections and shadows occur
only within its falloff cone.
<Targetspot>.coneShape Integer default: 1 -- alias: lightShape
The shape of the falloff and hotspot areas:
Circle
Rectangle
Note:
In MAXScript, you must explicitly construct a target for those objects that need one. For example:
c = Targetspot pos:[x,y,z] target:(targetObject pos:[xt, yt, zt])
974 Chapter 11 | 3ds max Objects
See also
Light Common Properties, Operators, and Methods (p. 966)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Camera : Node
The following list displays the camera objects:
FreeCamera (p. 976)
TargetCamera (p. 976)
See also
Camera Common Properties, Operators, and Methods (p. 974)
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Note:
The fov parameter value is the horizontal FOV in degrees.
The Vertical and Diagonal FOV and Lens values are based on the horizontal FOV and the current
renderer Aperture Width.
You can use the following function to calculate the Vertical FOV from the Horizontal FOV:
fn GetCamVFOV theCamera =
( local r_aspect=(renderWidth as float)/renderHeight
2.*atan(tan(theCamera.fov/2.)/r_aspect)
)
Examples:
The following script changes the fov of specified camera to simulate a “zoom extents all” for the
camera.
Script:
fn ZE_Cam cam objs =
( local max2, fov, asp, v -- declare local variables
-- define a function that returns the maximum value of a set of values in an array
fn maxof vals = (local v=vals[1]; for v1 in vals do (if v1 > v do v=v1);v)
fov=0 -- initialize the fov value
asp=(renderWidth as float)/renderHeight -- calculate the renderer’s image aspect
ratio
in coordsys cam -- work in coordinate system of the
camera
976 Chapter 11 | 3ds max Objects
( for obj in objs where obj != cam do -- loop across all objects except the
camera
( if obj.min.z >=0 do continue -- if object is behind camera, skip it
-- get max value of the object’s bounding box, correcting for the image
aspect ratio
-- in the y values
v = maxof #((abs obj.max.x),(abs obj.min.x),(abs (obj.max.y*asp)),(abs
(obj.min.y*asp)))
fov = maxof #(fov,(2*atan(-v/obj.min.z))) -- increase fov if needed
)
)
cam.fov=fov -- set the camera’s fov to the new fov
value
)
--test bed --
cam=$camera01 -- specify the camera to “zoom extent all” on
ZE_Cam cam $* -- call the function, passing the camera and an object set
containing all objects
FreeCamera : Camera
Constructor:
freecamera ...
Properties:
There are no additional properties for FreeCamera.
See also
Camera Common Properties, Operators, and Methods (p. 974)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
TargetCamera : Camera
Constructor:
targetCamera ...
Properties:
There are no additional properties for TargetCamera.
TargetCamera : Camera 977
See also
Camera Common Properties, Operators, and Methods (p. 974)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Helper : Node
The following list shows the helper objects:
-- Standard
Bone (p. 978)
Compass (p. 979)
Dummy (p. 979)
Grid (p. 980)
Point (p. 980)
Protractor (p. 981)
Tape (p. 981)
-- Atmospheric
BoxGizmo (p. 982)
CylGizmo (p. 983)
SphereGizmo (p. 983)
-- Camera Match
CamPoint (p. 984)
-- VRML 1.0/VRBL
Inline (p. 984)
LOD (p. 985)
VRML_VRBL (p. 985)
-- VRML97
Anchor (p. 986)
AudioClip (p. 986)
Background (p. 987)
Billboard (p. 987)
FogHelper (p. 987)
InlineHelper (p. 988)
LODHelper (p. 988)
NavInfo (p. 988)
978 Chapter 11 | 3ds max Objects
Helper - Standard
The following list shows the standard helper objects:
Bone (p. 978)
Compass (p. 979)
Dummy (p. 979)
Grid (p. 980)
Point (p. 980)
Protractor (p. 981)
Tape (p. 981)
Bone : Helper
Constructor:
bone ...
Properties:
There are no additional properties for Bone.
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Note:
The Bone helper object is used by 3ds max to represent the nodes in a Bones system. In 3ds max 4,
it is not possible to create a Bones system using IK controllers on the Bones’ nodes.
You can create a hierarchy of Bone helper objects which use the standard PRS transform controller
for each node. For example:
b0 = bone pos:[x,y,z]
in b0 b1 = bone pos:[x1,y1,z1]
in b1 b2 = bone pos:[x2,y2,z2]
in b2 b3 = bone pos:[x3,y3,z3]
Compass : Helper 979
Compass : Helper
Constructor:
compass ...
Properties:
There are no additional properties for Compass.
Note:
The Show Compass Rose and Radius properties are not accessible to MAXScript in 3ds max 4.
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Dummy : Helper
Constructor:
dummy ...
Properties:
<Dummy>.boxsize Point3 default: [10,10,10]
Icon size.
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
980 Chapter 11 | 3ds max Objects
Grid : Helper
Constructor:
grid ...
Properties:
<grid>.length Float default: 50.0 -- animatable
Length of the grid.
<grid>.width Float default: 50.0 -- animatable
Width of the grid.
<grid>.grid Float default: 10.0 -- animatable
The size of the smallest square in the visible grid.
Note:
The Active Color and Display properties are not accessible to MAXScript in 3ds max 4.
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Point : Helper
Constructor:
point ...
Properties:
<Point>.axisLength Float default: 20.0
Sets the length of the tripod axis.
<Point>.size Float default: 20.0 -- animatable
Sets the size of of the point helper.
<Point>.centermarker Boolean default: false -- animatable
When turned on, a small X marker is displayed at the center of the point helper object.
<Point>.axistripod Boolean default: false -- animatable
When this is turned on, an axis tripod with ‘x’, ‘y’, and ‘z’ labels is displayed.
<Point>.cross Boolean default: true -- animatable
When this is turned on, an axis aligned cross is displayed.
<Point>.box Boolean default: false -- animatable
When this is turned on, a square box is displayed centered at the center of the point
helper object.
Protractor : Helper 981
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Protractor : Helper
Constructor:
protractor ...
Properties:
There are no additional properties for Protractor.
Note:
There is not a way to set the Protractor reference objects using MAXScript in 3ds max 4.
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Tape : Helper
Constructor:
tape ...
Properties:
<Tape>.length Float default: 50.0 -- animatable
Length of the tape object.
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
982 Chapter 11 | 3ds max Objects
Note:
To construct a tape, you have to create its target node first (using the targetObject constructor),
and then construct the tape giving it the target:
tape pos:p target:(targetObject pos:q)
The length property shows the tape length set in the 3ds max user interface, not the true
distance from the tape to its target. The following function can be used to return this distance:
fn getTapeDist TapeObj = distance TapeObj TapeObj.target
Helper - Atmospheric
The following list shows the atmospheric helper objects:
BoxGizmo (p. 982)
CylGizmo (p. 983)
SphereGizmo (p. 983)
BoxGizmo : Helper
Constructor:
boxGizmo ...
Properties:
<BoxGizmo>.length Float default: 0.0 -- animatable
Length of the box gizmo.
<BoxGizmo>.width Float default: 0.0 -- animatable
Width of the box gizmo.
<BoxGizmo>.height Float default: 0.0 -- animatable
Height of the box gizmo.
<BoxGizmo>.seed Integer default: 0 -- alias: parameter
Base value used to generate the atmospheric effect. Each apparatus in the scene should
have a different seed. If more than one apparatus uses the same seed and same
atmospheric effect, they will produce nearly identical results.
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
CylGizmo : Helper 983
CylGizmo : Helper
Constructor:
cylGizmo ...
Properties:
<CylGizmo>.radius Float default: 0.0 -- animatable
Radius of cylinder gizmo object.
<CylGizmo>.height Float default: 0.0 -- animatable
Height of cylinder gizmo object.
<CylGizmo>.seed Integer default: 0 -- alias: parameter
Base value used to generate the atmospheric effect. Each apparatus in the scene should
have a different seed. If more than one apparatus uses the same seed and same
atmospheric effect, they will produce nearly identical results.
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
SphereGizmo : Helper
Constructor:
sphereGizmo ...
Properties:
<SphereGizmo>.radius Float default: 0.0 -- animatable
Radius of sphere gizmo object.
<SphereGizmo>.hemisphere Integer default: 0
When turned on, the bottom half of the SphereGizmo is discarded, creating a hemisphere:
OFF
ON
<SphereGizmo>.seed Integer default: 0
Base value used to generate the atmospheric effect. Each apparatus in the scene should
have a different seed. If more than one apparatus uses the same seed and same
atmospheric effect, they will produce nearly identical results.
984 Chapter 11 | 3ds max Objects
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
CamPoint : Helper
Constructor:
camPoint ...
Properties:
<CamPoint>.showAxis Boolean default: true
When on, an axis tripod is displayed with the camera point object.
<CamPoint>.axisLength Float default: 20.0
The length of the axis tripod.
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Inline : Helper
Constructor:
inline ...
Properties:
There are no additional properties for Inline.
LOD : Helper 985
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
LOD : Helper
Constructor:
lod ...
Properties:
There are no additional properties for LOD.
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
VRML_VRBL : Helper
Constructor:
vrml_vrbl ...
Properties:
There are no additional properties for VRML_VRBL.
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Helper - VRML97
The following list shows the VRML97 helper objects:
Anchor (p. 986)
AudioClip (p. 986)
Background (p. 987)
Billboard (p. 987)
FogHelper (p. 987)
986 Chapter 11 | 3ds max Objects
Anchor : Helper
Constructor:
anchor ...
Properties:
There are no additional properties for Anchor.
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
AudioClip : Helper
Constructor:
audioClip ...
Properties:
There are no additional properties for AudioClip.
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Background : Helper 987
Background : Helper
Constructor:
background ...
Properties:
There are no additional properties for Background.
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Billboard : Helper
Constructor:
billboard ...
Properties:
There are no additional properties for Billboard.
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
FogHelper : Helper
Constructor:
fogHelper ...
Properties:
There are no additional properties for FogHelper.
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
988 Chapter 11 | 3ds max Objects
InlineHelper : Helper
Constructor:
inlineHelper ...
Properties:
There are no additional properties for InlineHelper.
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
LODHelper : Helper
Constructor:
lodHelper ...
Properties:
There are no additional properties for LODHelper.
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
NavInfo : Helper
Constructor:
navInfo ...
Properties:
There are no additional properties for NavInfo.
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
ProxSensor : Helper 989
ProxSensor : Helper
Constructor:
proxSensor ...
Properties:
There are no additional properties for ProxSensor.
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Sound : Helper
Constructor:
sound ...
Properties:
There are no additional properties for Sound.
Variables:
WAVsound.filename
Get/set Sound track filename as <string>. There currently is not a way to perform and
Remove Sound via MAXScript
WAVsound.start
Get/set Sound track range start time as <time>.
WAVsound.end
A read only variable to get the Sound track range end time as a <time> value.
WAVsound.mute
Get/set whether Sound track is active as <boolean>.
WAVsound.isPlaying
A read only variable that returns whether the Sound track is currently playing as a
<boolean> value.
Methods:
WAVsound.scrub <interval>
Plays back the specified time interval of the Sound track.
990 Chapter 11 | 3ds max Objects
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
TimeSensor : Helper
Constructor:
timeSensor ...
Properties:
There are no additional properties for TimeSensor.
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
TouchSensor : Helper
Constructor:
touchSensor ...
Properties:
There are no additional properties for TouchSensor.
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Bones : System 991
System : Node
System objects are not creatable by MAXScript. Once a system object in created in 3ds max, various
properties associated with the system are accessible by MAXScript.
The 3ds max system objects are:
Bones (p. 991)
Sunlight (p. 991)
RingArray (p. 992)
Note: Only the Sunlight class is available in 3D Studio VIZ.
Bones : System
Note: This class is not available in 3D Studio VIZ.
Bones system objects are not creatable by MAXScript.
A Bones system is comprised of the Bone Helper (p. 978) objects, a master IK controller, and slave IK
controllers. The slave IK controllers are used as the transform controller for all nodes in the IK
system, and the master IK controller controls the individual slave IK controllers. The methods
associated with the IK controller are described in the IK_ControllerMatrix3Controller :
Matrix3Controller (p. 1313) topic.
Sunlight : System
Sunlight system objects are not creatable by MAXScript.
A Bones system is comprised of a Compass Helper (p. 979) object and a TargetDirectionalLight (p. 972)
object. The TargetDirectionalLight’s transform is controlled by a set of float controllers, which are
sub-controllers of a non-accessible position controller (a Sunlight_Slave_Controller position
controller). These float controllers can be accessed as subAnims of the TargetDirectionalLight node.
These float controllers, and their subAnim index number, are:
Solar_Time - subAnim[3]
Solar_Date - subAnim[4]
Latitude - subAnim[5]
Longitude - subAnim[6]
Orbital_Scale - subAnim[7]
For example, if node $Sun01 is the light for a Sunlight system, the Solar_Time controller can be
accessed as:
solarTimeCont=$Sun01[3].object
992 Chapter 11 | 3ds max Objects
RingArray : System
Note: This class is not available in 3D Studio VIZ.
RingArray system objects are not creatable by MAXScript.
A RingArray system is comprised of a Dummy Helper (p. 979) object, a variable number of Box (p. 853)
objects, a master controller, and Slave_Control controllers. The Slave_Control controllers are used
as the transform controller for all Boxes in the RingArray system, and the master controller controls
the individual Slave_Control controllers. The methods associated with the Slave_Control controller
are described in the Slave_Controller : Matrix3Controller (p. 1333) topic.
SpacewarpObject : Node
Note: Spacewarp objects are not available in 3D Studio VIZ.
The following list shows the space warp objects:
-- Geometric/Deformable
Bomb (p. 993)
Conform (p. 995)
SpaceDisplace (p. 996)
SpaceFFDBox (p. 998)
SpaceFFDCyl (p. 999)
SpaceRipple (p. 1001)
SpaceWave (p. 1002)
-- Particles and Dynamics
Gravity (p. 1003)
Motor (p. 1004)
PBomb (p. 1006)
Push (p. 1008)
Wind (p. 1010)
-- Modifier-Based
SpaceBend (p. 1011)
SpaceNoise (p. 1012)
SpaceSkew (p. 1014)
SpaceStretch (p. 1015)
SpaceTaper (p. 1016)
SpaceTwist (p. 1017)
Bomb : SpacewarpObject 993
-- Dynamics Interface
PDynaFlect (p. 1019)
SDynaFlect (p. 1020)
UDynaFlect (p. 1022)
-- Particles Only
Deflector (p. 1024)
Path_Follow (p. 1025)
POmniFlect (p. 1027)
SDeflector (p. 1030)
SOmniFlect (p. 1031)
UDeflector (p. 1033)
UOmniFlect (p. 1034)
Spacewarp - Geometric/Deformable
Note: Spacewarp objects are not available in 3D Studio VIZ.
The following list shows the geometric/deformable space warp objects:
Bomb (p. 993)
Conform (p. 995)
SpaceDisplace (p. 996)
SpaceFFDBox (p. 998)
SpaceFFDCyl (p. 999)
SpaceRipple (p. 1001)
SpaceWave (p. 1002)
Bomb : SpacewarpObject
Constructor:
bomb ...
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
ConformSpaceWarp : SpacewarpObject 995
ConformSpaceWarp : SpacewarpObject
Constructor:
conformSpaceWarp ...
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
996 Chapter 11 | 3ds max Objects
SpaceDisplace : SpacewarpObject
Constructor:
spaceDisplace ...
Associated Methods:
bindSpaceWarp <node> <spaceDisplace_node>
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
998 Chapter 11 | 3ds max Objects
SpaceFFDBox : SpacewarpObject
Constructor:
spaceFFDBox ...
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
See also Class and Object Inspector Functions (p. 799) and Scripting Vertex and Control Point Animation
(p. 1461) for details on accessing the control points in an FFD.
SpaceFFDCyl : SpacewarpObject
Constructor:
spaceFFDCyl ...
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
See also Class and Object Inspector Functions (p. 799) and Scripting Vertex and Control Point Animation
(p. 1461) for details on accessing the control points in an FFD.
SpaceRipple : SpacewarpObject 1001
SpaceRipple : SpacewarpObject
Constructor:
spaceRipple ...
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
SpaceWave : SpacewarpObject
Constructor:
spaceWave ...
Note: This class is not available in 3D Studio VIZ.
Properties:
<Spacewave>.amplitude1 Float default: 5.0 -- animatable, alias: Amplitude_1
Wave amplitude along the wave warp object’s local X axis.
<Spacewave>.amplitude2 Float default: 5.0 -- animatable, alias: Amplitude_2
Wave amplitude along the wave warp object’s local Y axis.
<Spacewave>.wavelength Float default: 25.0 -- animatable, alias: Wave_Length
The length of each wave along the wave’s local Y axis, in active units.
<Spacewave>.phase Float default: 0.0 -- animatable
Offsets the phase of the wave from its origin at the wave object’s center. Whole values have
no effect; only fractional values do. Animating this parameter makes the wave appear to
travel through space.
<Spacewave>.decay Float default: 0.0 -- animatable
When set to 0.0, the wave has the same amplitude or amplitudes throughout world space.
Increasing the Decay value causes amplitude to diminish as distance increases from the
position of the wave warp object.
<Spacewave>.circles Integer default: 4
The number of side segments along the wave object’s local X dimension.
<Spacewave>.segments Integer default: 20
The number of segments along the wave object’s local Y dimension.
<Spacewave>.divisions Integer default: 10
Adjusts the size of the wave icon without altering the wave effect as scaling would.
Associated Methods:
bindSpaceWarp <node> <spaceWave_node>
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Gravity : SpacewarpObject
Constructor:
gravity ...
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Motor : SpacewarpObject
Constructor:
motor ...
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
PBomb : SpacewarpObject
Constructor:
pbomb ...
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
1008 Chapter 11 | 3ds max Objects
PushSpaceWarp : SpacewarpObject
Constructor:
pushSpaceWarp ...
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
1010 Chapter 11 | 3ds max Objects
Wind : SpacewarpObject
Constructor:
wind ...
Note: This class is not available in 3D Studio VIZ.
Properties:
<Wind>.strength Float default: 1.0 -- animatable
Increasing Strength increases the wind effect. Strength less than 0.0 creates a suction. It
repels particles moving in the same direction and attracts particles moving in the opposite
direction. When Strength is 0.0, the Wind warp has no effect.
<Wind>.decay Float default: 1.0 -- animatable
When Decay is set to 0.0, the Wind warp has the same strength throughout world space.
Increasing the Decay value causes wind strength to diminish as distance increases from the
position of the Wind warp object.
<Wind>.windtype Integer default: 0
Sets the type of wind:
Planar
Spherical
<Wind>.turbulence Float default: 1.0 -- animatable
Causes particles to change course randomly as the wind blows them. The greater the value,
the greater the turbulence effect.
<Wind>.frequency Float default: 1.0 -- animatable
When set greater than 0.0, causes turbulence to vary periodically over time. This subtle
effect is probably not visible unless your bound particle system generates a large number of
particles.
<Wind>.windScale Float default: 0.0 -- animatable
Scales the turbulence effect. When Scale is small, turbulence is smoother and more regular.
As Scale increases, turbulence grows more irregular and wild.
<Wind>.showRange Boolean default: false
When on, and when the decay value is greater than zero, icons appear in the viewports
that represent the range at which the force of wind is half the maximum value.
<Wind>.iconsize Float default: 10.0 -- animatable
Size of the Wind warp object icon, in active units.
<Wind>.hoopson Boolean default: false
When turned on, icons appear in the viewports that represent the range at which the force
of wind is half the maximum value. When you use the Planar option, the indicators are
two planes; when you use the Spherical option, the indicator is a double-hooped sphere.
SpaceBend : SpacewarpObject 1011
Associated Methods:
bindSpaceWarp <node> <wind_node>
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Spacewarp - Modifier-Based
Note: Spacewarp objects are not available in 3D Studio VIZ.
The following list shows the Modifier-Based space warp objects:
SpaceBend (p. 1011)
SpaceNoise (p. 1012)
SpaceSkew (p. 1014)
SpaceStretch (p. 1015)
SpaceTaper (p. 1016)
SpaceTwist (p. 1017)
SpaceBend : SpacewarpObject
Constructor:
spaceBend ...
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
SpaceNoise : SpacewarpObject
Constructor:
spaceNoise ...
The Animate Noise property is not accessible using MAXScript in 3ds max 4.
Associated Methods:
bindSpaceWarp <node> <spaceNoise_node>
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
SpaceSkew : SpacewarpObject
Constructor:
spaceSkew ...
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
SpaceStretch : SpacewarpObject
Constructor:
spaceStretch ...
Associated Methods:
bindSpaceWarp <node> <spaceStretch_node>
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
SpaceTaper : SpacewarpObject
Constructor:
spaceTaper ...
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
SpaceTwist : SpacewarpObject
Constructor:
spaceTwist ...
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
PDynaFlect : SpacewarpObject
Constructor:
PDynaFlect ...
Associated Methods:
bindSpaceWarp <node> <PDynaFlect_node>
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
SDynaFlect : SpacewarpObject
Constructor:
SDynaFlect ...
Associated Methods:
bindSpaceWarp <node> <SDynaFlect_node>
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
UDynaFlect : SpacewarpObject
Constructor:
UDynaFlect ...
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Deflector : SpacewarpObject
Constructor:
deflector ...
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Path_Follow : SpacewarpObject
Constructor:
path_Follow ...
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
POmniFlect : SpacewarpObject
Constructor:
POmniFlect ...
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
SDeflector : SpacewarpObject
Constructor:
sdeflector ...
Associated Methods:
bindSpaceWarp <particlesys_node> <sdeflector_node>
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
SOmniFlect : SpacewarpObject
Constructor:
SOmniFlect ...
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
UDeflector : SpacewarpObject
Constructor:
uDeflector ...
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
UOmniFlect : SpacewarpObject
Constructor:
UOmniFlect ...
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
XRefObject : Node
A XRefObject value represents an XRef object in 3ds max. A XRefObject value is returned when the
xrefs.addNewXRefObject() function is called. There are two objects associated with an XRef
object in 3ds max – the non-proxy object and the proxy object. The proxy object is typically a lower
resolution object that is used as a standin for the non-proxy object in the viewports.
Constructor:
xrefs.addNewXRefObject <filename_string> <objectname_string> [#proxy]
Loads the specified node object from the specified scene file as an XRef object. The case of
objectname_string must match the object’s name in the scene file. If #proxy is
specified, the node object is loaded as the proxy object, otherwise it is loaded as the
non-proxy object.
The XRefObject is always loaded at world center.
Properties:
<XRefObject>.proxyFileName String default: varies
The file name of the proxy object.
<XRefObject>.fileName String default: varies
The file name of the non-proxy object.
<XRefObject>.currentFileName String default: varies
The file name of the non-proxy object if the useProxy property is false, the file name of
the proxy object if the useProxy property is true.
<XRefObject>.objectName String default: varies
The name of the proxy object.
<XRefObject>.proxyObjectName String default: varies
The name of the non-proxy object.
<XRefObject>.currentObjectName String default: varies
The name of the non-proxy object if the useProxy property is false, the name of the
proxy object if the useProxy property is true.
<XRefObject>.useProxy Boolean default: varies
If true, the proxy object will be displayed in the viewports, otherwise the non-proxy
object will be displayed. If the XRef object is added to the scene using the
xrefs.addNewXRefObject() method, this parameters default value will be true if
#proxy is specified, false otherwise.
1038 Chapter 11 | 3ds max Objects
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
XRefScene Values
A XRefScene value represents a XRef Scene object in 3ds max. A XRefScene value is returned when
the xref.addNewXRefFile() and xref.getXRefFile() functions are called.
XRef Scene objects can be nested. For example, scene file A can contain an XRef Scene object
specifying XRef file B, and XRef file B can contain an XRef Scene object specifying XRef file C (eg: A
xrefs B, and B xrefs C). To provide access to the nested XRef scene objects, the applicable XRefScene
methods provide an optional root keyword parameter. If this argument is provided then these
methods act on the root node of the specified XRefScene value, otherwise they act on root node of
the current scene. To get to C from A, you load A and do something like:
bXref = xrefs.getXRefFile 1 -- taken from root node of current scene
cXref = xrefs.getXRefFile 1 root:bXref -- taken from root of bXref
cRoot = cXref.tree -- to get root of C
Constructor:
xrefs.addNewXRefFile <filename_string> [ #noLoad ] [root:<XRefScene>]
Adds a new XRef Scene object and returns a XRefScene value. If #noLoad is not specified,
the XRef Scene file is loaded immediately and the scene updated. If #noLoad is specified,
the scene is not updated until the user requests it. Use the updateXRef() method to load
the XRef Scene object.
If root:<XRefScene> is specified, the XRef Scene object is treated in the current file
during the current session as if it was an XRef Scene object in the file corresponding to the
XRefScene value specified. If the specified root XRef Scene object is reloaded, either
because the current scene was saved and then reloaded, or because updateXRef() was
executed on the root XRef Scene object, the XRef Scene object is deleted from the scene.
XRefScene Values 1039
Methods:
delete <XRefScene>
Deletes the XRef Scene object.
merge <XRefScene>
Merges the nodes in the XRef Scene object into the scene and deletes the XRef Scene
object.
updateXRef <XRefScene>
Tries to reload the XRef Scene object. Returns true if the operation is successful, false
otherwise.
flagChanged <XRefScene>
This method indicates that the specified XRef Scene object has been changed and should
be updated. Use the xrefs.updateChangedXRefs() method to update the changed
XRef Scene objects.
Associated Methods:
xrefs.getXRefFileCount [root:<XRefScene>]
If root is not specified, returns the total number of top-level XRef Scene objects in the
scene. If the root:<XRefScene> is specified, the total number of XRef Scene objects in
the nested XRef file within the XRefScene’s XRef file is returned.
xrefs.deleteAllXRefs [root:<XRefScene>]
If root is not specified, deletes all XRef Scene objects. If the root:<XRefScene> is
specified, only the specified XRefScene’s XRef Scene object, and its nested XRef Scene
objects, are deleted.
xrefs.updateChangedXRefs [#noRedraw] [root:<XRefScene>]
If root is not specified, updates all XRef Scene objects flagged as changed. If the
root:<XRefScene> is specified, only the specified XRefScene’s XRef Scene objects flagged
as changed are updated. If #noRedraw is specified, the viewports won’t be updated after
the XRef Scene objects are loaded. Returns true if the XRef Scene objects were loaded
okay, otherwise false.
xrefs.findUnresolvedXRefs [root:<XRefScene>]
If root is not specified, returns an array of file name strings for all the unresolved XRef
Scene objects. If the root:<XRefScene> is specified, only the unresolved XRef Scene
objects within the specified XRefScene’s XRef Scene object are returned.
xrefs.attemptUnresolvedXRefs [root:<XRefScene>]
If root is not specified, tries to load any XRef Scene objects that are currently unresolved.
If the root:<XRefScene> is specified, only the unresolved XRef Scene objects within the
specified XRefScene’s XRef Scene object are loaded.
Editable_Mesh : GeometryClass and TriMesh : Value 1041
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Class and Object Inspector Functions (p. 799)
Scripting Vertex and Control Point Animation (p. 1461)
Note:
1. Only the update() function updates the mesh’s internal caches and images in 3ds max
viewports. This is because updates can be computationally expensive and you don’t want them
performed on every function call. However, you must make sure you do call the update()
function after a series of changes and before the mesh is to be worked on in 3ds max or by other
functions in MAXScript.
2. Coordinates are given in the MAXScript working coordinate system.
1042 Chapter 11 | 3ds max Objects
3. If the update() function is called on an object that is selected and currently open in the Modify
panel, it will drop the current selection in order to avoid a potential crash in 3ds max, which at
the moment, does not support scripted changes to an object open in the Modify panel.
4. If you are creating or modifying a mesh, and have not yet run update() on the mesh, 3ds max
will crash if you minimize and then maximize the 3ds max window. This is because an only
partially created mesh is created, and the internal 3ds max mesh structure is left in an unstable
state.
Constructors (Editable_Mesh):
mesh [ length:<integer> ] [ width:<integer> ] \
[ lengthsegs:<integer> ] [ widthsegs:<integer> ]
Creates a flat rectangular mesh with the given size and number of segments. The default
length and width are 50, the default number of segments is 5.
mesh [ numverts:<number> ] [ numfaces:<number> ]
Creates a mesh of the given geometry but with no topology (i.e., no faces or edges). You
have to individually place the vertices and create the faces from the vertices. The default
number of vertices and faces are 36 and 50, respectively.
mesh vertices:<array_of_point3s> \
faces:<array_of_point3s> \
[ materialIDs:<array_of_integers> ] \
[ tverts:<array_of_point3s> ]
Creates a mesh from an array of vertices and faces. Each Point3 value in the vertices
array specifies the position of the vertex in the current coordinate system. Each Point3
value in the faces array specifies the 3 vertex indices that form the face. The
materialIDs array specifies the material ID to be assigned to each face. Each Point3 value
in the tverts array specifies the UVW coordinates of the texture vertices. See Texture
Mapping in the methods section for more information on texture vertices.
An example of construction a mesh using this form of the constructor is:
mesh vertices:#([0,0,0],[10,0,0],[0,10,0],[10,10,0]) \
faces:#([1,2,3],[2,4,3]) materialIDS:#(1,2)
collapseStack() does not collapse the effect of any world space modifiers (including
bindings to space warps). The world space modifiers remain on the object’s stack. To
collapse an object to a mesh use the snapshot() method.
Editable_Mesh : GeometryClass and TriMesh : Value 1043
Properties:
<mesh>.numverts Integer
Get or set the number of vertices
<mesh>.numfaces Integer
Get or set the number of faces
<mesh>.numtverts Integer
Get or set the number of texture vertices
1044 Chapter 11 | 3ds max Objects
<mesh>.numcpvverts Integer
Get or set the number of color-per-vertex vertices
<mesh>.mesh TriMesh
Reading this property yields a copy of the mesh, taken from after any modifiers are
applied, but before any space warps are applied. Assigning to this property sets the mesh to
the TriMesh value given. You can use this property, along with copy() and the
<node_or_baseobject>.mesh property to build a TriMesh from other objects’ meshes.
The following properties are not applicable to TriMeshes:
<mesh>.selectedVerts VertexArray
Get the currently selected vertices of the Editable_Mesh object. See VertexSelection Values
(p. 786).
<mesh>.verts VertexArray
Get all of the vertices of the Editable_Mesh object. See VertexSelection Values (p. 786).
<mesh>.selectedFaces FaceArray
Get the currently selected faces of the Editable_Mesh object. See FaceSelection Values
(p. 788).
<mesh>.Faces FaceArray
Get all of the faces of the Editable_Mesh object. See FaceSelection Values (p. 788).
<mesh>.selectedEdges EdgeArray
Get the currently selected edges of the Editable_Mesh object. See EdgeSelection Values
(p. 790).
<mesh>.Edges EdgeArray
Get all of the edges of the Editable_Mesh object. See EdgeSelection Values (p. 790).
<mesh>.displacementMapping Boolean
Get or set whether to perform displacement mapping for the Editable_Mesh object. There
is no corresponding user interface element for this property.
<mesh>.subdivisionDisplacement Boolean
Get or set whether to perform subdivision displacement for the Editable_Mesh object. This
property corresponds to the Subdivision Displacement checkbox in the Surface Properties
rollout.
<mesh>.splitMesh Boolean
Get or set whether to split the mesh during subdivision displacement. This property
corresponds to the Split Mesh checkbox in the Surface Properties rollout. Setting this
property will enable subdivisionDisplacement if it is set to false.
You can both read and assign to the above properties with the exception of the properties that return
a VertexSelection, FaceSelection, or EdgeSelection. If you assign numbers to them to add room for
more vertices or faces, the mesh will lose all current topology/geometry (i.e., vertices, faces, and
edges), assuming you want to rebuild it from scratch. If you want to retain the current topology/
geometry, use the setNumVerts(), setNumTVerts() and setNumFaces() methods described
below.
Editable_Mesh : GeometryClass and TriMesh : Value 1045
Methods:
The following methods operate on the base object in a node if no object space modifiers are present.
If object space modifiers are present, the mesh get operations access the world-state mesh, after the
object space modifiers have been applied. The mesh set operations only work on base object
Editable Meshes and signal an error if there are object space modifiers present, informing you that
the mesh is not changeable when modifiers are present. You can convert objects to Editable Meshes
with the collapseStack(), snapshot(), and convertToMesh() methods. If there are no object
space modifiers present, both get and set operations work on the base editable mesh object.
Because the mesh get operations require a mesh, the combination of base object and modifiers must
yield a mesh at the top of the modifier stack. This excludes combinations such as Patch base-objects
and deformer modifiers such as bend and twist, because they pass a patch object, not a mesh up the
stack. Applying an Edit Mesh modifier always forces the world-state object to be a mesh.
If world space modifiers are present, the mesh get operations access the world-state mesh, after any
object space modifiers have been applied, but before the world space modifiers have been applied.
Currently you can not access the position of vertices as affected by world space modifiers. The mesh
set operations will work if only world space modifiers are applied to the object. Setting a vertices
position in such a case will set it’s position before the world space modifiers have been applied. You
can create a new mesh object using the snapshot() method which accounts for the effects of world
space modifiers.
The update() method makes any scripted changes to a base object mesh visible to 3ds max and you
must call this function at some point after modifying a mesh so that 3ds max sees a valid mesh.
Because this update can be a compute-intensive operation, it is made available as a separate function
so you perform many changes on a mesh and then invoke the update just once to signal all the
changes to 3ds max.
All vertex and face indexes start at 1, following the other indexing conventions in MAXScript. All
coordinates used are relative to the current working coordinate system.
-- General Methods
update <mesh> [ geometry:<boolean> ] [ topology:<boolean> ] \
[ normals:<boolean> ] -- mapped
The three optional keyword arguments provide control over the kind of updating done to
the mesh. If the geometry: argument is true, the geometry cache is rebuilt (normals and
edge list) and the mesh’s bounding box is invalidated. If the topology: argument is true,
1046 Chapter 11 | 3ds max Objects
the edge and strip databases will be rebuilt. If normals: is true, the face normals are
computed. All flags default to true, so that a simple call to update() causes a complete
reconstruction of all the caches.
attach <mesh> <node>
Corresponds to the mesh attach function in the Editable Mesh Modify panel allowing you
to construct a mesh by adding complete objects to it. Extracts the mesh from <node> (first
converting to a mesh if need), adds it to <mesh> which must be an Editable Mesh object
and then deletes <node>. The materials and material IDs in <node> are merged into
<node> using the default settings for the attach operation in the Editable Mesh Modify
panel. This method is not applicable to TriMeshes.
meshop.attach {<target_editable_mesh_node> | <target_mesh>}
{<source_node> | <source_mesh>} \ targetNode:<node=unsupplied>
sourceNode:<node=unsupplied> \ attachMat:<{#neither | #MatToID |
#IDToMat}=#neither> condenseMat:<boolean=true> \ deleteSourceNode:<boolean=true>
Attaches the source mesh to the target mesh. If the target or source is specified as a mesh
rather than a node, the mesh is attached using the local coordinate system of the mesh,
and no material correction is performed. To get around this, if the target or source is a
mesh, the corresponding targetNode or sourceNode named parameter is checked to
see if a node is specified and, if it is, the transform and material for that node is used. If the
source or target is specified as a node, the corresponding targetNode or sourceNode
named parameter is not checked. The attachMat and condenseMat options correspond
to the attach options in editable mesh.
condenseMat is applicable only if attachMat:#IDToMat is specified. If
deleteSourceNode:false is not specified, and the source was specified as a node, or as
a mesh and a sourceNode was specified, the source node is deleted after the attach.
Examples:
meshop.attach $.baseobject $sphere02 targetNode:$
meshop.attach $box01 $box02 attachMat:#IDToMat
condenseMat:true deleteSourceNode:false
Vertex methods
meshop.breakVerts <Mesh mesh> <vertlist>
For each vertex in <vertlist>, N-1 new vertices are created at the same location, where N
is the number of faces using that vertex. Each of these faces will use one of these vertices.
meshop.chamferVerts <Mesh mesh> <vertlist> <float amount>
Chamfers the specified vertices by the specified amount.
meshop.cloneVerts <Mesh mesh> <vertlist>
Clones the specified vertices.
meshop.cutVert <Mesh mesh> <int start_vert> <point3 destination> <point3 projdir>
node:<node=unsupplied>
If <mesh> is a node, or if <mesh> is an Editable Mesh and <node> is specified,
destination and projdir are in the current coordinate system context. If <mesh> is an
Editable Mesh and <node> is not specified, destination and projdir are in the mesh’s
local coordinate system.
Returns the index of the new vertex if created, or undefined if no vertex was created.
meshop.deleteIsoVerts <Mesh mesh>
Deletes all vertices not used by a face.
meshop.deleteVerts <Mesh mesh> <vertlist>
Deletes the specified vertices.
1048 Chapter 11 | 3ds max Objects
Edge methods
meshop.chamferEdges <Mesh mesh> <edgelist> <float amount>
Chamfers the specified edges by the specified amount.
meshop.cloneEdges <Mesh mesh> <edgelist>
Clones the specified edges.
meshop.collapseEdges <Mesh mesh> <edgelist>
Collapses the specified edges.
meshop.cutEdge <Mesh mesh> <int edge1> <float prop1> <int edge2> <float prop2>
<point3 projdir> node:<node=unsupplied>
If <mesh> is a node, or if <mesh> is an Editable Mesh and <node> is specified, projdir is
in the current coordinate system context. If <mesh> is an Editable Mesh and <node> is not
specified, projdir is in the mesh’s local coordinate system.
Returns the index of the new vertex if created, or undefined if no vertex was created.
meshop.deleteEdges <Mesh mesh> <edgelist> delIsoVerts:<boolean=true>
Deletes the specified edges. If <delIsoVerts> is true, any isolated vertices are deleted.
meshop.divideEdge <Mesh mesh> <int edgeIndex> <float edgef>
visDiag1:<boolean=false> visDiag2:<boolean=false> fixNeighbors:<boolean=true>
split:<boolean=false>
Divides the specified edge at a fractional distance of <edgef> along its length.
<visDiag1> and <visDiag2> specify whether each of the two new edges will be visible.
If <fixNeighbors> is true, the face on the other side of this edge, that is, the “reverse
face”, should be divided as well to prevent the introduction of a seam. If <split> is true,
separate vertices for the two halves of the edge will be created, splitting the mesh open
along the diagonal(s).
meshop.divideEdges <Mesh mesh> <edgelist>
Divides all the specified edges in half, creating new points and subdividing faces.
meshop.edgeTessellate <Mesh mesh> <facelist> <float tension>
Tessellates the specified edges. This algorithm is exactly the one used in the Tessellate
modifier, when operating on Faces and Edge SO elements.
<tension> specifies the tension for the edge tessellation. This value should be fairly small,
between 0 and .5, and corresponds to the value in the Tessellate, Edit Mesh, or Editable
Mesh UI’s divided by 400.
meshop.extrudeEdges <Mesh mesh> <edgelist> <float height> dir:<{<point3 dir> |
#independent | #common}=#independent> node:<node=unsupplied>
Creates new edges corresponding to the specified edges, and then moves the new edges by
<height>. The direction the edges are moved is determined by <dir>. If <dir> is a
point3 value, the edges will be moved in that direction. (If <mesh> is a node, or if <mesh>
is an Editable Mesh or a Mesh value and <node> is specified, the direction is in the current
1052 Chapter 11 | 3ds max Objects
coordinate system context. If <mesh> is an Editable Mesh or a Mesh value and <node> is
not specified, the direction is in the mesh’s local coordinate system.) If
dir:#independent is specified, the edges are moved based on the normals of the faces
using the edge. If dir:#common is specified, the edges are moved based on the normals of
the face clusters using the edge.
meshop.getEdgesUsingVert <Mesh mesh> <vertlist>
Returns a bitarray of size=(#edges in mesh) with bits set for all edges that use the specified
vertices.
meshop.getOpenEdges <Mesh mesh>
Returns a bitarray of size=(#edges in mesh) with bits set for all edges that are used by a
single face.
meshop.turnEdges - renamed to turnEdge, still showing in index
meshop.turnEdge <Mesh mesh> <int edgeIndex>
Turns the specified edge. Only works on edges that have a face on both sides. These two
faces are considered as a quad, where this edge is the diagonal, and remapped so that the
diagonal flows the other way, between the vertices that were opposite this edge on each
face.
Face methods
meshop.bevelFaces <Mesh mesh> <facelist> <float height> <float outline>
dir:<{<point3 dir> | #independent |
#common}=#independent> node:<node=unsupplied>
Moves the specified faces by <height> and outlines them by <outline>. The direction
the faces are moved is determined by <dir>. If <dir> is a point3 value, the faces will be
moved in that direction. (If <mesh> is a node, or if <mesh> is an Editable Mesh or a Mesh
value and <node> is specified, the direction is in the current coordinate system context. If
<mesh> is an Editable Mesh or a Mesh value and <node> is not specified, the direction is
in the mesh’s local coordinate system.) If dir:#independent is specified, the faces are
moved based on the individual face normals. If dir:#common is specified, the faces are
moved based on the face cluster normals.
meshop.cloneFaces <Mesh mesh> <facelist>
Clones the specified faces.
meshop.collapseFaces <Mesh mesh> <facelist>
Collapses the specified faces.
meshop.cutFace <Mesh mesh> <int face> <point3 start> <point3 destination> <point3
projdir> node:<node=unsupplied>
If <mesh> is a node, or if <mesh> is an Editable Mesh and <node> is specified, start,
destination, and projdir are in the current coordinate system context. If <mesh> is an
Editable Mesh and <node> is not specified, start, destination, and projdir are in the
mesh’s local coordinate system.
Returns the index of the new vertex if created, or undefined if no vertex was created.
Editable_Mesh : GeometryClass and TriMesh : Value 1053
Mesh methods
meshop.createPolygon <Mesh mesh> <vertIndex array> smGroup:<int=0> matID:<int=1>
Creates a set of faces using the specified vertices. The order of the vertices in the faces is
the order in the vertex array. The polygon may be nonconvex, but should be (roughly)
coplanar.
<smGroup> and <matID> specify the smoothing group data and material ID number
assigned to the new faces.
meshop.cut <Mesh mesh> <int edge1Index> <float edge1f> <int edge2Index> <float
edge2f> <point3 normal> fixNeighbors:<boolean=true> split:<boolean=true>
node:<node=unsupplied>
Cuts the mesh from a point on one edge to a point on another, along a line drawn by
looking at the mesh from a particular viewpoint.
<edge1Index> specifies the edge that the cut starts on.
<edge1f> specifies the fractional distance along the edge to start the cut from.
<edge2Index> specifies the edge that the cut ends on.
<edge2f> specifies the fractional distance along the edge to finish the cut on.
<normal> specifies the direction of view. The cut will take place on this “side” of the
mesh, in the plane formed by this vector and the direction from the start to the end.
If <fixNeighbors> is true, the faces on the other side of each end of the cut should be
split to prevent splits at the ends. If <split> is true, the cut will split the mesh apart. If
false, the cut will just refine the mesh by adding geometry. If <mesh> is a node, or if
<mesh> is an Editable Mesh or a Mesh value and <node> is specified, the normal is in the
current coordinate system context. If <mesh> is an Editable Mesh or a Mesh value and
<node> is not specified, the normal is in the mesh’s local coordinate system.
meshop.getPolysUsingVert <Mesh mesh> <vertlist> ignoreVisEdges:<boolean=false>
threshhold:<float=45.>
Returns a bitarray of size=(#faces in mesh) with bits set for all faces that are in ‘polygons’
containing the specified vertices. The definition of a polygon is all faces sharing invisible
edges with edge angles below the threshhold angle. The default threshhold angle is 45
degrees. If ignoreVisEdges is set to true, the edge visibility is ignored but the threshhold is
still relevant.
1056 Chapter 11 | 3ds max Objects
By assigning controllers to the vertices, the vertices are added to the Master subAnim and
appear as animatables in the Track View, allowing further scripting of the vertices. For
example,
animateVertex $Sphere01 #all
The vertices to be animated are specified by index number or with the keyword #all to
animate all vertices.
See also Class and Object Inspector Functions (p. 799) and Scripting Vertex and Control Point
Animation (p. 1461) for details on accessing the Editable_Mesh vertices. The controller
values assigned to the vertices is in object space. See the Using Node Transform Properties
(p. 843) topic for information on converting between world space to object space.
The setMesh() method enables bulk changes to a mesh via arrays of vertices, faces, tverts, etc.
setMesh() has the following forms:
setMesh <mesh> [ numverts:<integer> ] [ numfaces:<integer> ]
Resets the mesh to the given geometry but with no topology (i.e., no faces or edges). Any
current mesh data is lost. You have to individually place the vertices and create the faces
from the vertices. The default number of vertices and faces are 36 and 50, respectively.
setMesh <mesh> [ vertices:<array_of_point3s> ] \
[ faces:<array_of_point3s> ] \
[ materialIDs:<array_of_integers> ] \
[ tverts:<array_of_point3s> ]
Resets the mesh based on the given arrays. Only those portions of the mesh that are
specified are reset. For example, if only the vertices parameter is specified, the existing
face data is retained. Each Point3 value in the vertices array specifies the position of the
vertex in the current coordinate system. Each Point3 value in the faces array specifies the
3 vertex indices that form the face. The materialIDs array specifies the material ID to be
assigned to each face. Each Point3 value in the tverts array specifies the UVW
coordinates of the texture vertices. See Texture Mapping in the methods section for more
information on texture vertices.
setMesh <mesh> [ length:<integer> ] [ width:<integer> ] [ lengthsegs:<integer> ] \
[ widthhsegs:<integer> ]
Resets the mesh with a flat rectangular mesh with the given size and number of segments.
The default length and width are 50, the default number of segments is 5.
setMesh <mesh> <trimesh>
Sets the mesh to a copy of the source TriMesh.
yields
#{2..5,9,25..27}
This is a snapshot of the selection -- the BitArray doesn’t change automatically as you
make different selections. Further, it reflects the current vertex selection whether or not
the modifier is in vertex sub-object selection mode (this selection is remembered and re-
established whenever you go back into vertex subobject mode). So, for example, if you
select some vertices then click out of vertex subobject mode, the whole object rather than
the selection is passed up the stack to the next modifier, but getVertSelection()
returns the selected vertices at the time the subobject mode was exited.
You might use the modifiers modifier array accessing scheme here if you’ve got many
edit mesh modifiers with non-unique names. You can also use a constructed string as an
index into the modifiers array, for example:
$foo.modifiers[”edit mesh” + i as string]
assuming the variable ‘i’ had some indexing value and the names were set up
thusly. ‘+’ on strings concatenates.
setVertSelection <node> [ <modifier_or_index> ] \
( <sel_bitarray> | <sel_array> ) \
[ name:<name> ] [ keep:<boolean> ]
setVertSelection <mesh> ( <sel_bitarray> | <sel_array> ) \
[ keep:<boolean> ]
Sets the vertex selections in an Editable Mesh base object, Mesh Select modifier, Edit Mesh
Modifier, or TriMesh. This mirrors the selection getting method above.
Editable_Mesh : GeometryClass and TriMesh : Value 1065
The <modifier_or_index> argument is interpreted as for the get- form above, except
that only the Mesh Select modifier is supported for set operations.
For example:
setVertSelection $foo #{1..4,100..102}
setFaceSelection $foo \
(getFaceSelection $baz) keep:true
If the optional name: argument is specified, the vertices in the specified named selection
set in the Editable Mesh or Mesh Select modifier are selected. If the name: argument is not
specified, the selection index argument gives the indexes of the sub-object items to be
selected as either a BitArray or an array of integers. If the optional keep: keyword
argument is false or not supplied, any current selection will be replaced by the new one.
If the keep: keyword argument is true, the new selection is added to the current
selection. The name: argument is not applicable to TriMeshes.
Use the mesh update() function after making a group of selection changes in order to
make them visible to any modifiers on the object.
averageSelVertCenter <node> [ <modifier_or_index> ]
Returns the average position (center) of the selected vertices in the given mesh as a Point3.
If the object is not a mesh this method returns undefined. If no vertices are selected in the
mesh, a value of [0,0,0] is returned. This method is not applicable to TriMeshes.
The <modifier_or_index> argument is interpreted as for getVertSelection.
averageSelVertNormal <node> [ <modifier_or_index> ]
Returns the normalized average of the normals of the selected vertices in the given mesh
as a Point3. If the given node is not a mesh, it returns undefined. If no vertices are selected
in the mesh, or the averaged normal is [0,0,0], a value of [1,0,0] is returned. This method is
not applicable to TriMeshes.
The <modifier_or_index> argument is interpreted as for getVertSelection.
The vertex normals used in this method do not consider smoothing group data of the
faces that use the vertex.
-- Face Methods
getNumFaces <mesh>
Returns number of faces as an integer, equivalent to using <mesh>.numfaces
getFace <mesh> <face_index_integer>
Returns the face vertex indexes for the indexed face as a point3. Each component of the
point3 value contains a vertex index.
setFace <mesh> <face_index_integer> <vert_indices_point3>
Sets the face vertex indexes for the indexed face from a point3.
setFace <mesh> <face_index_integer> <vert_index_integer> \
<vert_index_integer> <vert_index_integer>
Sets the face vertex indexes for the indexed face from 3 vertex indexes.
1066 Chapter 11 | 3ds max Objects
-- or ...
faces = meshop.getFacesUsingVert $ #(13)
edges = meshop.getEdgesUsingFace $ faces
-- get the edges on the adjacent faces that are the “reverse” of these edges
-- get the faces that use the edges, and “OR” that bitarray with the initial
-- face bitarray
faces = (meshop.getFacesUsingEdge $ edges) + faces
$.selectedVerts = meshop.getVertsUsingFace $ faces
update $
1070 Chapter 11 | 3ds max Objects
The following function returns the indices of the 2 vertices that define an edge as a Point2 value.
The two arguments to the function are a editable mesh node or TriMesh value and the edge index.
A value of undefined is returned if the first argument isn’t an editable mesh node or TriMesh value,
or if the edge index is out of range.
fn edgeVerts theObj theEdge =
( if not (classof theObj == Editable_mesh or
classof theObj == triMesh) do return undefined
if theEdge < 1 or theEdge > (theObj.numfaces*3) do return undefined
local theFace = ((theEdge-1)/3)+1
local theVerts = getFace theObj theFace
case ((mod (theEdge-1) 3) as integer) of
( 0: point2 theVerts.x theVerts.y
1: point2 theVerts.y theVerts.z
2: point2 theVerts.z theVerts.x
)
)
-- Color-Per-Vertex Methods
getNumCPVVerts <mesh>
Returns number of color-per-vertex vertices as an integer, equivalent to using
<node>.numcpvverts
setNumCPVVerts <mesh> <integer> [ <boolean> ]
Sets the number of c-p-v vertices. If the optional boolean argument is true, the existing
topology remains intact. If it is false or not supplied, the topology is lost.
buildVCFaces <mesh> [ <boolean> ]
Builds the c-p-v face array after you have set the c-p-v vertex count. If the optional boolean
argument is true, the existing topology remains intact. If it is false or not supplied, the
topology is lost.
defaultVCFaces <mesh>
Sets the number of c-p-v vertices and c-p-v faces to match exactly the current mesh’s
geometry and topology and calls buildVCFaces()
getVertColor <mesh> <CPVvert_index_integer>
Returns the color of the indexed c-p-v vertex as a color
getVCFace <mesh> <CPVface_index_integer>
Returns the topology for the indexed c-p-v face as a point3 containing 3 c-p-v vertex
indexes
setVCFace <mesh> <CPVface_index_integer> <CPVvert_indices_point3>
Sets the indexed c-p-v face topology from a point3 containing 3 c-p-v vertex indexes
setVCFace <mesh> <CPVface_index_integer> <CPVvert_index_integer> \
<CPVvert_index_integer> <CPVvert_index_integer>
Sets the indexed c-p-v face topology from 3 c-p-v vertex index number arguments
The c-p-v vertex and face indexes are 1-based as with other mesh indexes in MAXScript.
Remember that you need to call update() on the mesh after making changes to it for the
changes to be reflected in the scene.
Note:
The mesh class contains a list of color vertices which are completely independent of the regular
vertices in the mesh. There is no correlation between the number of vertices in a mesh and the
number of color vertices. In addition to the color vertices there are also color faces. There needs to
be one color face for every regular face in the mesh.
Each color face has three indices into the color vertex array. The coordinates of a color vertex are
RGB coordinates, and are accessed as Color values.
The techniques for building and accessing color vertices and faces is virtually identical to the
techniques for building and accessing texture vertices and faces. An example script for creating
planar texture mapping on an object is shown in the Working with Editable Meshes (p. 1077) topic.
Editable_Mesh : GeometryClass and TriMesh : Value 1073
a user action or a MAXScript command) causes the operation to be terminated and the highlight is
removed from the button.
In 3ds max 4, there is no access to the spinner field values in the Editable Mesh rollouts.
meshOps.startAttach <editable_mesh_node_or_modifier>
Enters “Attach” command mode - valid in Vertex, Face, Polygon, and Element Sub-Object
levels, and when not in Sub-Object mode.
meshOps.startBevel <editable_mesh_node_or_modifier>
Enters “Bevel” command mode - valid in Edge, Face, Polygon, and Element Sub-Object
levels.
meshOps.startChamfer <editable_mesh_node_or_modifier>
Enters “Chamfer” command mode - valid in Vertex and Edge Sub-Object levels.
meshOps.startCreate <editable_mesh_node_or_modifier>
Enters “Create” command mode, valid in Vertex, Face, Polygon, and Element Sub-Object
levels.
meshOps.startCut <editable_mesh_node_or_modifier>
Enters “Cut” command mode - valid in Edge, Face, Polygon, and Element Sub-Object
levels.
meshOps.startDivide <editable_mesh_node_or_modifier>
Divides selected edges into 2 edges, for selected face into 3 faces - valid in Edge, Face,
Polygon, and Element Sub-Object levels.
meshOps.startExtrude <editable_mesh_node_or_modifier>
Enters “Extrude” command mode - valid in Face, Polygon, and Element Sub-Object levels.
meshOps.startFlipNormalMode <editable_mesh_node_or_modifier>
Enters “Flip Normal” command mode - valid in Face, Polygon, and Element Sub-Object
levels.
meshOps.startSlicePlane <editable_mesh_node_or_modifier>
Enters “Slice Plane” command mode - valid in all Sub-Object levels, and when not in Sub-
Object mode.
meshOps.startTurn <editable_mesh_node_or_modifier>
Enters “Turn “ command mode - valid in Edge Sub-Object level.
meshOps.startWeldTarget <editable_mesh_node_or_modifier>
Enters “Weld Target “ command mode - valid in Vertex Sub-Object level.
The following methods invoke one of the ‘instantaneous’ button operations in the Editable Mesh
Modify panel, acting on the currently selected sub-objects:
meshOps.autoEdge <editable_mesh_node_or_modifier>
Automatically sets the edge visibility on the selected sub-objects - valid in Edge Sub-Object
level.
meshOps.break <editable_mesh_node_or_modifier>
Creates a new vertex for each face attached to the selected sub-objects - valid in Vertex
Sub-Object level.
Editable_Mesh : GeometryClass and TriMesh : Value 1075
meshOps.collapse <editable_mesh_node_or_modifier>
Collapses the selected sub-objects - valid in Vertex, Edge, Face, Polygon, and Element Sub-
Object levels.
meshOps.createShapeFromEdges <editable_mesh_node_or_modifier>
Displays Create Shape dialog allowing the user to specify an object name, shape type, and
whether to ignore hidden edges. Valid in Edge Sub-Object level.
meshOps.delete <editable_mesh_node_or_modifier>
Deletes the selected sub-objects - valid in Vertex, Face, Polygon, and Element Sub-Object
levels.
meshOps.detach <editable_mesh_node_or_modifier>
Displays Detach dialog allowing the user to specify an object name or to detach as
element, and whether to clone the selected subobjects. Valid in Vertex, Face, Polygon, and
Element Sub-Object levels.
meshOps.explode <editable_mesh_node_or_modifier>
Displays Explode to Objects dialog allowing the user to specify an object name. Explodes
the selected faces into multiple elements or objects based on the angles of its edges. Valid
in Vertex, Face, Polygon, and Element Sub-Object levels.
meshOps.flipNormal <editable_mesh_node_or_modifier>
Flips the normal of the selected faces - valid in Face, Polygon, and Element Sub-Object
levels.
meshOps.gridAlign <editable_mesh_node_or_modifier>
Aligns the selected sub-objects to the construction plane - valid in Vertex, Edge, Face,
Polygon, and Element Sub-Object levels.
meshOps.hide <editable_mesh_node_or_modifier>
Hides the selected sub-objects - valid in Vertex, Face, Polygon, and Element Sub-Object
levels.
meshOps.invisibleEdge <editable_mesh_node_or_modifier>
Sets selected edges invisible. Valid in Vertex Sub-Object level.
meshOps.makePlanar <editable_mesh_node_or_modifier>
Forces all selected sub-objects to become coplanar - valid in Vertex, Edge, Face, Polygon,
and Element Sub-Object levels.
meshOps.removeIsolatedVerts <editable_mesh_node_or_modifier>
Deletes all isolated vertices in the object regardless of the current selection.
meshOps.selectOpenEdges <editable_mesh_node_or_modifier>
Selects all edges with only one face. Valid in Edge Sub-Object level.
meshOps.slice <editable_mesh_node_or_modifier>
Subdivides edges and faces based on Slice Plane. meshOps.startSlicePlane() must be
called to enter the “Slice Plane” command mode before slice is valid. Valid in all Sub-
Object levels, and when not in Sub-Object mode.
meshOps.tessellate <editable_mesh_node_or_modifier>
Tessellates the selected sub-objects - valid in Face, Polygon, and Element Sub-Object levels.
1076 Chapter 11 | 3ds max Objects
meshOps.unhideAll <editable_mesh_node_or_modifier>
Unhides the hidden sub-objects at the current Sub-Object level - valid in Vertex, Face,
Polygon, and Element Sub-Object levels.
meshOps.unifyNormal <editable_mesh_node_or_modifier>
Unifies the normals of the selected faces - valid in Face, Polygon, and Element Sub-Object
levels.
meshOps.viewAlign <editable_mesh_node_or_modifier>
Aligns all selected sub-objects to the 0,0,0 plane of the active viewport - valid in Vertex,
Edge, Face, Polygon, and Element Sub-Object levels.
meshOps.visibleEdge <editable_mesh_node_or_modifier>
Sets selected edges visible. Valid in Edge Sub-Object level.
meshOps.weld <editable_mesh_node_or_modifier>
Welds the selected vertices - valid in Vertex Sub-Object level.
The meshOps methods depend on the Modify panel being open and the desired object, either an
Editable Mesh base object or Edit Mesh modifier, being currently open in the panel. The meshOps
methods do not perform any operation if these conditions aren’t met. You will need to use
MAXScript functions like max modify mode or setCommandPanelTaskMode mode:#modify to
open the Modify panel, select <obj> to select the object, subObjectLevel = <n> to set the Sub-
Object level, and modPanel.setCurrentObject <obj_or_modifier> to establish the right
context for the new functions to operate. For example:
Script:
s=sphere() -- create a sphere
ConvertToMesh s -- convert to an Editable Mesh
s.selectedfaces=#{1..112} -- select half the faces
max modify mode -- open the Modify panel
select s -- select the sphere
modPanel.setCurrentObject s -- set modifier stack to the base object
-- (not really needed in this example)
subObjectLevel = 4 -- set Sub-Object level to polygon
meshOps.startExtrude s -- start the face extrude command mode,
-- highlighting its button in the Edit
-- Geometry rollout, at which point the
-- user interactively performs the extrude.
which would invoke the Hide button operation on the current object open in the Modify panel if it
was an Edit Mesh modifier or Editable Mesh base object.
Working with Editable Meshes 1077
)
-- set the corresponding texture vertex “position”
settvert obj v normalize_pos
)
-- done “positioning” the texture vertices. Build the texture faces.
-- since in this case there is a 1-to-1 correspondence between mesh and
-- texture vertices, the vertex indices for a mesh face are also the
-- texture vertex indices for the texture faces.
for f = 1 to obj.numfaces do
setTVFace obj f (getface obj f)
-- all done. reset the coordinate system
set coordsys oldcoordsys
-- update the mesh so 3ds max sees the changes
update obj
)
--
-- test bed. Create a sphere, apply a material, set the diffuse map
-- to a 2x3 tiled checker map, turn on viewport display of the
-- checker texture map, and call the ApplyPlanarMap function
--
g=geosphere()
convertToMesh g
g.material=standard()
g.material.maps[2]=checker()
g.material.maps[2].coordinates.u_tiling=2
g.material.maps[2].coordinates.v_tiling=3
showTextureMap g.material g.material.maps[2] true
ApplyPlanarMap g #x
Output:
ApplyPlanarMap() -- output of function declaration lines 5 to 45
$GeoSphere:GeoSphere02 @ [0.0,0.0,0.0] -- output line 51
$Editable_Mesh:GeoSphere02 @ [0.0,0.0,0.0] -- output line 52
Standard:Standard -- output line 53
Checker:Checker -- output line 54
2 -- output line 55
3 -- output line 56
OK -- output line 57
OK -- output line 58
SplineShape : Shape 1079
SplineShape : Shape
SplineShapes are the general editable versions of all the shape objects, in the same way that Editable
Meshes relate to geometry objects. They are the objects that a shape is converted to when you apply
an Edit Spline modifier and the result of collapsing a modifier stack on a shape base object.
MAXScript lets you construct SplineShapes from scratch, adding individual curves and controls
points or you can modify an existing shape by converting it to a SplineShape and using the methods
listed below.
See also
Shape Common Properties, Operators, and Methods (p. 945)
Spline Shape Common Properties, Operators, and Methods (p. 947)
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Class and Object Inspector Functions (p. 799)
Scripting Vertex and Control Point Animation (p. 1461)
Note:
1. You must convert existing shapes to SplineShapes in order to operate on them with the these
methods. Use the convertToSplineShape() function to do this.
2. Only the updateShape() function updates the shape’s internal caches and images in 3ds max
viewports. This is because updates can be computationally expensive and you don’t want them
performed on every function call. However, you must make sure you do call the
updateShape() function after a series of changes and before the shape is to be worked on in
3ds max or by other functions in MAXScript.
3. The in and out vectors for Bezier control points are given as vector handle coordinates, not as
true vectors as the names suggests.
4. Coordinates are given in the MAXScript working coordinate system - this is important to note
if you are familiar with the corresponding SDK spline functions which always work in object-
local coordinates.
5. If the updateShape() function is called on an object that is selected and currently open in the
Modify panel, it will drop the current selection in order to avoid a potential crash in 3ds max,
which at the moment, does not support scripted changes to an object open in the Modify panel.
6. If you are creating or modifying a spline object, and have not yet run updateShape() on the
spline, 3ds max will crash if you minimize and then maximize the 3ds max window. This is
because an only partially created spline is created, and the internal 3ds max spline structure is
left in an unstable state.
1080 Chapter 11 | 3ds max Objects
Properties:
<SplineShape>.angle Float default: 0.0 -- animatable
The rotational position of the cross-section in the renderer.
<SplineShape>.thickness Float default: 1.0 -- animatable
Diameter of the rendered spline.
<SplineShape>.sides Float default: 12.0 -- animatable
Sets the number of sides for the spline mesh in the renderer. A value of 4 will give you a
square cross section, for example.
<SplineShape>.viewport_thickness Float default: 1.0
Diameter of the viewport spline.
<SplineShape>.viewport_sides Integer default: 12
Sets the number of sides for the spline mesh in the viewports. A value of 4 will give you a
square cross section, for example.
<SplineShape>.viewport_angle Float default: 0.0
The rotational position of the cross-section in the viewports.
<SplineShape>.DisplayRenderMesh Booleandefault: false
When on, displays the mesh generated by the spline in the viewports.
<SplineShape>.UseViewportSettings Boolean default: false
When on, displays the mesh generated by the Viewport settings.
<SplineShape>.DisplayRenderSettings Boolean default: true
When on, displays the mesh generated by the render settings.
<SplineShape>.numSplines Integer, read-only
The number of individual spline curves in the shape.
Up to 3*N vertex and tangent coordinates are available as properties, where N is the number of
vertices in the SplineShape. A vertex and its tangents are available as properties once a controller has
been assigned to the vertex. Controllers can be assigned to vertices using the animateVertex()
method described in the Scripting Vertex and Control Point Animation (p. 1461) topic. For example, if
a circle object is collapsed to a SplineShape, and some of its vertices are animated, the properties for
the vertices and tangents would be similar to:
$Circle01.Spline_1___InVec_1 Point3 value: [-75,33,0] -- animatable
$Circle01.Spline_1___Vertex_1 Point3 value: [-75,33,0] -- animatable
$Circle01.Spline_1___OutVec_1 Point3 value: [-50,0,0] -- animatable
$Circle01.Spline_1___InVec_2 Point3 value: [-20,-33,0] -- animatable
$Circle01.Spline_1___Vertex_2 Point3 value: [7,-66,0] -- animatable
$Circle01.Spline_1___OutVec_2 Point3 value: [32,-95,0] -- animatable
SplineShape : Shape 1081
Methods:
-- Shape Methods
updateShape <shape>
Updates the shape’s internal caches and viewport display to account for all the changes
made by other functions in this kit. This update must be done before 3ds max or any other
code tries to work with a modified shape object.
The updateShape() function makes any scripted changes to a base object spline shape
propagate into the bottom of any modifier stack that is present. Note that there is no
check to warn you that modifications such as topology changes might invalidate modifiers
already in the stack. This is equivalent to opening and modifying the base object in a
Modify panel, ignoring its warnings about invalidating the object.
resetShape <shape>
Clears all the spline curves out of a shape
numSplines <shape>
Returns the number of spline curves in the shape as an integer. Equivalent to
<shape>.numSplines.
setFirstSpline <shape> <spline_index_integer>
Rolls the order of the splines in a shape around so that the numbered spline is the first
spline in the shape. This is useful when working with multi-spline shapes in the Lofter and
some other modifiers such as Surface Tools which are sensitive to spline order.
hideselectedsplines <shape>
Hides the selected splines in the shape.
hideselectedsegments <shape>
Hides the selected segments in the shape.
hideselectedverts <shape>
Hides the segments attached to the selected knots in the shape.
unhidesegments <shape>
Unhides all segments in the shape.
addAndWeld <to_shape> <from_shape> <weldthreshold_float>
Add the splines from one spline shape to the specified bezier shape. The weld threshold
will weld the endpoints of the new splines onto endpoints of existing ones if they are
within the distance specified.
bindKnot <shape> <isEnd_boolean> <splineId_integer> \
<segIndex_integer> <splineSegId_integer>
Binds the first or end knot of a spline to the midpoint of the specified segment. A bind acts
as a constraint, it constrains the first point or the end point of a spline to the mid point of
a segment. If <isEnd_boolean> is true the end knot of the spline is bound, otherwise
the first knot is bound. <splineId_integer> specifies the index of the spline the first/
end knot to bind belongs to, <segIndex_integer> specifies the index of the segment to
bind to, and <splineSegId_integer> specifies the index of the spline the bind to
segment belongs to.
1082 Chapter 11 | 3ds max Objects
By assigning controllers to the vertices and tangents, the vertices and tangents are added
to the Master subAnim and appear as animatables in the Track View, allowing further
scripting of the vertices and tangents. For example,
animateVertex $Circle01 #all
The vertices to be animated are specified by index number or with the keyword #all to
animate all vertices.
See also Class and Object Inspector Functions (p. 799) and Scripting Vertex and Control Point
Animation (p. 1461) for details on accessing the splineshape vertices and tangents. The
controller values assigned to the vertices and tangent handles is in object space. See the
Using Node Transform Properties (p. 843) topic for information on converting between world
space to object space.
-- Spline Methods
addNewSpline <shape>
Adds a new spline curve to the spline shape and returns an integer reflecting the spline
index of the newly added spline curve. Individual spline curves are given index numbers
starting at 1. The addNewSpline() function adds new spline curves to the end of the list
of curves in a shape.
getSplineSelection <shape>
Returns the indices of the selected splines in the shape as an array of integers.
setSplineSelection <shape> <spline_index_array> [ keep:<boolean> ]
Selects the splines specified by <spline_index_array> in the specified shape.
<spline_index_array> is an array of integers specifying the spline indices. Splines
already selected are de-selected unless keep:true is specified.
deleteSpline <shape> <spline_index_integer>
Deletes the indexed spline curve from the shape. The remaining curves are renumbered to
account for the deletion.
SplineShape : Shape 1083
If you have made scripted changes to the shape you must call the updateShape() method on the
mesh before calling these methods. You do not need to call updateShape() after just calling one
of these methods, as 3ds max will take care of updating the shape.
The following methods invoke one of the ‘user-interaction’ button operations in the Editable Spline
Modify panel, acting on the currently selected sub-objects. These methods highlight the
corresponding button in the Geometry rollout and start the operation, at which point the user
interactively completes the operation. These methods return after starting the operation, and before
the user completes the operation, so care should be taken to ensure that your script does not
interfere with the operation. Invoking any of these methods is the same as clicking on the associated
button in the Modify panel. Calling a method when the operation is already in effect (either due to
a user action or a MAXScript command) causes the operation to be terminated and the highlight is
removed from the button.
splineOps.startUnion <editable_spline_or_line_node_or_modifier>
Enters “Boolean Union” command mode - valid in Spline Sub-Object level. Only 1 closed
spline must be selected to enter this command mode.
splineOps.startSubtract <editable_spline_or_line_node_or_modifier>
Enters “Boolean Subtract” command mode - valid in Spline Sub-Object level. Only 1 closed
spline must be selected to enter this command mode.
splineOps.intersect <editable_spline_or_line_node_or_modifier>
Enters “Boolean Intersect” command mode - valid in Spline Sub-Object level. Only 1
closed spline must be selected to enter this command mode.
splineOps.startAttach <editable_spline_or_line_node_or_modifier>
Enters “Attach” command mode - valid in all Sub-Object levels, and when not in Sub-
Object mode.
splineOps.startBind <editable_spline_or_line_node_or_modifier>
Enters “Bind” command mode - valid in Vertex Sub-Object level.
splineOps.startBreak <editable_spline_or_line_node_or_modifier>
Enters “Break” command mode - valid in Vertex and Segment Sub-Object levels.
splineOps.startChamfer <editable_spline_or_line_node_or_modifier>
Enters “Chamfer” command mode - valid in Vertex Sub-Object level.
splineOps.startConnect <editable_spline_or_line_node_or_modifier>
Enters “Connect” command mode - valid in Vertex Sub-Object level.
splineOps.startCreateLine <editable_spline_or_line_node_or_modifier>
Enters “Create Line” command mode - valid in all Sub-Object levels, and when not in Sub-
Object mode.
splineOps.startCrossInsert <editable_spline_or_line_node_or_modifier>
Enters “CrossInsert” command mode - valid in Vertex Sub-Object level.
splineOps.startExtend <editable_spline_or_line_node_or_modifier>
Enters “Extend” command mode - valid in Spline Sub-Object level.
splineOps.startFillet <editable_spline_or_line_node_or_modifier>
Enters “Fillet” command mode - valid in Vertex Sub-Object level.
SplineShape : Shape 1087
splineOps.startInsert <editable_spline_or_line_node_or_modifier>
Enters “Insert” command mode - valid in all Sub-Object levels, and when not in Sub-
Object mode.
splineOps.startOutline <editable_spline_or_line_node_or_modifier>
Enters “Outline” command mode - valid in Spline Sub-Object level.
splineOps.startRefine <editable_spline_or_line_node_or_modifier>
Enters “Refine” command mode - valid in Vertex and Segment Sub-Object levels. This
method does not turn off the Connect checkbox, so it is effectively the same as the
startRefineConnect() method.
splineOps.startRefineConnect <editable_spline_or_line_node_or_modifier>
Enters “Refine” command mode - valid in Vertex and Segment Sub-Object levels. This
method does not turn on the Connect checkbox, so it is effectively the same as the
startRefine() method.
splineOps.startTrim <editable_spline_or_line_node_or_modifier>
Enters “Trim” command mode - valid in Spline Sub-Object level.
The following methods invoke one of the ‘instantaneous’ button operations in the Editable Shape
Modify panel, acting on the currently selected sub-objects:
splineOps.attachMultiple <editable_spline_or_line_node_or_modifier>
Displays Attach Multiple dialog allowing the user to select multiple shapes to attach. Valid
in all Sub-Object levels, and when not in Sub-Object mode.
splineOps.close <editable_spline_or_line_node_or_modifier>
Closes the selected splines – valid in Spline Sub-Object level.
splineOps.cycle <editable_spline_or_line_node_or_modifier>
Cycles through the vertices of the spline, selecting each vertex. At least one vertex must be
selected before calling this method, or no vertex is selected. If more than one vertex is
selected when this method is called, the first vertex of the first shape is selected. Valid in
Vertex Sub-Object level.
splineOps.delete <editable_spline_or_line_node_or_modifier>
Deletes the selected sub-objects - valid in all Sub-Object levels.
splineOps.detach <editable_spline_or_line_node_or_modifier>
Displays Detach dialog allowing the user to specify an object name. Valid in all Sub-Object
levels.
splineOps.divide <editable_spline_or_line_node_or_modifier>
Divides the selected segments - valid in Segment Sub-Object level.
splineOps.explode <editable_spline_or_line_node_or_modifier>
Explodes the each segment in the selected splines into separate splines or objects. Valid in
Spline Sub-Object level.
splineOps.hide <editable_spline_or_line_node_or_modifier>
Hides the selected sub-objects - valid in all Sub-Object levels.
splineOps.makeFirst <editable_spline_or_line_node_or_modifier>
Makes the selected vertices the first vertex in the spline- valid in Vertex Sub-Object level.
1088 Chapter 11 | 3ds max Objects
splineOps.mirrorBoth <editable_spline_or_line_node_or_modifier>
Mirrors the selected splines horizontally and vertically – valid in Spline Sub-Object level.
splineOps.mirrorHoriz <editable_spline_or_line_node_or_modifier>
Mirrors the selected splines horizontally – valid in Spline Sub-Object level.
splineOps.mirrorVert <editable_spline_or_line_node_or_modifier>
Mirrors the selected splines vertically – valid in Spline Sub-Object level.
splineOps.reverse <editable_spline_or_line_node_or_modifier>
Reverses the order of vertices in the selected splines – valid in Spline Sub-Object level.
splineOps.unbind <editable_spline_or_line_node_or_modifier>
Unbinds the selected vertices - valid in Vertex Sub-Object level.
splineOps.unhideAll <editable_spline_or_line_node_or_modifier>
Unhides all hidden sub-objects -valid in all Sub-Object levels, and when not in Sub-Object
mode.
splineOps.weld <editable_spline_or_line_node_or_modifier>
Welds the selected vertices - valid in Vertex Sub-Object level.
Patch : GeometryClass
Patches are the general editable versions of all the patch objects, in the same way that Editable
Meshes relate to geometry objects. They are the objects that a patch is converted to when you apply
an Edit Patch modifier and the result of collapsing a modifier stack on a patch base object. While
MAXScript lets you construct patches, there are no properties or methods for accessing or modifying
the sub-objects (vertices, edges, and patches) within the patch object.
Constructor:
patch ...
To create a Patch scene object from scratch, you call the Patch constructor function, for
example:
patch pos:[10,10,10] name:”foo”
Properties:
A control vertex and its tangents are available as properties once a controller has been assigned to
the control vertex. The number of tangents for a control vertex is the number of edges associated
with the control vertex. Controllers can not be assigned to the control vertices using MAXScript in
3ds max 4. If a TriPatch object is collapsed to a SplineShape, and some of its control vertices are
animated, the properties for the control vertices and tangents would be similar to:
$TriPatch01.Vertex_1 Point3 value: [-21.5,-6.4,0] -- animatable
$TriPatch01.Vertex_1_Vector_1 Point3 value: [-21.5,-2.1,0] -- animatable
$TriPatch01.Vertex_1_Vector_2 Point3 value: [-7.1,-6.4,0] -- animatable
$TriPatch01.Vertex_2 Point3 value: [21.5,-6.4,0] -- animatable
$TriPatch01.Vertex_2_Vector_1 Point3 value: [7.1,-6.4,0] -- animatable
$TriPatch01.Vertex_2_Vector_2 Point3 value: [7.1,-2.1,0] -- animatable
See also Class and Object Inspector Functions (p. 799) for details on accessing the patch vertices and
tangents. The controller values assigned to the vertices and tangent handles is in object space. See
the Using Node Transform Properties (p. 843) topic for information on converting between world space
to object space.
Methods:
getPatchSteps <editable_patch_node>
Returns the number of steps the patch uses in the viewports, and reflects the View Steps
spinner in the Modify panel.
setPatchSteps <editable_patch_node> <integer>
Sets the number of View Steps used by the editable patch object to the specified value.
Editable Patch Modify Panel Command Modes and Operations
A suite of methods provide the ability for a script to invoke Editable Patch and Edit Mesh Modify
panel modes and operations, corresponding to buttons available at various mesh sub-object levels.
These methods reside in the patchOps global structure. These methods effectively “push the
button” in the Modify panel. In order to use these methods, the node must be selected and the
Modify panel open. In the description of these methods, the first argument
<editable_patch_node_or_modifier> should be interpreted as either an Editable Patch node
where the modifier stack level is at the base object, or an Edit Patch modifier where the modifier
stack level is at the Edit Patch. In all cases, the following methods work at the current sub-object
level, but only if that level is appropriate for the invoked operation.
The follow methods invoke one of the ‘user-interaction’ button operations in the Editable Patch
Modify panel, acting on the currently selected sub-objects. These methods highlight the
corresponding button in the Geometry rollout and start the operation, at which point the user
interactively completes the operation. These methods return after starting the operation, and before
the user completes the operation, so care should be taken to ensure that your script does not
interfere with the operation. Invoking any of these methods is the same as clicking on the associated
button in the Modify panel. Calling a method when the operation is already in effect (either due to
a user action or a MAXScript command) causes the operation to be terminated and the highlight is
removed from the button.
1090 Chapter 11 | 3ds max Objects
patchOps.startAttach <editable_patch_node_or_modifier>
Enters “Attach” command mode - valid in all Sub-Object levels, and when not in Sub-
Object mode.
patchOps.startBevel <editable_patch_node_or_modifier>
Enters “Bevel” command mode - valid in Patch Sub-Object level.
patchOps.startBind <editable_patch_node_or_modifier>
Enters “Bind” command mode - valid in Vertex Sub-Object level.
patchOps.startCreate <editable_patch_node_or_modifier>
Enters “Create” command mode - valid in Vertex, Patch, and Element Sub-Object levels.
patchOps.startExtrude <editable_patch_node_or_modifier>
Enters “Extrude” command mode - valid in Patch Sub-Object level.
patchOps.startFlipNormalMode <editable_patch_node_or_modifier>
Enters “Flip Normal” command mode - valid in Patch and Element Sub-Object levels.
patchOps.startWeldTarget <editable_patch_node_or_modifier>
Enters “Weld Target” command mode - valid in Vertex Sub-Object level.
The following methods invoke one of the ‘instantaneous’ button operations in the Editable Patch
Modify panel, acting on the currently selected sub-objects:
patchOps.addTri <editable_patch_node_or_modifier>
Adds a TriPatch to the selected edge - valid in Edge Sub-Object level.
patchOps.addQuad <editable_patch_node_or_modifier>
Adds a QuadPatch to the selected edge - valid in Edge Sub-Object level.
patchOps.break <editable_patch_node_or_modifier>
Creates a new vertex for each patch attached to the selected sub-objects - valid in Vertex
and Edge Sub-Object levels.
patchOps.clearAllSG <editable_patch_node_or_modifier>
Clears the smoothing groups on the currently selected patches - valid in Face, Polygon,
and Element Sub-Object levels.
patchOps.createShapeFromEdges <editable_patch_node_or_modifier>
Displays Create Shape dialog allowing the user to specify an object name for the shape to
create from the selected edges. Valid in Edge Sub-Object level.
patchOps.delete <editable_patch_node_or_modifier>
Deletes the selected sub-objects - valid in all Sub-Object levels.
patchOps.detach <editable_patch_node_or_modifier>
Displays Detach dialog allowing the user to specify an object name. Valid in Patch Sub-
Object level.
patchOps.flipNormal <editable_patch_node_or_modifier>
Flips the normal of the selected patches - valid in Patch and Element Sub-Object levels.
patchOps.hide <editable_patch_node_or_modifier>
Hides the selected sub-objects - valid in all Sub-Object levels.
Patch : GeometryClass 1091
patchOps.selectByID <editable_patch_node_or_modifier>
Display a Select By Material ID dialog and choose patches with the specified material ID -
valid in Patch and Element Sub-Object levels.
patchOps.selectBySG <editable_patch_node_or_modifier>
Display a Select By Smooth Groups dialog and choose patches with the specified
smoothing groupd IDs - valid in Patch and Element Sub-Object levels.
patchOps.selectOpenEdges <editable_patch_node_or_modifier>
Selects all edges with only one patch. Valid in Edge Sub-Object level.
patchOps.subdivide <editable_patch_node_or_modifier>
Divides the selected sub-objects - valid in Edge and Patch Sub-Object levels.
patchOps.unbind <editable_patch_node_or_modifier>
Unbinds the selected vertices - valid in Vertex Sub-Object level.
patchOps.unifyNormal <editable_patch_node_or_modifier>
Unifies the normals of the selected patches - valid in Patch and Element Sub-Object levels.
patchOps.unhideAll <editable_patch_node_or_modifier>
Unhides all hidden sub-objects -valid in all Sub-Object levels, and when not in Sub-Object
mode.
patchOps.weld <editable_patch_node_or_modifier>
Welds the selected vertices - valid in Vertex Sub-Object level.
There is now a new patch function containing a large number of functions for creating,
modifying and accessing patch objects.
The following functions are used to get and set the overall geometry of the patch.
Set keep:true to the setNumXXX functions for them to retain existing vertex/vector/patch/edge
data. This value defaults to false, which cleans out the geometry
patch.getNumVerts <obj> -> integer
patch.setNumVerts <obj> <num> [keep:<boolean>]
patch.getNumVecs <obj> -> integer
patch.setNumVecs <obj> <num> [keep:<boolean>]
patch.getNumPatches <obj> -> integer
patch.setNumPatches <obj> <num> [keep:<boolean>]
patch.getNumEdges <obj> -> integer
patch.setNumEdges <obj> <num> [keep:<boolean>]
The following functions get and set individual vertex and vector handle locations. The vertex and
vector coordinates are interpreted in MAXScript’s current working coordinate context. Consistent
with the rest of MAXScript, all vertex/patch/vector/edge indexes start numbering at 1.
patch.getVert <obj> <index> -> Point3
patch.setVert <obj> <index> <point3>
patch.getVec <obj> <index> -> Point3
patch.setVec <obj> <index> <point3>
1092 Chapter 11 | 3ds max Objects
The following two functions are the main mechanism for creating individual patches in the
patch mesh.
patch.makeQuadPatch <obj> <index> <va> <vab> <vba> <vb> <vbc> <vcb> <vc> <vcd>
<vdc> <vd> <vda> <vad> <i1> <i2> <i3> <i4> <sm>
where:
index = The index of the patch to create (0> = index < numPatches).
va = The first vertex.
vab = Vector ab.
vba = Vector ba.
vb = The second vertex.
vbc = Vector bc.
vcb = Vector cb.
vc = The third vertex.
vcd = Vector cd.
vdc = Vector dc.
vd = The fourth vertex.
vda = Vector da.
vad = Vector ad.
i1 = Interior 1.
i2 = Interior 2.
i3 = Interior 3.
i4 = Interior 4.
sm = The smoothing group mask
patch.makeTriPatch <obj> <index> <va> <vab> <vba> <vb> <vbc> <vcb> <vc> <vca> <vac>
<i1> <i2> <i3> <sm>
where:
index = The index of the patch to create (0> = index < numPatches).
va = The first vertex.
vab = Vector ab.
vba = Vector ba.
vb = The second vertex.
vbc = Vector bc.
vcb = Vector cb.
vc = The third vertex.
vca = Vector ca.
Patch : GeometryClass 1093
The following functions give access to the topology of an existing patch object. They return either
indexes or arrays of indexes of the sub-objects requested. For example, getVertVecs() returns an
array of the vectors coming out of the specified vertex.
patch.getVertVecs <obj> <index> -> integer_array
patch.getVertPatches <obj> <index> -> integer_array
patch.getVertEdges <obj> <index> -> integer_array
patch.getVecVert <obj> <index> -> integer
patch.getVecPatches <obj> <index> -> integer_array
patch.getEdgeVert1 <obj> <index> -> integer
patch.getEdgeVert2 <obj> <index> -> integer
patch.getEdgeVec12 <obj> <index> -> integer
patch.getEdgeVec21 <obj> <index> -> integer
The following functions access and manipulate the texture mapping information in the patch
object.
patch.setNumMaps <obj> <num> [keep:<bool>] ->
patch.getNumMaps <obj> -> integer
patch.setMapSupport <obj> <map_chan> [init:<boolean>] ->
patch.getMapSupport <obj> <map_chan> -> boolean
patch.maxMapChannels <obj> ->
patch.setNumMapVerts <obj> <map_chan> <num> [keep:<boolean>]
patch.getNumMapVerts <obj> <map_index>
patch.setNumMapPatches <obj> <map_chan> <num> [keep:<boolean>]
patch.getMapVert <obj> <map_chan> <index>
patch.setMapVert <obj> <map_chan> <index> <point3>
patch.getMapPatch <obj> <map_chan> <index>
patch.setMapPatch <obj> <map_chan> <index> <index_array>
1094 Chapter 11 | 3ds max Objects
The following functions get and set the material ID for the patch object as a whole or for individual
patches.
patch.getMtlID <obj> -> integer
patch.setMtlID <obj> <mtl_id>
patch.getPatchMtlID <obj> <index> -> integer
patch.setPatchMtlID <obj> <patch_index> <mtl_id>
The following functions access and control viewport and renderer tesselation and visibility.
patch.setMeshSteps <obj> <steps>
patch.getMeshSteps <obj>
patch.setMeshStepsRender <obj> <steps>
patch.getMeshStepsRender <obj>
patch.setShowInterior <obj> <bool>
patch.getShowInterior <obj>
patch.setAdaptive <obj> <bool>
patch.getAdaptive <obj>
The following functions access topology info for the specified sub-object.
patch.getEdges <obj> <v1> [<v2>] -> integer_array
patch.getPatches <obj> <v1> [<v2>] -> integer_array
patch.getVectors <obj> <vert> -> integer_array
The following function transforms all the vertices and vectors in the patch object by the given
matrix. This transform happens in object local space.
patch.transform <obj> <matrix3>
The following functions get and manipulate surface normal information. Again, normal vectors are
given in MAXScript’s current working coordinate context.
patch.patchNormal <obj> <patch>
patch.edgeNormal <obj> <edge>
patch.updatePatchNormals <obj>
patch.flipPatchNormal <obj> <patch>
patch.unifyNormals <obj>
patch.autoSmooth <obj> <angle> <useSel_bool> <preventIndirectSmoothing_bool>
Patch : GeometryClass 1095
The following functions access and change the vertex and interior vertex types:
patch.changeVertType <obj> <vert> #corner|#coplanar
patch.getVertType <obj> <vert> -> #corner or #coplanar
patch.changePatchInteriorType <obj> <patch> #automatic|#manual
patch.getPatchInteriorType <obj> <patch> -> #automatic or #manual
The following function returns the current mesh tesselation for the patch object:
patch.getMesh <obj> -> mesh value
The following functions are used to interpolate individual patch surfaces. A tri-patch interpolation
takes u,v,w barycentric coordinates. A quad-patch takes u and c parameters. In both cases, the point
returns is given in the current MAXScript working coordinate context.
patch.interpTriPatch <obj> <patch> <u> <v> <w> -> point3
patch.interpQuadPatch <obj> <patch> <u> <v> -> point3
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Class and Object Inspector Functions (p. 799)
Scripting Vertex and Control Point Animation (p. 1461)
You can then access modifier properties as subproperties on the modifier as shown. If the
modifier name has spaces in it, you can use the ‘_’ as space convention that pathnames use,
like this:
$box1.uvw_map -- to get the ‘UVW Map’ modifier
• This will work in simple situations, but there may be several modifiers with the same name, or
a modifier with the same name as a creation parameter (which is always looked for first). In this
situation you can use the modifier array mechanism, which yields an array of modifiers you can
index into:
$box1.modifiers -- get modifier array
$box1.modifiers[3] -- get the 3rd down the list
$box1.modifiers[#twist] -- get the one named “twist”
$box1.modifiers[”ffd 4x4x4”] -- get the FFD
As you can see from the examples, you can use both name literals and strings to index modifiers
by name in the table, so this is a way to get at modifiers with characters you cannot use in a
MAXScript property name.
The ordering is as you would see in the Modify panel, numbered starting at 1 from
top-to-bottom.
The classes derived directly from the Modifier and SpacewarpModifier classes are described in the
Modifier and SpacewarpModifier Types (p. 1100) topic.
The properties, operators, and methods that are common to all classes derived directly from the
Modifier and SpacewarpModifier classes are described in the Modifier Common Properties, Operators,
and Methods (p. 1096) topic.
The Modifier and SpacewarpModifier classes are derived from the MAXWrapper class, and inherits
the properties and methods defined for that class. These properties and methods are described in the
MAXWrapper Common Properties, Operators, and Methods (p. 809) topic.
Associated Methods:
The modifier stack on a scene node can be manipulated using the following <node> methods:
validModifier ( <node> | <objectset>) <modifier>
Tests whether a particular modifier may be added the given <node> or <objectset>.
Returns true if so, false if not.
The validModifier() method operates exactly as does the Modify panel in determining
modifier applicability. Any modifier that takes a deformable object will return true for all
scene objects except Helpers. This corresponds to the Modify panel’s behavior of allowing
modifiers such as Bend, Taper, etc. to be applied to lights and cameras, space warp objects,
etc., as well as geometry types like box, sphere, etc., but not helpers such as dummys or
bones.
addModifier <node> <modifier> [before:index] -- mapped
adds the modifier to all instances of the node to which the function is applied. The
optional before: keyword argument can be used to insert the modifier into the node’s
modifier stack just before the indexed modifier, counting from the top of the stack. The
added modifier will apply to any appropriate active sub-object selection in the node only if
the node is currently selected and open in the Modify panel at the desired sub-object level.
You can use the 3ds max System global variable, subObjectLevel to test and set the level
for the object currently open in the Modify panel. For example:
max modify mode -- open mod panel
select $box01 -- select box01 into mod panel
subObjectLevel = 3 -- subobject level to Face
addModifier $box01 (ffd_2x2x2()) -- add FFD mod to those faces
If the before: keyword argument would place a modifier in an invalid position in the
stack, the modifier will be placed at the nearest valid position. For example, if you tried to
place a SpacewarpModifier class object below a Modifier class object, the
SpacewarpModifier object would be placed below any SpacewarpModifier objects, and
above any Modifier objects.
If <node> is a collection, an instance of the modifier is placed on each of the nodes in the
collection. Unlike interactively applying a modifier to a selection, the position and size of
each modifier instance’s gizmo corresponds to position and size of the node the modifier
instance is applied to. To apply a modifier to a collection in the same manner that 3ds max
applies modifiers, use the modPanel.addModToSelection() described in the Modify
Panel (p. 1572) topic.
A limitation of the addModifier() function is that it cannot generally apply modifiers to
sub-object selections, and so it disables any current sub-object levels. To apply a modifier
to a sub-object selection in the same manner that 3ds max applies modifiers, use the
modPanel.addModToSelection(). This function correctly observes the currently
selected sub-object level in the Modify panel.
1098 Chapter 11 | 3ds max Objects
See also
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Modifier Sub-Object Transform Properties (p. 1099)
Modifier Sub-Object Transform Properties 1099
There are two special considerations when accessing FFD control points. First, you can only access
control points that have ALREADY been animated by hand, or by using the animateVertex() or
the animateAll() MAXScript functions (see the Scripting Vertex and Control Point Animation
(p. 1461) topic). The FFD doesn’t actually create accessible control points until you do this, a
behavior that shows up in the track view in normal 3ds max use - you cannot actually place control
point keyframes in the track view until you’ve animated the control point.
Second, control point coordinates are in FFD lattice space. This is a normalized space, with [0,0,0] at
the lower left-hand corner (at control_point_1) and [1,1,1] at the opposite corner of the FFD lattice,
so you have to be careful about computing and scaling correct coordinates when you set them. This
is also reflected in the track view for FFD control points in normal 3ds max use - if you look at their
values in a keyframe property dialog or a function graph, they are in this normalized lattice space,
not world-space coordinates. You’d have to work in this space also if you tried to use expression
controllers to control FFDs. The modifier utility functions getModContextBBoxMin() and
getModContextBBoxMin() can be used to determine the world-space bounds of an FFD lattice
allowing you to compute scaled lattice space coordinates from world coordinates. See details on
these functions in the Modifier Common Properties, Operators, and Methods (p. 1096) topic. An example
1100 Chapter 11 | 3ds max Objects
of accessing and converting coordinate systems for FFD control points is shown in the following
script:
b=box pos:[10,20,0]
ffd=ffdbox()
addModifier b ffd
animateVertex ffd 64
cp64posL=ffd.control_point_64
objTM=b.objecttransform
modTM=(getModContextTM b ffd)*ffd.lattice_transform.value
modBBMin=getModContextBBoxMin b ffd
modBBMax=getModContextBBoxMax b ffd
cp64posW=(modBBMin+(cp64posL*(modBBMax-modBBMin)) * (inverse modTM) * objTM
Modifiers
Affect_Region : Modifier
Constructor:
affect_region ...
Properties:
<Affect_Region>.falloff Float default: 20.0 -- animatable
Distance in current units from the center to the edge of a sphere defining the affected
region. Use higher falloff settings to achieve more gradual slopes, depending on the scale
of your geometry.
<Affect_Region>.Pinch Float default: 0.0 -- animatable
Raises and lowers the top point of the curve along the vertical axis. Sets the relative
“pointedness” of the region. When negative, a crater is produced instead of a point. At a
setting of 0, Pinch produces a smooth transition across this axis.
1104 Chapter 11 | 3ds max Objects
See also
Modifier Sub-Object Transform Properties (p. 1099)
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Bend : Modifier
Constructor:
bend ...
Properties:
<Bend>.angle Float default: 0.0 -- animatable
The angle to bend from the vertical plane.
<Bend>.direction Float default: 0.0 -- animatable
The direction of the bend relative to the horizontal plane.
Bend : Modifier 1105
See also
Modifier Sub-Object Transform Properties (p. 1099)
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
1106 Chapter 11 | 3ds max Objects
Bevel : Modifier
Constructor:
bevel ...
Properties:
<Bevel>.Cap_Bottom Integer default: 1
When on, caps the end with the lowest local Z value (bottom) of the object. When turned
off, the bottom is open.
OFF
ON
<Bevel>.Cap_Top Integer default: 1
When on, caps the end with the highest local Z value (top) of the object. When turned off,
the end is left open.
OFF
ON
<Bevel>.Cap_Type Integer default: 0
Sets cap type:
Morph (Creates cap faces suitable for morphing.)
Grid (Creates cap faces in a grid pattern. This cap type deforms and renders better than
morph capping.)
<Bevel>.Side_Type Integer default: 0
Side type:
Linear Sides (Segment interpolation between levels follows a straight line.)
Curved Sides (Segment interpolation between levels follows a Bezier curve.)
<Bevel>.segments Integer default: 1 -- animatable
The number of intermediate segments between each level.
<Bevel>.Smooth_Levels Integer default: 0
Controls whether smoothing groups are applied to the sides of a beveled object. Caps
always use a different smoothing group than the sides. When turned on, smoothing
groups are applied to the sides, and the sides appear rounded. When turned off,
smoothing groups are not applied, and the sides appear as flat bevels.
OFF
ON
<Bevel>.Produce_Mapping_Coords Integer default: 0
When turned on, mapping coordinates are applied to the beveled object.
OFF
ON
Bevel : Modifier 1107
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
1108 Chapter 11 | 3ds max Objects
Bevel_Profile : Modifier
Constructor:
bevel_profile ...
Properties:
<Bevel_Profile>.Produce_Mapping_Coords Integer default: 0
When on, assigns UV coordinates.
OFF
ON
<Bevel_Profile>.Cap_Bottom Integer default: 1
When on, caps the end with the lowest local Z value (bottom) of the object. When turned
off, the bottom is open.
OFF
ON
<Bevel_Profile>.Cap_Top Integer default: 1
When on, caps the end with the highest local Z value (top) of the object. When turned off,
the end is left open.
OFF
ON
<Bevel_Profile>.Cap_Type Integer default: 0
Cap type:
Morph (Selects a deterministic method of capping that provides the same number of
vertices for morphing between objects.)
Grid (Creates gridded caps that are better for cap deformations.)
<Bevel_Profile>.Keep_Lines_From_Crossing Integer default: 0
When on, prevents beveled surfaces from self intersecting. This requires more processor
calculation and can be time-consuming in complex geometry.
OFF
ON
<Bevel_Profile>.Separation_Between_Lines Float default: 1.0 -- animatable
The distance that sides should be kept apart to prevent intersections.
<Bevel_Profile>.profile_gizmo SubAnim
You can move, scale, and rotate the gizmo to alter the effect of the bevel profile modifier
on the object.
<Bevel_Profile.Profile_Gizmo>.position Point3 default: [0,0,0] --
animatable
The position of the profile gizmo.
CameraMap : Modifier 1109
See also
Modifier Sub-Object Transform Properties (p. 1099)
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
CameraMap : Modifier
Constructor:
cameraMap ...
Properties:
There are no additional properties for CameraMap.
Note:
There is no way to set the Camera using MAXScript in 3ds max 4.
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
1110 Chapter 11 | 3ds max Objects
Cap_Holes : Modifier
Constructor:
cap_holes ...
Properties:
<Cap_Holes>.Smooth_New_Faces Integer default: 1
When on, assigns the same smoothing group number to all new faces. If possible, this will
be a smoothing group number not used elsewhere in the object.
OFF
ON
<Cap_Holes>.Smooth_With_Old_Faces Integer default: 0
Smoothes new triangular faces using the smoothing groups from bordering old faces. This
smoothes only one level in from the perimeter of the border of the hole, so you might
need to use both this and the Smooth New Faces option to properly smooth a large hole.
OFF
ON
<Cap_Holes>.Make_All_New_Edges_Visible Integer default: 0
When on, makes all of the edges visible in the new faces.
OFF
ON
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
CrossSection : Modifier
Constructor:
crossSection ...
Properties:
There are no additional properties for CrossSection.
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
DeleteMesh : Modifier 1111
DeleteMesh : Modifier
Constructor:
deleteMesh ...
Properties:
There are no additional properties for DeleteMesh.
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
DeleteSplineModifier : Modifier
Constructor:
deleteSplineModifier ...
Properties:
There are no additional properties for DeleteSplineModifier.
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Disp_Approx : Modifier
Constructor:
disp_Approx ...
Properties:
There are no additional properties for Disp_Approx.
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
1112 Chapter 11 | 3ds max Objects
Displace : Modifier
Constructor:
displace ...
Properties:
<Displace>.strength Float default: 0.0 -- animatable
When set to 0.0, Displace has no effect. Values greater than 0.0 displace object geometry or
particles away from the position of the gizmo. Values less than 0.0 displace geometry
toward the gizmo.
<Displace>.decay Float default: 0.0 -- animatable
Varies the displacement strength with distance. By default, Displace has the same strength
throughout world space. Increasing Decay causes the displacement strength to diminish as
distance increases from the position of the Displace gizmo. This has the effect of
concentrating the force field near the gizmo, similar to the field around a magnet repelling
its opposite charge.
<Displace>.lumCenterEnable Boolean default: false
When on, the software uses .center to determine which level of gray Displace uses as
the zero displacement value.
<Displace>.center Float default: 0.5 -- animatable, alias:
lumCenter
By default, Displace centers the luminance by using medium (50 percent) gray as the zero
displacement value. Gray values greater than 128 displace in the outward direction (away
from the Displace gizmo) and gray values less than 128 displace in the inward direction
(toward the Displace gizmo). This value adjusts the default. With a Planar projection, the
displaced geometry is repositioned above or below the Planar gizmo.
<Displace>.bitmap Bitmap default: undefined
This bitmap is used for displacement.
<Displace>.map TextureMap default: undefined
This texture map is used for displacement.
<Displace>.blur Float default: 0.0 -- animatable
Blurs or softens the effect of the bitmapped displacement by increasing the value.
<Displace>.maptype Integer default: 0
Type of map projection:
Planar (Projects the map from a single plane.)
Cylindrical (Projects the map as if it were wrapped around the cylinder.)
Spherical (Projects the map from a sphere, with singularities at the top and bottom of the
sphere where the bitmap edges meet at the sphere’s poles.)
Shrink Wrap (Projects the map from a sphere, as Spherical does, but truncates the corners
of the map and joins them all at a single pole, creating only one singularity at the bottom.)
Displace : Modifier 1113
<Displace>.gizmo SubAnim
You can move, scale, and rotate the gizmo to alter the effect of the displacement modifier
on the object.
<Displace.Gizmo>.position Point3 default: [0,0,0] -- animatable
The position of the displace gizmo.
<Displace.Gizmo>.rotation Quat default: (quat 0 0 -1 0) -- animatable
The rotation of the displace gizmo.
<Displace.Gizmo>.scale Point3 default: [1,1,1] -- animatable
The scaling of the displace gizmo.
Note:
The Gizmo property is not present until the Displace modifier has been applied to a node.
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Edit_Mesh : Modifier
Constructor:
edit_mesh ...
Properties:
There are no additional properties for Edit_Mesh.
See the getVertSelection(), getFaceSelection(), and getEdgeSelection() functions in
the Editable_Mesh (p. 1041) topic for information about accessing the current selections in the
Edit_Mesh modifier.
See the Editable Mesh Modify Panel Command Modes and Operations section in the Editable_Mesh
(p. 1041) topic for information on invoking the various Edit_Mesh operations.
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Edit_Patch : Modifier 1115
Edit_Patch : Modifier
Constructor:
edit_patch ...
Properties:
There are no additional properties for Edit_Patch.
See the Editable Patch Modify Panel Command Modes and Operations section in the Patch (p. 1088)
topic for information on invoking the various Edit_Patch operations.
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Edit_Spline : Modifier
Constructor:
edit_spline ...
Properties:
There are no additional properties for Edit_Spline.
See the Editable Spline Modify Panel Command Modes and Operations section in the SplineShape
(p. 1079) topic for information on invoking the various Edit_Spline operations.
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Extrude : Modifier
Constructor:
extrude ...
Properties:
<Extrude>.amount Float default: 25.0 -- animatable
The depth of the extrusion.
<Extrude>.segs Integer default: 1 -- animatable, alias: segments
The number of segments that will be created in the extruded object.
1116 Chapter 11 | 3ds max Objects
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
FFDBox : Modifier 1117
FFDBox : Modifier
Constructor:
ffdBox ...
Properties:
<FFDBox>.dispLattice Boolean default: true -- alias: Lattice
Draws lines connecting the control points to make a grid.
<FFDBox>.dispSource Boolean default: false -- alias: Source_Volume
Displays the control points and lattice in their unmodified state.
<FFDBox>.deformType Integer default: 0
deformType = 0 - Only In Volume; 1 - All Vertices
<FFDBox>.falloff Float default: 0.0 -- animatable
Determines the distance from the lattice that the FFD effect will decrease to zero.
<FFDBox>.tension Float default: 25.0 -- animatable
Adjusts the tension of the deformation splines.
<FFDBox>.continuity Float default: 25.0 -- animatable
Adjusts the continuity of the deformation splines.
<FFDBox>.inPoints Boolean default: true -- alias: Inside_Points
Only control points inside the object are affected by Conform to Shape.
<FFDBox>.outPoints Boolean default: true -- alias: Outside_Points
Only control points outside the object are affected by Conform to Shape.
<FFDBox>.offset Float default: 0.05 -- animatable
The distance by which control points affected by Conform to Shape are offset from the
object surface.
<FFDBox>.lattice_transform SubAnim
<FFDBox.lattice_transform>.position Point3 default: [0,0,0] -- animatable
<FFDBox.lattice_transform>.rotation Quat default: (quat 0 0 0 1) -- animatable
<FFDBox.lattice_transform>.scale Point3 default: [1,1,1] -- animatable
Methods:
conformToShape <FFDBox>
conforms the control points of the FFD to the node the FFD is applied to. If an instance of
the FFD modifier has been applied to more than one object, no action is performed.
resetLattice <FFDBox>
resets the control points of the FFD to their default positions.
getDimensions <FFDBox>
setDimensions <FFDBox> <Point3>
Get and set the number of control points for the FFDBox modifier. The first component
value in the Point3 specifies the number of Width control points, the second the number
of Length control points, and the third the number of Height control points. The
minimum value for each component value is 2.
1118 Chapter 11 | 3ds max Objects
By assigning controllers to the control points, the control points are added to the Master
subAnim and appear as animatables in the Track View, allowing further scripting of the
control points. For example,
animateVertex $box01.modifier[1] #all
The control points to be animated are specified by index number or with the keyword
#all to animate all control points.
See also Class and Object Inspector Functions (p. 799) and Scripting Vertex and Control Point
Animation (p. 1461) for details on accessing the control points in an FFD and Modifier Sub-
Object Transform Properties (p. 1099) for details on the coordinate system used for FFD
control points.
animateAll <FFDBox>
Applies controllers to all control points of the FFD modifier.
Note:
The default number of control points in a FFDBox created by MAXScript is 4x4x4.
See also
Modifier Sub-Object Transform Properties (p. 1099)
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Class and Object Inspector Functions (p. 799)
Scripting Vertex and Control Point Animation (p. 1461)
Modifier Sub-Object Transform Properties (p. 1099)
FFDCyl : Modifier 1119
FFDCyl : Modifier
Constructor:
ffdCyl ...
Properties:
<FFDCyl>.dispLattice Boolean default: true -- alias: Lattice
Draws lines connecting the control points to make a grid.
<FFDCyl>.dispSource Boolean default: false -- alias: Source_Volume
Displays the control points and lattice in their unmodified state.
<FFDCyl>.deformType Integer default: 0
Deform type:
Only In Volume (Deforms vertices that lie inside the source volume. Vertices outside the
source volume are not affected.)
All Vertices (Deforms all vertices regardless of whether they lie inside or outside the source
volume depending on the value in the Falloff spinner. The deformation outside the
volume is a continuous extrapolation of the deformation inside the volume. Note that the
deformation can be extreme for points far away from the source lattice.)
<FFDCyl>.falloff Float default: 0.0 -- animatable
Determines the distance from the lattice that the FFD effect will decrease to zero.
<FFDCyl>.tension Float default: 25.0 -- animatable
Adjusts the tension of the deformation splines.
<FFDCyl>.continuity Float default: 25.0 -- animatable
Adjusts the continuity of the deformation splines.
<FFDCyl>.inPoints Boolean default: true -- alias: Inside_Points
Only control points inside the object are affected by Conform to Shape.
<FFDCyl>.outPoints Boolean default: true -- alias: Outside_Points
Only control points outside the object are affected by Conform to Shape.
<FFDCyl>.offset Float default: 0.05 -- animatable
The distance by which control points affected by Conform to Shape are offset from the
object surface.
<FFDCyl>.lattice_transform SubAnim
Methods:
conformToShape <FFDCyl>
conforms the control points of the FFD to the node the FFD is applied to. If an instance of
the FFD modifier has been applied to more than one object, no action is performed.
resetLattice <FFDCyl>
resets the control points of the FFD to their default positions.
getDimensions <FFDCyl>
setDimensions <FFDCyl> <Point3>
sets the number of control points for the FFDCyl modifier. The first component value in
the Point3 specifies the number of Side control points, the second the number of Radial
control points, and the third the number of Height control points. The minimum
component values are 6, 2, and 2, respectively.
animateVertex <FFDCyl> <control_point_spec>
Applies controllers to the specified control points of the FFD modifier, where
<control_point_spec> is one of:
<integer_index>
<integer_index_array>
#all
By assigning controllers to the control points, the control points are added to the Master
subAnim and appear as animatables in the Track View, allowing further scripting of the
control points. For example,
animateVertex $box01.modifier[1] #all
The control points to be animated are specified by index number or with the keyword
#all to animate all control points.
See also Class and Object Inspector Functions (p. 799) and Scripting Vertex and Control Point
Animation (p. 1461) for details on accessing the control points in an FFD and Modifier Sub-
Object Transform Properties (p. 1099) for details on the coordinate system used for FFD
control points.
animateAll <FFDCyl>
Applies controllers to all control points of the FFD modifier.
Note:
The default number of control points in a FFDCyl created by MAXScript is always 4x6x4.
See also
Modifier Sub-Object Transform Properties (p. 1099)
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Class and Object Inspector Functions (p. 799)
FFD_2x2x2 : Modifier 1121
FFD_2x2x2 : Modifier
Constructor:
ffd_2x2x2 ...
Properties:
<FFD_2x2x2>.dispLattice Boolean default: true -- alias: Lattice
Draws lines connecting the control points to make a grid.
<FFD_2x2x2>.dispSource Boolean default: false -- alias: Source_Volume
Displays the control points and lattice in their unmodified state.
<FFD_2x2x2>.deformType Integer default: 0
Deform type:
Only In Volume (Deforms vertices that lie inside the source volume. Vertices outside the
source volume are not affected.)
All Vertices (Deforms all vertices, regardless of whether they lie inside or outside the source
volume.)
<FFD_2x2x2>.inPoints Boolean default: true -- alias: Inside_Points
Only control points inside the object are affected by Conform to Shape.
<FFD_2x2x2>.outPoints Boolean default: true -- alias: Outside_Points
Only control points outside the object are affected by Conform to Shape.
<FFD_2x2x2>.offset Float default: 0.05 -- animatable
The distance by which control points affected by Conform to Shape are offset from the
object surface.
<FFD_2x2x2>.lattice_transform SubAnim
Note:
The Falloff, Tension, and Continuity parameters are not accessible by MAXScript in 3ds max 4.
1122 Chapter 11 | 3ds max Objects
Methods:
conformToShape <FFD_2x2x2>
conforms the control points of the FFD to the node the FFD is applied to. If an instance of
the FFD modifier has been applied to more than one object, no action is performed.
resetLattice <FFD_2x2x2>
resets the control points of the FFD to their default positions.
animateVertex <FFD_2x2x2> <control_point_spec>
Applies controllers to the specified control points of the FFD modifier, where
<control_point_spec> is one of:
<integer_index>
<integer_index_array>
#all
By assigning controllers to the control points, the control points are added to the Master
subAnim and appear as animatables in the Track View, allowing further scripting of the
control points. For example,
animateVertex $box01.modifier[1] #all
The control points to be animated are specified by index number or with the keyword
#all to animate all control points.
See also Class and Object Inspector Functions (p. 799) and Scripting Vertex and Control Point
Animation (p. 1461) for details on accessing the control points in an FFD and Modifier Sub-
Object Transform Properties (p. 1099) for details on the coordinate system used for FFD
control points.
animateAll <FFD_2x2x2>
Applies controllers to all control points of the FFD modifier.
See also
Modifier Sub-Object Transform Properties (p. 1099)
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Class and Object Inspector Functions (p. 799)
Scripting Vertex and Control Point Animation (p. 1461)
Modifier Sub-Object Transform Properties (p. 1099)
FFD_3x3x3 : Modifier 1123
FFD_3x3x3 : Modifier
Constructor:
ffd_3x3x3 ...
Properties:
<FFD_3x3x3>.dispLattice Boolean default: true -- alias: Lattice
Draws lines connecting the control points to make a grid.
<FFD_3x3x3>.dispSource Boolean default: false -- alias: Source_Volume
Displays the control points and lattice in their unmodified state.
<FFD_3x3x3>.deformType Integer default: 0
Deform type:
Only In Volume (Deforms vertices that lie inside the source volume.)
All Vertices (Deforms all vertices, regardless of whether they lie inside or outside the source
volume.)
<FFD_3x3x3>.inPoints Boolean default: true -- alias: Inside_Points
Only control points inside the object are affected by Conform to Shape.
<FFD_3x3x3>.outPoints Boolean default: true -- alias: Outside_Points
Only control points outside the object are affected by Conform to Shape.
<FFD_3x3x3>.offset Float default: 0.05 -- animatable
The distance by which control points affected by Conform to Shape are offset from the
object surface.
<FFD_3x3x3>.lattice_transform SubAnim
Note:
The Falloff, Tension, and Continuity parameters are not accessible by MAXScript in 3ds max 4.
Methods:
conformToShape <FFD_3x3x3>
conforms the control points of the FFD to the node the FFD is applied to. If an instance of
the FFD modifier has been applied to more than one object, no action is performed.
resetLattice <FFDBox>
resets the control points of the FFD to their default positions.
1124 Chapter 11 | 3ds max Objects
By assigning controllers to the control points, the control points are added to the Master
subAnim and appear as animatables in the Track View, allowing further scripting of the
control points. For example,
animateVertex $box01.modifier[1] #all
The control points to be animated are specified by index number or with the keyword
#all to animate all control points.
See also Class and Object Inspector Functions (p. 799) and Scripting Vertex and Control Point
Animation (p. 1461) for details on accessing the control points in an FFD and Modifier Sub-
Object Transform Properties (p. 1099) for details on the coordinate system used for FFD
control points.
animateAll <FFD_3x3x3>
Applies controllers to all control points of the FFD modifier.
See also
Modifier Sub-Object Transform Properties (p. 1099)
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Class and Object Inspector Functions (p. 799)
Scripting Vertex and Control Point Animation (p. 1461)
Modifier Sub-Object Transform Properties (p. 1099)
FFD_4x4x4 : Modifier
Constructor:
ffd_4x4x4 ...
Properties:
<FFD_4x4x4>.dispLattice Boolean default: true -- alias: Lattice
Draws lines connecting the control points to make a grid.
<FFD_4x4x4>.dispSource Boolean default: false -- alias: Source_Volume
Displays the control points and lattice in their unmodified state.
FFD_4x4x4 : Modifier 1125
Note:
The Falloff, Tension, and Continuity parameters are not accessible by MAXScript in 3ds max 4.
Methods:
conformToShape <FFD_4x4x4>
conforms the control points of the FFD to the node the FFD is applied to. If an instance of
the FFD modifier has been applied to more than one object, no action is performed.
resetLattice <FFDBox>
resets the control points of the FFD to their default positions.
animateVertex <FFD_4x4x4> <control_point_spec>
Applies controllers to the specified control points of the FFD modifier, where
<control_point_spec> is one of:
<integer_index>
<integer_index_array>
#all
By assigning controllers to the control points, the control points are added to the Master
subAnim and appear as animatables in the Track View, allowing further scripting of the
control points. For example,
animateVertex $box01.modifier[1] #all
1126 Chapter 11 | 3ds max Objects
The control points to be animated are specified by index number or with the keyword
#all to animate all control points.
See also Class and Object Inspector Functions (p. 799) and Scripting Vertex and Control Point
Animation (p. 1461) for details on accessing the control points in an FFD and Modifier Sub-
Object Transform Properties (p. 1099) for details on the coordinate system used for FFD
control points.
animateAll <FFD_4x4x4>
Applies controllers to all control points of the FFD modifier.
See also
Modifier Sub-Object Transform Properties (p. 1099)
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Class and Object Inspector Functions (p. 799)
Scripting Vertex and Control Point Animation (p. 1461)
Modifier Sub-Object Transform Properties (p. 1099)
FFD_Select : Modifier
Constructor:
ffd_select ...
Properties:
There are no additional properties for FFD_Select.
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Face_Extrude : Modifier 1127
Face_Extrude : Modifier
Constructor:
face_extrude ...
Properties:
<Face_Extrude>.amount Float default: 0.0 -- animatable
The extent of the extrusion.
<Face_Extrude>.scale Float default: 100.0 -- animatable
Scales each cluster of selected faces independently about its center.
<Face_Extrude>.extrude_center Point3 default: [0,0,0] -- animatable; alias:
extrudeFromCenter
Extrudes each vertex radially from the point.
Note:
The Extrude From Center parameter is not accessible by MAXScript in 3ds max 4.
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Fillet_Chamfer : Modifier
Constructor:
fillet_chamfer ...
Properties:
There are no additional properties for Fillet_Chamfer.
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
1128 Chapter 11 | 3ds max Objects
Flex : Modifier
Constructor:
flex ...
NumberVertices <flex>
Returns and integer containing the number of points in the system.
SelectVertices <flex> <sel> <update>
Selects the vertices passed in sel.
Sel (bitarray) - The bitarray that holds the selection.
Update (boolean) - Determines whether the viewports get updated.
GetSelectedVertices <flex>
Returns bitarray containing the current selected vertices.
GetVertexWeight <flex> <index>
Returns the weight of a specific vertex.
index (integer) - The index of the vertex you want to get the weight of.
SetVertexWeight <flex> <Index_tab> <values_tab>
Sets the weight of vertices. These tables should be the same size.
index_tab (integer table) - A table of indices of the vertex you want to set the weight of.
values_tab (float table) - A table of values containing the weights.
SetEdgeList <flex> <sel> <update>
Sets the edges to sel.
Sel (bitarray) - The bitarray that holds the edge selection.
Update (boolean) - Determines whether the viewports get updated.
GetEdgeList <flex>
Returns bitarray containing the current edge selection list.
AddSpringFromSelection <flex> <flag> <addDupes>
This creates one spring between 2 selected vertices that belong to a group.
flag (integer) - The group that this spring will belong to.
addDupes (boolean) - Will add duplicates if true.
addSpring <flex> <a> <b> <flag> <addDupes>
This creates a spring between the 2 specified vertices.
a (integer) - Index of vertex of the start of the spring.
b (integer) - Index of the vertex of the end of the spring.
flag (integer) - Group springs belongs to (0 to12).
addDupes (boolean) – When true, if there is a duplicate spring it will be added.
removeAllSprings <flex>
Removes all the springs the in the system.
addSpringButton <flex>
Equivalent of hitting the Add Spring button in the interface.
RemoveSpringButton <flex>
Equivalent of hitting the Remove Spring button in the interface.
optionsButton <flex>
Equivalent of hitting the Options button in the interface.
1132 Chapter 11 | 3ds max Objects
createSimpleSoftButton <flex>
Equivalent of hitting the Create Simple Soft Bodies button in the interface.
RemoveSpringByEnd <flex> <a>
This removes all springs that are connected to a vertex.
a (integer) – The vertex index to be checked.
removeSpringByEnds <flex> <a> <b>
This removes all springs that are connected to both vertex a and b.
a (integer) – First vertex index.
b (integer) – Second vertex index.
removeSpringByIndex <flex> <index>
Remove a spring from the list which is at index in the spring list.
index (integer) – Index of the spring.
numberSprings <flex>
Returns the number of springs in the system
getSpringGroup <flex> <index>
Returns the group that the spring belongs to.
index (integer) – Index of the spring you want to examine.
setSpringGroup <flex> <index> <group>
Sets the spring’s groups.
index (integer) – Index of the spring.
group (integer) – The group number (0-12).
getSpringLength <flex> <index>
Gets the rest length of a particular spring.
index (integer) – Index of the spring that you want to examine.
setSpringLength <flex> <index> <length>
Sets the rest length of a particular spring.
index (integer) – Index of the spring that you want to examine.
length (float) – The rest length of the spring.
getIndex <flex> <a> <b>
Returns the index of a spring that uses vertex a and b.
a (integer) – Index of the start vertex of the spring.
b (integer) – Index of the start end of the spring.
FlexOps Methods:
flexOps.GetNumberVertices <Flex>
Returns the number of vertices in the object the Flex modifier is applied to.
flexOps.GetVertexWeight <Flex> <vertex_index_integer>
Returns the weight of the specified vertex.
flexOps.SelectVertices <Flex> \
( <vertex_index_integer> | <index_integer_array> | <bitarray> )
Lathe : Modifier 1133
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Lathe : Modifier
Constructor:
lathe ...
Properties:
<Lathe>.degrees Float default: 360.0 -- animatable, angle
Determines the number of degrees that the object is spun around the axis of revolution (0
to 360, default=360). You can set keyframes for Degrees to animate the circular growth of a
lathed object. The Lathe axis auto-sizes itself to the height of the shape being lathed.
<Lathe>.weldCore Boolean default: false
When on, simplifies the mesh by welding together vertices that lie on the axis of
revolution.
<Lathe>.flipNormals Boolean default: false
Depending on the direction of the vertices on your shape, and the direction of rotation,
the lathed object might be inside out. Toggle this value to fix this.
<Lathe>.segs Integer default: 16 -- animatable, alias: segments
Determines how many interpolated segments are created in the surface between the start
and endpoint.
1134 Chapter 11 | 3ds max Objects
Note:
The Flip Normals, Generate Material IDs, and Use Shape IDs properties are not accessible by
MAXScript in 3ds max 4.
See also
Modifier Sub-Object Transform Properties (p. 1099)
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Lattice : Modifier
Constructor:
lattice ...
Properties:
<Lattice>.Strut_Radius Float default: 2.0 -- animatable
The radius of the struts.
<Lattice>.Strut_Segments Integer default: 1 -- animatable
The number of segments along the struts. Increase this value when you need to deform or
distort the struts with subsequent modifiers.
<Lattice>.Strut_Sides Integer default: 4 -- animatable
The number of sides around the perimeter of the struts.
<Lattice>.Joint_Radius Float default: 5.0 -- animatable
The radius of the joints.
<Lattice>.Joint_Segs Integer default: 1 -- animatable
The number of segments in the joints. The more segments, the more spherical the joints’
shape.
Note:
The Geometry, Struts Material ID, Struts Ignore Hidden Edges, Struts End Caps, Struts Smooth, Joints
Base Type, Joints Material ID, Joints Smooth, and Mapping Coordinates parameters are not
accessible by MAXScript in 3ds max 4.
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
1136 Chapter 11 | 3ds max Objects
Linked_XForm : Modifier
Constructor:
linked_xform ...
Properties:
<Linked_xform>.Control Node default: undefined
Object that the vertices are linked to. When transformed, the vertices follow.
Note:
While you can assign a node to the Control property in MAXScript, an internal transform in
Linked_XForm is not properly set. This will cause an immediate, undesired offset of the geometry of
the node the modifier is applied to.
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
MaterialByElement : Modifier
Constructor:
materialByElement ...
Properties:
<MaterialByElement>.method Integer default: 1
Set method:
Random Distribution (Assigns the materials at random to different elements in the object.)
List Frequency (Determines an approximate relative weight (percentage) for each of up to
eight material ID’s)
<MaterialByElement>.Material_ID_Count Integer default: 2 -- animatable
The minimum number of material IDs to assign. Because material ID assignment is
random, setting it to the number of materials in the multi/sub-object material or higher
doesn’t guarantee that all materials get used.
<MaterialByElement>.Material_ID__1 Float default: 0.5 -- animatable
Approximate relative weight (percentage) for first material ID.
<MaterialByElement>.Material_ID__2 Float default: 0.5 -- animatable
Approximate relative weight (percentage) for second material ID.
<MaterialByElement>.Material_ID__3 Float default: 0.0 -- animatable
Approximate relative weight (percentage) for third material ID.
<MaterialByElement>.Material_ID__4 Float default: 0.0 -- animatable
Approximate relative weight (percentage) for fourth material ID.
MaterialModifier : Modifier 1137
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
MaterialModifier : Modifier
Constructor:
materialModifier ...
Properties:
<Materialmodifier>.materialid Integer default: 1 -- animatable, alias:
Material_ID
The material ID to be assigned. If the input object is in face sub-selection, then the ID is
only applied to selected faces, otherwise it is applied to the entire object. The ID number
refers to one of the materials in a multi/sub-object material.
Note:
The default modifier name used when creating a MaterialModifier modifier is “material”. If you then
try to access the modifier as a property of the node it is applied to, a name conflict occurs with the
material property of nodes. To prevent this conflict, you should specify a name during
MaterialModifier creation. For example:
addModifier myObj (materialModifier materialID:5 name:”MaterialMod”)
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
1138 Chapter 11 | 3ds max Objects
Melt : Modifier
Constructor:
melt ...
See also
Modifier Sub-Object Transform Properties (p. 1099)
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
MeshSmooth : Modifier
Constructor:
meshSmooth ...
Properties:
<MeshSmooth>.subdivMethod Integer default: 2
Selects the Subdivision method to use:
Classic (Produces three- and four-sided facets.)
Quad Output (Produces only four-sided facets.)
NURMS (Produces Non-Uniform Rational MeshSmooth object.)
<MeshSmooth>.Apply_To_Whole_Mesh Boolean default: true
When turned on, any sub-object selection passed up the stack is ignored and MeshSmooth
is applied to the entire object. Note that the sub-object selection is still passed up the stack
to any subsequent modifiers.
<MeshSmooth>.ignoreSel Boolean default: true
When turned on, any sub-object selection passed up the stack is ignored and MeshSmooth
is applied to the entire object.
<MeshSmooth>.oldMapping Boolean default: false
Uses the algorithm from the previous release of the program to apply MeshSmooth to the
mapping coordinates. This technique tends to distort the underlying mapping coordinates
as it creates new faces and as texture coordinates shift.
<MeshSmooth>.iterations Integer default: 0 -- animatable
The number of iterations used to smooth the mesh. Each iteration generates new faces
using the vertices created from the previous iteration.
1140 Chapter 11 | 3ds max Objects
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Mesh_Select : Modifier
Constructor:
mesh_select ...
Properties:
<Mesh_Select>.Use_Soft_Selection Integer default: 0 -- animatable
Use_Soft_Selection = 0 - off; 1 - on
<Mesh_Select>.falloff Float default: 20.0 -- animatable
<Mesh_Select>.Pinch Float default: 0.0 -- animatable
<Mesh_Select>.Bubble Float default: 0.0 -- animatable
Mirror : Modifier 1143
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Mirror : Modifier
Constructor:
mirror ...
Properties:
<Mirror>.mirror_axis Integer default: 0
The axis or axes about which the mirroring takes place:
X
Y
Z
XY
YZ
ZX
<Mirror>.Mirror_Offset Float default: 0.0 -- animatable
The offset, in units, from the mirror axis.
<Mirror>.copy Boolean default: false
When on, copies the geometry rather than simply mirroring it.
<Mirror>.mirror_center SubAnim
Represents the axis of the mirror effect. You can move, rotate or scale the gizmo to affect
the mirroring.
<Mirror.Mirror_Center>.position Point3 default: [0,0,0] -- animatable
The position of the mirror center.
<Mirror.Mirror_Center>.rotation Quat default: (quat 0 0 0 1) -- animatable
The rotation of the mirror center.
<Mirror.Mirror_Center>.scale Point3 default: [1,1,1] -- animatable
The scaling of the mirror center.
1144 Chapter 11 | 3ds max Objects
See also
Modifier Sub-Object Transform Properties (p. 1099)
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Morpher : Modifier
Constructor:
Morpher ...
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
NCurve_Sel : Modifier 1145
NCurve_Sel : Modifier
Constructor:
NCurve_Sel ...
Properties:
There are no additional properties for NCurve_Sel.
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
NoiseModifier : Modifier
Constructor:
noiseModifier ...
Properties:
<Noisemodifier>.seed Integer default: 0 -- animatable
A random start point is generated from the number you set.
<Noisemodifier>.scale Float default: 100.0 -- animatable
The size of the noise effect (not strength). Larger values produce smoother noise, lower
values more jagged noise.
<Noisemodifier>.fractal Boolean default: false -- animatable
When on, produces a fractal effect based on current settings.
<Noisemodifier>.roughness Float default: 0.0 -- animatable, alias: rough
The extent of fractal variation. Lower values are less rough than higher values.
<Noisemodifier>.iterations Float default: 6.0 -- animatable
The number of iterations (or octaves) used by the fractal function. Fewer iterations use less
fractal energy and generate a smoother effect. An iteration of 1.0 is the same as turning
.fractal off.
<Noisemodifier>.strength Point3 default: [0,0,0] -- animatable
The strength of the noise effect along each of three axes. Enter a value for at least one of
these axes to produce a noise effect.
<Noisemodifier>.animate Boolean default: false
Enables/disables animation playback.
<Noisemodifier>.frequency Float default: 0.25
The speed of the noise effect. Higher frequencies make the noise quiver faster. Lower
frequencies produce a smoother and more gentle noise.
<Noisemodifier>.phase Time default: 0f -- animatable
1146 Chapter 11 | 3ds max Objects
See also
Modifier Sub-Object Transform Properties (p. 1099)
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Normalize_Spline : Modifier
Constructor:
normalize_spline ...
Properties:
<normalize_spline>.Length Float default: 20.0
Determines how many control points are added. Smaller values produce more control
points; larger values produce fewer.
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
NormalModifier : Modifier 1147
NormalModifier : Modifier
Constructor:
normalModifier ...
Properties:
<Normalmodifier>.unify Boolean default: false
When on, unifies the normals of an object by flipping the normals so that they all point in
the same direction, usually outward.
<Normalmodifier>.flip Boolean default: false
When on, reverses the direction of all the surface normals of the faces of the selected
object or objects.
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
NSurf_Sel : Modifier
Constructor:
NSurf_Sel ...
Properties:
There are no additional properties for NSurf_Sel.
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
1148 Chapter 11 | 3ds max Objects
Optimize : Modifier
Constructor:
optimize ...
Properties:
<optimize>.renderLOD Integer default: 0
You can store two different optimization settings for the renderer, in two separate levels;
L1 & L2. Set the level of display for the default scanline renderer:
L1
L2
<optimize>.viewLOD Integer default: 0
You can store two different optimization settings for the viewport, in two separate levels;
L1 & L2. Set the level of display for the viewport:
L1
L2
<optimize>.facethreshold1 Float default: 4.0 -- animatable, angle, alias:
Face_Threshold_L1
The threshold angle used to determine which faces are collapsed. Low values produce less
optimization but better approximations of the original shape. Higher values improve
optimization, but are more likely to result in faces that render poorly .
<optimize>.edgethreshold1 Float default: 1.0 -- animatable, angle, alias:
Edge_Threshold_L1
Sets a different threshold angle for open edges (those that bound only one face). A low
value preserves open edges. At the same time you can apply a high face threshold to get
good optimization.
<optimize>.bias1 Float default: 0.1 -- animatable, alias: Bias_L1
Helps eliminate the skinny or degenerate triangles that occur during optimization, which
can cause rendering artifacts. Higher values keeps triangles from becoming degenerate.
The default of 0.1 is enough to eliminate the skinniest triangles.
<optimize>.Max_Edge_Length_1 Float default: 0.0 -- animatable
The maximum length, beyond which an edge cannot be stretched when optimized. When
Max_Edge_Length_1 is 0, it has no effect. Any value greater than 0 specifies the
maximum length of the edges.
<optimize>.preservemat1 Boolean default: false
When on, prevents face collapse across material boundaries.
<optimize>.preservesmooth1 Boolean default: false
When turned on, allows only faces that share at least one smoothing group to collapse.
Optimize : Modifier 1149
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
1150 Chapter 11 | 3ds max Objects
PatchDeform : Modifier
Constructor:
patchDeform ...
Properties:
<PatchDeform>.U_Percent Float default: 50.0 -- animatable,
percentage
Moves the object along the U (horizontal) axis of the gizmo patch, based on a percentage
of the U distance. This defaults to a setting of 50 percent, which places the object at the
center of the gizmo patch. A setting of 0 percent places the object at the left edge of the
gizmo patch, as seen from the viewport where the patch was created.
<PatchDeform>.U_Stretch Float default: 1.0 -- animatable
Scales the object along the U (horizontal) axis of the gizmo patch.
<PatchDeform>.V_Percent Float default: 50.0 -- animatable,
percentage
Moves the object along the V (vertical) axis of the gizmo patch, based on a percentage of
the V distance. A setting of 0 percent places the object at the bottom of the gizmo patch.
<PatchDeform>.V_Stretch Float default: 1.0 -- animatable
Scales the object along the V (vertical) axis of the gizmo patch.
<PatchDeform>.rotation Float default: 0.0 -- animatable, angle
Rotates the modified object with respect to the gizmo patch.
<PatchDeform>.Plane_to_Patch_Deform Integer default: 0
Choose a two-axis plane of the object to make parallel with the XY plane of the gizmo
patch:
XY
YZ
ZX
<PatchDeform>.Flip_deformation_axis Integer default: 0
When on, reverses the gizmo direction.
Don’t flip
Flip
<PatchDeform>.gizmo SubAnim
At this sub-object level, you can transform and animate the gizmo like any other object,
altering the effect of the modifier. The PatchDeform gizmo is a representation of the
deforming patch object, so transforming it determines which part of the patch affects the
modified object.
PathDeform : Modifier 1151
See also
Modifier Sub-Object Transform Properties (p. 1099)
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
PathDeform : Modifier
Constructor:
pathDeform ...
Properties:
<PathDeform>.path Node default: undefined
The selected path object.
<PathDeform>.Percent_along_path Float default: 0.0 -- animatable,
percentage
Moves the object along the gizmo path based on a percentage of the path length.
<PathDeform>.Stretch Float default: 1.0 -- animatable
Scales the object along the gizmo path, using the object’s pivot point as the base of the
scale.
<PathDeform>.rotation Float default: 0.0 -- animatable, angle
Rotates the object about the gizmo path.
<PathDeform>.Twist Float default: 0.0 -- animatable, angle
Twists the object about the path. The twist angle is based on the rotation of one end of the
overall length of the path. Typically, the deformed object takes up only a portion of the
path, so the effect can be subtle.
1152 Chapter 11 | 3ds max Objects
See also
Modifier Sub-Object Transform Properties (p. 1099)
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Preserve : Modifier
Constructor:
preserve ...
Properties:
<Preserve>.iterations Integer default: 25 -- animatable
The number of calculations toward the solution. The higher this number, the closer the
object comes to matching the original object and the slower the process. When this is set
to zero, the original object has no effect, as if the Preserve modifier were never applied.
<Preserve>.Edge_Length_Weight Float default: 1.0 -- animatable
The relative importance of the edge length.
Push : Modifier 1153
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Push : Modifier
Constructor:
push ...
Properties:
<Push>.Push_Value Float default: 0.0 -- animatable
The distance in world units by which vertices are moved with respect to the object center.
Use a positive value to move vertices outward, or a negative value to move vertices inward.
1154 Chapter 11 | 3ds max Objects
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Relax : Modifier
Constructor:
relax ...
Properties:
<Relax>.iterations Integer default: 1 -- animatable
The number of times Relax is repeated. Each iteration recalculates average vertex locations
based on the result of the previous iteration.
<Relax>.Relax_Value Float default: 0.5 -- animatable
The distance a vertex moves as a percentage of the distance between a vertex and the
average location of its neighbors.
<Relax>.Keep_Boundary_Pts_Fixed Integer default: 1
When on, vertices at the edge of open meshes do not relax.
OFF
ON
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Ripple : Modifier
Constructor:
ripple ...
Properties:
<Ripple>.amplitude1 Float default: 5.0 -- animatable, alias: Amplitude_1
The amplitude of the first ripple.
<Ripple>.amplitude2 Float default: 5.0 -- animatable, alias: Amplitude_2
The amplitude of the second ripple, which is perpendicular to the first ripple.
<Ripple>.wavelength Float default: 25.0 -- animatable, alias: Wave_Length
The distance between the peaks of the wave. The greater the length, the smoother and
more shallow the ripple for a given amplitude.
Skew : Modifier 1155
See also
Modifier Sub-Object Transform Properties (p. 1099)
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Skew : Modifier
Constructor:
skew ...
Properties:
<Skew>.amount Float default: 25.0 -- animatable
The angle to skew from the vertical plane.
<Skew>.direction Float default: 0.0 -- animatable
The direction of the skew relative to the horizontal plane.
1156 Chapter 11 | 3ds max Objects
See also
Modifier Sub-Object Transform Properties (p. 1099)
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Skin : Modifier 1157
Skin : Modifier
Constructor:
skin ...
skinops.getSelectedBonePropEnvelopeVisible <Skin>
Returns the bone visibility parameter of the current selected bone. 0 is invisible, 1
is visible.
skinops.getSelectedBonePropFalloff <Skin>
Returns the falloff parameter of the current selected bone:
1 – linear
2 – sinual
3 – fast out
4 – slow out
skinops.getSelectedBonePropRelative <Skin>
Gets the relative property of the current selected bone. It returns 1 if relative or 0
is absolute.
skinops.getSelectedGizmo <Skin>
Returns the current selected gizmo.
skinops.GetStartPoint <Skin> <BoneID_integer>
Returns a point3 which is the start point of the bone.
skinOps.GetVertexWeight <Skin> \
<vertex_integer> <vertex_bone_integer>
Returns the influence of the Nth bone affecting the specified vertex.
skinOps.GetVertexWeightBoneID <Skin> \
<vertex_integer> <vertex_bone_integer>
Returns the system bone index of the Nth bone affecting the specified vertex.
skinOps.GetVertexWeightCount <Skin> <vertex_integer>
Returns the number of bones influencing the specified vertex.
skinops.isBoneSelected <Skin> <BoneID_integer>
Returns 1 if the bone is selected otherwise 0.
skinOps.IsVertexModified <Skin> <vertex_integer>
Returns 1 if the vertex has been modified, 0 if it has not been modified. A modified vertex
is vertex that has been weighted by hand or painting, an unmodified vertex weight
depends solely on the envelopes.
skinOps.IsVertexSelected <Skin> <vertex_integer>
Returns 1 if the vertex is selected, 0 if it is not selected.
skinops.loadEnvelope <Skin>
Opens the load envelopes dialog
skinops.loadEnvelope <Skin> <filename_string>
Loads the envelopes to the file supplied
skinops.multiRemove <Skin>
Brings up a list box where the user can delete multiple bones instead of one at a time.
skinops.pasteToAllBones <Skin>
Pastes the copy buffer to all the bones.
1162 Chapter 11 | 3ds max Objects
skinops.selectPreviousBone <Skin>
Selects the next bone in the bone list.
skinops.selectStartPoint <Skin>
Selects the end point of the envelope of the current selected bone.
skinOps.SelectVertices <Skin> \
( <vertex_integer> | <vertex_array > | <<vertex_bitarray> )
Selects the specified vertices.
skinops.setBonePropEnvelopeVisible <Skin> <BoneID_integer> <Visible_integer>
Sets the bone visibility parameter of the bone whose index matches BoneID_integer.
For Visible_integer, 0 is visible, 1 is invisible when not selected.
skinops.setBonePropFalloff <Skin> <BoneID_integer> <Falloff_integer>
Sets the falloff parameter of the bone.
For Faloff_integer, the fall off of the bone is:
1 – linear
2 – sinual
3 – fast out
4 – slow out
skinops.setBonePropRelative <Skin> <BoneID_integer> <Relative_integer>
Sets the relative property of the bone whose index matches BoneID_integer.
For Relative_integer, 0 is absolute and 1 is relative.
skinops.SetCrossSectionU <Skin> <BoneID_integer> <CrossSectionID_integer>
<U_float>
Sets the U value from the specified bone and cross section.
skinops.SetEndPoint <Skin> <BoneID_integer> <EndPointPos_point3>
Sets the end point of the specified bone.
skinOps.SetInnerRadius <Skin> \
<bone_integer> <CrossSectionID_integer> <Radius_float>
Sets the inner cross section radius for the specified bone and cross section.
skinOps.SetOuterRadius <Skin> \
<bone_integer> <CrossSectionID_integer> <Radius_float>
Sets the outer cross section radius for the specified bone and cross section.
skinops.setSelectedBonePropEnvelopeVisible <Skin> <Visible_integer>
Sets the bone visibility parameter of the current selected bone.
For Visible_integer, 0 = visible, 1 = invisible when not selected
1164 Chapter 11 | 3ds max Objects
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
SliceModifier : Modifier 1165
SliceModifier : Modifier
Constructor:
sliceModifier ...
Properties:
<sliceModifier>.Slice_Type Integer default: 0
Defines how the slice plane will affect the geometry to which it has been applied:
Refine Mesh (Adds new vertices and edges along the intersection of the geometry with the
slicing plane. Faces cut by the plane are subdivided into new faces.)
Split Mesh (Adds a double set of vertices and edges along the plane boundary producing
two separate meshes (one on either side of the slice plane), which you can modify
differently if desired. Use this to break a mesh in two.)
Remove Top (Deletes all the faces and vertices above the Slice Plane.)
Remove Bottom (Deletes all the faces and vertices below the Slice Plane.)
<sliceModifier>.Faces___Polygons_Toggle Integer default: 1
Specifies how the slice handles quads and other polygons:
Operate on Face (Treats the selection set as a set of triangular faces, slicing each one in
turn.)
Operate on Polygon (Treats the selection set as polygonal facets based on visible edges.
Hidden edges within a polygon are recomputed to give the best result for the whole
polygons.)
<sliceModifier>.slice_plane SubAnim
At this sub-object level, you can transform and animate the gizmo like any other object to
determine where the slice occurs. Scaling the gizmo has no effect, because its extents are
effectively infinite. If you need to limit the extent of the slice, use it on a sub-object
selection set of faces, rather than on the entire object.
<sliceModifier.Slice_Plane>.position Point3 default: [0,0,0] --
animatable
The position of the slice plane object.
<sliceModifier.Slice_Plane>.rotation Quat default: (quat 0 0 0 1) -- animatable
The rotation of the slice plane object.
<sliceModifier.Slice_Plane>.scale Point3 default: [1,1,1] --
animatable
The scale of the slice plane object.
1166 Chapter 11 | 3ds max Objects
See also
Modifier Sub-Object Transform Properties (p. 1099)
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Smooth : Modifier
Constructor:
smooth ...
Properties:
<smooth>.autosmooth Boolean default: false
When on, the object is auto-smoothed using the threshold value. Auto Smooth sets the
smoothing groups based on the angle between faces. Any two adjacent faces are put in the
same smoothing group if the angle between their normals is less than the threshold angle.
<smooth>.preventIndirect Boolean default: false
Turn on to prevent smoothing “leaks” when using Auto Smooth. If you apply Auto
Smooth to an object, and portions of that object that should not be smoothed become
smoothed, then turn on Prevent Indirect Smoothing to see if it corrects the problem.
<smooth>.threshold Float default: 30.0 -- animatable, angle
The threshold angle in degrees. Any two adjacent faces are put in the same smoothing
group if the angle between their normals is less than the threshold angle.
<SmoothModifier>.smoothingBits Integer default: 0
The smoothing group assigned to the selected face.
Note:
See the Editable_Mesh (p. 1041) topic, Face Methods for a description of the smoothing group
integer value.
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Spherify : Modifier 1167
Spherify : Modifier
Constructor:
spherify ...
Properties:
<Spherify>.percent Float default: 100.0 -- animatable
The percentage of spherical distortion to apply to an object.
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
SplineSelect : Modifier
Constructor:
splineSelect ...
Properties:
There are no additional properties for SplineSelect.
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Squeeze : Modifier
Constructor:
squeeze ...
Properties:
<Squeeze>.Bulge_Amount Float default: 0.0 -- animatable
The magnitude of the bulging effect. Higher values effectively elongate the object and
cause the ends to curve outward.
<Squeeze>.Bulge_Curviture Float default: 2.0 -- animatable
The degree of curvature on the bulging ends. You can use this to control whether the bulge
is smooth or pointy.
1168 Chapter 11 | 3ds max Objects
See also
Modifier Sub-Object Transform Properties (p. 1099)
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
STL_Check : Modifier 1169
STL_Check : Modifier
Constructor:
stl_check ...
Properties:
<STL_Check>.Selection_Type Integer default: 4
Selects incorrect geometry specific to the following settings:
Open Edge (Checks for open edges.)
Double Face (Checks for faces that share the same 3D space.)
Spike (Checks for spikes, which are isolated faces that share only one edge with the object.)
Multiple Edge (Checks for faces that share more than one edge.)
Everything (Checks for all of the above.)
<STL_Check>.Select_Faces Integer default: 1
These options specify the level of incorrect geometry that’s selected, based on the settings
for the selection_type value:
Don’t Select (When on, STL Check doesn’t select any part of objects in error.)
Select Edges (When on, STL Check marks the edges of faces in error by selecting them. The
selection of erroneous edges is visible in viewports.)
Select Faces (When on, STL Check marks the faces of any object in error by selecting them.
The selection of erroneous faces is visible in viewports.)
<STL_Check>.Check_Now Integer default: 0
Turn on to perform the STL check. For complex objects, expect a pause between the time
you turn this on, and the time you see the reported errors in the Status group.
OFF
ON
<STL_Check>.Change_MatID Integer default: 1
When on, STL Check also marks faces in error by assigning them a unique material ID.
OFF
ON
<STL_Check>.Material_ID Integer default: 2
The material ID that STL Check assigns to faces in error.
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
1170 Chapter 11 | 3ds max Objects
Stretch : Modifier
Constructor:
stretch ...
Properties:
<Stretch>.Stretch Float default: 0.0 -- animatable
The base scale factor for all three axes. The scale factor derived from the Stretch value
varies according to the sign of the value.
<Stretch>.Amplify Float default: 0.0 -- animatable
The scale factor applied to the minor axes. Amplify generates a multiplier using the same
technique as stretch. The multiplier is then applied to the stretch value before the
scale factor for the minor axes is calculated.
<Stretch>.axis Integer default: 2
Determines which of the object’s local axes is the Stretch Axis:
X
Y
Z
<Stretch>.limit Boolean default: false
When on, the stretch effect is limited by the from and to values.
<Stretch>.from Float default: 0.0 -- animatable
The boundary of the stretch effect along the negative Stretch Axis.
<Stretch>.to Float default: 0.0 -- animatable
The boundary of the stretch effect along the positive Stretch Axis.
<Stretch>.center Point3 default: [0,0,0] -- animatable
At this sub-object level, you can translate and animate the center, altering the Stretch
gizmo’s shape, and thus the shape of the stretched object.
<Stretch>.gizmo SubAnim
At this sub-object level, you can transform and animate the gizmo like any other object,
altering the effect of the Stretch modifier. Translating the gizmo translates its center an
equal distance. Rotating and scaling the gizmo takes place with respect to its center.
<Stretch.Gizmo>.position Point3 default: [0,0,0] -- animatable
The position of the stretch gizmo.
<Stretch.Gizmo>.rotation Quat default: (quat 0 0 0 1) -- animatable
The rotation of the stretch gizmo.
<Stretch.Gizmo>.scale Point3 default: [1,1,1] -- animatable
The scale of the stretch gizmo.
Note:
The Limit Effect property is not accessible by MAXScript in 3ds max 4.
Surface : Modifier 1171
See also
Modifier Sub-Object Transform Properties (p. 1099)
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Surface : Modifier
Constructor:
surface ...
Properties:
<surface>.threshold Float default: 1.0 -- animatable
The overall distance that is used to weld the vertices of the spline object. All vertices/
vectors within the threshold of each other are treated as one.
<surface>.steps Integer default: 5 -- animatable
The number of steps used between each vertex. The higher the step count, the smoother
the curve you will get between vertices.
Note:
The Flip Normals, Remove Interior Patches, and Use Only Selected Segs. properties are not accessible
by MAXScript in 3ds max 4.
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
SurfDeform : Modifier
Constructor:
surfDeform ...
Properties:
<SurfDeform>.surface Node default: undefined
The surface used to apply deformation.
<SurfDeform>.U_Percent Float default: 50.0 -- animatable,
percentage
Moves the object along the U (horizontal) axis of the gizmo patch, based on a percentage
of the U distance. This defaults to a setting of 50 percent, which places the object at the
center of the gizmo patch. A setting of 0 percent places the object at the left edge of the
gizmo patch, as seen from the viewport where the patch was created.
1172 Chapter 11 | 3ds max Objects
See also
Modifier Sub-Object Transform Properties (p. 1099)
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Taper : Modifier 1173
Taper : Modifier
Constructor:
taper ...
Properties:
<Taper>.amount Float default: 1.0 -- animatable
The extent to which the ends are scaled. Amount is a relative value with a maximum of 10.
<Taper>.curve Float default: 0.0 -- animatable, alias: curvature
Applies a curvature to the sides of the Taper gizmo, thus affecting the shape of the tapered
object. Positive values produce an outward curve along the tapered sides, negative values
an inward curve. At 0, the sides are unchanged.
<Taper>.primaryaxis Integer default: 2
The central axis or spine of the taper:
X
Y
Z
<Taper>.effectaxis Integer default: 2
The axis, or pair of axes, indicating the direction of the taper from the primary axis. The
available choices are determined by the choice of primary axis. The effect axis can be
either of the two remaining axes, or their combination. If the primary axis is X, the effect
axis can be Y, Z, or YZ.
Z
Y
ZY
<Taper>.symmetry Boolean default: false -- animatable
When on, produces a symmetrical taper around the primary axis. A taper is always
symmetrical around the effect axis.
<Taper>.limit Boolean default: false
Enables/disables upper and lower limits for the taper effect.
<Taper>.upperlimit Float default: 0.0 -- animatable, alias: Upper_Limit
The upper limit boundaries in world units from the taper center point, beyond which the
taper no longer affects the geometry.
<Taper>.lowerlimit Float default: 0.0 -- animatable, alias: Lower_Limit
The lower limit boundaries in world units from the taper center point, beyond which the
taper no longer affects the geometry.
<Taper>.center Point3 default: [0,0,0] -- animatable
At this sub-object level, you can translate and animate the center, altering the Taper
gizmo’s shape, and thus the shape of the melted object
1174 Chapter 11 | 3ds max Objects
<Taper>.gizmo SubAnim
At this sub-object level, you can transform and animate the gizmo like any other object,
altering the effect of the Taper modifier. Translating the gizmo translates its center an
equal distance. Rotating and scaling the gizmo takes place with respect to its center.
<Taper.Gizmo>.position Point3 default: [0,0,0] -- animatable
The position of the taper gizmo.
<Taper.Gizmo>.rotation Quat default: (quat 0 0 0 1) -- animatable
The rotation of the taper gizmo.
<Taper.Gizmo>.scale Point3 default: [1,1,1] -- animatable
The scale of the taper gizmo.
See also
Modifier Sub-Object Transform Properties (p. 1099)
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Tessellate : Modifier
Constructor:
tessellate ...
Properties:
<Tessellate>.tension Float default: 2500.0 -- animatable, percentage
Determines if the new faces are flat, concave, or convex after Edge tessellation. A positive
value rounds faces by pushing vertices outward. A negative value creates concave faces by
pulling vertices inward. A setting of 0 keeps the faces flat.
Note:
The tension value is 100* the value shown in the 3ds max user interface.
Most properties in the Tessellate modifier are not accessible by MAXScript in 3ds max 4.
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Trim_Extend : Modifier 1175
Trim_Extend : Modifier
Constructor:
trim_extend ...
Properties:
There are no additional properties for Trim_Extend.
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Twist : Modifier
Constructor:
twist ...
Properties:
<Twist>.angle Float default: 0.0 -- animatable
The amount of twist around the vertical axis.
<Twist>.bias Integer default: 0 -- animatable
Causes the twist rotation to bunch up at either end of the object. When the parameter is
negative, the object twists closer to the gizmo center. When the value is positive, the
object twists more away from the gizmo center. When the parameter is 0, the twisting is
uniform.
<Twist>.axis Integer default: 2
The axis along which the twist will occur. This is the local axis of the Twist gizmo.
X
Y
Z
<Twist>.limit Boolean default: false
When on, applies limit constraints to the Twist modifier.
<Twist>.upperlimit Float default: 0.0 -- animatable, alias: Upper_Limit
The upper limit for the twist effect.
<Twist>.lowerlimit Float default: 0.0 -- animatable, alias: Lower_Limit
The lower limit for the twist effect.
<Twist>.center Point3 default: [0,0,0] -- animatable
You can translate and animate the center at this sub-object level, altering the Twist gizmo’s
shape, and thus the shape of the twisted object.
1176 Chapter 11 | 3ds max Objects
<Twist>.gizmo SubAnim
You can transform and animate the gizmo like any other object at this sub-object level,
altering the effect of the Twist modifier. Translating the gizmo translates its center an equal
distance. Rotating and scaling the gizmo takes place with respect to its center.
<Twist.Gizmo>.position Point3 default: [0,0,0] -- animatable
The position of the twist gizmo.
<Twist.Gizmo>.rotation Quat default: (quat 0 0 0 1) -- animatable
The rotation of the twist gizmo.
<Twist.Gizmo>.scale Point3 default: [1,1,1] -- animatable
The scale of the twist gizmo.
See also
Modifier Sub-Object Transform Properties (p. 1099)
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Unwrap_UVW : Modifier
Constructor:
unwrap_UVW ...
SetMapChannel <channel>
Sets the Map Channel field in the rollup
Channel (integer) – The channel that you want to set to.
GetMapChannel()
Returns the Map Channel field value in the rollup
SetVC <VertexColor>
Sets the Vertex Color Channel radio button in the rollup on or off.
VertexColor (integer) – Turn the vertex color on/off.
GetVC()
Returns the state of the Vertex Color Channel radio button in the rollup.
SetProjectionType <Proj>
Proj (integer) – The type of mapping you want:
1 – X aligned
2 – Y aligned
3 – Z aligned
4 – normal aligned
GetProjectionType()
Returns the state of the mapping align radio buttons:
1 – X aligned
2 – Y aligned
3 – Z aligned
4 – normal aligned
Move()
Presses the Move button in the edit floater.
MoveH()
Presses the Move Horizontal button in the edit floater.
MoveV()
Presses the Move Vertical button in the edit floater.
Rotate()
Presses the Rotate button in the edit floater.
Scale()
Presses the Scale button in the edit floater.
ScaleH()
Presses the Scale Horizontal button in the edit floater.
ScaleV()
Presses the Scale Vertical button in the edit floater.
MirrorH()
Presses the Mirror Horizontal button in the edit floater.
1178 Chapter 11 | 3ds max Objects
MirrorV()
Presses the Mirror Vertical button in the edit floater.
ExpandSelection()
Presses the Expand Selection button in the edit floater.
ContractSelection()
Presses the Contract Selection button in the edit floater
SetFalloffType <falloff>
Sets the falloff type in the edit floater.
falloff (integer) – The falloff type:
1 – Linear falloff
2 – Sinual falloff
3 – Fast falloff
4 – Slow falloff
GetFalloffType()
Returns the falloff type in the edit floater:
1 – Linear falloff
2 – Sinual falloff
3 – Fast falloff
4 – Slow falloff
SetFalloffSpace <space>
Sets the falloff space in the edit floater.
space (integer) – The space you want the falloff to be computed in:
1 – XY (The local space of the object.)
2 – UV (The UVW space of the object.)
GetFalloffSpace()
Returns the falloff space in the edit floater.
SetFalloffDist <dist>
Sets the falloff distance in the edit floater.
dist (float) – The falloff distance.
GetFalloffDist()
Returns the falloff distance from the edit floater.
BreakSelected()
Presses the Break Selected button in the edit floater.
Weld()
Presses the Target Weld button in the edit floater.
WeldSelected()
Presses the Weld Selected button in the edit floater.
Updatemap()
Presses the Update Map button in the edit floater.
Unwrap_UVW : Modifier 1179
Displaymap <DisplayMap>
Toggles the Display Map button in the edit floater.
DisplayMap (boolean) – The state that you want to set the Display Map to.
IsMapDisplayed()
Returns the state of the Display Map button.
SetUVSpace <UVspace>
Sets the UV Space fly out in the edit floater.
UVSpace (integer) – The space that you want to view the texture vertices in:
1 – UV
2 – VW
3 – UW
GetUVSpace()
Returns the state of the UV Space fly out in the edit floater:
1 – UV
2 – VW
3 – UW
Options()
Presses the Options button in the edit floater.
Lock()
Toggles the Lock Selected Vertices button in the edit floater.
Hide()
Presses the Hide button in the edit floater.
Unhide()
Presses the Unhide button in the edit floater.
Freeze()
Presses the Freeze button in the edit floater.
Thaw()
Presses the Unfreeze button in the edit floater
FilterSelected()
Toggles the Filter Selected Faces button in the edit floater.
Pan()
Presses the Pan button in the edit floater.
Zoom()
Presses the Zoom button in the edit floater.
ZoomRegion()
Presses the Zoom Region button in the edit floater.
Fit()
Presses the Fit button in the edit floater.
FitSelected()
Presses the Fit Selected button in the edit floater.
1180 Chapter 11 | 3ds max Objects
Snap()
Presses the Snap button in the edit floater.
GetCurrentMap()
Returns the index into the map drop down list of the current map in the view of the edit
floater.
SetCurrentMap <map>
Changes the currently displayed map to the index provided.
map (integer) – The index of the map in the drop down list that you want to display.
NumberMaps()
Returns the number of maps in the map drop down list.
GetLineColor()
Returns the color of the lines used to connect the texture vertices edges as a Point3 value.
SetLineColor <color>
Sets the line color of the texture vertices.
color (point3) – The color that you want to set the lines to.
GetSelColor()
Returns the texture vertices selection color as a Point3 value.
SetSelColor <color>
Sets the color of selected texture vertices.
color (point3) – The color that you want the selected vertice to be.
GetRenderWidth <dist>
Returns the width of the bitmap used to render 2d/3d textures to.
SetRenderWidth <width>
Sets the width of the bitmap used to render to for display.
width (integer) – The width in pixels for the bitmap.
GetRenderHeight()
Returns the height of the bitmap used to render 2d/3d textures to.
SetRenderHeight <height>
Sets the width of the bitmap used to render to the display.
height (integer) - The height in pixels for the bitmap.
GetUseBitmapRes()
Returns the state of the Use Bitmap Resolution as a boolean value. If false, the bitmaps are
rendered using the RenderWidth/Height values.
SetUseBitmapRes <useBitmapRes>
Sets the state of the Use Bitmap Resolution value. If it is false the bitmaps are rendered
using the RenderWidth/Height values.
UseBitmapRes (boolean) - Toggle Use Bitmap Resolution.
GetWeldThresold()
Returns the weld threshold
Unwrap_UVW : Modifier 1181
SetWeldThreshold <threshold>
Sets the threshold values for welds.
threshold (float) – Threshold for welds.
GetConstantUpdate()
Returns the state of Constant Update as a boolean value. When true, viewport is updated
on every move, otherwise it is just updated on mouse up.
SetConstantUpdate <constantUpdates>
Sets the state of the Constant Update value. When true, the viewport is updated on every
move, otherwise it is just updated on mouse up.
GetShowSelectedVertices()
Returns a boolean value which indicates whether the selected texture vertices are also
displayed in the view port.
SetShowSelectedVertices <show>
Sets whether the selected texture vertices are also displayed in the viewport.
show (boolean) – The state of Show Selected Vertices.
GetMidPixelSnape()
Returns a boolean value which indicated whether the mid pixels snap is used, if it is false
the snap is set to the bottom right corner of the pixel, else it snaps to the center of the
pixel.
SetMidPixelSnape <snap>
Sets whether mid pixels snap is used. When false, the snap is set to the bottom right corner
of the pixel. When true, it snaps to the center of the pixel.
snap (boolean) – The mid pixel snap state to be set.
GetMatID()
Returns the current material id index filter.
SetMatID <matid>
Sets the material drop list to the index supplied.
matid (integer) – The material id index to be set.
NumberMatIDs()
Returns the number of material ids in the material id filter drop down.
GetSelectedVerts()
Returns the current selected texture vertices in the edit floater as a bitarray.
SelectVerts <sel>
Selects texture vertices in the edit floater dialog.
sel (bitarray) – The selection set.
IsVertexSelected <index>
Returns a boolean value which indicates whether a texture vertex is selected.
index (integer) – The index of the vertex to check.
1182 Chapter 11 | 3ds max Objects
MoveSelectedVertices <offset>
Moves the selected texture vertices by the offset.
offset (point3) - The offset by which you want to move the vertices.
RotateSelectedVertices <angle>
Rotates the selected vertices around their center point.
angle (float) – The angle in radians that you want to rotate the selection by.
RotateSelectedVertices <angle> <axis>
Rotates the selected vertices around a specific axis.
angle (float) – The angle in radians that you want to rotate the selection by.
axis (point3) – The axis that you want to rotate the selected vertices by. This is in the
space of the window.
ScaleSelectedVertices <scale> <dir>
Scales the selected points around their center.
scale (float) – The amount that you want to scale by.
dir (integer) – The direction you want to scale by:
0 – Scales uniform
1 – Scales in the x
2 – Scales in the y
ScaleSelectedVertices <scale> <dir> <axis>
Scales the selected points around their center around the axis.
scale (float) – The amount that you want to scale by.
dir (integer) – The direction:
0 – Scales uniform
1 – Scales in the x
2 – Scales in the y
axis (point3) – The axis that you want to rotate the selected vertices by. This is in the
space of the window.
GetVertexPosition <time> <index>
Returns the position of the vertex as a Point3 value.
time (timevalue) – The time at which you wan to check.
index (integer) – The index of the vertex.
NumberVertices()
Returns the number of texture vertices.
MoveX <p>
This sets the selected vertices x values in absolute coordinates.
p (float) – The absolute position along the x axis.
Unwrap_UVW : Modifier 1183
MoveY <p>
This sets the selected vertices y values in absolute coordinates.
p (float) – The absolute position along the y axis.
MoveZ <p>
This sets the selected vertices xzvalues in absolute coordinates.
p (float) – The absolute position along the z axis.
GetSelectedPolygons()
Returns the selected polygons in the view port as a bitarray.
SelectPolygons <sel>
Selects the polygons in the view ports.
sel (bitarray) – The polygons to select.
IsPolygonSelected <index>
Returns whether a polygon is selected or not.
index (integer) – Index of the polygon to check.
NumberPolygons()
Returns the number of polygons in the object.
DetachEdgeVerts()
Detaches any vertex that is not completely surrounded by selected vertices. This is similar
to a polygon selection detach except it uses the vertex selection to determine what is
detached.
FlipH()
This presses the Flip Horizontal button in the edit floater dialog.
FlipV()
This presses the Flip Vertical button in the edit floater dialog.
GetLockAspect()
Returns whether the edit window aspect ratio is locked or not. If the aspect ratio is not
locked the image will try stretch to fit the aspect ratio of the window.
SetLockAspect <aspect>
This sets the Lock Aspect Ratio value.
aspect (boolean) – Aspect lock toggle.
GetMapScale()
Returns the scaling factor when the user applies a planar map. The smaller the value the
more planar map is scaled down
SetMapScale <scale>
Sets the scaling factor when the user applies a planar map. The smaller the value the more
planar map is scaled down.
scale (float) - The scaling factor for planar map.
GetSelectionFromFace()
This takes the current polygon selection and uses it to select the texture vertices that are
associated with it.
1184 Chapter 11 | 3ds max Objects
ForceUpdate <update>
This sets a flag to determines how Unwrap will behave when a topology change occurs. If
update is TRUE the mapping gets reset, otherwise unwrap skips mapping the object if it
has a different topology. It is sometimes useful to turn this off if you have MeshSmooth or
other topology changing modifiers below Unwrap that have different topologies when
rendering.
update (boolean) – Determines whether the mapping is reset on topology change.
ZoomToGizmo <all>
This zooms the selected or all the viewports to zoom to the current planar map gizmo.
all (boolean) – Determines whether the active or all the viewports get zoomed.
UpdateView()
This forces the viewport and dialog to update.
SetVertexPosition <t> <index> <pos>
This sets the position of a UVW vertex at a specific time.
t (timeValue) – The time at what you want to set the pos.
index (integer) – The index of the vertex.
pos (point3) – The position of the vertex in UVW space.
The functions below work on the UVW topology allowing you to rearrange the topology or add new
topology. Use these with care since you can create invalid topology which can cause unpredictable
results. Unwrap has topology similar to meshes but it has been changed to support everything
except patches and polygons at the same time. Unwrap has a list of Point3 values which are the
texture vertices positions. Then there are texture faces which contain an array of integers which are
indices into the texture vertex list. There can be 3 to N number of ints in this array depending on
the topology being fed into Unwrap. In addition to this, there are also 2 arrays of integers for the
handles and interior handles if the topology is a patch which also points into the texture vertex list.
The functions below allow you to manipulate these arrays to do things like break, weld, and other
topological functions.
MarkAsDead <index>
This marks a vertex that it is dead, and no longer in use. Vertices are not actually deleted
they are just marked and recycled when needed. That means that when a vertex is added
vertices marked as dead will be the first ones checked. If there are no dead vertices, the
vertex is appended to the end of the list. Use this function carefully, since marking a vertex
in use as dead will cause strange results.
index (integer) – The index of the vertex to mark as dead.
NumberPointsInFace <index>
This retrieves the numbers of vertices that a face contains. A face can contain 3 to N
number of points depending on what type of topology Unwrap is working on. For Tri
Meshes this is always 3; for patches this can be 3 or 4; and for polygons this can be 3 or
greater. Unwrap abstracts all three object types into one generic format.
index (integer) – The index of the face that you are inspecting.
Unwrap_UVW : Modifier 1185
FaceIndex (integer) – The index of the face that you want to inspect.
IthVertexIndex (integer) – The ith handle of that you want to retrieve. This value
should range from 1 to twice the number of vertices that the face contains.
GetInteriorGIndexFromFace <faceindex> <ithVertexIndex>
This retrieves the index of a geometric interior handle from a patch. This the interior
handle that is attached to the patch and not the texture faces. A face contains 0 to N
number of interior handles, so to retrieve a particular interior handle index, you give it the
face index and the ith interior handle that you want to inspect. For example, if you
wanted to look at the 3 interior handle on face 1 you would call
GetInteriorGeomIndexFromFace (1,3).
FaceIndex (integer) – The index of the face that you want to inspect.
IthVertexIndex (integer) – The ith interior handle of that you want to retrieve. This
value should range from 1 to the number of vertices that the face contains.
SetFaceVertex <pos> <fIndex> <vIndex> <sel>
This allows you to manipulate the position of vertex attached to a face. Basically, it
detaches the vertex if multiple faces share that vertex and then moves it to the position
specified. So if you want to move the 3rd vertex of face 1 to (.5,.5,.0) you would do
setFaceVertex [.5 .5 .0] 1 3. If you don’t want the vertex broken use SetVertexSPosition.
pos (point3) - The position that you want to move a vertex to.
fIndex (integer) – The index of the face that you wish to work on.
vIndex (integer) – The ith vertex of the face that you want to change.
sel (boolean) – Whether or not to select the vertex after it is recreated.
SetFaceHandle <pos> <fIndex> <vIndex> <sel>
Identical to SetFaceVertex except works on patch handles.
pos (point3) - The position that you want to move a vertex to.
fIndex (integer) – The index of the face that you wish to work on.
vIndex (integer) – The ith vertex of the face that you want to change.
sel (boolean) – Whether or not to select the vertex after it is recreated.
SetFaceInterior <pos> <fIndex> <vIndex> <sel>
Identical to SetFaceVertex except works on patch interior handles.
pos (point3) - The position that you want to move a vertex to.
fIndex (integer) – The index of the face that you wish to work on.
vIndex (integer) – The ith vertex of the face that you want to change.
sel (boolean) – Whether or not to select the vertex after it is recreated.
UVW_Xform : Modifier 1187
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
UVW_Xform : Modifier
Constructor:
uvw_xform ...
Properties:
<UVW_Xform>.U_Tile Float default: 1.0 -- animatable
The tiling along the U-axis.
<UVW_Xform>.U_Flip Integer default: 0
When on, reverses the direction of the map along the U-axis.
OFF
ON
<UVW_Xform>.V_Tile Float default: 1.0 -- animatable
The tiling along the V-axis.
1188 Chapter 11 | 3ds max Objects
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
UVWmap : Modifier
Constructor:
uvwmap ...
Properties:
<Uvwmap>.maptype Integer default: 0
Determines the type of mapping coordinates used. Different kinds of mapping are
distinguished by how the map is geometrically projected onto the object and how the
projection interacts with the object’s surfaces.
UVWmap : Modifier 1189
Planar (Projects the map from a single plane flat against the object, somewhat like
projecting a slide. Planar projection is useful when only one side of an object needs to be
mapped. It is also useful for obliquely mapping multiple sides, and for mapping two sides
of a symmetrical object.)
Cylindrical (Projects the map from a cylinder, wrapping it around an object. Seams where
the edges of the bitmap meet are visible unless a seamless map is used. Cylindrical
projection is useful for objects that are roughly cylindrical in shape.)
Spherical (Surrounds the object by projecting the map from a sphere. You see a seam and
mapping singularities at the top and bottom of the sphere where the bitmap edges meet at
the sphere’s poles. Spherical mapping is useful for objects that are roughly spherical in
shape.)
Shrink Wrap (Uses spherical mapping, but truncates the corners of the map and joins
them all at a single pole, creating only one singularity. Shrink-wrap mapping is useful
when you want to hide the mapping singularity.)
Box (Projects the map from the six sides of a box. Each side projects as a planar map, and
the effect on the surface depends on the surface normal. Each face is mapped from the
closest box surface whose normal most closely parallels its own normal.)
Face (Applies a copy of the map to every face of an object. Pairs of faces sharing a hidden
edge are mapped with the full rectangular map. Single faces with no hidden edge are
mapped with a triangular portion of the map.)
XYZ to UVW (Maps 3D procedural coordinates to UVW coordinates. This “sticks” the
procedural texture to the surface. If the surface stretches, so does the 3D procedural map.)
<Uvwmap>.cap Boolean default: false
When on, applies planar mapping coordinates to the caps of the cylinder.
<Uvwmap>.length Float default: 1.0 -- animatable
The length of the UVW mapping gizmo.
<Uvwmap>.width Float default: 1.0 -- animatable
The width of the UVW mapping gizmo.
<Uvwmap>.height Float default: 1.0 -- animatable
The height of the UVW mapping gizmo.
<Uvwmap>.utile Float default: 1.0 -- animatable, alias: U_Tile
The tiling of the UVW map along the U-axis.
<Uvwmap>.uflip Boolean default: false
When on, reverses the image about the U-axis.
<Uvwmap>.vtile Float default: 1.0 -- animatable, alias: V_Tile
The tiling of the UVW map along the V-axis.
<Uvwmap>.vflip Boolean default: false
When on, reverses the image about the V-axis.
<Uvwmap>.wtile Float default: 1.0 -- animatable, alias: W_Tile
The tiling of the UVW map along the W-axis.
1190 Chapter 11 | 3ds max Objects
See also
Modifier Sub-Object Transform Properties (p. 1099)
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Vertex_Colors : Modifier 1191
Vertex_Colors : Modifier
Constructor:
The Vertex_Colors modifier is not creatable by MAXScript. It can only be created
using the Assign Vertex Colors utility.
Properties:
There are no additional properties for Vertex_Colors.
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
VertexPaint : Modifier
Constructor:
vertexPaint ...
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
1192 Chapter 11 | 3ds max Objects
VolumeSelect : Modifier
Constructor:
volumeselect ...
Properties:
<Volumeselect>.level Integer default: 0
Volume Select provides three selection levels. Vertex and Face levels put the modifier stack
in sub-object selection. You can make one sub-object selection for each Volume Select
modifier. You can then toggle the one selection between Face and Vertex level to send
either up the stack. Object (top) level lets you modify the whole object while retaining any
sub-object selection.
Object
Vertex
Face
<Volumeselect>.type Integer default: 0
Sets the volume select type:
Replace (Clears any selection passed up the stack to the Volume Select modifier, and then
selects geometry within the volume.)
Add (Selects all geometry within the volume, adding to any previous selection.)
Subtract (Deselects all geometry within the volume.)
<Volumeselect>.invert Boolean default: false
When on, the entire selection set is reversed. Geometry that was unselected becomes
selected, and vice versa.
<Volumeselect>.method Integer default: 0
Lets you determine whether selected faces are wholly or partially within the defined
volume:
Window (Selects only faces with all three vertices within the selection volume.)
Crossing (Selects faces with only one vertex within the selection volume.)
<Volumeselect>.volume Integer default: 0
These controls let you define the selection with a primitive, a mesh object, or by surface
characteristics:
Box
Sphere
Cylinder
Mesh Object
Texture Map
Material Id
Smoothing Group
VolumeSelect : Modifier 1193
See also
Modifier Sub-Object Transform Properties (p. 1099)
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Wave : Modifier
Constructor:
wave ...
Properties:
<Wave>.amplitude1 Float default: 5.0 -- animatable, alias: Amplitude_1
This produces a sine wave along the gizmo’s Y-axis. Switching a value from positive to
negative reverses the positions of peaks and troughs.
<Wave>.amplitude2 Float default: 5.0 -- animatable, alias: Amplitude_2
This produces a sine wave the gizmo’s X-axis. Switching a value from positive to negative
reverses the positions of peaks and troughs.
<Wave>.wavelength Float default: 25.0 -- animatable, alias: Wave_Length
The distance in current units between the crests of both waves.
<Wave>.phase Float default: 0.0 -- animatable
Shifts the wave pattern over the object. Positive numbers move the pattern in one
direction, while negative numbers move it in the other.
XForm : Modifier 1195
See also
Modifier Sub-Object Transform Properties (p. 1099)
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
XForm : Modifier
Constructor:
xform ...
Properties:
<XForm>.center Point3 default: [0,0,0] -- animatable
At this sub-object level, you can translate and animate the center, altering the Xform
gizmo’s shape, and thus the shape of the object.
<XForm>.gizmo SubAnim
At this sub-object level, you can transform and animate the gizmo like any other object,
altering the effect of the Xform modifier. Translating the gizmo translates its center an
equal distance. Rotating and scaling the gizmo takes place with respect to its center.
<XForm.Gizmo>.position Point3 default: [0,0,0] -- animatable
The position of the wave gizmo.
1196 Chapter 11 | 3ds max Objects
See also
Modifier Sub-Object Transform Properties (p. 1099)
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
BombBinding:
bindSpaceWarp <node> <bomb_node>
DeflectorBinding:
bindSpaceWarp <particlesys_node> <deflector_node>
DisplaceBinding:
bindSpaceWarp <node> <spaceDisplace_node>
FFD_Binding:
bindSpaceWarp <node> <spaceFFDBox_node>
bindSpaceWarp <node> <spaceFFDCyl_node>
GravityBinding:
bindSpaceWarp <node> <gravity_node>
MotorMod:
bindSpaceWarp <node> <motor_node>
PathFollowMod:
bindSpaceWarp <particlesys_node> <path_Follow_node>
XForm : Modifier 1197
PBombMod:
bindSpaceWarp <node> <pbomb_node>
PDynaFlectMod:
bindSpaceWarp <node> <PDynaFlect_node>
POmniFlectMod:
bindSpaceWarp <particlesys_node> <POmniFlect_node>
PushMod:
bindSpaceWarp <node> <pushSpaceWarp_node>
RippleBinding:
bindSpaceWarp <node> <spaceRipple_node>
<RippleBinding>.Flexibility Float default: 1.0 -- animatable
SDeflectMod:
bindSpaceWarp <particlesys_node> <sdeflector_node>
SDynaFlectMod:
bindSpaceWarp <node> <SDynaFlect_node>
SOmniFlectMod:
bindSpaceWarp <particlesys_node> <SOmniFlect_node>
SpaceConform:
bindSpaceWarp <node> <conformSpaceWarp_node>
UDeflectorMod:
bindSpaceWarp <particlesys_node> <uDeflector_node>
UDynaFlectMod:
bindSpaceWarp <node> <UDynaFlect_node>
UOmniFlectMod:
bindSpaceWarp <particlesys_node> <UOmniFlect_node>
WaveBinding:
bindSpaceWarp <node> <spaceWave_node>
<WaveBinding>.Flexibility Float default: 1.0 -- animatable
WindBinding:
bindSpaceWarp <node> <wind_node>
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
1198 Chapter 11 | 3ds max Objects
Other SpacewarpModifiers
Displace_Mesh : SpacewarpModifier
Constructor:
displace_Mesh ...
Properties:
There are no additional properties for Displace_Mesh.
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Displace_NURBS : SpacewarpModifier
Constructor:
displace_NURBS ...
Properties:
There are no additional properties for Displace_NURBS.
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
MapScaler : SpacewarpModifier
Constructor:
MapScaler ...
Properties:
<MapScaler>.scale Float default: 100.0 -- animatable
The size of one repeat of the texture pattern. Size is measured in current scene units.
Repeats occur across the object in the U direction.
<MapScaler>.channel Integer default: 1
The map channel used.
SpaceCameraMap : SpacewarpModifier 1199
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
SpaceCameraMap : SpacewarpModifier
Constructor:
SpaceCameraMap ...
Properties:
<SpaceCameraMap>.camera Node default: undefined
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
SpacePatchDeform : SpacewarpModifier
Constructor:
SpacePatchDeform ...
Properties:
<SpacePatchDeform>.U_Percent Float default: 50.0 -- animatable,
percentage
Moves the object along the U (horizontal) axis of the gizmo patch, based on a percentage
of the U distance. This defaults to a setting of 50 percent, which places the object at the
center of the gizmo patch. A setting of 0 percent places the object at the left edge of the
gizmo patch, as seen from the viewport where the patch was created.
1200 Chapter 11 | 3ds max Objects
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
SpacePathDeform : SpacewarpModifier
Constructor:
SpacePathDeform ...
Properties:
<SpacePathDeform>.path Node default: undefined
The node designated as the path.
<SpacePathDeform>.Percent_along_path Float default: 0.0 -- animatable,
percentage
Moves the object along the gizmo path based on a percentage of the path length.
SpaceSurfDeform : SpacewarpModifier 1201
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
SpaceSurfDeform : SpacewarpModifier
Constructor:
SpaceSurfDeform ...
Properties:
<SpaceSurfDeform>.surface Node default: undefined
The surface used for deformation.
<SpaceSurfDeform>.U_Percent Float default: 50.0 -- animatable,
percentage
Moves the object along the U (horizontal) axis of the gizmo patch, based on a percentage
of the U distance. This defaults to a setting of 50 percent, which places the object at the
center of the gizmo patch. A setting of 0 percent places the object at the left edge of the
gizmo patch, as seen from the viewport where the patch was created.
1202 Chapter 11 | 3ds max Objects
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Surface_Mapper : SpacewarpModifier
Constructor:
surface_mapper ...
Properties:
There are no additional properties for Surface_Mapper.
Methods:
updateSurfaceMapper <surface_mapper>
This method has the effect of performing a manual update to the mapping provided by
the associated NURBS surface.
Note:
There is no way to specify the Source Texture Surface using MAXScript in 3ds max 4.
Material Common Properties, Operators, and Methods 1203
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Material : MAXWrapper
The Material class represents the materials which you can assign to objects in 3ds max. You can
create materials like standard, blend, and raytrace, access various properties on them, and assign
these materials to 3ds max objects.
The classes derived directly from the Material class are described in the Material Types (p. 1204) topic.
Other classes are derived from these classes, and inherit the properties and methods defined for the
Material class.
The properties, operators, and methods that are common to all classes derived directly from the
Material class are described in the Material Common Properties, Operators, and Methods (p. 1203) topic.
The Material class is derived from the MAXWrapper class, and inherits the properties and methods
defined for that class. These properties and methods are described in the MAXWrapper (p. 808) topic.
See also
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Material Types
The following list displays the 3ds max material subclasses:
Blend (p. 1205)
Composite (p. 1206)
DoubleSided (p. 1207)
MatteShadow (p. 1208)
MorpherMaterial (p. 1209)
MultiMaterial (p. 1210)
Blend : Material 1205
Blend : Material
Constructor:
blend ...
Properties:
<blend>.map1 Material default: Standard -- alias: Map_1
The first material to be blended.
<blend>.map1Enabled Boolean default: true -- alias: Map_1_Enable
Turn on/off the use of the first material in the blend.
<blend>.map2 Material default: Standard -- alias: Map_1
the second material to be blended.
<blend>.map2Enabled Boolean default: true -- alias: Map_2_Enable
Turn on/off
<Blend>.mask TextureMap default: undefined
Selects a map to use as a mask. The two materials will blend in greater or lesser degree
according to the intensity of the map. Lighter (whiter) areas of the mask show Material 1.
Darker (blacker) areas of the mask show Material 2.
<blend>.maskEnabled Boolean default: true -- alias: MaskEnable
Enable/disable the use of the map mask.
<blend>.interactive Integer default: 0
Selects which of the two materials is displayed on object surfaces in viewports by the
interactive renderer:
Material 1
Material 2
<blend>.mixAmount Float default: 0.0 -- animatable; percentage
The proportion of the blend (percentage). 0 means only Material 1 is visible on the surface;
100 means only Material 2 is visible.
1206 Chapter 11 | 3ds max Objects
See also
Material Common Properties, Operators, and Methods (p. 1203)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
CompositeMaterial : Material
Constructor:
compositeMaterial()
Properties:
<compositematerial>.materialList Array default: #(Standard, undefined, ... ,
undefined, undefined) -- alias: Material
This array contains all of the materials included in the composite material.
<compositematerial>.mapEnables Array default: #(true, true, ... , true,
true) -- alias: Map_Enable
This array turns on/off the use of materials (corresponding to the .materialList array)
in the composite material.
<compositematerial>.mixType Array default: #(0, 0, ... , 0,
0) -- alias: Composite_Type
This array sets the mix type for each material in the .materialList of the composite
material:
Additive
Subtractive
Mix
<compositematerial>.amount Array default: #(100.0, 100.0, ... , 100.0,
100.0) -- animatable
This array sets the amount of mixing for each corresponding material in the
.materialList.
<compositematerial>.baseMaterial Standard Material default: (null) – alias for
materialList[0]
S ets a base material for the composite material.
DoubleSided : Material 1207
Note:
The materialList array stores the material for the base material and the sub-materials, the
mapEnables array stores whether a sub-material is enabled, the mixTypes array stores the type of
mixing to be performed for a sub-material, and the mixTypes array stores the amount of mixing to
be performed for a sub-material. The materialList array contains N elements, corresponding to
the base material and the (N-1) sub-materials. The remaining arrays store (N-1) elements,
corresponding to the (N-1) sub-materials.
A property alias exists for each element of the amount array. The property aliases have the name
amount_X, where X is the array element index. So the alias for the first amount element is amount_1,
for the second amount_2, etc.
baseMaterial is an alias for materialList[1].
See also
Material Common Properties, Operators, and Methods (p. 1203)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
DoubleSided : Material
Constructor:
doubleSided ...
doubleSidedMat ...
Properties:
<DoubleSided>.translucency Float default: 0.0 -- animatable
The amount that one material shows through the other. This is a percentage that can
range from 0.0 to 100.0. At 100 percent, the outer material is visible on inner faces and the
inner material is visible on outer faces. At intermediate values, the specified percentage of
the inner material “bleeds through” and is visible on outer faces.
<DoubleSided>.material1 Material default: Standard -- alias: Material_1
The facing material.
<DoubleSided>.map1Enabled Boolean default: true -- alias: Map_1_Enable
Turn on/off display of the facing material.
<DoubleSided>.material2 Material default: Standard -- alias: Material_2
The back material.
<DoubleSided>.map2Enabled Boolean default: true -- alias: Map_2_Enable
Turn on/off display of the back material.
1208 Chapter 11 | 3ds max Objects
See also
Material Common Properties, Operators, and Methods (p. 1203)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
MatteShadow : Material
Constructor:
matteShadow ...
matte ...
Properties:
<MatteShadow>.opaqueAlpha Boolean default: true -- alias: Opaque_Alpha
Determines whether or not the matte material appears in the alpha channel. If you turn
off Opaque Alpha, the matte object will not make an alpha channel, and the image can be
used for compositing, just as if there are no matte objects in the scene.
<MatteShadow>.applyAtmosphere Boolean default: false
Turns the fogging of matte objects on and off.
<MatteShadow>.atmosphereDepth Integer default: 0
When applying fog, you can choose between two different methods. You can either apply
fog as if the matte surface is at an infinite distance from the camera or you can apply it as
if the matte surface is actually at that point on the object being shaded. In other words,
you can apply the fog to the matte surface in either 2D or 3D. The following controls
determine how this is applied:
At Background Depth (This is the 2D method. The scanline renderer fogs the scene, and
then renders its shadows. In this case, the shadows won’t be lightened by the fog. If you
want to lighten the shadows, you need to turn up the shadow brightness.)
At Object Depth (This is the 3D method. The renderer first renders the shadows, and then
fogs the scene. Since this varies the amount of fog over the 3D matte surface, the generated
matte/alpha channels don’t blend perfectly into the background. Use At Object Depth
when the matte object is meant to be a 3D object in the scene that the 2D background
represents.)
<MatteShadow>.receiveShadows Boolean default: false
When on, renders shadows on the matte surfaces.
<MatteShadow>.affectAlpha Boolean default: false
When on, shadows cast on a matte material are applied to the alpha channel. This lets you
render bitmaps with alpha channels that you can composite later.
MorpherMaterial : Material 1209
See also
Material Common Properties, Operators, and Methods (p. 1203)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
MorpherMaterial : Material
Constructor:
morphermaterial ...
The Channel_N property values are 100* the value shown for the corresponding Morph
modifier channel percentage value.
The submaterial for each channel is stored as a subAnim, and can not be set using MAXScript.
Once a material has been assigned to a channel (channel N), the properties of that material can
be accessed as subAnim N+1 of the MorpherMaterial, and the base object submaterial is
subAnim 101.
As an example, suppose you had an object called MyMorph which has two morph channels
defined, and a MorpherMaterial applied to it. You would need to assign the channel
submaterials in the 3ds max user interface. To access this material and its submaterials you
could use:
mtl=$MyMorph.material -- get the MorpherMaterial
MM_C1_percent=mtl.Channel_0/100. -- get morph target 1 percentage and scale it
correctly
MM_C1_mtl=mtl[1] -- get morph target 1 submaterial
MM_base_percent=mtl.Channel_100/100. -- get morph base object percentage and
scale it correctly
MM_base_mtl=mtl[101] -- get morph base object submaterial
See also
Material Common Properties, Operators, and Methods (p. 1203)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
MultiMaterial : Material
Constructor:
multimaterial [ numsubs:<integer> ]
multiSubMaterial [ numsubs:<integer> ]
Properties:
<multimaterial>.numsubs
<multisubmaterial>.numsubs
the number of sub-materials in the multimaterial.
<multimaterial>.materialList ArrayParameter default: #(Standard, Standard, ...
Standard, Standard)
<multisubmaterial>.materialList ArrayParameter default: #(Standard, Standard,
... Standard, Standard)
Stores the Material for each sub-material.
<multimaterial>.mapEnabled ArrayParameter default: #(true, true, ... true,
true)
<multisubmaterial>.mapEnabled ArrayParameter default: #(true, true, ... true,
true)
Stores whether the sub-material is enabled.
<multimaterial>.names ArrayParameter default: #(”“, ““, ... ““, ““)
MultiMaterial : Material 1211
If the numsubs named parameter is not specified, the default numsubs value is 10.
The number of sub-materials can be changed after material creation by changing the numsubs
property value.
The number of sub-materials can also be changed by setting the count property for the
materialList, mapEnabled, or names property to the desired number.
material1 is an alias for materialList[1].
See also
Material Common Properties, Operators, and Methods (p. 1203)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
1212 Chapter 11 | 3ds max Objects
NoMaterial : Material
Assigning this material is equivalent to setting the material to “None” in the Material Editor. Setting
a material to the value undefined is also equivalent to setting the material to “None” in the
Material Editor. For example, if a box had a Top_Bottom material assigned, the following would set
the Top sub-material to “None”:
$box01.material.TopMaterial=noMaterial()
or
$box01.material.TopMaterial=undefined
Constructor:
noMaterial ...
Properties:
There are no additional properties for NoMaterial.
See also
Material Common Properties, Operators, and Methods (p. 1203)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
RayTraceMaterial : Material
Constructor:
rayTraceMaterial ...
Properties:
<RaytraceMaterial>.Ambient_Color_On Float default: 0.0
If Ambient_Color_On = 0, Ambient_Amount is used, otherwise Ambient is used
<RaytraceMaterial>.Ambient Color default: (color 0 0 0) --
animatable
Sets the degree to which the material absorbs ambient light.
<RaytraceMaterial>.Ambient_Amount Float default: 0.0 -- animatable;
percentage
The amount that the ambient map affects the material expressed as a percentage of full
intensity.
<RaytraceMaterial>.Luminosity_Color_On Float default: 0.0
If Luminosity_Color_On = 0, Self_Illum__Amount is used, otherwise Luminosity is
used
RayTraceMaterial : Material 1213
The following properties are associated with the Dynamics Properties rollout. These properties are
not present in 3D Studio VIZ.
<RaytraceMaterial>.Bounce_Coefficient Float default:
1.0 -- animatable
Sets how far an object bounces after hitting a surface. The higher the value, the greater the
bounce. A value of 1 represents a “perfectly elastic collision,” or a bounce in which no
kinetic energy is lost.
<RaytraceMaterial>.Static_Friction Float default:
0.0 -- animatable
Sets how difficult it is for the object to start moving along a surface. The higher this value,
the more difficult.
<RaytraceMaterial>.Sliding_Friction Float default:
0.0 -- animatable
Sets how difficult it is for the object to keep moving over a surface. The higher this value,
the more difficult for the object to keep moving.
The following properties do not correspond to any user-interface items, but appear to be used by the
raytracer. These properties appear to be similar to the corresponding properties for the Raytrace
TextureMap (p. 1271).
<RaytraceMaterial>.Attenuation_Start Float default: 0.0
The distance in world units where attenuation begins.
<RaytraceMaterial>.Attenuation_Exponent Float default: 2.0
The distance in world units where the ray is fully attenuated.
<RaytraceMaterial>.Attenuation_Color_Mode Integer default: 0
This affects the behavior of light rays as they attenuate out:
Background (As the ray attenuates out, returns the background (either the scene’s
background or the background specified locally in the Raytracer Parameters rollout) rather
than the actual color of what the reflected/refracted ray sees.)
Use Attenuation_Color
<RaytraceMaterial>.Attenuation_Color Color default:
(color 0 0 0)
The color used for attenuation.
<RaytraceMaterial>.Attenuation_Near Float default: 1.0
The strength of the reflected/refracted ray at the start range distance. This is a normalized
percentage that can range from 0.0 to 1.0.
<RaytraceMaterial>.Attenuation_Control_1 Float default: 0.6666
Controls the shape of the curve near the curve start.
<RaytraceMaterial>.Attenuation_Control_2 Float default: 0.3333
Controls the shape of the curve near the curve end.
<RaytraceMaterial>.Attenuation_Far Float default: 0.0
Sets the strength of the reflected/refracted ray at the end range distance. This is a
normalized percentage that can range from 0.0 to 1.0.
RayTraceMaterial : Material 1223
See also
Material Common Properties, Operators, and Methods (p. 1203)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
1224 Chapter 11 | 3ds max Objects
StandardMaterial : Material
Constructor:
standardMaterial ...
standard ...
Properties:
The properties of a standard material vary based on the shader type. The following properties are
applicable to all shader types:
<Standard>.shaderType Integer default: 1 -- alias:
Shader_Type
Sets the shader type:
Anisotropic
Blinn
Metal
Multi-Layer
Oren-Nayar-Blinn
Phong
Strauss
<Standard>.shaderByName String default: “Blinn” -- alias:
Shader_Name
Sets the type of shader with a string, rather than a number. Enter “anisotropic”,
“blinn”, “metal”, “multi-layer”, “oren-nayar-blinn”, “phong”, or “strauss”.
Note: The .shaderType and .shaderByName are linked and will automatically change
each others values.
<Standard>.wire Boolean default: false
When on, the material will be rendered in wireframe mode.
<Standard>.twoSided Boolean default: false -- alias:
Two_sided
When on, the material will be applied to both sides of the selected faces.
<Standard>.faceMap Boolean default: false -- alias:
Face_Map
Applies the material to the faces of the geometry. If the material is a mapped material, it
requires no mapping coordinates. The map is automatically applied to each facet of the
object.
<Standard>.faceted Boolean default: false
Renders each face of a surface as if it were flat.
<Standard>.adTextureLock Boolean default: false -- alias:
Ambient_Diffuse_Texture_Lock
When on, ambient and diffuse texture maps will be locked.
StandardMaterial : Material 1225
samples specified by the Quality. Turning on Adaptive On can reduce the amount of time
required to supersample.
<Standard>.samplerAdaptThreshold Float default: 0.1 -- alias:
Adaptive_Threshold
Controls the Adaptive methods. A change in color greater than the Threshold value causes
the adaptive methods to take the full number of samples specified by the Quality. If the
color does not change as much, the adaptive method takes fewer samples and does not
require as much processing time.
<Standard>.samplerAdvancedOptions Boolean default: true -- alias:
Advanced_Options
The samplerAdvancedOptions property is defined as a property, but is not used by the
Standard material.
<standard>.UserParam0 Float default: 0.0 -- alias:
Optional_Param0
<standard>.UserParam1 Float default: 0.0 -- alias:
Optional_Param1
The UserParam0 and UserParam1 properties are defined as properties, but are not used by
the Standard material.
<Standard>.maps ArrayParameter default: #(undefined,
undefined, ... , undefined, undefined)
<Standard>.mapEnables ArrayParameter default: #(false, false, ... ,
false, false) -- alias: Map_Enables
<Standard>.mapAmounts ArrayParameter default: #(100.0, 100.0, ... ,
100.0, 100.0) -- animatable, alias: Map_Amounts
The three map arrays each have 24 elements and store data related to the material’s maps.
The maps array stores the textureMap for each channel, the mapEnables array stores
whether the that map channel is enabled, and the mapAmounts array stores the amount
value for each channel. The meaning of each map channel depends on the shaderType
value. Table Map Channels for Standard Material Shaders (p. 1232) shows the meaning of
each map channel for each shader. For example, for the Blinn shader type element 5 of the
map arrays correspond to the Glossiness map channel. The names in this table also reflect
property aliases that have been defined for easier access to the map channels. Again for the
Blinn shader type, array element 4, the property aliases for the 3 map arrays are:
GlossinessMap (maps[5]), GlossinessMapEnable (mapEnables[5]), and
GlossinessMapAmount (mapAmounts[5]). A textureMap needs to be assigned to a maps
array element (or alias) before the corresponding mapAmounts property (or alias) can be
animated.
The following properties are associated with the Dynamics Properties rollout. These properties are
not present in 3D Studio VIZ.
<Standard>.bounce Float default: 1.0 -- animatable,
alias: Bounce_Coefficient
Sets how far an object bounces after hitting a surface. The higher the value, the greater the
bounce. A value of 1 represents a “perfectly elastic collision,” or a bounce in which no
kinetic energy is lost.
1228 Chapter 11 | 3ds max Objects
See also
Material Common Properties, Operators, and Methods (p. 1203)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
1232 Chapter 11 | 3ds max Objects
Aniso- Oren-Nayar-
tropic Blinn Metal Multi-Layer Blinn Phong Strauss
1 AmbientMap AmbientMap AmbientMap AmbientMap AmbientMap AmbientMap DiffuseMap
2 DiffuseMap DiffuseMap DiffuseMap DiffuseMap DiffuseMap DiffuseMap GlossinessMap
3 SpecularMap SpecularMap SpecularMap DiffuseLevelMap SpecularMap SpecularMap MetalnessMap
Shellac : Material
Constructor:
Shellac ...
Properties:
<Shellac>.shellacMtl1 Material default: Standard -- alias: Base_Material
The base sub-material.
<Shellac>.shellacMtl2 Material default: Standard -- alias:
Shellac_Material
The shellac material.
<Shellac>.shellacColorBlend Float default: 0.0 -- animatable,
percentage, alias: Shellac_Color_Blend
Controls the amount of color mixing. At 0.0, the shellac material has no effect. Increasing
the Shellac Color Blend value increases the amount of shellac material color blended into
the base material color. There is no upper limit on this parameter. Large values “overload”
the shellac material colors.
See also
Material Common Properties, Operators, and Methods (p. 1203)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
TopBottom : Material
Constructor:
topBottom ...
topBottomMat ...
Properties:
<TopBottom>.topMaterial Material default: Standard -- alias:
Top______Standard
The top material.
<TopBottom>.bottomMaterial Material default: Standard -- alias:
Bottom______Standard
The bottom material.
<TopBottom>.map1Enabled Boolean default: true -- alias: Map_1_Enable
Turns on/off the use of the top material in the topbottom material.
<TopBottom>.map2Enabled Boolean default: true -- alias: Map_2_Enable
Turns on/off the use of the bottom material in the topbottom material.
1234 Chapter 11 | 3ds max Objects
See also
Material Common Properties, Operators, and Methods (p. 1203)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
TextureMap : Material
The TextureMap class represents the 2D and 3D texture maps which you can assign to materials or
certain object properties in 3ds max. You can create texture maps like bitmap, dent, and swirl, access
various properties on them, and assign these texture maps to materials and to certain 3ds max object
properties.
The classes derived directly from the TextureMap class are described in the TextureMap Types
(p. 1240) topic.
The properties, operators, and methods that are common to all classes derived directly from the
TextureMap class are described in the TextureMap Common Properties, Operators, and Methods (p. 1235)
topic.
TextureMaps also share a set of classes for properties that are used in several different TextureMap
classes. These shared classes are described in the TextureMap Shared Classes (p. 1236) topic.
The TextureMap class is derived from the Material class, and inherits the properties and methods
defined for that class. These properties and methods are described in the Material Common Properties,
Operators, and Methods (p. 1203) topic.
TextureMap Common Properties, Operators, and Methods 1235
The above will render a map to a bitmap and save it as a .bmp file.
1236 Chapter 11 | 3ds max Objects
Associated Methods:
showTextureMap <material> <TextureMap> <boolean>
This method provides control over the visibility of textures in the shaded viewport. You
specify the material containing the texture map, the texture map in that material to be
controlled, and a boolean to turn the display on or off. For example:
showTextureMap $foo.material $foo.material.diffuseMap on
tm = checker()
mat = standardMaterial diffuseMap:tm
mm = multimaterial()
mm[1] = mat
$box01.material = mm
showTextureMap mm[1] tm on
Note that for multimaterials, you need to specify the appropriate sub-material (using []
indexing, for example).
See also
Material Common Properties, Operators, and Methods (p. 1203)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
UVGenClass : Material
Properties:
<textureMap.coordinates>.mappingType Integer default: 0
mappingType = 0 - Texture; 1 - Environment
If the Coordinates rollout for the textureMap is displayed in Material Editor and this
property’s value is changed, the Texture/Environ radiobutton and Mapping dropdown
displays are not updated to reflect the change.
<textureMap.coordinates>.mapping Integer default: varies
If mapping type is Texture mapping (mappingType = 0), the default value for this property
is 0. mapping = 0 – Explicit Map Channel; 1 – Vertex Color Channel; 2 – Planar from
Object XYZ; 3 – Planar from World XYZ
If mapping type is Environment mapping (mappingType = 1), the default value for this
property is 4. mapping = 0 - Spherical; 1 - Cylindrical; 2 - Shrink-Wrap; 3 – Screen
The mapping source for Texture and Environment mapping types are internally stored in
separate variables, and the mapping source set for a mapping type is retained if you change
the mapping source for the other mapping type.
<textureMap.coordinates>.mapChannel Integer default: 1
The UV coordinate map channel.
<textureMap.coordinates>.U_Offset Float default: 0.0 -- animatable
<textureMap.coordinates>.V_Offset Float default: 0.0 -- animatable
Offset mapping coordinates along the surface’s local U axis or V axis. That is, at 0.0 (the
default), the map begins at the U or V origin. Increasing an Offset value moves the map
forward along that axis, and decreasing it moves it backward.
<textureMap.coordinates>.U_Tiling Float default: 1.0 -- animatable
<textureMap.coordinates>.V_Tiling Float default: 1.0 -- animatable
The tiling of UV mapping coordinates; that is, the number of times a mapped material’s
map is repeated in the surface’s local U axis or V axis.
<textureMap.coordinates>.U_Angle Float default: 0.0 -- animatable, angle
Rotates the map about the U-axis (in degrees).
<textureMap.coordinates>.V_Angle Float default: 0.0 -- animatable, angle
Rotates the map about the V-axis (in degrees).
<textureMap.coordinates>.W_Angle Float default: 0.0 -- animatable, angle
Rotates the map about the W-axis (in degrees).
<textureMap.coordinates>.Blur Float default: 1.0 -- animatable
Affects the sharpness or blurriness of the map based on its distance from the view. The
farther away the map is, the greater the blurring. The Blur value blurs maps in world space.
<textureMap.coordinates>.Blur_Offset Float default: 0.0 -- animatable
Affects the sharpness or blurriness of the map without regard to its distance from the view.
Blur Offset blurs the image itself in object space. Use this option when you want to soften
or defocus the details in a map to achieve the effect of a blurred image.
1238 Chapter 11 | 3ds max Objects
See also
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
StandardXYZGen : Material
Properties:
<textureMap.coords>.coordType Integer default: 0
The type of coordinates used for mapping:
Object XYZ (Uses planar mapping based on the object’s local coordinates (disregarding the
pivot point location).)
World XYZ (Uses planar mapping based on the scene’s world coordinates (disregarding the
object’s bounding box).)
Explicit Map Channel (Uses the map channel specified by the .mapChannel value.)
Vertex Color Channel (Uses assigned vertex colors as a channel.)
<textureMap.coords>.mapChannel Integer default: 1
The map channel used for mapping coordinates.
<textureMap.coords>.offset Point3 default: [0,0,0] -- animatable
Changes the position of the map in UV coordinates. The map moves in relation to its size.
<textureMap.coords>.Tiling Point3 default: [1,1,1] -- animatable
The number of times the map is tiled across each axis.
TexOutputClass : Material 1239
See also
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
TexOutputClass : Material
Properties:
<texturemap.output>.Output_Amount Float default: 1.0 -- animatable
The amount of the map being mixed into a composite material. Affects the saturation and
alpha value of the map.
<texturemap.output>.RGB_Offset Float default: 0.0 -- animatable
This value is added to the RGB values of the map colors, which affects the tonal value of
the colors. Eventually the map becomes white and self-illuminated. Lowering the value
decreases the tonal value towards black.
<texturemap.output>.RGB_Level Float default: 1.0 -- animatable
The RGB values of the map colors are multiplied by this value, which affects the saturation
of the color. Eventually the map becomes fully saturated and self-illuminated. Lowering
the value decreases the saturation and makes the map colors grayer.
<texturemap.output>.Bump_Amount Float default: 1.0 -- animatable
Adjusts the amount of bumpiness. This value has an effect only when the map is used as a
bump map.
<texturemap.output>.Mono_Color_Map subAnim
The Mono_Color_Map SubAnim contains the monochrome color mapping curve. You
cannot create this curve in MAXScript, or access this curve unless you first turn on the
Enable Color Map checkbox in the user interface.
<texturemap.output>.RGB_Color_Map subAnim
The RGB_Color_Map SubAnim contains the RGB color mapping curves. You cannot create
these curves in MAXScript, or access the curves unless you first turn on the Enable Color
Map checkbox and select the RGB radiobutton in the user interface.
1240 Chapter 11 | 3ds max Objects
<texturemap.output.Mono_Color_Map>.curve_1 SubAnim
The curve_1 SubAnim contains the monochrome color mapping curve points. You
cannot create or access these points unless the point is animated. If a point is animated,
you can access the point position using the .Point_X property of curve_1, where X in
the point number.
<texturemap.output.RGB_Color_Map>.curve_1 SubAnim
<texturemap.output.RGB_Color_Map>.curve_2 SubAnim
<texturemap.output.RGB_Color_Map>.curve_3 SubAnim
The curve_1, curve_2, and curve_3 SubAnims contains the R, G, and B color mapping
curve, respectively. You cannot create or access points in these curves unless the point is
animated. If a point is animated, you can access the point position using the .Point_X
property of the curve, where X in the point number.
Note:
The following properties are not accessible by MAXScript in 3ds max 4: Invert, Clamp, Alpha from
RGB Intensity, and Enable Color Map checkboxes, and the RGB/Mono radio-button.
See also
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
TextureMap Types
The following list displays the 3ds max TextureMap subclasses:
Adobe_Photoshop_Plug_In_Filter (p. 1241)
Adobe_Premiere_Video_Filter (p. 1242)
Bitmap (p. 1243)
Bricks (p. 1245)
Cellular (p. 1247)
Checker (p. 1249)
Composite (p. 1250)
Dent (p. 1251)
Falloff (p. 1252)
FalloffTextureMap (p. 1255)
FlatMirror (p. 1255)
Gradient (p. 1257)
Gradient_Ramp (p. 1259)
Marble (p. 1261)
Mask (p. 1262)
Mix (p. 1262)
Adobe_Photoshop_Plug_In_Filter : TextureMap 1241
Adobe_Photoshop_Plug_In_Filter : TextureMap
Constructor:
adobe_photoshop_plug_in_filter ...
<Adobe_Photoshop_Plug_In_Filter>.coordinates SubAnim
See the UVGenClass (p. 1237) topic for the StandardUVGen properties.
<Adobe_Photoshop_Plug_In_Filter>.output StandardTextureOutput
See the TexOutputClass (p. 1239) topic for the StandardTextureOutput properties.
Note:
The following properties are not accessible by MAXScript in 3ds max 4: the Use Alpha Plane
checkbox in the Parameters rollout, and all properties in the Bitmap Parameters and Time
Parameters rollouts.
See also
TextureMap Common Properties, Operators, and Methods (p. 1235)
Material Common Properties, Operators, and Methods (p. 1203)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Adobe_Premiere_Video_Filter : TextureMap
Constructor:
adobe_premiere_video_filter ...
See also
TextureMap Common Properties, Operators, and Methods (p. 1235)
Material Common Properties, Operators, and Methods (p. 1203)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
BitmapTexture : TextureMap 1243
BitmapTexture : TextureMap
Constructor:
bitmaptexture ...
bitmaptex ...
Properties:
<Bitmaptexture>.bitmap Bitmap default: Bitmap:
Returns the bitmap of the texture map. The script can perform any bitmap operations on
this bitmap and the changes will be reflected in the texture map. In order to see the results
of changing the bitmap in Material Editor and in the viewports, you need to modify any
one bitmapTexture property in the Material Editor user interface. This is a read only
property.
<Bitmaptexture>.filename String default: ““ -- alias: file_name
The name of the bitmap file.
<Bitmaptexture>.filtering Integer default: 0
The method of pixel averaging used in antialiasing the bitmap:
Pyramidal (Requires less memory and is adequate for most purposes.)
Summed Area (Requires much more memory, but yields generally superior results.)
None (Turns off filtering.)
<Bitmaptexture>.monoOutput Integer default: 0
Some parameters, such as opacity or specular level are a single value as opposed to a
material’s three-value color components. Controls in this group determine the source of
the Output mono channel in terms of the input bitmap:
RGB Intensity (Uses the intensity of the red, green, and blue channels for mapping. The
color of the pixels is ignored and only the value or luminance of the pixels is used. The
colors are computed as gray values in the range between 0 (black) and 255 (white).)
Alpha (Uses the intensity of the alpha channel for mapping.)
<Bitmaptexture>.RGBOutput Integer default: 0
The RGB Channel Output determines where the output RGB part comes from. The
controls in this group affect only maps for material components that display color:
Ambient, Diffuse, Specular, Filter Color, Reflection, and Refraction.
RGB (Displays the full color values of the pixels.)
Alpha as Gray (Displays tones of gray based on the levels of the alpha channel.)
<Bitmaptexture>.apply Boolean default: false
Turn on to use the cropping or placements settings.
<Bitmaptexture>.cropPlace Integer default: 0
Set whether cropping or placement is active:
Crop
Place
1244 Chapter 11 | 3ds max Objects
<Bitmaptexture>.output StandardTextureOutput
See the TexOutputClass (p. 1239) topic for the StandardTextureOutput properties.
Associated Methods:
enumerateFiles [ <MAXWrapper_obj> ] <function> [ <arg> ] \
[ #inactive ] [ #videoPost ] [ #render ] [ #missing ] \
[ #localOnly ]
Lets you run through all the bitmap files currently used in the scene or in an individual
object. You can filter this so it just gives you the bitmap files that are inactive or missing.
See the Bitmap Files (p. 1641) topic for a description of this method’s parameters.
freeSceneBitmaps()
Frees up all the memory used by the image file bitmap caches. This is useful if memory is
fragmented with a lot of different bitmaps and you want to have just the ones currently
active reloaded.
See also
TextureMap Common Properties, Operators, and Methods (p. 1235)
Material Common Properties, Operators, and Methods (p. 1203)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Bricks : TextureMap
Constructor:
bricks ...
Properties:
<Bricks>.Brick_Type Integer default: 1
Brick_Type = 0 - Custom Bricks; 1 - Running Bond; 2 - Common Flemish Bond; 3 - English
Bond; 4 - 1/2 Running Bond; 5 - Stack Bond; 6 - Fine Running Bond; 7 - Fine Stack Bond
The brick_type values define a set of predefined values for the Stacking and Row and
Column Editing properties. Changing brick_type only updates these properties if
Material Editor is displayed and the material is in the active slot.
<Bricks>.Show_Texture_Swatches Integer default: 1
When on, updates to show the texture assigned by a map for Bricks or Mortar.
OFF
ON
<Bricks>.Brick_Color Color default: (color 165.75 76.5 51) --
animatable
The color of the bricks.
<Bricks>.Horizontal_Count Float default: 3.0 -- animatable
The number of bricks in a row.
1246 Chapter 11 | 3ds max Objects
See also
TextureMap Common Properties, Operators, and Methods (p. 1235)
Material Common Properties, Operators, and Methods (p. 1203)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Cellular : TextureMap
Constructor:
cellular ...
Properties:
<Cellular>.celcolor Color default: (color 255 255 255) -- animatable,
alias: Cell_Color
The color of the cell.
<Cellular>.cellmap textureMap default: undefined
Assigns a map to the cells, rather than a solid color.
1248 Chapter 11 | 3ds max Objects
See also
TextureMap Common Properties, Operators, and Methods (p. 1235)
Material Common Properties, Operators, and Methods (p. 1203)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Checker : TextureMap
Constructor:
checker ...
Properties:
<Checker>.soften Float default: 0.0 -- animatable
Blurs the edges between the checkers. A little blurs a lot.
<Checker>.color1 Color default: (color 0 0 0) -- animatable, alias:
Color_1
Sets the color of one of the checkers.
1250 Chapter 11 | 3ds max Objects
See also
TextureMap Common Properties, Operators, and Methods (p. 1235)
Material Common Properties, Operators, and Methods (p. 1203)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
CompositeTextureMap : TextureMap
Constructor:
compositeTextureMap ...
compositeTexture ...
Properties:
<CompositeTexturemap>.mapList ArrayParameter default: #(undefined,
undefined) -- alias: Maps
<CompositeTexturemap>.mapEnabled ArrayParameter default: #(true, true) --
alias: Map_1_Enable
Dent : TextureMap 1251
Note:
Each of the map arrays initially contains 2 elements, corresponding to 2 sub-texturemaps for the
CompositeTextureMap. The mapList array stores the TextureMap for each sub-TextureMap, the
mapEnabled array stores whether that sub-TextureMap is enabled.
To change the number of sub-texturemaps, set the count property for either the mapList or
mapEnabled property to the desired number. For example, to create a compositeTextureMap with 5
sub-texturemaps, you would say:
c=compositeTextureMap()
c.mapList.count=5
See also
TextureMap Common Properties, Operators, and Methods (p. 1235)
Material Common Properties, Operators, and Methods (p. 1203)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Dent : TextureMap
Constructor:
dent ...
Properties:
<Dent>.size Float default: 200.0 -- animatable
Sets the relative size of dents. As the size increases, the number of dents decreases when
other settings are the same.
<Dent>.strength Float default: 20.0 -- animatable
Higher values increase the number of dents, lower values decrease the number of dents.
Decreasing Strength reduces the number of dents over a surface. At 0, the surface is
smooth (no dents). Increasing Strength increases the number of dents over a surface. 100 is
maximum.
<Dent>.iterations Integer default: 2 -- animatable
Sets the number of calculations used to create the dents.
<Dent>.color1 Color default: (color 0 0 0) -- animatable, alias:
Color_1
Sets the color of the dent.
<Dent>.map1 TextureMap default: undefined
Colors can be replaced by maps in the dent pattern.
<Dent>.map1Enabled Boolean default: true -- alias: MapOn1
Enables the associated map.
1252 Chapter 11 | 3ds max Objects
See also
TextureMap Common Properties, Operators, and Methods (p. 1235)
Material Common Properties, Operators, and Methods (p. 1203)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Falloff : TextureMap
Constructor:
falloff ...
Properties:
<Falloff>.color1 Color default: (color 0 0 0) -- animatable, alias:
Color_1
Sets the first color for falloff.
<Falloff>.map1Amount Float default: 100.0 -- animatable, alias:
Map_Amount_1
Relative strength of the first color in the falloff map.
<Falloff>.map1 TextureMap default: undefined -- alias: Map_1
Assigns a map to the first slot in the falloff.
<Falloff>.map1On Boolean default: true -- alias: Map_1_Enable
When on, the selected maps are used in the falloff. When off, colors are used.
<Falloff>.color2 Color default: (color 255 255 255) -- animatable,
alias: Color_2
Sets the second color for falloff.
<Falloff>.map2Amount Float default: 100.0 -- animatable, alias:
Map_Amount_2
Relative strength of the second color in the falloff map.
<Falloff>.map2 TextureMap default: undefined -- alias: Map_1
Assigns a map to the second slot in the falloff.
<Falloff>.map2On Boolean default: true -- alias: Map_2_Enable
When on, the selected maps are used in the falloff. When off, colors are used.
Falloff : TextureMap 1253
Object ( Picks an object whose orientation determines the falloff direction, .node. The
falloff direction is the direction from the point being shaded toward the object’s center.
Points on the side toward the object center get the Towards value, and those away from
the object get the Away value.)
Local X Axis (Sets the falloff direction to the object’s local X-axis. Changing the
orientation of the object changes the falloff direction. When no object is chosen, the
falloff direction uses the local X-axis of the object being shaded.)
Local Y Axis (Sets the falloff direction to the object’s local Y-axis. Changing the orientation
of the object changes the falloff direction. When no object is chosen, the falloff direction
uses the local Y-axis of the object being shaded.)
Local Z Axis (Sets the falloff direction to the object’s local Z-axis. Changing the orientation
of the object changes the falloff direction. When no object is chosen, the falloff direction
uses the local Z-axis of the object being shaded.)
World X Axis (Sets the falloff direction to the world coordinate system X-axis. Changing
object orientation doesn’t affect the falloff map.)
World Y Axis (Sets the falloff direction to the world coordinate system Y-axis. Changing
object orientation doesn’t affect the falloff map.)
World Z Axis (Sets the falloff direction to the world coordinate system Z-axis. Changing
object orientation doesn’t affect the falloff map.)
<Falloff>.node Node default: undefined -- alias:
Falloff_Direction_Object
When Falloff_Direction = 1, this object will determine the falloff direction.
<Falloff>.texture_output StandardTextureOutput
See the TexOutputClass (p. 1239) topic for the StandardTextureOutput properties.
<Falloff>.mixcurve SubAnim default: SubAnim:MixCurve
This mix curve determines the falloff.
<Falloff.mixcurve>.curve_1 SubAnim default: SubAnim:Curve_1
The curve_1 SubAnim contains the mix curve points. You cannot create or access these
points unless the point is animated. If a point is animated, you can access the point
position using the .Point_X property of curve_1, where X in the point number.
See also
TextureMap Common Properties, Operators, and Methods (p. 1235)
Material Common Properties, Operators, and Methods (p. 1203)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
FalloffTextureMap : TextureMap 1255
FalloffTextureMap : TextureMap
Constructor:
The falloffTextureMap class is used to convert 3ds max R2.5 falloff texture maps to the new
3ds max 4 falloff texture map. FalloffTextureMap objects are not creatable in MAXScript.
Properties:
There are no properties associated with falloffTextureMap.
See also
TextureMap Common Properties, Operators, and Methods (p. 1235)
Material Common Properties, Operators, and Methods (p. 1203)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
FlatMirror : TextureMap
Constructor:
flatMirror ...
Properties:
<FlatMirror>.applyBlur Boolean default: true
Turns on filtering to blur the maps. Antialiasing is also applied to the Distortion effect, if
any, when Apply Blur is turned on.
<FlatMirror>.blurAmount Float default: 1.0 -- animatable
Affects the sharpness or blurriness of the generated map based on its distance from the
object. The farther away the map is, the greater the blurring.
<FlatMirror>.frame Integer default: 1
When this is set to 0, the renderer creates the automatic flat mirror only on the first frame.
When this is set to 1, the renderer creates the automatic flat mirror based on nthframe.
<FlatMirror>.nthFrame Integer default: 1
<FlatMirror>.useEnviroment Boolean default: true
When off, environment maps are ignored by the mirror during rendering. It’s useful to
turn this off when you have mirrors in the scene and you’re rotoscoping against a flat
screen environment map. A screen environment map does not exist in 3D space the way
the other environment-map types do, and will not render properly.
<FlatMirror>.applyToFaceID Boolean default: false
When on, a specified material is applied to the mirror face.
<FlatMirror>.faceID Integer default: 1
Specifies the material ID number where you want the mirror assigned.
1256 Chapter 11 | 3ds max Objects
See also
TextureMap Common Properties, Operators, and Methods (p. 1235)
Material Common Properties, Operators, and Methods (p. 1203)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Gradient : TextureMap 1257
Gradient : TextureMap
Constructor:
gradient ...
Properties:
<Gradient>.color1 Color default: (color 0 0 0) -- animatable,
alias: Color_1
The gradient interpolates between 3 colors. This is the first color.
<Gradient>.map1 TextureMap default: undefined -- alias: Map_1
You can interpolate between 3 maps instead of colors. This is the first map.
<Gradient>.map1Enabled Boolean default: true -- alias:
Map_1_Enable
When on, the associated map is enabled.
<Gradient>.color2 Color default: (color 127.5 127.5 127.5) --
animatable, alias: Color_2
The gradient interpolates between 3 colors. This is the second color.
<Gradient>.map2 TextureMap default: undefined -- alias: Map_2
You can interpolate between 3 maps instead of colors. This is the second map.
<Gradient>.map2Enabled Boolean default: true -- alias:
Map_2_Enable
When on, the associated map is enabled.
<Gradient>.color3 Color default: (color 255 255 255) -
- animatable, alias: Color_3
The gradient interpolates between 3 colors. This is the third color.
<Gradient>.map3 TextureMap default: undefined -- alias: Map_3
You can interpolate between 3 maps instead of colors. This is the third map.
<Gradient>.map3Enabled Boolean default: true -- alias:
Map_3_Enable
When on, the associated map is enabled.
<Gradient>.color2Pos Float default: 0.5 -- animatable,
alias: Color_2_Position
Controls the centerpoint of the middle color. The position ranges from 0 to 1. When it is
0, color2 replaces color3. When it is 1, color2 replaces color1.
<Gradient>.gradientType Integer default: 0 -- alias:
Gradient_Type
Sets the type of gradient:
Linear (Interpolates the color based on the vertical position.)
Radial (Interpolates based on the distance from the center of the map.)
<Gradient>.noiseAmount Float default: 0.0 -- animatable,
alias: Noise_Amount
When nonzero (ranges from 0 to 1), applies a noise effect. This perturbs the color
interpolation parameter using a 3D noise function based on U, V, and Phase.
1258 Chapter 11 | 3ds max Objects
See also
TextureMap Common Properties, Operators, and Methods (p. 1235)
Material Common Properties, Operators, and Methods (p. 1203)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Gradient_Ramp : TextureMap
Constructor:
gradient_ramp ...
Properties:
<Gradient_Ramp>.Gradient_Type Integer default: 4
The type of gradient:
4 Corner (An asymmetrical linear transition of colors.)
Box (A box.)
Diagonal (A linear diagonal transition of colors.)
Lighting (Based on the light intensity value.)
Linear (A smooth, linear transition of colors.)
Mapped (Based on the luminance. Remaps the colors of the source map used in the
gradient.)
Normal (Based on the angle between the vector from the camera to the object and the
surface normal vector at the sample point.)
Pong (A diagonal sweep that repeats in the middle.)
Radial (A radial transition of colors.)
Spiral (A smooth, circular transition of colors.)
Sweep (A linear sweep transition of colors.)
Tartan (A plaid.)
<Gradient_Ramp>.Source_Map_On Integer default: 1
When on, assigns a map to a mapped gradient.
OFF
ON
1260 Chapter 11 | 3ds max Objects
See also
TextureMap Common Properties, Operators, and Methods (p. 1235)
Material Common Properties, Operators, and Methods (p. 1203)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Marble : TextureMap
Constructor:
marble ...
Properties:
<Marble>.size Float default: 70.0 -- animatable
Sets the spacing between the veins.
<Marble>.width Float default: 0.025 -- animatable, alias:
Vein_width
Sets the width of the veins.
<Marble>.color1 Color default: (color 51 51 25.5) -- animatable, alias:
Color_1
The color for the veins.
<Marble>.map1 TextureMap default: undefined -- alias: Map_1
The map used for the veins.
<Marble>.map1Enabled Boolean default: true -- alias: Map_1_Enable
When on, the veins use map1 as their color.
<Marble>.color2 Color default: (color 209.1 209.1 153) -- animatable,
alias: Color_2
The color of the background.
<Marble>.map2 TextureMap default: undefined -- alias: Map_2
The map used for the background.
<Marble>.map2Enabled Boolean default: true -- alias: Map_2_Enable
When on, map2 is used for the background.
<Marble>.coords StandardXYZGen -- alias: coordinates
See the StandardXYZGen (p. 1238) topic for the StandardXYZGen properties.
See also
TextureMap Common Properties, Operators, and Methods (p. 1235)
Material Common Properties, Operators, and Methods (p. 1203)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
1262 Chapter 11 | 3ds max Objects
Mask : TextureMap
Constructor:
mask ...
maskTex ...
Properties:
<Mask>.map TextureMap default: undefined
The map viewed through the mask.
<Mask>.mapEnabled Boolean default: true -- alias: Map_1_Enable
Enables the map.
<Mask>.mask TextureMap default: undefined
The map to be used as a mask.
<Mask>.maskEnabled Boolean default: true -- alias: Map_2_Enable
Enables the mask map.
<Mask>.maskInverted Boolean default: false -- alias: Invert
When on, inverts the effect of the mask.
See also
TextureMap Common Properties, Operators, and Methods (p. 1235)
Material Common Properties, Operators, and Methods (p. 1203)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Mix : TextureMap
Constructor:
mix ...
Properties:
<Mix>.color1 Color default: (color 0 0 0) -- animatable, alias: Color_1
The first color to be mixed.
<Mix>.map1 TextureMap default: undefined -- alias: Map_1
Sets a map to be used instead of color1.
<Mix>.map1Enabled Boolean default: true -- alias: Map_1_Enable
When on, map1 is enabled.
<Mix>.color2 Color default: (color 255 255 255) -- animatable, alias:
Color_2
The second color to be mixed.
<Mix>.map2 TextureMap default: undefined -- alias: Map_2
Sets a map to be used instead of color2.
Noise : TextureMap 1263
See also
TextureMap Common Properties, Operators, and Methods (p. 1235)
Material Common Properties, Operators, and Methods (p. 1203)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Noise : TextureMap
Constructor:
noise ...
Properties:
<Noise>.type Integer default: 0
Sets the type of noise:
Regular (Generates plain noise. Basically the same as fractal noise with levels at 1.)
Fractal (Generates noise using a fractal algorithm. levels sets the number of iterations for
the fractal noise.)
Turbulence (Generates fractal noise with an absolute value function applied to it to make
fault lines.)
<Noise>.size Float default: 25.0 -- animatable, alias:
Noise_Size
Sets the scale of the noise function.
1264 Chapter 11 | 3ds max Objects
See also
TextureMap Common Properties, Operators, and Methods (p. 1235)
Material Common Properties, Operators, and Methods (p. 1203)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
NoTexture : TextureMap 1265
NoTexture : TextureMap
Assigning this texture is equivalent to setting a texture to “None” in the Material Editor. Setting a
texture to the value undefined is also equivalent to setting the texture to “None” in the Material
Editor. For example:
$box01.material.bumpmap=noTexture()
or
$box01.material.bumpmap=undefined
Constructor:
noTexture ...
Properties:
There are no additional properties associated with NoTexture.
See also
TextureMap Common Properties, Operators, and Methods (p. 1235)
Material Common Properties, Operators, and Methods (p. 1203)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Output : TextureMap
Constructor:
output ...
Properties:
<output>.map1 TextureMap default: undefined -- alias: Map_1
Map used to apply output settings.
<output>.map1Enabled Boolean default: true -- alias: Map_1_Enable
When on, enables the associated map.
<output>.output StandardTextureOutput
see the TexOutputClass (p. 1239) topic for the StandardTextureOutput properties
See also
TextureMap Common Properties, Operators, and Methods (p. 1235)
Material Common Properties, Operators, and Methods (p. 1203)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
1266 Chapter 11 | 3ds max Objects
Paint : TextureMap
Note: Paint maps are no longer supported in 3ds max 4.
Constructor:
paint ...
Properties:
<Paint>.height Integer default: 0 -- animatable
<Paint>.width Integer default: 0 -- animatable
<Paint>.coordinates SubAnim
See the UVGenClass (p. 1237) topic for the StandardUVGen properties.
See also
TextureMap Common Properties, Operators, and Methods (p. 1235)
Material Common Properties, Operators, and Methods (p. 1203)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Particle_Age : TextureMap
Constructor:
particle_age ...
See also
TextureMap Common Properties, Operators, and Methods (p. 1235)
Material Common Properties, Operators, and Methods (p. 1203)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Particle_MBlur : TextureMap
Constructor:
particle_mblur ...
See also
TextureMap Common Properties, Operators, and Methods (p. 1235)
Material Common Properties, Operators, and Methods (p. 1203)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Perlin_Marble : TextureMap
Constructor:
perlin_marble ...
Properties:
<Perlin_Marble>.size Float default: 50.0 -- animatable
Sets the size of the marble pattern. Change this to change the scale of marble, relative to
the object’s geometry.
<Perlin_Marble>.level Float default: 8.0 -- animatable, alias:
Levels
Sets the number of times the turbulence algorithm is applied. Can range from 1.0 to 10.0.
The higher the value, the more complicated the marble pattern.
<Perlin_Marble>.color1 Color default: (color 189.975 189.975 160.65) --
animatable, alias: Color_1
The first color used in the marble.
<Perlin_Marble>.saturation1 Float default: 85.0 -- animatable, alias:
Color_1_Saturation
Controls the saturation of the color in the map, without altering the color displayed in the
color swatch. Lower values darken the color, and higher values lighten it.
<Perlin_Marble>.map1 TextureMap default: undefined
Map used in place of color1.
<Perlin_Marble>.map1Enabled Boolean default: true -- alias: EnableMap1
When on, the associated map is enabled.
<Perlin_Marble>.color2 Color default: (color 59.925 89.25 59.925) --
animatable, alias: Color_2
The second color used in the marble.
<Perlin_Marble>.saturation2 Float default: 70.0 -- animatable, alias:
Color_2_Saturation
Controls the saturation of the color in the map, without altering the color displayed in the
color swatch. Lower values darken the color, and higher values lighten it.
Planet : TextureMap 1269
See also
TextureMap Common Properties, Operators, and Methods (p. 1235)
Material Common Properties, Operators, and Methods (p. 1203)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Planet : TextureMap
Constructor:
planet ...
Properties:
<Planet>.color1 Color default: (color 10.2 20.4 79.05) -- animatable,
alias: Color_1
The color at the center of the water mass.
<Planet>.color2 Color default: (color 10.2 30.6 79.05) -- animatable,
alias: Color_2
The color surrounding the center of the water mass.
<Planet>.color3 Color default: (color 10.2 40.8 79.05) -- animatable,
alias: Color_3
The color surrounding color2, meeting the land.
<Planet>.color4 Color default: (color 10.2 99.45 12.75) -- animatable,
alias: Color_4
<Planet>.color5 Color default: (color 99.45 79.05 12.75) -- animatable,
alias: Color_5
<Planet>.color6 Color default: (color 79.05 20.4 7.65) -- animatable,
alias: Color_6
<Planet>.color7 Color default: (color 99.45 79.05 51) -- animatable,
alias: Color_7
<Planet>.color8 Color default: (color 99.45 99.45 99.45) -- animatable,
alias: Color_8
The colors in these five swatches are applied to the land areas of the planet surface. Their
arrangement continues that of the water colors. color4 is the shoreline of the land,
meeting the water; color5 comes next, working toward the center of the land mass.
color8 is at the center of the land mass.
1270 Chapter 11 | 3ds max Objects
See also
TextureMap Common Properties, Operators, and Methods (p. 1235)
Material Common Properties, Operators, and Methods (p. 1203)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Raytrace : TextureMap 1271
Raytrace : TextureMap
Constructor:
raytrace ...
Properties:
<Raytrace.parameters>.Trace_Mode Integer default: 0
Sets whether to cast reflected or refracted rays:
Auto Detect (If assigned to the material’s Reflection component, the raytracer will reflect.
If assigned to Refraction, it will refract. If you assign Raytrace to any other component, you
have to manually specify whether you want reflected rays or refracted rays.)
Reflection (Casts reflected rays off the object’s surface.)
Refraction (Casts refracted rays into or through the object’s surface.)
<Raytrace.parameters>.Options__Raytracer_Enable Boolean default:
true -- animatable
Turns the raytracer on or off. Even with raytracing off, Raytrace material and Raytrace map
still reflect and refract the environment, including both the environment map for the
3ds max scene, and the environment map assigned to the Raytrace material.
<Raytrace.parameters>.Options__Antialiasing_Enable Boolean default:
true -- animatable
Turns antialiasing on or off. Antialiasing is possibly the slowest portion of raytrace
rendering.
<Raytrace.parameters>.Options__Self_Reflect_Refract Boolean default:
true -- animatable
Turns self reflection/refraction on or off.
<Raytrace.parameters>.Options__Raytrace_Atmospherics Boolean default:
true -- animatable
Turns the raytracing of atmospheric effects on or off. Atmospheric effects include fire, fog,
volume light, and so on.
<Raytrace.parameters>.Options__Reflect_Refract_Material_ID_s Boolean default:
true -- animatable
When on, the material reflects effects assigned to material IDs in the renderer’s G-buffer on
or off.
<Raytrace.parameters>.Options__Raytrace_Objects_in_Glass Boolean default:
true -- animatable
Turns the raytracing of objects inside raytraced objects on or off.
<Raytrace.parameters>.Options__Raytrace_Atmospherics_in_Glass Boolean default:
true -- animatable
Same as the previous control, but for atmospheric effects instead of objects.
<Raytrace.parameters>.Options__Color_Density___Fog_Enable Boolean default:
true -- animatable
Turns the color density and fog features on or off.
1272 Chapter 11 | 3ds max Objects
Note:
The sub-maps that can be assigned to a Raytrace texturemap are not accessible to MAXScript in
3ds max 4 unless they have already been assigned to the Bricks map. Once these maps have been
assigned, they are available as properties of the Bricks TextureMap value. The property names,
however, are dependent on the type of maps assigned. For example, if dent maps were assigned to
all the sub-maps, the property names would be similar to Background__Map__17____Dent,
Blur_Map__Map__18____Dent, Defocus_Map__Map__19____Dent,
Reflectivity_Map__Map__20____Dent, Tint_Map__Map__21____Dent,
Color_Density_Map__Map__22____Dent, and Fog_Color_Map__Map__23____Dent. These
maps are also stored as subAnims 2 through 8 of the Raytrace TextureMap value, respectively. If the
subAnim name for a subAnim is similar to Background__None, no map has been assigned to that
sub-map.
See also
TextureMap Common Properties, Operators, and Methods (p. 1235)
Material Common Properties, Operators, and Methods (p. 1203)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Reflect_Refract : TextureMap
Constructor:
reflect_refract ...
Properties:
<Reflect_Refract>.source Integer default: 0
Chooses the source of the six cubic maps:
Automatic (Automatically generates by looking out in six directions from the pivot of the
object with the material, then mapped onto the surface during rendering. When on, the
options in the Automatic group are active, letting you choose whether the maps will be
generated only once, or regenerated at specified frames in the animation.)
From File (When on, you can specify the bitmaps to use.)
<Reflect_Refract>.size Integer default: 100 -- animatable
Sets the size of the Reflect/Refract maps. The default value of 100 produces distinct images.
Lower values lose progressively more detail.
<Reflect_Refract>.useAtmosphericMap Boolean default: true -- alias:
Use_Atmospheric
When off, environment maps are ignored by Reflect/Refract map during rendering. It’s
useful to turn this off when you have mirrors in the scene and you’re rotoscoping against a
flat screen environment map. A screen environment map does not exist in 3D space the
way the other environment-map types do, and will not render properly.
Reflect_Refract : TextureMap 1277
See also
TextureMap Common Properties, Operators, and Methods (p. 1235)
Material Common Properties, Operators, and Methods (p. 1203)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
1278 Chapter 11 | 3ds max Objects
RGB_Multiply : TextureMap
Constructor:
rgb_multiply ...
Properties:
<RGB_Multiply>.color1 Color default: (color 255 255 255) -- animatable,
alias: Color_1
<RGB_Multiply>.map1 TextureMap default: undefined -- alias: Map_1
<RGB_Multiply>.map1Enabled Boolean default: true -- alias: Map_1_Enable
Enables associated map.
<RGB_Multiply>.color2 Color default: (color 255 255 255) -- animatable,
alias: Color_2
<RGB_Multiply>.map2 TextureMap default: undefined -- alias: Map_2
<RGB_Multiply>.map2Enabled Boolean default: true -- alias: Map_2_Enable
Enables associated map.
<RGB_Multiply>.alphaFrom Integer default: 2
Determines how to generate alpha for the map:
Map #1 (Uses the first map’s alpha channel.)
Map #2 (Uses the second map’s alpha channel.)
Multiply Alphas (Generates a new alpha channel by multiplying the alpha channels of the
two maps.)
See also
TextureMap Common Properties, Operators, and Methods (p. 1235)
Material Common Properties, Operators, and Methods (p. 1203)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
RGB_Tint : TextureMap
Constructor:
rgb_tint ...
Properties:
<RGB_Tint>.red Color default: (color 255 0 0) -- animatable
The tint of the red color channel.
<RGB_Tint>.green Color default: (color 0 255 0) -- animatable
The tint of the green color channel.
<RGB_Tint>.blue Color default: (color 0 0 255) -- animatable
The tint of the blue color channel.
Smoke : TextureMap 1279
See also
TextureMap Common Properties, Operators, and Methods (p. 1235)
Material Common Properties, Operators, and Methods (p. 1203)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Smoke : TextureMap
Constructor:
smoke ...
Properties:
<Smoke>.size Float default: 40.0 -- animatable
Changes the scale of the smoke “clumps.”
<Smoke>.iterations Integer default: 5 -- animatable
Sets the number of times the fractal function is applied. The higher the value, the more
detail within the smoke, but the longer the calculation time.
<Smoke>.phase Float default: 0.0 -- animatable
Shifts the turbulence within the smoke pattern. Animate this parameter to animate the
movement of the smoke.
<Smoke>.exponent Float default: 1.5 -- animatable
Makes color2, representing the smoke, sharper and more wispy. As this value increases,
the smoke “tendrils” become smaller within the pattern.
<Smoke>.color1 Color default: (color 0 0 0) -- animatable, alias:
Color_1
The smokeless portion of the effect.
<Smoke>.map1 TextureMap default: undefined
The map used for the smokeless portion of the effect.
<Smoke>.map1On Boolean default: true -- alias: Map1_On
Enables the associated map.
<Smoke>.color2 Color default: (color 229.5 229.5 229.5) -- animatable,
alias: Color_2
The color of the smoke.
<Smoke>.map2 TextureMap default: undefined
The map used for the smoke.
1280 Chapter 11 | 3ds max Objects
See also
TextureMap Common Properties, Operators, and Methods (p. 1235)
Material Common Properties, Operators, and Methods (p. 1203)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Speckle : TextureMap
Constructor:
speckle ...
Properties:
<Speckle>.size Float default: 60.0 -- animatable
Adjusts the size of the speckles. Use this to make the speckles match your geometry.
<Speckle>.color1 Color default: (color 51 127.5 255) -- animatable, alias:
Color_1
The color of the speckles.
<Speckle>.map1 TextureMap default: undefined
The map used as the color of the speckles.
<Speckle>.map1On Boolean default: true -- alias: Map1_On
Enables associated map.
<Speckle>.color2 Color default: (color 178.5 204 204) -- animatable, alias:
Color_2
The color of the background.
<Speckle>.map2 TextureMap default: undefined
The map used as the color of the background.
<Speckle>.map2On Boolean default: true -- alias: Map2_On
Enables associated map.
<Speckle>.coords StandardXYZGen -- alias: Coordinates
See the StandardXYZGen (p. 1238) topic for the StandardXYZGen properties.
See also
TextureMap Common Properties, Operators, and Methods (p. 1235)
Material Common Properties, Operators, and Methods (p. 1203)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Splat : TextureMap 1281
Splat : TextureMap
Constructor:
splat ...
Properties:
<Splat>.size Float default: 40.0 -- animatable
Adjusts the size of the splats. Use this to make the splats match your geometry.
<Splat>.iterations Integer default: 4 -- animatable
Sets the number of times the fractal function is evaluated. The higher the number, the
more detailed the splats, but the longer the calculation time.
<Splat>.threshold Float default: 0.2 -- animatable
Determines how much of color1 is mixed with color2. At 0, only color1 is displayed;
at 1, only color2 is displayed.
<Splat>.color1 Color default: (color 178.5 204 204) -- animatable,
Color_1
The color of the background.
<Splat>.map1 TextureMap default: undefined
The map used as the color of the background.
<Splat>.map1On Boolean default: true -- alias: Map1_On
Enables associated map.
<Splat>.color2 Color default: (color 51 127.5 255) -- animatable,
Color_2
The color of the splats.
<Splat>.map2 TextureMap default: undefined
The map used as the color of the splats.
<Splat>.map2On Boolean default: true -- alias: Map2_On
Enables associated map.
<Splat>.coords StandardXYZGen -- alias: Coordinates
See the StandardXYZGen (p. 1238) topic for the StandardXYZGen properties.
See also
TextureMap Common Properties, Operators, and Methods (p. 1235)
Material Common Properties, Operators, and Methods (p. 1203)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
1282 Chapter 11 | 3ds max Objects
Stucco : TextureMap
Constructor:
stucco ...
Properties:
<Stucco>.size Float default: 20.0 -- animatable
Adjusts the size of the indentations. Use this to make the scale of the stucco match your
geometry.
<Stucco>.thickness Float default: 0.15 -- animatable
Blurs the border between the two colors. At 0, the borders are sharp. The higher the
Thickness, the more the borders are blurred and the less distinct the indentations are.
When you use Stucco as a bump map, the indentations are very faint at 0.5 and disappear
at values not much greater.
<Stucco>.threshold Float default: 0.57 -- animatable
Determines how much of color1 is mixed with color2. At 0, only color1 is displayed;
at 1, only color2 is displayed.
<Stucco>.color1 Color default: (color 0 0 0) -- animatable, alias:
Color_1
The color of the indentations.
<Stucco>.map1 TextureMap default: undefined
The map used as the color of the indentations.
<Stucco>.map1On Boolean default: true -- alias: Map1_On
Enables associated map.
<Stucco>.color2 Color default: (color 229.5 229.5 229.5) -- animatable,
alias: Color_2
The background stucco color.
<Stucco>.map2 TextureMap default: undefined
The map used as the background stucco color.
<Stucco>.map2On Boolean default: true -- alias: Map2_On
Enables associated map.
<Stucco>.coords StandardXYZGen -- alias: Coordinates
See the StandardXYZGen (p. 1238) topic for the StandardXYZGen properties.
See also
TextureMap Common Properties, Operators, and Methods (p. 1235)
Material Common Properties, Operators, and Methods (p. 1203)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Swirl : TextureMap 1283
Swirl : TextureMap
Constructor:
swirl ...
Properties:
<Swirl>.Base Color default: (color 229.5 147.9 76.5) -- animatable
The underlying layer for the swirl effect.
<Swirl>.Swirl Color default: (color 0 25.5 51) -- animatable
Mixed with the Base color or map, produces the swirl effect.
<Swirl>.Color_Contrast Float default: 0.4 -- animatable
Controls the contrast between Base and Swirl. At 0, the swirl is blurred. Higher values
increase the contrast until all colors become black and white, even if Swirl Intensity and
Swirl Amount are very high.
<Swirl>.Swirl_Intensity Float default: 2.0 -- animatable
Controls the intensity of the swirl color. Higher values create a more vibrant mix of colors.
At 0, the swirl effect disappears.
<Swirl>.Swirl_Amount Float default: 1.0 -- animatable
Controls the quantity of the swirl color that gets mixed into the base color. If set to 0,
only the base color is used.
<Swirl>.Twist Float default: 1.0 -- animatable
Changes the number of spirals in the swirl effect. Higher values increase the number of
spirals. Negative values change the direction of the twist. At 0, the colors are randomly
distributed, not swirled.
<Swirl>.Constant_Detail Integer default: 4 -- animatable
Changes the level of detail within a swirl. Lower values minimize the level of detail within
the swirl. At 0, all detail is lost. Higher values increase detail until the swirl effect
disappears.
<Swirl>.Center_Position_Y Float default: -0.5 -- animatable
<Swirl>.Center_Position_X Float default: -0.5 -- animatable
Adjusts the location of the swirl’s center on the object.
<Swirl>.Lock_Background Integer default: 1
X and Y values remain identical as you adjust them. By turning off Lock and adjusting
either the X or Y position, you can “slide” the swirl effect across the object.
OFF
ON
<Swirl>.Random_Seed Float default: 23638.4 -- animatable
Sets a new starting point for the swirl effect. Changes the swirl pattern while maintaining
other parameters.
<Swirl>.coordinates SubAnim
See the UVGenClass (p. 1237) topic for the StandardUVGen properties.
1284 Chapter 11 | 3ds max Objects
Note:
The Base and Swirl sub-maps are not accessible to MAXScript in 3ds max 4 unless they have already
been assigned to the Swirl map. Once these maps have been assigned, they are available as properties
of the Swirl TextureMap value. The property names, however, are dependent on the type of maps
assigned. For example, if a Checker and a Cellular map were assigned as the Base and Swirl sub-maps,
the property names would be similar to Swirl__Map__7____Checker and
Swirl__Map__6____Cellular. These maps are also stored as subAnims 12 and 13 of the Swirl
TextureMap value. If the subAnim name for the subAnim is Swirl__None and Swirl__None,
respectively, no map has been assigned.
See also
TextureMap Common Properties, Operators, and Methods (p. 1235)
Material Common Properties, Operators, and Methods (p. 1203)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Thin_Wall_Refraction : TextureMap
Constructor:
thin_wall_refraction ...
Properties:
<Thin_Wall_Refraction>.applyBlur Boolean default: true
Turns on filtering to blur the maps.
<Thin_Wall_Refraction>.blur Float default: 1.0 -- animatable
Affects the sharpness or blurriness of the generated map based on its distance from the
object. The farther away the map is, the greater the blurring. Blur is primarily used to avoid
aliasing. It’s a good idea to use a small amount of blurring for all maps in order to avoid
the scintillation or aliasing that can occur when pixel details are reduced off in the
distance.
<Thin_Wall_Refraction>.frame Integer default: 0
Affects how the refraction should behave in animations:
First Frame Only (Tells the renderer to create the refracted image only on the first frame.)
Every Nth Frame (Tells the renderer to regenerate the refracted image based on nthframe.)
<Thin_Wall_Refraction>.nthFrame Integer default: 1
Sets the regeneration rate in animations.
<Thin_Wall_Refraction>.useEnviroment Boolean default: true
When off, environment maps are ignored by the refraction during rendering. It’s useful to
turn it this off when you have refractions in the scene and you’re rotoscoping against a flat
screen environment map. A screen environment map does not exist in 3D space the way
the other environment map types do, and will not render properly.
Vertex_Color : TextureMap 1285
See also
TextureMap Common Properties, Operators, and Methods (p. 1235)
Material Common Properties, Operators, and Methods (p. 1203)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Vertex_Color : TextureMap
Constructor:
vertex_color ...
Properties:
There are no additional properties for vertex_color.
See also
TextureMap Common Properties, Operators, and Methods (p. 1235)
Material Common Properties, Operators, and Methods (p. 1203)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
1286 Chapter 11 | 3ds max Objects
Water : TextureMap
Constructor:
water ...
Properties:
<Water>.numWaveSets Integer default: 10 -- animatable, alias:
Num_Wave_Sets
Specifies how many wave sets are used in the pattern. Wave sets are groups of radially
symmetrical waves that originate from randomly computed points along the surface of an
imaginary sphere inside the object (a circle, in the case of 2D wave distribution). For calm
water, set this to a low number. Use a high number for choppy water.
<Water>.waveRadius Float default: 800.0 -- animatable, alias:
Wave_Radius
Specifies the radius, in 3ds max units, of the imaginary sphere (3D distribution) or circle
(2D distribution) whose surface is the origin of each wave set. A large radius produces large
circular wave patterns, while a small radius produces dense, smaller waves.
<Water>.waveLenMax Float default: 50.0 -- animatable
<Water>.waveLenMin Float default: 5.0 -- animatable
Define the interval used to randomly chose each wave center. If these two values are close
together, the water appears more regular. If they’re farther apart, the water is less regular.
<Water>.amplitude Float default: 1.0 -- animatable
Adjusts the strength and the depth of the waves by increasing the contrast between the
two colors.
<Water>.phase Float default: 0.0 -- animatable
Shifts the wave pattern. Animate this parameter to animate the motion of the pattern.
<Water>.distribution Integer default: 0
3D distributes the wave centers on the surface of an imaginary sphere, affecting all sides of
a 3D object. 2D distributes the wave in circles centered on the XY plane, which is more
appropriate for flat water surfaces such as oceans and lakes.
3D
2D
<Water>.randomSeed Integer default: 30159
Provides a seed number to generate the water pattern. The pattern changes with each seed,
but all other settings are maintained.
<Water>.color1 Color default: (color 198.9 198.9 239.7) -- animatable,
alias: Color_1
Sets the wave trough color.
<Water>.map1 TextureMap default: undefined
Sets a map as the wave trough color.
<Water>.map1On Boolean default: true -- alias: Map1_On
Enables associated map.
Wood : TextureMap 1287
See also
TextureMap Common Properties, Operators, and Methods (p. 1235)
Material Common Properties, Operators, and Methods (p. 1203)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Wood : TextureMap
Constructor:
wood ...
Properties:
<Wood>.thickness Float default: 7.0 -- animatable, alias:
Grain_Thickness
Sets the relative thickness of the color bands that make up the grain.
<Wood>.radialNoise Float default: 1.0 -- animatable, alias:
Radial_Noise
Sets the relative randomness of the pattern on a plane perpendicular to the grain, the
circular ring structure.
<Wood>.axialNoise Float default: 1.0 -- animatable, alias:
Axial_Noise
Sets the relative randomness of the pattern on a plane parallel with the grain, along the
length of the grain.
<Wood>.color1 Color default: (color 201.45 175.95 68.85) -- animatable,
alias: Color_1
<Wood>.map1 TextureMap default: undefined
<Wood>.map1Enabled Boolean default: true -- alias: MapOn1
Enables associated map.
1288 Chapter 11 | 3ds max Objects
See also
TextureMap Common Properties, Operators, and Methods (p. 1235)
Material Common Properties, Operators, and Methods (p. 1203)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Animation Controllers
All animation in 3ds max is implemented using one of the many controller classes accessible in the
Track View and Motion Panel, or assigned automatically by 3ds max when you use the Animate
button to do keyframing. Certain controllers (keyframeable controllers) store their animation values
as keys.
This section includes topics that discuss all aspects of scripting 3ds max controllers and the Key
classes used in keyframing.
Controller Common Properties, Operators, and Methods (p. 1289)
Time and Key Functions on Object Hierarchies (p. 1299)
Controllers - Superclass Level (p. 1300)
The controllers are arranged in a hierarchy of superclasses and classes. All classes in a superclass
output a specific data type (for example, Float or Point3). Each animatable property in 3ds max has
a data type, and any of the classes in the superclass that outputs that data type can be assigned that
property. So, for example, the linear_float and noise_float controllers are classes in the Float
superclass, and either can be assigned to the height property of a box, which is has a Float data type.
The list of controller superclasses can be determined using the apropos() function:
apropos “controller:super”
The list of available controllers can be determined using the showClass() function:
showClass “*:*controller*”
which lists all the known classes that have “controller” in their superclass name. The
controllers include, at least, 3ds max’s core controllers and any 3rd-party plug-in
controllers. In some cases, embedded controllers for some complex plug-ins may be visible
in the showClass() listing (such as for character studio and HyperMatter). You should
not attempt to create and use these controllers individually, this may result in system
exceptions.
Wood : TextureMap 1289
The keys and value properties give you access to the value and keys in a free-standing
controller, which is useful when working with the global tracks controllers that are
accessible in MAXScript. Those controllers that are not keyframeable return an empty
KeyArray for their keys property.
The value property is sensitive to the current time and animate contexts, so you can use it
to evaluate a controller at various times or to plant keyframes in those controllers that
support keys.
You can only assign a value to a controller’s value property if the controller is a key-based
controller. The only exception to this is that you can assign a Matrix3 value to a PRS
controller’s value property. MAXScript will automatically set the individual position,
rotation, and scale values to the values represented in the Matrix3 value.
If an Ease Curve has been assigned to a controller, the following controller-related sub-property is
available:
<controller>.Ease_Curve Float -- the controller’s ease curve value
If an Ease Curve has been assigned to a controller, the following controller-related sub-property is
available:
<controller>.Multiplier_Curve Float -- the controller’s multiplier curve value
See the Ease and Multiplier Curve Functions (p. 1297) topic for methods and notes related to ease and
multiplier curves.
Example:
globaltracks.float.mycontroller.value
globaltracks.float.mycontroller.keys[2]
Associated Properties:
All animatable properties in 3ds max objects let you reference several controller-related sub-
properties. These are:
<property>.controller -- the property’s controller
<property>.track -- a synonym for .controller
<property>.isAnimated -- a boolean indicating whether the property is animated
<property>.keys -- read-only, gets the property’s controller’s key array
The track property is a simple synonym for controller. If an animatable property does not yet
have a controller assigned, the isAnimated property returns false and the controller, track,
and keys properties return undefined.
1290 Chapter 11 | 3ds max Objects
Example:
$foo.pos.controller
bend_mod1.angle.isAnimated
$bar.taper.gizmo.scale.keys[2]
You create controllers as you do other 3ds max objects by calling the class as a function:
c = bezier_position()
and assign them to animatable properties by assigning to the controller property in those
animatables.
Example:
$foo.pos.controller = c
$baz.bend.gizmo.rotation.controller = tcb_rotation()
$box01.length = linear_float()
Methods:
getPointControllers {<editable_mesh_node> | <editable_spline_node>}
Returns an array of controllers assigned to the vertices in the mesh or spline. If no
controller has been assigned to a vertex, the array element value will be undefined. For
editable splines, each knot consists of 3 vertices: the in vector, the knot, and the out
vector. The array of controllers returned is a “snapshot” of the current controllers. If
controllers are assigned or changed for a vertex, this change is not reflected in the array. If
a vertex is added/deleted, the array is not resized to reflect the change in number of
vertices.
getPointController <editable_mesh_node> <vertex_index_integer>
Returns the controller currently assigned to the vertex, undefined if no controller
assigned.
getPointController <editable_spline_node> <spline_index_integer>
<vertex_index_integer>
Returns the controller for specified vertex in the specified spline, undefined if no
controller assigned. Each spline knot consists of 3 vertices: the in vector, the knot, and the
out vector.
Note:
Applying a controller to a property causes the controller to take on the properties value at frame 0.
If keys are present for the controller before the assignment to the property, all keys will be adjusted
by the difference between the controller’s value at frame 0 and the property’s value. This is shown
in the following example.
Wood : TextureMap 1291
Script:
a=bezier_float()
addnewkey a 0
addnewkey a 10
a.keys[1].value=10
a.keys[2].value=100
b=box()
b.height
b.height.controller=a
b.height
at time 10 b.height
Output:
Controller:Bezier_Float -- result line 1
#Bezier Float key(1 @ 0f) -- result line 2
#Bezier Float key(2 @ 10f) -- result line 3
10 -- result line 4, key value at time 0
100 -- result line 5, key value at time 10
$Box:Box01 @ [0.0,0.0,0.0] -- result line 6
25.0 -- result line 7, default property value
Controller:Bezier_Float -- result line 8
25.0 -- result line 9, key value changed from 10 to 25 (delta= +15)
115.0 -- result line 10, key value changed by delta = +15
A somewhat strange situation can arise when a single controller is assigned to multiple object
properties. The value actually stored in a controller may not necessarily be the same value seen
in Track View or in the command panels, nor the same value returned by accessing the property
value in MAXScript. Part of a MAXWrapper property definition is scaling value that is applied
when reading or setting the true value stored in a controller. For example, the slice_to and
slice_from properties associated with many of the geometry primitives is displayed in
degrees. The actual value stored in the controller associated with these properties are in radians.
This scaling factor is an internal property of the MAXWrapper property, and not an internal
property of the controller. Both 3ds max and MAXScript automatically apply the specified
scaling factor when accessing properties, so this scaling is normally invisible to the user. If the
same controller is assigned to two properties which have different scaling factors, the question
arises as to which scaling factor to apply to the output of the controller. If you are accessing the
controller’s value through a MAXWrapper property, the scaling factor associated with that
property is applied to the controller’s value. MAXScript also internally stores the last scaling
factor applied to the controller’s value. If you are directly accessing the value property of the
controller, or the value property of a key in the controller, the stored scaling factor is used. This
can result in a controller’s value property returning different values at different times in a
script, based on how the controller was last accessed. Because of this, it is highly recommended
that you do not instance a controller onto multiple MAXWrapper properties which have
different scaling factors. The scaling factor, if any, is listed for each MAXWrapper property in
the documentation of the MAXWrapper classes.
1292 Chapter 11 | 3ds max Objects
Methods:
displayControlDialog <controller> <string>
Displays the modal controller dialog, if any. The string will be in the dialog title bar. If the
controller is a keyframe controller, the key info dialog will be displayed for the selected
keys. If no keys are selected, no dialog will be displayed.
Controllers that can be keyframed support several time and key-related functions, as described in
the following topics:
Controller Time Functions (p. 1292)
Controller Key Functions (p. 1294)
Controller Out-Of-Range Functions (p. 1296)
Controller Ease and Multiplier Curve Functions (p. 1297)
Controller Key Reducer (p. 1299)
See also
Key Common Properties, Operators, and Methods (p. 768)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
This is equivalent to the Recouple Ranges function in the Position Ranges mode in
Track View.
Example:
The following script shows example usages of some of the above methods.
Script:
-- controller test bed 1
b=box height:10
at time 5 animate on b.height=50
at time 10 animate on b.height=100
bhc=b.height.controller
bhk=bhc.keys
supportstimeoperations bhc
deletetime bhc 4 5
bhk
deletetime bhc 4 5 #incLeft
bhk
deletetime bhc 1 4 #noslide
bhk
at time 5 animate on b.height=50
deletetime bhc (interval 5 8) #incLeft
1294 Chapter 11 | 3ds max Objects
bhk
at time 10 animate on b.height=150
for k in bhk do format “%:%\n” k.time k.value
reversetime bhc 5 15 #incLeft #incRight
for k in bhk do format “%:%\n” k.time k.value
insertTime bhc 12 5
bhk
getTimeRange bhc
numKeys <controller>
Returns the number of keys in the controller. Returns -1 if you call it on a controller that
does not support keyframing.
getKey <controller> <index_integer>
Returns the indexed key as a MAXKey instance. See the Controller Key Functions (p. 1294)
topic for MAXKey class information.
getKeyTime <controller> <index_integer>
Returns the time of indexed key.
getKeyIndex <controller> <time>
Returns the index of the key at the specified time.
numSelKeys <controller>
Returns the number of keys currently selected in the track view.
sortKeys <controller>
Re-sorts keys according to their times. Some MAXKey operations can result in out of order
keys and this function must be called to correctly order keys. See the Controller Keys and
Key Properties topic for MAXKey properties information.
createLockKey <controller> <time> <rot_or_pos_integer>
This method is called to create a locking key at the specified time. This is a key that looks
back to the previous key and creates a new key at the specified time which matches the
previous key in value. It also adjusts the parameters for the key such that the value stays
constant from the previous key to this key. For instance, for a TCB controller the
continuity of the previous key and new key will set to 0. For a Bezier controller the out
tangent type of the previous key is set to linear and the in tangent type of the new key is
set to linear.
If the controller passed to this method is a transform level controller,
<rot_or_pos_integer> specifies whether to create the key in the transform controller’s
position or rotation (or roll angle) sub-controller. If rot_or_pos_integer = 0, the key is
created in the position controller. For all other values, the key is created in the rotation (or
roll angle) controller.
If the controller passed to this method is not a transform level controller, the
<rot_or_pos_integer> value is not used.
Returns true if the key creation was successful, false otherwise.
1296 Chapter 11 | 3ds max Objects
Example:
The following script shows example usages of some of the above methods.
Script:
-- controller test bed 2
b=box height:10
at time 5 animate on b.height=50
at time 10 animate on b.height=100
bhc=b.height.controller
bhk=bhc.keys
addnewkey bhc 7
addnewkey bhc 9
for k in bhk do format “%:%\n” k.time k.value
selectKeys bhc (interval 7 9)
deleteKeys bhc #selection
bhk
addnewkey bhc 7
addnewkey bhc 9
selectKeys bhc (interval 7 9)
deleteKeys bhc #selection #slide
bhk
addnewkey bhc 7
addnewkey bhc 9
selectKeys bhc (interval 7 9)
deleteKeys bhc #selection #slide #rightToLeft
bhk
addnewkey bhc 8
i=getKeyIndex bhc 8
selectKey bhc i
moveKey bhc i 10
bhk
getKeyTime bhc 4
b.width.controller=noise_float()
numkeys b.width.controller
getAfterORT <controller>
Gets the Out-of-Range (ORT) type for the controller for the time after the last key. Returns
one of the name values as for getBeforeORT() shown above.
Controller Ease and Multiplier Curve Functions 1297
numMultiplierCurves <controller>
Returns the number of multiplier curves currently operating on the controller.
getMultiplierValue <controller> <time>
Returns the combined (float) value of the multiplier curves in the specified controller at
the given time value.
Associated Properties:
If an Ease Curve has been assigned to a controller, the following controller-related sub-property is
available:
<controller>.Ease_Curve -- the controller’s ease curve value
If an Ease Curve has been assigned to a controller, the following controller-related sub-property is
available:
<controller>.Multiplier_Curve -- the controller’s multiplier curve value
Note:
The values stored in an Ease Curve controller are stored as integer time ticks.
Example:
The following script shows example usages of some of the above methods.
Script:
-- controller test bed 3
b=box height:10
at time 5 animate on b.height=50
at time 10 animate on b.height=100
bhc=b.height.controller
ec=bezier_float()
at time 0 animate on ec.value = 0
at time 100 animate on ec.value=100*ticksPerFrame
setBeforeORT ec #linear
setAfterORT ec #linear
addEaseCurve bhc ec
applyEaseCurve bhc 50
addEaseCurve bhc ec
numEaseCurves bhc
deleteEaseCurve bhc 2
numEaseCurves bhc
at time 50 bhc.ease_curve.value
mc=bezier_float()
at time 0 animate on mc.value = 1
at time 100 animate on mc.value = 2
addMultiplierCurve bhc mc
at time 50 bhc.multiplier_curve
Controller Key Reducer 1299
addNewKey
deleteKeys
selectKeys
deselectKeys
moveKeys
sortKeys
reduceKeys
addEaseCurve
deleteEaseCurve
setBeforeORT
setAfterORT
enableORTs
1300 Chapter 11 | 3ds max Objects
The above functions can be called on any 3ds max object collection (such as a wild-card pathname
or object set or array of objects ) and will recursively apply to all animation within those objects. If
they are called on components within an object that themselves have nested controllers, they are
applied to all those nested controllers - see the examples below.
Examples:
insertTime $box01.xform 0f 10f
all keys after 0f in all controllers in the xform modifier are moved by 10f
insertTime $box01 0f 10f
all keys after 0f in box01 are moved (transform, creation, modifiers)
selectKeys $box02.xform.gizmo.rotation.controller 0f 100f
selects keys in 0-100f, if controller is Euler, e.g., will select x, y and z keys
deleteTime $box* 10f 10f
delete 10f at frame 10 in all keys in all objects named $box* (works with any pathname or
array of objects)
insertTime $box03.children 0f 10f
inserts time in all controllers of all children of $box03
reduceKeys $box01.modifiers 0.5 1f
applies key reductions to all controllers in all modifiers in $box01 (leaves transform and
creation parameters alone)
Controller Types
FloatController : MAXWrapper
FloatController is the superclass for all controllers that can be assigned to parameters that are
simple numbers (Float or Integer). The following is a list of the core FloatController classes
accessible in MAXScript:
AudioFloat (p. 1306)
Bezier_Float (p. 1309)
Block (p. 1311)
Float_Expression (p. 1313)
Float_List (p. 1317)
Float_Motion_Capture (p. 1321)
Float_Reactor (p. 1326)
Float_Script (p. 1329)
Linear_Float (p. 1315)
LOD_Controller (p. 1319)
Noise_Float (p. 1322)
On_Off (p. 1323)
SlaveFloat (p. 1333)
TCB_Float (p. 1334)
Waveform_Float (p. 1335)
MasterBlockController : MAXWrapper
MasterBlockController is the superclass for the controllers associated with the Block Control
Track View node. These classes are:
Block_Control (p. 1311)
MasterBlock (p. 1320)
1302 Chapter 11 | 3ds max Objects
Matrix3Controller : MAXWrapper
Matrix3Controller is the superclass for all controllers that can be assigned to transform or
Position-Rotation-Scale parameters. The following is a list of the core Matrix3Controller classes
accessible in MAXScript:
Link_Control (p. 1316)
LookAt (p. 1319)
PRS (p. 1325)
IK_ControllerMatrix3Controller (p. 1313)
Slave_Controller (p. 1333)
MorphController : MAXWrapper
MorphController is the superclass for all controllers that can be assigned to morph objects. The
following is a list of the core MorphController classes accessible in MAXScript:
Barycentric_Morph_Controller (p. 1306)
Cubic_Morph_Controller (p. 1312)
Point3Controller : MAXWrapper
Point3Controller is the superclass for all controllers that can be assigned to Point3 parameters.
The following is a list of the core Point3Controller classes accessible in MAXScript:
AudioPoint3 (p. 1306)
Bezier_Color (p. 1309)
Bezier_Point3 (p. 1309)
Color_RGB (p. 1335)
Noise_Point3 (p. 1322)
Point3_Expression (p. 1313)
Point3_List (p. 1317)
Point3_Motion_Capture (p. 1321)
Point3_Reactor (p. 1326)
Point3_Script (p. 1329)
Point3_XYZ (p. 1335)
Slave_Point3 (p. 1333)
TCB_Point3 (p. 1334)
PositionController : MAXWrapper 1303
PositionController : MAXWrapper
PositionController is the superclass for all controllers that can be assigned to position
parameters. The following is a list of the core Point3Controller classes accessible in MAXScript:
Attachment (p. 1304)
Audioposition (p. 1306)
Bezier_Position (p. 1309)
Dynamic_Position_Controller (p. 1312)
Linear_Position (p. 1315)
Noise_Position (p. 1322)
Path (p. 1324)
Position_Expression (p. 1313)
Position_List (p. 1317)
Position_Motion_Capture (p. 1321)
Position_Reactor (p. 1326)
Position_Script (p. 1329)
Position_XYZ (p. 1335)
Surfaceposition (p. 1334)
TCB_Position (p. 1334)
RotationController : MAXWrapper
RotationController is the superclass for all controllers that can be assigned to rotation
parameters. The following is a list of the core RotationController classes accessible in
MAXScript:
AudioRotation (p. 1306)
Bezier_Rotation (p. 1309)
Dynamics_Rotation_Controller (p. 1312)
Euler_XYZ (p. 1335)
Linear_Rotation (p. 1315)
Local_Euler_XYZ (p. 1335)
Noise_Rotation (p. 1322)
Rotation_List (p. 1317)
1304 Chapter 11 | 3ds max Objects
ScaleController : MAXWrapper
ScaleController is the superclass for all controllers that can be assigned to scale parameters. The
following is a list of the core ScaleController classes accessible in MAXScript:
AudioScale (p. 1306)
Bezier_Scale (p. 1309)
Linear_Scale (p. 1315)
Noise_Scale (p. 1322)
Scale_Expression (p. 1313)
Scale_List (p. 1317)
Scale_Motion_Capture (p. 1321)
Scale_Reactor (p. 1326)
Scale_Script (p. 1329)
ScaleXYZ (p. 1335)
SlaveScale (p. 1333)
TCB_Scale (p. 1334)
QuatController : MAXWrapper
There are presently no classes associated with the QuatController superclass.
Attachment : PositionController
Constructor:
attachment ...
Properties:
<attachment>.keys : MAXKeyArray
<attachment>.node : Node
<attachment>.align : Booleandefault: true
Fixes the orientation of the attached object to the face where it’s assigned. When this is
turned off, the orientation of the attached object is not affected by the orientation of the
face on the target object.
Attachment Controller Keys 1305
See also
MAXKeyArray Values (p. 793)
Attachment Controller Keys (p. 1305)
Controller Common Properties, Operators, and Methods (p. 1289)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
See also
Key Common Properties, Operators, and Methods (p. 768)
Value Common Properties, Operators, and Methods (p. 714)
Audio Controllers
audiofloat : floatController
audiopoint3 : point3Controller
audioposition : positionController
audiorotation : rotationController
audioscale : scaleController
Constructor:
audiofloat ...
audiopoint3 ...
audioposition ...
audiorotation ...
audioscale ...
Properties:
There are no additional properties accessible for Audio controllers.
See also
Controller Common Properties, Operators, and Methods (p. 1289)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Barycentric_Morph_Controller : MorphController
You access the morph controller on a morph compound object via the <node>.morph property, for
example:
c = $foo.morph -- get the morph controller
mk1 = c.keys[1] -- get the first morph key
Constructor:
createMorphObject <source_node>
Turns the given scene node into a Morph compound object - does nothing if it already is a
Morph object. The returned morph object has a morph controller created accessible via
the morph property.
Barycentric_Morph_Controller : MorphController 1307
Methods:
addMorphTarget <morph_controller> <target_node> <add_method>
Adds a new morph target object to the given morph controller. The <add_method>
argument defines the method of attaching the target and should be a number between 1
and 4 with the following interpretation:
1 -- by reference
2 -- by copy
3 -- by move
4 -- by instance
The return value is an Integer giving the target index of the added target object.
setMorphTarget <morph_controller> <target_index_integer> <target_node>
<add_method>
Replaces an existing target with a different scene node. The arguments are the same as for
addMorphTarget().
getMKTargetNames <morph_controller>
Returns an array of names of the targets in the given morph controller.
deleteMorphTarget <morph_controller> <target_index_integer>
Deletes the numbered morph target in the given controller.
setMorphTargetName <morph_controller> <target_index_integer> <name_string>
Changes the target name of the numbered target in the given morph controller.
getMKTargetWeights <morph_controller> <time> <dest_array>
A quick way of retrieving all the target weights for a given key at the time specified. The
targets are placed into <dest_array> which must be an array of the right size. You can
find out how many targets there by getting the size of the array returned by the
getMKTargetNames() function which returns an array of target names.
getMKKey <morph_controller> <time>
Returns the morph key on the given controller at the specified time, yields undefined if
there is no key at that time.
getMKKeyIndex <morph_controller> <time>
Returns the index of the key at the specified time, yields undefined if there is no key at
that time.
Note:
When using the addnewkey() method to create a key for the Barycentric_Morph_Controller
controller, the time component of the key value returned is usually not correct. Use the getMKKey()
method to access the created key.
1308 Chapter 11 | 3ds max Objects
See also
Barycentric_Morph_Controller Keys (p. 1308)
Controller Common Properties, Operators, and Methods (p. 1289)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Barycentric_Morph_Controller Keys
Note: This class is not available in 3D Studio VIZ.
The morph key functions operate on MAXScript key values that are accessed on Barycentric morph
controllers in the same way as keys on other keyable controllers. For Barycentric_Morph_Controller
keys, the following properties and methods are accessible:
Properties:
<key>.time Time -- time value or number (interpreted as frames). Read-
only.
<key>.selected Boolean -- specifies whether the key is selected. Read/write
access.
Methods:
getMKTime <morph_key>
Returns the given morph key’s time.
setMKTime <morph_key> <time>
Sets the time of the given morph key.
getMKWeight <morph_key> <target_index_integer>
Gets the weight as a percentage for the numbered target on the given morph key. Targets
are numbered in order as seen in the target list in the morph key Track View dialog. This is
the order in which the targets were added.
setMKWeight <morph_key> <target_index_integer> <pcnt_float> <keep100%_boolean>
Sets the percentage weight of the numbered target on the given morph key. The last
argument is a boolean, if true adjusts other target weights so the maximum is 100%.
Note:
When using the addnewkey() method to create a key for the Barycentric_Morph_Controller
controller, the time component of the key value returned is usually not correct. Use the getMKKey()
method to access the created key.
See also
Key Common Properties, Operators, and Methods (p. 768)
Value Common Properties, Operators, and Methods (p. 714)
Bezier Controllers 1309
Example:
Script:
sel1 = sphere radius:30 -- target 1
sel2 = sphere radius:50 -- target 2
createMorphObject sel1 -- create the morph object from sel1
mobj1= sel1.morph -- grab morph controller
addmorphtarget mobj1 sel2 3 -- add sel2 as target - creates key with
-- target weights of 0 and 100%
k=mobj1.keys[1] -- grab the key
setMKWeight k 1 100 true -- set target 1 to 100%, keep total 100%
addnewkey mobj1 50 -- create morph key at frame 50
k=getMKKey mobj1 50 -- grab the key
setMKWeight k 2 100 true -- set target 2 to 100%, keep total 100%
Output:
$Sphere:Sphere01 @ [0.0,0.0,0.0] -- result line 1
$Sphere:Sphere02 @ [0.0,0.0,0.0] -- result line 2
$Editable_Mesh:Sphere01 @ [0.0,0.0,0.0] -- result line 3
Controller:Barycentric_Morph_Controller -- result line 4
2 -- result line 5
#Barycentric Morph Controller key(1 @ 0f) -- result line 7
1 -- result line 8
#Barycentric Morph Controller key(0 @ 50f) -- result line 9
#Barycentric Morph Controller key(2 @ 50f) -- result line 10
2
Bezier Controllers
bezier_color : point3Controller
bezier_float : floatController
bezier_point3 : point3Controller
bezier_position : positionController
bezier_rotation : rotationController
bezier_scale : scaleController
Constructor:
bezier_color ...
bezier_float ...
bezier_point3 ...
bezier_position ...
bezier_rotation ...
bezier_scale ...
Properties:
<bezier_controller>.keys MAXKeyArray
1310 Chapter 11 | 3ds max Objects
See also
MAXKeyArray Values (p. 793)
Bezier Controller Keys (p. 1310)
Controller Common Properties, Operators, and Methods (p. 1289)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
The inTangent and outTangent values are Floats in keys of float controllers and Point3s for the
other appropriate controllers. Default value is 0 for float controllers, [0,0,0] otherwise.
The inTangentType and outTangentType properties have symbolic name values representing
the 6 possible tangent types available in the drop-down menu in the Bezier key property dialog:
#smooth (default)
#linear
#step
#fast
#slow
#custom
See also
Key Common Properties, Operators, and Methods (p. 768)
Value Common Properties, Operators, and Methods (p. 714)
Block : FloatController 1311
Examples:
c = bezier_position () -- create and assign new controller
$bar.pos.controller = c
Block : FloatController
Constructor:
The Block controller is not creatable by MAXScript. It can only be created by creating a Masterblock
in the Block Control node in the Global Tracks node of Track View. See the MasterBlock :
MasterBlockController (p. 1320) topic for more information.
See also
Controller Common Properties, Operators, and Methods (p. 1289)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Block_Control : MasterBlockController
Constructor:
The Block_Control controller is not creatable by MAXScript. Only one instance of the class
exists in 3ds max - the Block Control node in the Global Tracks node of Track View. See the
MasterBlock : MasterBlockController (p. 1320) topic for more information.
See also
Controller Common Properties, Operators, and Methods (p. 1289)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
1312 Chapter 11 | 3ds max Objects
Cubic_Morph_Controller : MorphController
The Barycentric_Morph_Controller (p. 1306) should be used instead of a Cubic_Morph_Controller
controller.
Constructor:
Cubic_Morph_Controller ...
See also
MAXKeyArray Values (p. 793)
Cubic_Morph_Controller Keys (p. 1312)
Controller Common Properties, Operators, and Methods (p. 1289)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Cubic_Morph_Controller Keys
Properties:
For Cubic_Morph_Controller keys, the following properties are accessible:
<key>.time Time -- time value or number (interpreted as frames). Read-
only.
<key>.selected Boolean -- specifies whether the key is selected. Read/write
access.
See also
Key Common Properties, Operators, and Methods (p. 768)
Value Common Properties, Operators, and Methods (p. 714)
Dynamics Controllers
Dynamics_Position_Controller : positionController
Dynamics_Rotation_Controller : rotationController
Constructor:
The Dynamics controllers are created by the Dynamics utility, and are not creatable in
MAXScript.
Note: These classes are not available in 3D Studio VIZ.
Expression Controllers 1313
Properties:
When you solve a dynamics solution in the Dynamics utility, the Dynamics controllers are assigned
as the position and rotation controllers of all objects not flagged as unyielding. These controllers are
similar to List controllers in that they contain multiple sub-controllers. The first sub-controller is a
Bezier controller of the appropriate type that contains the keys generated while solving the
dynamics solution. This controller can be accessed as the Dynamic_position_controller or
Dynamic_rotation_controller property of the dynamics controller. The second sub-controller
is the original position or rotation controller assigned to the object, and can be accessed as the
old_position or old_position property.
Expression Controllers
float_expression : floatController
point3_expression : point3Controller
position_expression : positionController
scale_expression : scaleController
Constructor:
float_expression ...
point3_expression ...
position_expression ...
scale_expression ...
See also
Controller Common Properties, Operators, and Methods (p. 1289)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
IK_ControllerMatrix3Controller : Matrix3Controller
The functions described in this topic provide access to some of the Inverse Kinematics (IK)
parameters of the IK controller. The IK controller is typically used by the Bones system in 3ds max.
You cannot create a Bones system using MAXScript in 3ds max 3, but these methods provide access
to the IK controller for existing Bones systems. An IK system actually consists of two types of
controllers – the master IK controller and slave IK controllers. The slave IK controllers are used as the
transform controller for all nodes in the IK system, and the master IK controller controls the
individual slave IK controllers.
1314 Chapter 11 | 3ds max Objects
All the IK-related methods are in the ik structure and are associated with a parameter in the Motion
panel, IK Controller Parameters rollout. These functions return undefined if executed on an object
whose controller is not an IK controller. The controller actually being accessed in these methods is
the master IK controller. Accessing the IK controller for any object in the IK system accesses the same
master IK controller.
Note:
The following ik structure methods are still present, but not applicable in 3ds max 4.
Getting/setting via these methods return a value of ‘undefined’:
GetRotThreshold
SetRotThreshold
GetPosThreshold
SetPosThreshold
GetIterations
SetIterations
ik.GetPosThreshold <node>
ik.SetPosThreshold <node> <float>
Get and set the Position threshold value for the specified object.
ik.GetRotThreshold <node>
ik.SetPosThreshold <node> <float>
Get and set the Rotation threshold value for the specified object.
ik.GetIterations <node>
ik.SetIterations <node> <integer>
Get and set the Iterations value for the specified object.
ik.GetStartTime <node>
ik.SetStartTime <node> <time>
Get and set the Start time for the specified object
ik.GetEndTime <node>
ik.SetEndTime <node> <time>
Get and set the End time for the specified object
ik.getPinNode <node>
Gets the node the specified node is bound to in the IK panel as a <node> value, undefined
if none.
ik.setPinNode <node> (<node> | undefined)
Sets the node the specified node is bound to in the IK panel. If undefined is specified, the
node is unbound. Returns true if the bind was successful, false otherwise.
ik.getPrecedence <node>
Gets the precedence of the node as specified in the IK panel as an <integer> value
ik.setPrecedence <node> <number>
Sets the precedence of the node as specified in the IK panel. Returns true if the assignment
was successful, false otherwise.
ik.getIsTerminator <node>
ik.setIsTerminator <node> <boolean>
Get/set whether the node is a terminator.
Linear Controllers 1315
ik.getBindPos <node>
ik.setBindPos <node> <boolean>
Get/set whether Bind Position is turned on for the node.
ik.getBindOrient <node>
ik.setBindOrient <node> <boolean>
Get/set whether Bind Orientation is turned on for the node.
Linear Controllers
linear_float : floatController
linear_position : positionController
linear_rotation : rotationController
linear_scale : scaleController
Constructor:
linear_float ...
linear_position ...
linear_rotation ...
linear_scale ...
Properties:
<controller>.keys MAXKeyArray
See also
MAXKeyArray Values (p. 793)
Linear Controller Keys (p. 1315)
Controller Common Properties, Operators, and Methods (p. 1289)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
See also
Key Common Properties, Operators, and Methods (p. 768)
Value Common Properties, Operators, and Methods (p. 714)
1316 Chapter 11 | 3ds max Objects
Link_Control : Matrix3Controller
Constructor:
link_control ...
Properties:
<link_control>.transform Matrix3Controller
Contains the transform controller below the link controller
Methods:
linkCtrl.getLinkCount <link_control>
Returns the number of nodes linked to as an integer.
linkCtrl.getLinkNode <link_control> <index_integer>
Returns the node for the indexed link as a node value.
linkCtrl.setLinkNode <link_control> <index_integer> <node>
Sets the node for the indexed link. The indexed link must already exist.
linkCtrl.getLinkTime <link_control> <index_integer>
Returns the time for the indexed link as a time value.
linkCtrl.setLinkTime <link_control> <index_integer> <time>
Sets the time for the indexed link. The indexed link must already exist.
linkCtrl.addLink <link_control> <node> <time>
Adds the specified node as a link with the specified time.
linkCtrl.deleteLink <link_control> <index_integer>
Deletes the indexed link.
See also
Controller Common Properties, Operators, and Methods (p. 1289)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
List Controllers 1317
List Controllers
float_list : floatController
point3_list : point3Controller
position_list : positionController
rotation_list : rotationController
scale_list : scaleController
Constructor:
float_list ...
point3_list ...
position_list ...
rotation_list ...
scale_list ...
Properties:
The property list for a list controller contains the sub-controllers in the list controller (if any), plus
an available property. The available property has a controller property, which contains a
“phantom” controller. To add a controller to a list controller, assign the controller to the
available.controller property. The following script shows an example of creating and adding
controllers to a list controller.
Script:
p=float_list() -- create a list controller
showproperties p -- show its properties
p.available.controller -- the “phantom” controller
p1=bezier_float() -- create a new bezier float controller
p.available.controller=p1 -- add it to the list controller
p2=bezier_float() -- create a new bezier float controller
p.available.controller=p2 -- add it to the list controller
getpropnames p -- show the list controller properties
showproperties p -- show the list controller properties
p.numSubs -- the number of list controller subAnims
getsubanimnames p -- show the list controller subAnim names
p[2].object -- retrieve the second bezier float controller
Output:
Controller:Float_List -- result line 1
.available : float -- output line 2
OK -- result line 2
Controller: -- result line 3 (the “phantom” controller)
Controller:Bezier_Float -- result line 4
Controller:Bezier_Float -- result line 5
Controller:Bezier_Float -- result line 6
Controller:Bezier_Float -- result line 7
#(#bezier_float, #available) -- result line 8
.bezier_float : float -- output line 9
.bezier_float : float -- output line 9
.available : float -- output line 9
1318 Chapter 11 | 3ds max Objects
OK -- result line 9
3 -- result line 10
#(#bezier_float, #bezier_float, #available) -- result line 11
Controller:Bezier_Float -- result line 12
In line 9 of the output, only one occurrence of #bezier_float is shown. The reason for this is this
is that multiple properties with the same name are not shown by MAXScript. This is because all
property names are normally supposed to be unique. In the case of list controllers, this is not true.
Instead of accessing the controllers added to a list controller as properties of the list controller, the
controllers should be accessed through the subAnims of the list controller as shown in the last line
of the example.
There currently is not a method for removing a controller from a list controller. To easiest way to
accomplish this is to create a new list controller, instance all other sub-controllers from the original
list controller, and then replace the original list controller with the new list controller. The following
script shows a example which performs these actions.
Script:
-- creates new list controller from old, deleting indexed controller
-- returns the new controller
fn deleteFromListController list_cont index =
(
-- create new list controller based on class of input list controller
new_cont=execute ((classof list_cont as string) + “()”)
-- for each subAnim (except the last, which is the phantom “available”
-- controller)..
for i=1 to (list_cont.numSubs-1) do
-- if not the sub-controller to delete
if i != index do
-- instance the sub-controller (contained in the .object property of
-- the subAnim) to the new list controller
new_cont.available.controller=list_cont[i].object
-- and return the new list controller
return new_cont
)
--
-- example usage (obj.pos already has list controller)
obj.pos.controller = deleteFromListController obj.pos.controller 2
Methods:
listCtrl.getName <list_controller> <index_integer>
Returns the name of the indexed subcontroller in the list controller
listCtrl.setName <list_controller> <index_integer> <string>
Sets the name of the indexed subcontroller in the list controller. If the string is a null string
(”“), the default controller name is used.
LOD_Controller : FloatController 1319
listCtrl.getActive <list_controller>
Returns the index of the active subcontroller in the list controller
listCtrl.setActive <list_controller> <index_integer>
Sets the indexed subcontroller in the list controller as the active controller
See also
Controller Common Properties, Operators, and Methods (p. 1289)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
LOD_Controller : FloatController
Constructor:
The LOD_Controller controller is not creatable by MAXScript. It can only be created using the
Level of Detail utility.
Properties:
There are no additional properties for LOD_Controller.
See also
Controller Common Properties, Operators, and Methods (p. 1289)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
LookAt : Matrix3Controller
Constructor:
lookat ...
Properties:
<lookAt>.position Bezier_Position -- the position controller
<lookAt>.roll_angle Bezier_Float -- the roll controller
<lookAt>.scale Bezier_Scale -- the scale controller
1320 Chapter 11 | 3ds max Objects
There presently are no methods for directly accessing or setting the target node in the LookAt
controller. To set the target node, the LookAt controller needs to be assigned to a node, and then the
lookat property of the node is set to the target node. If the transform controller for a node is not a
LookAt controller, and a target node is assigned to the lookat property of the node, a LookAt
controller is automatically assigned to the node. For example,
$box01.lookat=$box02
is equivalent to
$box01.transform.controller=lookat()
$box01.lookat=$box02
Note:
The following properties are not accessible by MAXScript in 3ds max 4 the Axis radio-button and
the Flip checkbox.
See also
Controller Common Properties, Operators, and Methods (p. 1289)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
MasterBlock : MasterBlockController
Constructor:
The MasterBlock controller is not creatable by MAXScript. It can only be created in the Block
Control node in the Global Tracks node of Track View. If multiple MasterBlocks are present, you
will need to access the MasterBlocks as a subAnim of trackviewnodes.global_tracks.
block_control. This is because all MasterBlocks have the same name (MasterBlock).
Properties:
Once a MasterBlock has been created in Track View, the following MasterBlock property is
available:
<MasterBlock>.blend Float
Once a track has been added to the MasterBlock, a Block controller is added to the MasterBlock,
and the track’s controller is added as an input controller to the Block controller. The name
assigned to the Block controller is the name specified for the block. The Block controller is then
available as a property of the MasterBlock, and the track’s controller is available as a property of
the Block controller. In addition, the track’s controller is replaced with a list controller and the
track’s original controller is placed in the list controller along with a Slave controller. This Slave
controller is controlled by the Block controller. For example, if a block with name “BoxHeight”
is present, and contains the height controller for a box object, the block and its track can be
accessed as follows:
Motion Capture Controllers 1321
mb=trackviewnodes.global_tracks.block_control[1] -- SubAnim:MasterBlock
getpropnames mb -- #(#Blend, #height)
h=mb.height -- SubAnim:height
h.object -- Controller:Block
getpropnames h -- #(#Box01_Height)
h.box01_height -- 157.083 - the box’s height
h.box01_height.controller -- Controller:Bezier_Float - the box’s height controller
See also
Controller Common Properties, Operators, and Methods (p. 1289)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
See also
Controller Common Properties, Operators, and Methods (p. 1289)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
1322 Chapter 11 | 3ds max Objects
Noise Controllers
noise_float : floatController
noise_point3 : point3Controller
noise_position : positionController
noise_rotation : rotationController
noise_scale : scaleController
Constructor:
noise_float ...
noise_point3 ...
noise_position ...
noise_rotation ...
noise_scale ...
Properties:
Access to the following properties is available on all noise controllers:
<noise_controller>.seed Integer default: 0
<noise_controller>.frequency Float default: 0.5
<noise_controller>.fractal Boolean default: true
<noise_controller>.roughness Float default: 0.0
<noise_controller>.rampin Time default: 0f
<noise_controller>.rampout Time default: 0f
In addition, for noise float controllers you can get these properties:
<noise_controller>.noise_strength Float default: 50 -- animatable
<noise_controller>.positive Boolean default: false
limits values to > 0
and for noise position, point3, rotation and scale controllers:
<noise_controller>.noise_strength Point3 default: varies -- animatable
position and point3 default: [50,50,50]
rotation default: [0.785398,0.785398,0.785398]
scale default: [0.5,0.5,0.5]
Note:
You need to access these properties explicitly on a controller, for example:
$box01.position.controller.x_strength = 100
or,
c = $box01.rotation.controller
c.seed = random 0 100
c.fractal = off
c.frequency = random 0.1 0.2
See also
Controller Common Properties, Operators, and Methods (p. 1289)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
On_Off : FloatController
Constructor:
on_off ...
Properties:
<on_off>.keys MAXKeyArray
See also
MAXKeyArray Values (p. 793)
On_Off Controller Keys (p. 1323)
Controller Common Properties, Operators, and Methods (p. 1289)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
See also
Key Common Properties, Operators, and Methods (p. 768)
Value Common Properties, Operators, and Methods (p. 714)
Path : PositionController
Constructor:
path ...
Properties:
<path>.allowUpsideDown Boolean default: false -- alias: Allow_Upside_Down
Turn on to avoid the situation in which an object flips when going around a vertically
oriented path.
<path>.axis Integer default: 0
axis = 0 - X; 1 - Y; 2 - Z
<path>.axisFlip Boolean default: false -- alias: Axis_Flip
Flips the direction of the object on the path 180 degrees.
<path>.bank Boolean default: false
Allows the object to bank (roll) as it negotiates the curves of the spline.
<path>.bankAmount Float default: 0.5 -- animatable, alias:
Bank_Amount
The amount of the banking to one side or the other, depending on whether the value is
positive or negative.
<path>.constantVel Boolean default: false -- alias: Constant_Velocity
Provides a constant velocity along the path. When off, the velocity of the object along the
path varies depending on the distance between the vertices on the path.
<path>.follow Booleandefault: false
Aligns the object to the trajectory as it follows the contour.
<path>.loop Boolean default: false -- boolean
When turned on, the path controlled object will loop back to the start point of the path,
after the end point is reached.
<path>.path Node default: undefined -– node; Path_Constraint
The spline in the scene that you want the selected object to follow.
<path>.pathlist Array default: #() -- node array; SubAnim
The object will follow the resultant path which is the weighted average of the paths in this
array. The weight for each path is found in the corresponding entry in
<path>.weightlist.
<path>.percent Floatdefault: 0.0 -- animatable, percentage
The percent that the object is positioned along the path.
<path>.relative Boolean default: false -- booleanExample
When turned on, the path controlled object will maintain the position offset between its
initial position and the start point of the path.
PRS : Matrix3Controller 1325
See also
Controller Common Properties, Operators, and Methods (p. 1289)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
PRS : Matrix3Controller
Constructor:
prs ...
Properties:
<prs>.position Bezier_Position -- the position controller
<prs>.rotation TCB_Rotation -- the rotation controller
<prs>.scale Bezier_Scale -- the scale controller
Note:
You can assign a Matrix3 value to a PRS controller’s value property. MAXScript will automatically
set the individual position, rotation, and scale values to the values represented in the Matrix3 value.
1326 Chapter 11 | 3ds max Objects
See also
Controller Common Properties, Operators, and Methods (p. 1289)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Reactor Controllers
float_Reactor : floatController
point3_Reactor : point3Controller
position_Reactor : positionController
rotation_Reactor : rotationController
scale_Reactor : scaleController
Constructor:
float_Reactor ...
point3_Reactor ...
position_Reactor ...
rotation_Reactor ...
scale_Reactor ...
Methods:
createReaction <reactor_controller>
Creates a new reaction for the specified reactor controller.
deleteReaction <reactor_controller> <index_integer>
Deletes the specified reaction. <index_integer> is the reaction you want to delete. The
order of reactions is the order in which they are created, and the order in which the
reactions are listed in the Reactor Parameters dialog.
reactTo <reactor_controller> ( <controller> | <node> )
Sets the controller that the reactor controller reacts to. You can either specify either a
controller you want to react to or a node whose world position to react to.
getReactionCount <reactor_controller>
Returns the number of reactions for the specified reactor controller.
selectReaction <reactor_controller> <index_integer>
Selects the specified reaction. <index_integer> is the reaction you want to select. The
order of reactions is the order in which they are created, and the order in which the
reactions are listed in the Reactor Parameters dialog.
getSelectedReactionNum <reactor_controller>
Returns the number of the selected reaction.
getReactionFalloff <reactor_controller> <index_integer>
Returns the specified reaction’s falloff. <index_integer> is the reaction you want to get
the falloff from. The order of reactions is the order in which they are created, and the order
in which the reactions are listed in the Reactor Parameters dialog.
Reactor Controllers 1327
See also
Controller Common Properties, Operators, and Methods (p. 1289)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Script Controllers
float_script : floatController
point3_script : point3Controller
position_script : positionController
rotation_script : rotationController
scale_script : scaleController
Constructor:
float_script ...
point3_script ...
position_script ...
rotation_script ...
scale_script ...
Properties:
<script_controller>.script String default: varies
lets you programmatically get and set the text for scripts. For example,
$foo.position.controller=position_script()
$foo.position.controller.script = “$baz.pos - [20,20,35]”
See also
Controller Common Properties, Operators, and Methods (p. 1289)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Script controllers function in similar way to expression controllers, providing a properties dialog in
which a script can be entered that is used to compute the controller value. The primary advantages
of script controllers are:
• They can use all the features of the MAXScript language including loops, scripted functions,
pathnames, etc.
• Almost any property of any object in the scene can be used to help compute controller values,
including things like mesh vertices, values of properties at arbitrary frame times, and other non-
animatable properties that are not accessible in Expression controllers.
• They can use MAXScript global variables to communicate and coordinate with other controllers
and scripts in 3ds max.
1330 Chapter 11 | 3ds max Objects
When you assign a Script controller to some parameter, a properties dialog becomes available in
Track View through the right-mouse-button menu or the Properties button on the Track View
toolbar. This dialog contains two text boxes and several buttons:
Script text box: You type the script to compute the controller value here. See the section below on
writing controller scripts for details.
Result text box: This box shows the results of an evaluation or any error messages caused by errors
in your script.
Evaluate button: Cause an evaluation of the controller script to be made and prints the result in the
Result box. The evaluation is computed for the current position of the 3ds max time slider.
Load/Save buttons: Load and save scripts to text files.
Close button: Compiles and checks the controller script and if all is OK, close the properties dialog.
Any problems result in a dialog asking whether you really want to close the box with an incorrect
script. If you do, the controller yields a null value (0, [0,0,0], etc.) when evaluated by 3ds max.
Script Controllers 1331
From this, a scripted controller would return unscaled values for the radius and height properties,
and radians for slice_from and slice_to. The scaling types, stored value meaning, and scaling
value applied to the true controller value are as follows:
Angle -- value stored in radians, output scaled by 57.29578
Percentage -- value stored as fraction (0 to 1), output scaled by 100
For properties that have a Color value type, the controller output is automatically scaled by 255. If
a point3_script is assigned to one of these properties, each component value should stored as
fraction (0 to 1). Remember that converting a MAXScript Color value to a Point3 value does not
apply a scaling factor – red as point3 returns a value of [255,0,0]. Therefore you must explicitly
scale a Color value by dividing by 255 if it is output by the script controller.
The body of a script controller’s script is any valid MAXScript expression that evaluates to the proper
data type, and can contain global and local variables, functions, and structure definitions. The script
is compiled in its own local scope, and the locals are only visible inside the scope of the script
controller. Script controller local variables are heap-based locals, which are slightly different from
normal (stack-based) locals. Normal locals are visible in the current scope and have a lifetime of one
execution of that scope. Heap-based locals are also visible only in the current scope, but have a
lifetime equal to the lifetime of the top-level expression where they are defined. A script controller’s
locals are created the first time the script is executed and are kept permanently in the heap (unless
1332 Chapter 11 | 3ds max Objects
and until you redefine the script). This means you can store values in local variables during one
execution of the script controller and these values will still be present at the next evaluation. You
cannot access the script controller’s locals from another utility or from Listener, because they are not
executing within the scope of the script controller. See the Scope of Variables (p. 646) topic for more
information.
As a special case, you can exit a script controller’s script using a return <expr>.
A controller is always evaluated by 3ds max with respect to a specific animation time. This might be
the current time slider or incrementing frame time if an animation is playing or a render is under
way.
In the case of Script controllers, the time being evaluated is used to establish an automatic ‘at time’
context around the controller script, so any properties you access (outside of other explicit ‘at time’
expressions) yield the correct values for the current controller evaluation time. This means you don’t
have to do anything special in your scripts to work at the correct time. You can access the evaluation
time if you need to with the standard MAXScript variable, currentTime. You can also reference
scene property values at other times by using explicit ‘at time’ expressions in your scripts, as in
normal MAXScript programming.
Remember that MAXScript lets you write multiline string literals, if you need.
Examples:
A position script keeping the object at the center of all other objects in the scene as they move about:
local pos = [0,0,0]
for o in objects where o != $foo do
pos += o.pos
pos / (objects.count - 1)
The above script computes the average position of all objects except the current one (written as
$foo here) by setting up a local variable that iterates through all objects except $foo,
accumulates a total position vector, and computes the average in the last line, which is the final
result of the script.
A position script keeping the object attached to the highest vertex in a given object:
local high_index = 1, high_z = (getVert $foo 1).z
for i in 2 to $foo.numVerts do
if (getVert $foo i).z > high_z then
(
high_index = i
high_z = (getVert $foo i).z
)
getVert $foo high_index
The above script runs over the vertices in $foo remembering the index of the vertex with the
largest z and returns that vertex’s coordinates as the new position.
Slave_Control : Matrix3Controller 1333
Limitations
Script controllers are not automatically updated when you interactively modify objects that they
depend on.
If you move the time slider or if you animate the changes and then play the animation, the changes
are reflected automatically. Because the scripts can refer to other objects in very indirect ways or
conditional ways, it is not possible for MAXScript to automatically determine the objects a script
depends on.
Slave_Control : Matrix3Controller
Note: This class is not available in 3D Studio VIZ.
The Slave_Control is used as the transform controller for the boxes in a RingArray system object. You
cannot create a RingArray system using MAXScript in 3ds max 4, but properties for this controller
are accessible by MAXScript for existing RingArray systems. A RingArray system actually consists of
two types of controllers – the master controller and Slave_Control controllers. The Slave_Control
controllers are used as the transform controller for all the boxes in the RingArray system, and the
master controller controls the individual Slave_Control controllers. Changing a property value for
one Slave_Control in a RingArray system changes the property value for all Slave_Controls in the
system.
Properties:
<Slave_Control>.radius Float default: 100.0 -- animatable
<Slave_Control>.cycles Float default: 3.0 -- animatable
<Slave_Control>.amplitude Float default: 20.0 -- animatable
<Slave_Control>.phase Float default: 1.0 -- animatable
Slave Controllers
slavefloat : floatController
slave_point3 : point3Controller
slavepos : positionController
slaverotation : rotationController
slavescale : scaleController
Constructor:
The Slave controllers are not creatable by MAXScript. They can only be created by creating a
Masterblock in the Block Control node in the Global Tracks node of Track View. See the
MasterBlock : MasterBlockController (p. 1320) topic for more information.
See also
Controller Common Properties, Operators, and Methods (p. 1289)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
1334 Chapter 11 | 3ds max Objects
Surface_position : PositionController
Constructor:
Surface_position ...
Properties:
<Surface_position>.surface Node default: undefined
<Surface_position>.u Float default: 0.0 -- animatable
<Surface_position>.v Float default: 0.0 -- animatable
<Surface_position>.align Integer default: 1
align = 1 - No Alignment; 2 - Align to U; 3 - Align to V
<Surface_position>.flip Boolean default: false
See also
Controller Common Properties, Operators, and Methods (p. 1289)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
TCB Controllers
TCB_float : floatController
TCB_point3 : point3Controller
TCB_position : positionController
TCB_rotation : rotationController
TCB_scale : scaleController
Constructor:
TCB_float ...
TCB_point3 ...
TCB_position ...
TCB_rotation ...
TCB_scale ...
Properties:
<controller>.keys MAXKeyArray
See also
MAXKeyArray Values (p. 793)
TCB Controller Keys (p. 1335)
Controller Common Properties, Operators, and Methods (p. 1289)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
TCB Controller Keys 1335
See also
Key Common Properties, Operators, and Methods (p. 768)
Value Common Properties, Operators, and Methods (p. 714)
Waveform_Float : FloatController
Constructor:
waveform_float ...
Properties:
There are no additional properties accessible for Waveform_Float controllers.
See also
Controller Common Properties, Operators, and Methods (p. 1289)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
XYZ Controllers
Color_RGB : Point3Controller
Euler_XYZ : RotationController
Local_Euler_XYZ : RotationController
Point3_XYZ : Point3Controller
Position_XYZ : PositionController
ScaleXYZ : ScaleController
1336 Chapter 11 | 3ds max Objects
Constructor:
Color_RGB ...
Euler_XYZ ...
Local_Euler_XYZ ...
Point3_XYZ ...
Position_XYZ ...
ScaleXYZ ...
Properties:
The property names for the XYZ controllers vary between the specific controllers.
Color_RGB:
<Color_RGB>.r Float default: 0.0 -- animatable
<Color_RGB>.g Float default: 0.0 -- animatable
<Color_RGB>.b Float default: 0.0 -- animatable
Euler_XYZ:
<Euler_XYZ>.x_rotation Float default: 0.0 -- animatable
<Euler_XYZ>.y_rotation Float default: 0.0 -- animatable
<Euler_XYZ>.z_rotation Float default: 0.0 -- animatable
<Euler_XYZ>.axisOrder Integer default: 1
Get/set the order of application of the axis angles. Its value can be any of the following:
1 - XYZ
2 - XZY
3 - YZX
4 - YXZ
5 - ZXY
6 - ZYX
7 - XYX
8 - YZY
9 - ZXZ
Local_Euler_XYZ:
<Local_Euler_XYZ>.local_x_rotation Float default: 0.0 -- animatable
<Local_Euler_XYZ>.local_y_rotation Float default: 0.0 -- animatable
<Local_Euler_XYZ>.local_z_rotation Float default: 0.0 -- animatable
<Local_Euler_XYZ>.axisOrder Integer default: 1
Get/set the order of application of the axis angles. Its value can be any of the following:
1 - XYZ
2 - XZY
3 - YZX
4 - YXZ
5 - ZXY
6 - ZYX
XYZ Controllers 1337
7 - XYX
8 - YZY
9 - ZXZ
Point3_XYZ:
<Point3_XYZ>.x Float default: 0.0 -- animatable
<Point3_XYZ>.y Float default: 0.0 -- animatable
<Point3_XYZ>.z Float default: 0.0 -- animatable
Position_XYZ:
<Position_XYZ>.x_position Float default: 0.0 -- animatable
<Position_XYZ>.y_position Float default: 0.0 -- animatable
<Position_XYZ>.z_position Float default: 0.0 -- animatable
ScaleXYZ:
<ScaleXYZ>.x_scale Float default: 0.0 -- animatable
<ScaleXYZ>.y_scale Float default: 0.0 -- animatable
<ScaleXYZ>.z_scale Float default: 0.0 -- animatable
Methods:
getXYZControllers <controller>
Returns an array of the X, Y, and Z sub-controllers of the specified controller
See also
Controller Common Properties, Operators, and Methods (p. 1289)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Atmospheric : MAXWrapper
The Atmospheric class lets you set up volumetric rendering effects with MAXScript. You can create
atmospherics like combustion and fog, access various properties on them and maintain their list of
gizmo nodes such as lights and atmospheric helpers.
The classes derived directly from the Atmospheric class are described in the Atmospheric Effect Types
(p. 1339) topic.
The properties, operators, and methods that are common to all classes derived directly from the
Atmospheric class are described in the Atmospheric Effects Common Properties, Operators, and Methods
(p. 1338) topic.
The Atmospheric class is derived from the MAXWrapper class, and inherits the properties and
methods defined for that class. These properties and methods are described in the MAXWrapper
Common Properties, Operators, and Methods (p. 809) topic.
1338 Chapter 11 | 3ds max Objects
See also
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Example:
atmos = combust density:20 outer_color:red
appendGizmo atmos $SphereGizmo01
Fire_Effect : Atmospheric
Constructor:
Fire_Effect ...
Properties:
<Fire_Effect>.Inner_Color Color default: (color 252 202 0) -- animatable
Sets the color of the densest part of the effect. For a typical fire, this color represents the
hottest part of the flame.
1340 Chapter 11 | 3ds max Objects
See also
Atmospheric Effects Common Properties, Operators, and Methods (p. 1338)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Fog : Atmospheric
Constructor:
fog ...
Properties:
<Fog>.Fog_Color Color default: (color 255 255 255) -- animatable
<Fog>.Use_Color_Map Integer default: 0
Use_Color_Map = 0 - off; 1 - on
<Fog>.Use_Opacity_Map Integer default: 0
Use_Opacity_Map = 0 - off; 1 - on
<Fog>.Fog_Background Integer default: 1
Fog_Background = 0 - off; 1 - on
<Fog>.Fog_Type Integer default: 0
Fog_Type = 0 - Standard; 1 - Layered
<Fog>.Exponential Integer default: 0
Exponential = 0 - off; 1 - on
<Fog>.Near Float default: 0.0 -- animatable, percentage
<Fog>.Far Float default: 100.0 -- animatable, percentage
<Fog>.Top Float default: 100.0 -- animatable
<Fog>.Bottom Float default: 0.0 -- animatable
<Fog>.Density Float default: 50.0 -- animatable
<Fog>.falloff Integer default: 2
falloff = 0 - Top; 1 - Bottom; 2 - None
<Fog>.Horizon_Noise Integer default: 0
Horizon_Noise = 0 - off; 1 - on
<Fog>.size Float default: 20.0 -- animatable
<Fog>.angle Float default: 5.0 -- animatable, angle
<Fog>.phase Float default: 0.0 -- animatable
Note:
You currently cannot assign texture maps as the color and opacity maps using MAXScript. Once
these texture maps have been assigned, they are accessible as subAnims of Fog.
Volume_Fog : Atmospheric 1343
See also
Atmospheric Effects Common Properties, Operators, and Methods (p. 1338)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Volume_Fog : Atmospheric
Constructor:
volume_fog ...
Properties:
<Volume_Fog>.Soften_Gizmo_Edges Float default: 0.2 -- animatable
<Volume_Fog>.Fog_Color Color default: (color 255 255 255) --
animatable
<Volume_Fog>.Exponential Integer default: 0
Exponential = 0 - off; 1 - on
<Volume_Fog>.Density Float default: 20.0 -- animatable
<Volume_Fog>.Step_Size Float default: 4.0
<Volume_Fog>.Max_Steps Integer default: 100
<Volume_Fog>.Fog_Background Integer default: 1
Fog_Background = 0 - off; 1 - on
<Volume_Fog>.Noise_Type Integer default: 0
Noise_Type = 0 - Regular; 1 - Fractal; 2 - Turbulence
<Volume_Fog>.invert Integer default: 0
invert = 0 - off; 1 - on
<Volume_Fog>.High_Threshold Float default: 1.0 -- animatable
<Volume_Fog>.Low_Threshold Float default: 0.0 -- animatable
<Volume_Fog>.Uniformity Float default: 0.0 -- animatable
<Volume_Fog>.Levels Float default: 3.0 -- animatable
<Volume_Fog>.size Float default: 20.0 -- animatable
<Volume_Fog>.phase Float default: 0.0 -- animatable
<Volume_Fog>.Wind_Strength Float default: 0.0
<Volume_Fog>.Wind_Direction Integer default: 0
Wind_Direction = 0 - Front; 1 - Back; 2 - Left; 3 - Right; 4 - Top; 5 - Bottom
See also
Atmospheric Effects Common Properties, Operators, and Methods (p. 1338)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
1344 Chapter 11 | 3ds max Objects
Volume_Light : Atmospheric
Constructor:
volume_light ...
Properties:
<Volume_Light>.Fog_Color Color default: (color 255 255
255) -- animatable
<Volume_Light>.attenuation_color Color default: (color 0 0
255) -- animatable
<Volume_Light>.Exponential Integer default: 0
Exponential = 0 - off; 1 - on
<Volume_Light>.Density Float default: 5.0 --
animatable
<Volume_Light>.Max_Light Float default: 90.0 --
animatable
<Volume_Light>.Min_Light Float default: 0.0 --
animatable
<Volume_Light>.Use_Attenuation_Color Integer default: 0
Use_Attenuation_Color = 0 - off; 1 - on
<Volume_Light>.Attenuation_Color_Multiplier Float default: 2.0 --
animatable
<Volume_Light>.Filter_Shadows Integer default: 3
Filter_Shadows = 0 - Low; 1 - Medium; 2 - High; 3 - Use Light Smp Range
<Volume_Light>.Samples Integer default: 20
<Volume_Light>.Auto_Sample Integer default: 1
Auto_Sample = 0 - off; 1 - on
<Volume_Light>.Atten_Start Float default: 100.0 --
animatable
<Volume_Light>.Atten_End Float default: 100.0 --
animatable
<Volume_Light>.Noise_On Integer default: 0
Noise_On = 0 - off; 1 - on
<Volume_Light>.Noise_Amount Float default: 0.0 --
animatable
<Volume_Light>.Link_To_Light Integer default: 0
Link_To_Light = 0 - off; 1 - on
<Volume_Light>.Noise_Type Integer default: 0
Noise_Type = 0 - Regular; 1 - Fractal; 2 - Turbulence
<Volume_Light>.invert Integer default: 0
invert = 0 - off; 1 - on
<Volume_Light>.High_Threshold Float default: 1.0 --
animatable
<Volume_Light>.Low_Threshold Float default: 0.0 --
animatable
Volume_Light : Atmospheric 1345
See also
Atmospheric Effects Common Properties, Operators, and Methods (p. 1338)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
lightLevel
Lets you get and set a Float value that defines the global rendering environment
(Rendering\Environment) Global Lighting Tint Level.
lightLevelController
Lets you get and set a Controller value that defines the global rendering environment
(Rendering\Environment) Global Lighting Tint Level controller.
numAtmospherics
Contains an Integer value that defines the number of atmospheric events, as shown in
Rendering\Environment. This variable is read-only.
The following methods set options in the global rendering environment:
getUseEnvironmentMap()
setUseEnvironmentMap <boolean>
Lets you get and set the global rendering environment (Rendering\Environment) Use Map
value. If <boolean> is true Use Map is turned on, false it is turned off.
getBackGroundController()
Returns the global rendering environment (Rendering\Environment) background color
controller.
setBackGround <time> <point3>
Lets you set a Point3 value that defines the global rendering environment
(Rendering\Environment) background color at the specified time. Each component of the
Point3 value is in the range of 0 to 255.
setBackGroundController ( <color_controller> | <point3_controller> )
Assigns the specified controller as the global rendering environment
(Rendering\Environment) background color controller.
Examples:
ambientColor = color 10 10 25
environmentMap = bitmapTexture filename:”foo.bmp”
The following script shows an example of creating Volume Fog and Volume Light atmospherics.
Script:
-- Atmospheric Effects Test Bed
-- create a geosphere, sphere gizmo, onnilight, and targetted camera
geos=geosphere radius:24
sgizmo=spheregizmo radius:40
omni=omnilight farAttenStart:20 farAttenEnd:100 useFarAtten:true v=255
cam=targetcamera pos:[150,-50,100] target:(targetobject())
--
-- put a material on the geosphere
geos.material=standard()
geos.material.selfIllumColor = color 238 241 2
--
-- create a Volume Fog atmospheric. Set name so it has one in Environment dialog.
vf=volume_fog name:”VolFog” soften_gizmo_edges:0.7 exponential:1 density:75
vf.fog_color=color 255 157 0
vf.noise_type=2
Render Effects Common Properties, Operators, and Methods 1347
vf.size=4
appendGizmo vf sgizmo
addAtmospheric vf
--
-- create a Volume Light atmospheric. Set name so it has one in Environment dialog.
vl=volume_light name: “VolLight” exponential:1 density:20
vl.fog_color=color 255 30 0
vl.attenuation_color= color 255 162 0
vl.Use_Attenuation_Color=1
vl.noise_on=1
vl.Noise_Amount=1
vl.size=5
vl.noise_type=2
appendGizmo vl omni
addAtmospheric vl
--
-- and render away…
renderWidth=320
renderHeight=200
render camera:cam
RenderEffect : MAXWrapper
The RenderEffect class lets you set up rendering effects with MAXScript. You can create render effects
such as blur, color balance, and film grain effect.
The classes derived directly from the RenderEffect class are described in the Render Effect Types
(p. 1348) topic.
The properties, operators, and methods that are common to all classes derived directly from the
RenderEffect class are described in the Render Effects Common Properties, Operators, and Methods
(p. 1347) topic.
The RenderEffect class is derived from the MAXWrapper class, and inherits the properties and
methods defined for that class. These properties and methods are described in the MAXWrapper
Common Properties, Operators, and Methods (p. 809) topic.
See also
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Blur : RenderEffect
Constructor:
blur ...
Properties:
<blur>.blur_type Integer default: 0 -- animatable
Select a blur type:
Uniform
Directional
Radial
<blur>.bUnifPixRad Float default: 10.0
Determines the intensity of the Blur effect. Increasing the value increases the number of
surrounding pixels that each pixel will use to compute its blur. The more pixels used
means a greater blur for the image.
<blur>.bUnifAlpha Boolean default: true -- animatable
Applies the Uniform Blur effect to the alpha channel when turned on.
<blur>.bDirUPixRad Float default: 10.0
Determines the horizontal intensity of the Blur effect. Increasing the value increases the
number of surrounding pixels that each pixel will use to compute its blur. The more pixels
used means a greater horizontal blur for the image.
<blur>.bDirVPixRad Float default: 10.0
Determines the vertical intensity of the Blur effect. Increasing the value increases the
number of surrounding pixels that each pixel will use to compute its blur. The more pixels
used means a greater vertical blur for the image.
<blur>.bDirUTrail Float default: 0.0
Adds “direction” to your blur by weighting more blur to either side of the U axis. This adds
a streaking effect and creates the illusion that your objects or your camera are rapidly
moving in a particular direction.
<blur>.bDirVTrail Float default: 0.0
Adds “direction” to your blur by weighting more blur to either side of the V axis. This adds
a streaking effect and creates the illusion that your objects or your camera are rapidly
moving in a particular direction.
1350 Chapter 11 | 3ds max Objects
See also
Render Effects Common Properties, Operators, and Methods (p. 1347)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Brightness_and_Contrast : RenderEffect
Constructor:
brightness_and_contrast ...
Properties:
<Brightness_and_Contrast>.Brightness Float default: 0.5 -- animatable
<Brightness_and_Contrast>.contrast Float default: 0.5 -- animatable
<Brightness_and_Contrast>.ignoreBack Boolean default: false -- animatable,
alias: ignore_background
See also
Render Effects Common Properties, Operators, and Methods (p. 1347)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
1354 Chapter 11 | 3ds max Objects
Color_Balance : RenderEffect
Constructor:
color_balance ...
Properties:
<Color_Balance>.red Integer default: 0 -- animatable
<Color_Balance>.green Integer default: 0 -- animatable
<Color_Balance>.blue Integer default: 0 -- animatable
<Color_Balance>.preserveLum Boolean default: false -- animatable, alias:
Preserve_Luminosity
<Color_Balance>.ignoreBack Boolean default: false -- animatable, alias:
Ignore_Background
See also
Render Effects Common Properties, Operators, and Methods (p. 1347)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Depth_of_Field : RenderEffect
Constructor:
depth_of_field ...
Properties:
<Depth_of_Field>.AffectAlpha Boolean default: true -- alias: Affect_Alpha
<Depth_of_Field>.camNodeIndex Integer default: -1 -- alias: Camera_Index
camNodeIndex specifies which camera in the Depth of Field camera dropdown is the
selected camera. A value of -1 specifies that no camera is selected. The index is otherwise 0-
based.
<Depth_of_Field>.focalNodeIndex Integer default: -1 -- alias: Focal_Index
focalNodeIndex specifies which camera in the Depth of Field focal point node dropdown
is the selected focal point node. A value of -1 specifies that no focal point node is selected.
The index is otherwise 0-based.
<Depth_of_Field>.FocalPoint Integer default: 0 -- alias: Focal_Point
FocalPoint = 0 - Focal Node; 1 - Use Camera
<Depth_of_Field>.FocalType Integer default: 0 -- alias: Focal_Type
FocalType = 0 - Custom; 1 - Use Camera
Depth_of_Field : RenderEffect 1355
Methods:
DOF.addCam <Depth_of_Field> <camera_node_name_string>
Adds the specified camera to the Depth of Field camera dropdown.
camera_node_name_string is the name of the camera as a string, and must match the
case of the camera’s name. Returns true if the addition was successful, false if it failed.
The normal reason for a failure is that the named camera is not present in the scene.
DOF.addFocalNode <Depth_of_Field> <node_name_string>
Adds the specified node to the Depth of Field focal point node dropdown.
node_name_string is the name of the node as a string, and must match the case of the
node’s name. Returns true if the addition was successful, false if it failed. The normal
reason for a failure is that the named node is not present in the scene.
DOF.deleteCam <Depth_of_Field> <index_integer>
Deletes the indexed camera from the Depth of Field camera dropdown, where
<index_integer> is the index of the camera in the dropdown. The index is 0-based to
maintain consistency with the camNodeIndex property. Returns true if the deletion was
successful, false if it failed. The normal reason for a failure is that the indexed camera is
not present in the dropdown.
DOF.deleteCamByName <Depth_of_Field> <camera_node_name_string>
Deletes the specified camera from the Depth of Field camera dropdown.
camera_node_name_string is the name of the camera as a string, and must match the
case of the camera’s name. Returns true if the deletion was successful, false if it failed.
The normal reason for a failure is that the named camera is not present in the dropdown.
DOF.deleteFocalNode <Depth_of_Field> <index_integer>
Deletes the indexed node from the Depth of Field focal point node dropdown, where
<index_integer> is the index of the node in the dropdown. The index is 0-based to
maintain consistency with the focalNodeIndex property. Returns true if the deletion
was successful, false if it failed. The normal reason for a failure is that the indexed node
is not present in the dropdown.
DOF.deleteFocalNodeByName <Depth_of_Field> <node_name_string>
Deletes the specified node from the Depth of Field focal point node dropdown.
node_name_string is the name of the node as a string, and must match the case of the
node’s name. Returns true if the deletion was successful, false if it failed. The normal
reason for a failure is that the named node is not present in the dropdown.
1356 Chapter 11 | 3ds max Objects
See also
Render Effects Common Properties, Operators, and Methods (p. 1347)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
File_Output : RenderEffect
Constructor:
file_output ...
Properties:
<File_Output>.bitmap BitMap default: BitMap: -- output bitmap
<File_Output>.channelType Integer default: 0 -- alias: channel_type
channelType = 0 - Whole Image; 1 - Luminance; 2 - Depth; 3 - Alpha
<File_Output>.active Boolean default: true -- animatable
<File_Output>.affectSource Boolean default: false -- animatable, alias:
affect_source
<File_Output>.cameraNode Node default: undefined -- alias: camera_node
<File_Output>.nearZ Float default: 0.0 -- animatable, alias:
near_z_depth
<File_Output>.farZ Float default: -500.0 -- animatable, alias:
far_z_depth
<File_Output>.fitScene Boolean default: true -- animatable, alias:
fit_entire_scene
See also
Render Effects Common Properties, Operators, and Methods (p. 1347)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Film_Grain : RenderEffect
Constructor:
film_grain ...
Properties:
<Film_Grain>.Grain Float default: 0.2 -- animatable
<Film_Grain>.’Mask Background’ Boolean default: false -- animatable; alias:
Ignore_Background
Lens_Effects : RenderEffect 1357
See also
Render Effects Common Properties, Operators, and Methods (p. 1347)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Lens Effects
Lens_Effects : RenderEffect
Constructor:
lens_effects ...
Properties:
<Lens_Effects>.size Float default: 100.0 -- animatable
<Lens_Effects>.intensity Float default: 100.0 -- animatable
<Lens_Effects>.seed Integer default: 1357
<Lens_Effects>.angle Float default: 0.0 -- animatable
<Lens_Effects>.squeeze Float default: 0.0 -- animatable
<Lens_Effects>.affectAlpha Boolean default: true -- alias:
Affect_Alpha
<Lens_Effects>.affectZBuffer Boolean default: false -- alias:
Affect_Z_Buffer
<Lens_Effects>.distAffectsSize Boolean default: false -- alias:
Distance_Affects_Size
<Lens_Effects>.distAffectsIntensity Boolean default: false -- alias:
Distance_Affects_Intensity
<Lens_Effects>.centerAffectsSize Boolean default: false -- alias:
Off_Center_Affects_Size
<Lens_Effects>.centerAffectsIntensity Boolean default: false -- alias:
Off_Center_Affects_Intensity
<Lens_Effects>.innerOcclusionRadius Float default: 3.0 -- animatable,
alias: Inner_Occlusion_Radius
<Lens_Effects>.outerOcclusionRadius Float default: 33.0 -- animatable,
alias: Outer_Occlusion_Radius
<Lens_Effects>.occlusionAffectsSize Boolean default: true -- alias:
Occlusion_Affects_Size
<Lens_Effects>.occlusionAffectsIntensity Boolean default: true -- alias:
Occlusion_Affects_Intensity
<Lens_Effects>.affectByAtmosphere Boolean default: false -- alias:
Affect_By_Atmosphere
1358 Chapter 11 | 3ds max Objects
Methods:
The following methods add elements to a Lens Effects, load and save a Lens Effects configuration
file, add and delete lights, and delete Lens Effects elements.
le.addASec <Lens_Effects>
Adds a Auto Secondary element to the Lens Effect. The element is appended to any
elements present. Returns true if the addition was successful, false if it failed.
le.addGlow <Lens_Effects>
Adds a Glow element to the Lens Effect. The element is appended to any elements present.
Returns true if the addition was successful, false if it failed.
le.addMSec <Lens_Effects>
Adds a Manual Secondary element to the Lens Effect. The element is appended to any
elements present. Returns true if the addition was successful, false if it failed.
le.addRay <Lens_Effects>
Adds a Ray element to the Lens Effect. The element is appended to any elements present.
Returns true if the addition was successful, false if it failed.
le.addRing <Lens_Effects>
Adds a Ring element to the Lens Effect. The element is appended to any elements present.
Returns true if the addition was successful, false if it failed.
le.addStar <Lens_Effects>
Adds a Star element to the Lens Effect. The element is appended to any elements present.
Returns true if the addition was successful, false if it failed.
le.addStreak <Lens_Effects>
Adds a Streak element to the Lens Effect. The element is appended to any elements
present. Returns true if the addition was successful, false if it failed.
le.load <Lens_Effects> <filename_string>
le.save <Lens_Effects> <filename_string>
Saves the Lens Effects configuration to the file specified by <filename_string>.
Animated parameter values are not saved.
le.numLights <Lens_Effects>
Returns the number of lights in the light list.
le.addLightNode <Lens_Effects> <light_node>
Adds light node to the light list.
le.addLight <Lens_Effects> <light_node_name_string>
Adds the specified light to the Lens Effects Lights dropdown. light_node_name_string
is the name of the light as a string, and must match the case of the light’s name. Returns
true if the addition was successful, false if it failed. The normal reason for a failure is
that the named light is not present in the scene.
le.deleteLight <Lens_Effects> <index_integer>
Deletes the indexed light from the Lens Effects Lights dropdown, where
<index_integer> is the index of the light in the Lens Effects Lights dropdown. Returns
true if the deletion was successful, false if it failed. The normal reason for a failure is
that the indexed light is not present in the dropdown.
Lens_Effects : RenderEffect 1359
le.deleteLightByName <light_node_name_string>
Deletes the named light from the Lens Effects Lights dropdown.
light_node_name_string is the name of the light as a string, and must match the case
of the light’s name. Returns true if the deletion was successful, false if it failed. The
normal reason for a failure is that the named light is not present in the dropdown.
le.lightIndex <Lens_Effects> <light_node_name_string>
Returns the light list index of the named light. Returns –1 if the light’s name is not in the
light list.
le.lightName <Lens_Effects> <index>
Returns the node name of the light for the specified light list index. If the index is out of
range, a null string will be returned.
le.deleteElement <Lens_Effects> <index_integer>
Deletes the indexed element, where <index_integer> is the index of the element in the
Lens Effects composition window. Returns true if the deletion was successful, false if it
failed. The normal reason for a failure is that the indexed element does not exist.
le.deleteElementByName <element_name_string>
Deletes the named element. element_name_string is the name of the element as a
string, and must match the case of the element’s name. Returns true if the deletion was
successful, false if it failed. The normal reason for a failure is that the named element
does not exist.
See also
Lens_Effects - Auto_Secondary (p. 1360)
Lens_Effects - Glow (p. 1363)
Lens_Effects - Manual_Secondary (p. 1366)
Lens_Effects - Ray (p. 1370)
Lens_Effects - Ring (p. 1373)
Lens_Effects - Star (p. 1376)
Lens_Effects - Streak (p. 1379)
Render Effects Common Properties, Operators, and Methods (p. 1347)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
1360 Chapter 11 | 3ds max Objects
Lens_Effects - Auto_Secondary
Constructor:
le.addASec <Lens_Effects>
Properties:
<auto_secondary>.elementName String default: “Auto Secondary” --
alias: Name
<auto_secondary>.on Boolean default: true
<auto_secondary>.minSize Float default: 25.0 --
animatable; alias: Min_Size
<auto_secondary>.maxSize Float default: 100.0 --
animatable; alias: Max_Size
<auto_secondary>.axis Float default: 3.0 --
animatable
<auto_secondary>.intensity Float default: 30.0 --
animatable
<auto_secondary>.quantity Integer default: 12 --
animatable
<auto_secondary>.colorSource Float default: 20.0 --
animatable; alias: Source_Color
<auto_secondary>.sides Integer default: 0
sides = 0 - Circular; 1 - Three; 2 - Four; 3 - Five; 4 - Six; 5 - Seven; 6 - Eight
<auto_secondary>.occlusion Float default: 100.0 --
animatable
<auto_secondary>.presets Integer default: 0
presets selects a preset from the indexed list. presets = 0 - no preset.
<auto_secondary>.squeeze Boolean default: false
<auto_secondary>.radialColor1 Color default: (color 0 0 0) --
animatable; alias: Radial_Color_1
<auto_secondary>.radialColor2 Color default: (color 57 34 89) --
animatable; alias: Radial_Color_2
<auto_secondary>.radialColor3 Color default: (color 85 139 85) --
animatable; alias: Radial_Color_3
<auto_secondary>.radialColor4 Color default: (color 190 99 10) --
animatable; alias: Radial_Color_4
<auto_secondary>.colorRadius1 Float default: 90.0 --
animatable; alias: Radius_Color_1
<auto_secondary>.colorRadius2 Float default: 92.0 --
animatable; alias: Radius_Color_2
<auto_secondary>.colorRadius3 Float default: 95.0 --
animatable; alias: Radius_Color_3
<auto_secondary>.colorRadius4 Float default: 98.0 --
animatable; alias: Radius_Color_4
<auto_secondary>.radialMtl TextureMap default: undefined -- alias:
Radial_Material
<auto_secondary>.useRadialMtl Boolean default: false -- alias:
Apply_Radial_Color_Map
<auto_secondary>.radial_falloff SubAnim
Lens_Effects - Auto_Secondary 1361
<auto_secondary.radial_falloff>.curve_1 SubAnim
The curve_1 SubAnim contains the radial_falloff curve. You cannot create or access
points in this curve unless the point is animated. In this case, you can access the animated
point position as a SubAnim of the curve_1 property.
Lens_Effects - Glow 1363
<auto_secondary.circular_falloff>.curve_1 SubAnim
The curve_1 SubAnim contains the circular_falloff curve. You cannot create or
access points in this curve unless the point is animated. In this case, you can access the
animated point position as a SubAnim of the curve_1 property.
<auto_secondary.radial_size>.curve_1 SubAnim
The curve_1 SubAnim contains the radial_size curve. You cannot create or access
points in this curve unless the point is animated. In this case, you can access the animated
point position as a SubAnim of the curve_1 property.
<auto_secondary.radial_density>.curve_1 SubAnim
The curve_1 SubAnim contains the radial_density curve. You cannot create or access
points in this curve unless the point is animated. In this case, you can access the animated
point position as a SubAnim of the curve_1 property.
Note:
The le.addASec <Lens_Effects> method returns true if the addition was successful, false if
it failed. Once the element has been added, it can be accessed as a property of the lens_effects
value. The name of this property for auto_secondary elements is auto_secondary. If more than
one element of the same type is added, only the first is accessible using the property name. You will
need to access the remaining elements as subAnims of the lens_effects value. The subAnim
names are the same as the property names. The elements start at subAnim 7.
See also
Lens_Effects : RenderEffect (p. 1357)
Value Common Properties, Operators, and Methods (p. 714)
Lens_Effects - Glow
Constructor:
le.addGlow <Lens_Effects>
Properties:
<glow>.elementName String default: “Glow” -- alias: Name
<glow>.on Boolean default: true
<glow>.size Float default: 30.0 -- animatable
<glow>.intensity Float default: 110.0 -- animatable
<glow>.objectsHide Boolean default: true -- alias: Object_Hide
<glow>.occlusion Float default: 100.0 -- animatable
<glow>.squeeze Boolean default: false
<glow>.useSourceColor Float default: 0.0 -- animatable; alias:
Source_Color
<glow>.centerColor Color default: (color 255 255 255) --
animatable; alias: Center_Color
<glow>.edgeColor Color default: (color 255 0 0) -- animatable;
alias: Edge_Color
1364 Chapter 11 | 3ds max Objects
<glow.radial_falloff>.curve_1 SubAnim
The curve_1 SubAnim contains the radial_falloff curve. You cannot create or access
points in this curve unless the point is animated. In this case, you can access the animated
point position as a SubAnim of the curve_1 property.
1366 Chapter 11 | 3ds max Objects
<glow.circular_falloff>.curve_1 SubAnim
The curve_1 SubAnim contains the circular_falloff curve. You cannot create or
access points in this curve unless the point is animated. In this case, you can access the
animated point position as a SubAnim of the curve_1 property.
<glow.radial_size>.curve_1 SubAnim
The curve_1 SubAnim contains the radial_size curve. You cannot create or access
points in this curve unless the point is animated. In this case, you can access the animated
point position as a SubAnim of the curve_1 property.
<glow.radial_density>.curve_1 SubAnim
The curve_1 SubAnim contains the radial_density curve. You cannot create or access
points in this curve unless the point is animated. In this case, you can access the animated
point position as a SubAnim of the curve_1 property.
Note:
The le.addGlow <Lens_Effects> method returns true if the addition was successful, false if
it failed. Once the element has been added, it can be accessed as a property of the lens_effects
value. The name of this property for glow elements is glow. If more than one element of the same
type is added, only the first is accessible using the property name. You will need to access the
remaining elements as subAnims of the lens_effects value. The subAnim names are the same as
the property names. The elements start at subAnim 7.
See also
Lens_Effects : RenderEffect (p. 1357)
Value Common Properties, Operators, and Methods (p. 714)
Lens_Effects - Manual_Secondary
Constructor:
le.addMSec <Lens_Effects>
Properties:
<manual_secondary>.elementName String default: “Manual
Secondary” -- alias: Name
<manual_secondary>.on Boolean default: true
<manual_secondary>.size Float default: 50.0 --
animatable
<manual_secondary>.intensity Float default: 30.0 --
animatable
<manual_secondary>.plane Float default: 150.0 --
animatable
<manual_secondary>.colorSource Float default: 20.0 --
animatable; alias: Source_Color
<manual_secondary>.sides Integer default: 0
sides = 0 - Circular; 1 - Three; 2 - Four; 3 - Five; 4 - Six; 5 - Seven; 6 - Eight
Lens_Effects - Manual_Secondary 1367
<manual_secondary.radial_falloff>.curve_1 SubAnim
The curve_1 SubAnim contains the radial_falloff curve. You cannot create or access
points in this curve unless the point is animated. In this case, you can access the animated
point position as a SubAnim of the curve_1 property.
<manual_secondary.circular_falloff>.curve_1 SubAnim
The curve_1 SubAnim contains the circular_falloff curve. You cannot create or
access points in this curve unless the point is animated. In this case, you can access the
animated point position as a SubAnim of the curve_1 property.
<manual_secondary.radial_size>.curve_1 SubAnim
The curve_1 SubAnim contains the radial_size curve. You cannot create or access
points in this curve unless the point is animated. In this case, you can access the animated
point position as a SubAnim of the curve_1 property.
<manual_secondary.radial_density>.curve_1 SubAnim
The curve_1 SubAnim contains the radial_density curve. You cannot create or access
points in this curve unless the point is animated. In this case, you can access the animated
point position as a SubAnim of the curve_1 property.
Note:
The le.addMSec <Lens_Effects> method returns true if the addition was successful, false if
it failed. Once the element has been added, it can be accessed as a property of the lens_effects
value. The name of this property for manual_secondary elements is manual_secondary. If more
than one element of the same type is added, only the first is accessible using the property name. You
will need to access the remaining elements as subAnims of the lens_effects value. The subAnim
names are the same as the property names. The elements start at subAnim 7.
1370 Chapter 11 | 3ds max Objects
See also
Lens_Effects : RenderEffect (p. 1357)
Value Common Properties, Operators, and Methods (p. 714)
Lens_Effects - Ray
Constructor:
le.addRay <Lens_Effects>
Properties:
<ray>.elementName String default: “Ray” -- alias: Name
<ray>.on Boolean default: true
<ray>.size Float default: 300.0 -- animatable
<ray>.intensity Float default: 10.0 -- animatable
<ray>.number Integer default: 100 -- animatable; alias:
Quantity
<ray>.angle Float default: 0.0 -- animatable
<ray>.sharpness Float default: 8.0 -- animatable
<ray>.objectsHide Boolean default: false
<ray>.occlusion Float default: 100.0 -- animatable
<ray>.squeeze Boolean default: false
<ray>.colorSource Float default: 100.0 -- animatable; alias:
Source_Color
<ray>.centerColor Color default: (color 255 255 255) -- animatable;
alias: Center_Color
<ray>.edgeColor Color default: (color 255 0 0) -- animatable;
alias: Edge_Color
<ray>.radialMtl TextureMap default: undefined -- alias:
Radial_Material
<ray>.useRadialMtl Boolean default: false -- alias:
Apply_Radial_Color_Map
<ray>.radial_falloff SubAnim
<ray>.radialMap TextureMap default: undefined -- alias:
Radial_Falloff_Map
<ray>.useRadialMap Boolean default: false -- alias:
Apply_Radial_Falloff_Map
<ray>.circularColorMix Float default: 0.0 -- animatable; alias:
Circular_Color_Mix
<ray>.quadrant1Color Color default: (color 255 0 0) -- animatable;
alias: Quadrant_1_Color
<ray>.quadrant2Color Color default: (color 255 0 0) -- animatable;
alias: Quadrant_2_Color
<ray>.quadrant3Color Color default: (color 255 0 0) -- animatable;
alias: Quadrant_3_Color
<ray>.quadrant4Color Color default: (color 255 0 0) -- animatable;
alias: Quadrant_4_Color
<ray>.circularMtl TextureMap default: undefined
Circular_Material
Lens_Effects - Ray 1371
<ray.radial_falloff>.curve_1 SubAnim
The curve_1 SubAnim contains the radial_falloff curve. You cannot create or access
points in this curve unless the point is animated. In this case, you can access the animated
point position as a SubAnim of the curve_1 property.
<ray.circular_falloff>.curve_1 SubAnim
The curve_1 SubAnim contains the circular_falloff curve. You cannot create or
access points in this curve unless the point is animated. In this case, you can access the
animated point position as a SubAnim of the curve_1 property.
<ray.radial_size>.curve_1 SubAnim
The curve_1 SubAnim contains the radial_size curve. You cannot create or access
points in this curve unless the point is animated. In this case, you can access the animated
point position as a SubAnim of the curve_1 property.
<ray.radial_density>.curve_1 SubAnim
The curve_1 SubAnim contains the radial_density curve. You cannot create or access
points in this curve unless the point is animated. In this case, you can access the animated
point position as a SubAnim of the curve_1 property.
Note:
The le.addRay <Lens_Effects> method returns true if the addition was successful, false if it
failed. Once the element has been added, it can be accessed as a property of the lens_effects
value. The name of this property for ray elements is ray. If more than one element of the same type
is added, only the first is accessible using the property name. You will need to access the remaining
elements as subAnims of the lens_effects value. The subAnim names are the same as the property
names. The elements start at subAnim 7.
Lens_Effects - Ring 1373
See also
Lens_Effects : RenderEffect (p. 1357)
Value Common Properties, Operators, and Methods (p. 714)
Lens_Effects - Ring
Constructor:
le.addRing <Lens_Effects>
Properties:
<ring>.elementName String default: “Ring” -- alias: Name
<ring>.on Boolean default: true
<ring>.size Float default: 75.0 -- animatable
<ring>.intensity Float default: 75.0 -- animatable
<ring>.plane Float default: 0.0 -- animatable
<ring>.thickness Float default: 10.0 -- animatable
<ring>.objectsHide Boolean default: false -- alias: Object_Hide
<ring>.occlusion Float default: 100.0 -- animatable
<ring>.squeeze Boolean default: false
<ring>.colorSource Float default: 0.0 -- animatable; alias:
Source_Color
<ring>.centerColor Color default: (color 255 255 255) --
animatable; alias: Center_Color
<ring>.edgeColor Color default: (color 255 0 0) -- animatable;
alias: Edge_Color
<ring>.radialMtl TextureMap default: undefined -- alias:
Radial_Material
<ring>.useRadialMtl Boolean default: false -- alias:
Apply_Radial_Color_Map
<ring>.radial_falloff SubAnim
<ring>.radialMap TextureMap default: undefined -- alias:
Radial_Falloff_Map
<ring>.useRadialMap Boolean default: false -- alias:
Apply_Radial_Falloff_Map
<ring>.circularColorMix Float default: 0.0 -- animatable; alias:
Circular_Color_Mix
<ring>.quadrant1Color Color default: (color 255 0 0) -- animatable;
alias: Quadrant_1_Color
<ring>.quadrant2Color Color default: (color 255 0 0) -- animatable;
alias: Quadrant_2_Color
<ring>.quadrant3Color Color default: (color 255 0 0) -- animatable;
alias: Quadrant_3_Color
<ring>.quadrant4Color Color default: (color 255 0 0) -- animatable;
alias: Quadrant_4_Color
<ring>.circularMtl TextureMap default: undefined -- alias:
Circular_Material
<ring>.useCircularMtl Boolean default: false -- alias:
Apply_Circular_Color_Map
<ring>.circular_falloff SubAnim
1374 Chapter 11 | 3ds max Objects
<ring.radial_falloff>.curve_1 SubAnim
The curve_1 SubAnim contains the radial_falloff curve. You cannot create or access
points in this curve unless the point is animated. In this case, you can access the animated
point position as a SubAnim of the curve_1 property.
<ring.circular_falloff>.curve_1 SubAnim
The curve_1 SubAnim contains the circular_falloff curve. You cannot create or
access points in this curve unless the point is animated. In this case, you can access the
animated point position as a SubAnim of the curve_1 property.
<ring.radial_size>.curve_1 SubAnim
The curve_1 SubAnim contains the radial_size curve. You cannot create or access
points in this curve unless the point is animated. In this case, you can access the animated
point position as a SubAnim of the curve_1 property.
<ring.radial_density>.curve_1 SubAnim
The curve_1 SubAnim contains the radial_density curve. You cannot create or access
points in this curve unless the point is animated. In this case, you can access the animated
point position as a SubAnim of the curve_1 property.
Note:
The le.addRing <Lens_Effects> method returns true if the addition was successful, false if
it failed. Once the element has been added, it can be accessed as a property of the lens_effects
value. The name of this property for ring elements is ring. If more than one element of the same
type is added, only the first is accessible using the property name. You will need to access the
remaining elements as subAnims of the lens_effects value. The subAnim names are the same as
the property names. The elements start at subAnim 7.
1376 Chapter 11 | 3ds max Objects
See also
Lens_Effects : RenderEffect (p. 1357)
Value Common Properties, Operators, and Methods (p. 714)
Lens_Effects - Star
Constructor:
le.addStar <Lens_Effects>
Properties:
<star>.elementName String default: “Star” -- alias: Name
<star>.on Boolean default: true
<star>.size Float default: 200.0 -- animatable
<star>.intensity Float default: 20.0 -- animatable
<star>.width Float default: 8.0 -- animatable
<star>.angle Float default: 0.0 -- animatable
<star>.taper Float default: 0.5 -- animatable
<star>.sharp Float default: 9.5 -- animatable; alias:
Sharpness
<star>.quantity Integer default: 6 -- animatable
<star>.objectsHide Boolean default: false -- alias: Object_Hide
<star>.occlusion Float default: 50.0 -- animatable
<star>.squeeze Boolean default: false
<star>.colorSource Float default: 100.0 -- animatable; alias:
Source_Color
<star>.centerColor Color default: (color 0 0 255) -- animatable;
alias: Center_Color
<star>.edgeColor Color default: (color 255 255 255) --
animatable; alias: Edge_Color
<star>.radialMtl TextureMap default: undefined -- alias:
Radial_Material
<star>.useRadialMtl Boolean default: false -- alias:
Apply_Radial_Color_Map
<star>.radial_falloff SubAnim
<star>.radialMap TextureMap default: undefined -- alias:
Radial_Falloff_Map
<star>.useRadialMap Boolean default: false -- alias:
Apply_Radial_Falloff_Map
<star>.circularColorMix Float default: 0.0 -- animatable; alias:
Circular_Color_Mix
<star>.leftSectionColor Color default: (color 0 0 255) -- animatable;
alias: Left_Section_Color
<star>.centerSectionColor Color default: (color 255 255 255) --
animatable; alias: Center_Section_Color
<star>.rightSectionColor Color default: (color 0 0 255) -- animatable;
alias: Right_Section_Color
<star>.circularMtl TextureMap default: undefined -- alias:
Circular_Material
Lens_Effects - Star 1377
<star.radial_falloff>.curve_1 SubAnim
The curve_1 SubAnim contains the radial_falloff curve. You cannot create or access
points in this curve unless the point is animated. In this case, you can access the animated
point position as a SubAnim of the curve_1 property.
<star.circular_falloff>.curve_1 SubAnim
The curve_1 SubAnim contains the circular_falloff curve. You cannot create or
access points in this curve unless the point is animated. In this case, you can access the
animated point position as a SubAnim of the curve_1 property.
<star.radial_size>.curve_1 SubAnim
The curve_1 SubAnim contains the radial_size curve. You cannot create or access
points in this curve unless the point is animated. In this case, you can access the animated
point position as a SubAnim of the curve_1 property.
<star.radial_density>.curve_1 SubAnim
The curve_1 SubAnim contains the radial_density curve. You cannot create or access
points in this curve unless the point is animated. In this case, you can access the animated
point position as a SubAnim of the curve_1 property.
Note:
The le.addStar <Lens_Effects> method returns true if the addition was successful, false if
it failed. Once the element has been added, it can be accessed as a property of the lens_effects
value. The name of this property for star elements is star. If more than one element of the same
type is added, only the first is accessible using the property name. You will need to access the
remaining elements as subAnims of the lens_effects value. The subAnim names are the same as
the property names. The elements start at subAnim 7.
Lens_Effects - Streak 1379
See also
Lens_Effects : RenderEffect (p. 1357)
Value Common Properties, Operators, and Methods (p. 714)
Lens_Effects - Streak
Constructor:
le.addStreak <Lens_Effects>
Properties:
<streak>.elementName String default: “Streak” -- alias: Name
<streak>.on Boolean default: true
<streak>.size Float default: 50.0 -- animatable
<streak>.intensity Float default: 30.0 -- animatable
<streak>.width Float default: 2.0 -- animatable
<streak>.angle Float default: 0.0 -- animatable
<streak>.taper Float default: 0.5 -- animatable
<streak>.sharp Float default: 9.8 -- animatable;
alias: Sharpness
<streak>.objectsHide Boolean default: false -- alias:
Object_Hide
<streak>.occlusion Float default: 100.0 -- animatable
<streak>.squeeze Boolean default: false
<streak>.colorSource Float default: 100.0 -- animatable;
alias: Source_Color
<streak>.centerColor Color default: (color 0 0 255) -- animatable;
alias: Center_Color
<streak>.edgeColor Color default: (color 255 255 255) --
animatable; alias: Edge_Color
<streak>.radialMtl TextureMap default: undefined -- alias:
Radial_Material
<streak>.useRadialMtl Boolean default: false -- alias:
Apply_Radial_Color_Map
<streak>.radial_falloff SubAnim
<streak>.radialMap TextureMap default: undefined -- alias:
Radial_Falloff_Map
<streak>.useRadialMap Boolean default: false -- alias:
Apply_Radial_Falloff_Map
<streak>.circularColorMix Float default: 50.0 -- animatable;
alias: Circular_Color_Mix
<streak>.quadrant1Color Color default: (color 0 0 0) -- animatable;
alias: Left_Section_Color
<streak>.quadrant2Color Color default: (color 255 255 255) --
animatable; alias: Center_Section_Color
<streak>.quadrant3Color Color default: (color 0 0 0) -- animatable;
alias: Right_Section_Color
<streak>.circularMtl TextureMap default: undefined -- alias:
Circular_Material
1380 Chapter 11 | 3ds max Objects
<streak.radial_falloff>.curve_1 SubAnim
The curve_1 SubAnim contains the radial_falloff curve. You cannot create or access
points in this curve unless the point is animated. In this case, you can access the animated
point position as a SubAnim of the curve_1 property.
<streak.circular_falloff>.curve_1 SubAnim
The curve_1 SubAnim contains the circular_falloff curve. You cannot create or
access points in this curve unless the point is animated. In this case, you can access the
animated point position as a SubAnim of the curve_1 property.
<streak.radial_size>.curve_1 SubAnim
The curve_1 SubAnim contains the radial_size curve. You cannot create or access
points in this curve unless the point is animated. In this case, you can access the animated
point position as a SubAnim of the curve_1 property.
<streak.radial_density>.curve_1 SubAnim
The curve_1 SubAnim contains the radial_density curve. You cannot create or access
points in this curve unless the point is animated. In this case, you can access the animated
point position as a SubAnim of the curve_1 property.
1382 Chapter 11 | 3ds max Objects
Note:
The le.addStreak <Lens_Effects> method returns true if the addition was successful, false
if it failed. Once the element has been added, it can be accessed as a property of the lens_effects
value. The name of this property for streak elements is streak. If more than one element of the
same type is added, only the first is accessible using the property name. You will need to access the
remaining elements as subAnims of the lens_effects value. The subAnim names are the same as
the property names. The elements start at subAnim 7.
See also
Lens_Effects : RenderEffect (p. 1357)
Value Common Properties, Operators, and Methods (p. 714)
Methods:
deleteTrackViewNode [ <parent_maxtvnode> ] <maxtvnode>
deletes the given node from the supplied parent, or the top-level if the parent is not
specified
addTrackViewController <maxtvnode> <controller> <name>
adds the sub-controller to the given Track View node. The
deleteTrackViewController <maxtvnode> <controller>
deletes the controller from the given Track View node
See also
Value Common Properties, Operators, and Methods (p. 714)
1384 Chapter 11 | 3ds max Objects
Examples:
-- access a video post track
videoPost.glow.size = 5
-- set up some visible tracks for some keyframeable parameters in a rollout panel
my_tracks = newTrackViewNode “Grinner”
happy_ctrl = bezier_position()
addTrackViewController my_tracks happy_ctrl “Happy”
...
-- plant keyframes in rollout spinner handler if the animate button is on
rollout grinner ...
(
...
on happy changed val do
(
...
happy_ctrl.value = [x, y, z]
...
)
...
)
-- add a new float controller to the global tracks float controller list:
globalTracks.float.controller.available.controller = bezier_float()
This is invalid because the viewport does not support displacement approximation, only the
production renderer does. Therefore, this will generate an Assertion Failure.
1386 Chapter 11 | 3ds max Objects
The NURBSObject class is the base NURBS class. It provides a set of properties that are common to
the other classes such as getting and setting the name of the item. It also has a NURBSId property
which is an ID used to specify a particular object in communication between the NURBS classes.
1388 Chapter 11 | 3ds max Objects
The NURBSSet class is the class used when developers want to create 3ds max NURBS objects, or
retrieve data from existing 3ds max NURBS objects. The NURBSSet acts as a container for the other
objects. This class contains a table of the various NURBSObject derived entities (points, curves,
surfaces) used to make up the set. Additionally it has two ‘fuse’ tables: one for fuse curves and one
for fuse surfaces. These are used to allow the CVs in the curves or surfaces to be ‘stitched’ or ‘fused’
together so that if one curve or surface moves the other moves with it. This class also has the surface-
approximation properties that control the object’s tessellation into triangle meshes for use in the
viewports and the production renderer.
The NURBSPoint classes describe a point in 3D space. Depending on the specific class, points can be
either independent or dependent. Independent points are those that don’t rely on other objects to
define their location. Dependent points are related to the objects they depend on such that the
relationship established initially remains if the point, curve or surface moves. For example, a point
can be created such that it always remains a certain distance from another point. The options are
XYZ-relative, along a normal, or along a tangent (or set of tangents for a surface-dependent
constrained point).
The NURBSControlVertex class defines a Control Vertex of a NURBS Curve or NURBS Surface. This
class shares may of the same properties as a NURBSPoint and has the added property of a rational
weight. The weight value of a CV is rational. That is, it is relative to other CVs in the curve or surface.
Changing the weight of all CVs at once has no effect, because this doesn’t change the ratio between
weights.
The NURBSCurve classes describe the properties of NURBS curves. As with the NURBSPoint classes,
depending on the specific class, curves can be either independent or dependent. Independent curves
are those that don’t rely on other objects to define their location. A dependent curve is an object
that depends on one or more other objects to define what it is. For example, a Blend Curve depends
on the two parent curves that it blends between when it was created (as well as on its two tension
parameters).
The NURBSSurface classes describe the properties of NURBS surfaces. As with the NURBSPoint and
NURBSCurve classes, depending on the specific class, surfaces can be either independent or
dependent. Independent surfaces are those that don’t rely on other objects to define their location.
Dependent surfaces are surface sub-objects whose geometry depends on other surfaces or curves in
the NURBS model. When you change the geometry of the original parent surface or curve, the
dependent surface changes as well.
Creating New NURBS Objects 1389
Note that the NURBSSet supplied to the NURBSNode() function will be modified by that function
to be a relational representative for the newly created scene node which you can then use to modify
the scene object -- you don’t have to re-extract a fresh relational NURBSSet.
The kinds of modification you can perform in this way are limited to changing those parameters and
properties that do not alter the structure of the NURBS scene object -- you can modify point and CV
positions, CV weights, dependent object parameters such as offsets and extrude amounts, etc. You
cannot add or delete objects, change the number of CVs or knots or parent curves, etc. To do this
kind of structural modification, use the appendObject(), setObject(), and removeObject()
functions defined in the NURBSSet : Value (p. 1450) topic and the addNURBSSet(),
breakSurface(), and similar functions defined in the NURBS Node Properties and Methods (p. 1397)
topic.
The stopCreating() method is used to ensure that the specified node is fully created. This method
is primarily used to ensure that a NURBS scene objects is fully created, which it will not be until the
creation is stopped. The NURBSSet returned for a NURBS scene object will not be complete if the
object is still in creation mode. This method will also deactivated any activated object create buttons
in the Create panel.
There are other global functions that may be used to modify NURBS scene objects. These functions
are documented in the NURBS Node Properties and Methods (p. 1397) topic. For instance, developers
Parameter Ranges for Curves and Surfaces 1391
can use the function breakSurface() to take an existing NURBS surface and break it into two
separate surfaces.
Non-relational NURBSSets
You can also use the getNURBSSet() function in a non-relational mode, but not supplying the
#relational argument, to retrieve a “flattened” version of the NURBSSet in which all dependent
surfaces, such as blends and offsets and lofts are represented as independent curves and surfaces and
there is no ‘live’ connection back to the scene object from which the NURBSSet was derived. You
might use this to get a simplified version of the NURBS scene object for an export script, for example
if the destination system does not support relational objects. You can also use a non-relational
NURBSSet derived in this way as the basis for creating other scene objects, perhaps modifying or
adding to the set and then re-instantiating it with the NURBSNode() function.
primitives, such as the Prism, don’t use (0,0) to (1,1) because of the way they wrap. Developers may
of course assign any values using the API. The <NURBSSurface> method to do this is
setTextureUVs().
flipNormals: <boolean>
true to invert the orientation of surface normals; otherwise false.
mapCoords: <boolean>
true to generate mapping coordinates; otherwise false.
segs: <integer>
The number of segments in the surface of revolution.
matIDs: <boolean>
If true special material IDs are assigned to the surfaces and caps.
shapeIDs: <boolean>
If true shape IDs are used. When on, this function uses the material ID values
assigned to segments in the spline to be lathed, or curve sub-objects in the NURBS
curve to be lathed. This is available only when matIds is true.
NURBSExtrudeNode <shape> <amount> [capStart:<boolean>] \
[capEnd:<boolean>] [capType:<integer>] \
[mapCoords:<boolean>] [matIDs:<boolean>] \
[shapeIDs:<boolean>] {node_creation_parameters}
This function generates a NURBS object based on the specified extrusion definition and
returns a pointer to it. This is used by the extrude modifier.
shape <node>
The shape node to extrude. Note that if the shape pointed to is a bezier spline then
capping won’t work properly.
amount <float>
Specifies the height of the extrusion.
capStart: <boolean>
Specifies if the surface should be capped at the beginning: true to cap; false to leave
open.
capEnd: <boolean>
Specifies if the surface should be capped at the ending: true to cap; false to leave
open.
capType: <integer>
This parameter is not currently used and the value specified is ignored.
matIDs: <boolean>
If true, special material IDs are assigned to the surfaces and caps.
shapeIDs: <boolean>
If true shape IDs are used. When on, this function uses the material ID values
assigned to segments in the spline to be extruded, or curve sub-objects in the NURBS
curve to be extruded. This is available only when matIds is true.
1394 Chapter 11 | 3ds max Objects
start <float>
The start angle in radians.
end <float>
The end angle in radians.
open: <boolean>
If true, the surface is closed; otherwise the surface is not closed. Defaults to false.
MakeNURBSTorusSurface <majorRad> <minorRad> <origin> <sym_axis> \
<ref_axis> <startU> <endU> <startV> <endV> \
[open:<boolean>]
This function generates a NURBS torus surface. The output of this function is a NURBS
Surface. Note that this is a CV surface that matches the definition, not a relational surface.
Note: This surface is not closed surface.
majorRad <float>
This is the radius of the entire ‘donut’ shape.
minorRad <float>
The is the radius of the ‘tube’.
origin <Point3>
The origin of the cone.
sym_Axis <Point3>
The axis of symmetry.
ref_Axis <Point3>
This is the direction of the seam. The symAxis and refAxis must be perpendicular to
one another.
startU <float>
The start angle of the torus in the U direction.
endU <float>
The end angle of the torus in the U direction.
startV <float>
The start angle of the torus in the V direction.
endV <float>
The end angle of the torus in the V direction.
open: <boolean>
If true, the surface is closed; otherwise the surface is not closed. Defaults to false.
NURBS Node Properties and Methods 1397
These all return a NURBSSelection Value (p. 1448), and enable sub-object manipulation in a manner
similar to that provided for Editable Meshes.
Methods:
The following NURBS-related methods operate on scene nodes:
getNURBSSet <node> [#relational]
This function is used to retrieve a NURBSSet that corresponds to the specified NURBS scene
node. This allows access the internal objects inside a 3ds max editable NURBS object.
If the optional #relational parameter is not supplied, the returned NURBSSet will
contain only independent curves and surfaces, all dependent objects will be decomposed
into corresponding independent objects. So for example, if you pass an object that has a
relational model (perhaps two CV surfaces and a dependent blend surface) it will
decompose them into three CV surfaces. This will be the CV surfaces that represent the
two surfaces and the blend, but you won’t have the blend relational data. If the
#relational argument is supplied, you get back two CV surfaces and a NURBS blend
surface and the NURBSSet is an active representative for the scene object -- any changes
you make to the properties of it’s constituent NURBSObjects will be reflected directly in
the source scene object.
addNURBSSet <node> <nurbsSet>
This function adds the supplied NURBSSet to the specified NURBS scene object, creating
subobjects within the scene node corresponding to the definitions in the NURBSSet. After
the function call, the supplied NURBSSet becomes an active representative for the new
scene node subobjects, all the NURBSId properties are filled-in and you can modify the
associated scene sub-object by modifying the properties of the NURBSSet component
objects.
1398 Chapter 11 | 3ds max Objects
Associated Methods:
canConvertTo <node> <class>
Allows you to test whether a given node is convertible into a given class. Returns true or
false. For example:
if canConvertTo $foo NURBSSurface then ...
The kinds of classes you can convert objects to are the generic editable forms including
Mesh, SplineShape, NURBSCurve, NURBSSurface, etc.
convertTo <node> <class> -- mapped
This function is a general form of the existing specific conversion functions such as
convertToMesh(), convertToSplineShape(), etc. For example,
convertToSplineShape() can be written:
convertTo $circle01 SplineShape
If the conversion is not supported, the function returns the value undefined.
convertToNURBSSurface <node> -- mapped
convertToNURBSCurve <node> -- mapped
These functions work on those primitive geometry and shape classes that support
conversion to NURBS (such as boxes, spheres, circles, lines, etc.). If an object does not
support conversion, the function returns undefined.
isPointSelected <node> <point_index>
Returns true is the specified point is selected, false if not. The definition of a ‘point’ varies
depending on the object type. For meshes, it is the mesh vertex. For a spline, it is the knot.
For NURBS objects, it is the vertex or control point.
pointSelection <node> <point_index>
Returns a floating point weighted point selection if the object supports it. Most object
types just return 1.0 if the point is selected and 0.0 if not. Only NURBS objects currently
support weighted point selection.
stopCreating <node>
This method stops the creation of the current object, if any. This method is primarily used
to ensure that a NURBS scene objects is fully created, which it will not be until the creation
is stopped. The NURBSSet returned for a NURBS scene object will not be complete if the
object is still in creation mode. This method will also deactivated any activated object
create buttons in the Create panel.
NURBS Node Properties and Methods 1401
NURBSObject Values
This is the parent class for all the NURBS classes and so is not directly constructable.
Properties:
Because this is a parent class, all the NURBS classes except NURBSSet have the following
properties:
<nurbsobject>.name : string
The name of the NURBS object
<nurbsobject>.index : integer, read-only
Only valid after a NURBSSet is instantiated via NURBSNode() or if the NURBS object is
part of a non-relational NURBSSet.
<nurbsobject>.nurbsID : integer, read-only
Only valid after a NURBSSet is instantiated via NURBSNode() or if the NURBS object is
part of a relational NURBSSet extracted using getNURBSSet().
<nurbsobject>.selected : boolean
Indicates whether the sub-object in a relational NURBSSet is selected in the NURBS
modifier panel in the 3ds max user interface. You can force the selection and deselection
of objects by setting this property to true or false.
NURBSPoint : NURBSObject 1403
See also
Value Common Properties, Operators, and Methods (p. 714)
NURBSPoint Classes
NURBSPoint : NURBSObject
This is the parent class for all the NURBS point classes and so is not directly constructable. The class
describes a point in 3D space.
Properties:
All NURBS point classes have the following properties. These properties are both gettable and
settable for independent points, and read-only for dependent points. They are always given in the
parent NURBS node local coordinate system.
<nurbspoint>.pos : point3
<nurbspoint>.x : float
<nurbspoint>.y : float
<nurbspoint>.z : float
See also
NURBSPoint (p. 1403)
NURBSObject (p. 1402)
Value Common Properties, Operators, and Methods (p. 714)
NURBSCurveConstPoint : NURBSPoint
This class defines a dependent point that lies on a curve or relative to it. The point can either be on
the curve or off the curve. If it is on the curve, the U Position is the only control of its location. The
U Position specifies a location along the curve (based on the curve’s local U axis). There are four ways
to specify the displacement of the point’s location relative to the U position:
• OnObject - the point is actually on the surface of the object.
• Offset - the point is moved according to a relative (object space) X,Y,Z location.
• Normal - the point is moved along the direction of the curve’s normal. (Negative values move
it opposite to the normal.)
• Tangent - the point is moved along the tangent of the U Position. If the value is positive it’s the
tangent that heads in the direction of increasing U value; if negative it’s the tangent that heads
in the direction of decreasing U value.
1404 Chapter 11 | 3ds max Objects
Constructors:
NURBSCurveConstPoint [<property>:<val>]...
Any of the object’s properties may be set via optional keyword arguments on the
constructor.
getObject <nurbsset> <index>
Properties:
<nurbscurveconstpoint>.parent : integer
The parent curve by NURBSet index.
<nurbscurveconstpoint>.parentID : integer
The parent curve by NURBSId.
<nurbscurveconstpoint>.uParam : float
Parametric point along the parent curve.
<nurbscurveconstpoint>.type : #onObject, #offset, #normal, #tangent
Specifies the transform relationship between the point and the curve.
<nurbscurveconstpoint>.offset : point3
Offset vector if an offset type.
<nurbscurveconstpoint>.normal : float
Distance along the normal if a normal type.
<nurbscurveconstpoint>.uTangent : float
Distance along the curve tangent if a tangent type.
<nurbscurveconstpoint>.trimCurve : boolean
If true, trims parent curve at the point.
<nurbscurveconstpoint>.flipTrim : boolean
If true the curve is trimmed from the point towards low parameter space. If false the
curve is trimmed from the point towards high parameter space.
See also
NURBSPoint (p. 1403)
NURBSObject (p. 1402)
Value Common Properties, Operators, and Methods (p. 714)
NURBSCurveIntersectPoint : NURBSPoint
This class defines a dependent point at the intersection of two curves.
Constructors:
NURBSCurveIntersectPoint [<property>:<val>]...
Any of the object’s properties may be set via optional keyword arguments on the
constructor.
getObject <nurbsset> <index>
NURBSCurveSurfaceIntersectPoint : NURBSPoint 1405
Properties:
<nurbscurveintersectpoint>.parent1 : integer
The 1st parent curve by NURBSet index.
<nurbscurveintersectpoint>.parent1ID : integer
The 1st parent curve by NURBSId.
<nurbscurveintersectpoint>.parent2 : integer
The 2nd parent curve by NURBSet index.
<nurbscurveintersectpoint>.parent2ID : integer
The 2nd parent curve by NURBSId.
<nurbscurveintersectpoint>.trimCurve1 : boolean
If true, trim the 1st parent curve at the intersection.
<nurbscurveintersectpoint>.trimCurve2 : boolean
If true, trim the 2nd parent curve at the intersection.
<nurbscurveintersectpoint>.flipTrim1 : boolean
If true the 1st parent curve is trimmed from the point towards low parameter space. If
false the curve is trimmed from the point towards high parameter space.
<nurbscurveintersectpoint>.flipTrim2 : boolean
If true the 2nd parent curve is trimmed from the point towards low parameter space. If
false the curve is trimmed from the point towards high parameter space.
See also
NURBSPoint (p. 1403)
NURBSObject (p. 1402)
Value Common Properties, Operators, and Methods (p. 714)
NURBSCurveSurfaceIntersectPoint : NURBSPoint
This class defines a dependent point at the intersection of a curve and a surface.
Constructors:
NURBSCurveSurfaceIntersectPoint [<property>:<val>]...
Any of the object’s properties may be set via optional keyword arguments on the
constructor.
getObject <nurbsset> <index>
Properties:
<nurbscurvesurfaceintersectpoint>.parent1 : integer
The parent surface by NURBSet index.
<nurbscurvesurfaceintersectpoint>.parent1ID : integer
The parent surface by NURBSId.
<nurbscurvesurfaceintersectpoint>.parent2 : integer
The parent curve by NURBSet index.
1406 Chapter 11 | 3ds max Objects
<nurbscurvesurfaceintersectpoint>.parent2ID : integer
The parent curve by NURBSId.
<nurbscurvesurfaceintersectpoint>.trimCurve : boolean
If true, trims parent curve at the point.
<nurbscurvesurfaceintersectpoint>.flipTrim : boolean
If true the curve is trimmed from the point towards low parameter space. If false the
curve is trimmed from the point towards high parameter space.
<nurbscurvesurfaceintersectpoint>.seed : float
The seed location is a U position along the length of the parent curve.
See also
NURBSPoint (p. 1403)
NURBSObject (p. 1402)
Value Common Properties, Operators, and Methods (p. 714)
NURBSIndependentPoint : NURBSPoint
This class defines an independent, free-standing point.
Constructors:
NURBSIndependentPoint <point3>
getObject <nurbsset> <index>
getPoint <nurbspointsurface> <index>
getPoint <nurbspointcurve> <index>
getPoint <nurbspointcurveonsurface> <index>
Operators:
<nurbsindependentpoint> == <nurbsindependentpoint>
<nurbsindependentpoint> != <nurbsindependentpoint>
Properties:
There are no additional properties for NURBSIndependentPoint.
See also
NURBSPoint (p. 1403)
NURBSObject (p. 1402)
Value Common Properties, Operators, and Methods (p. 714)
NURBSPointConstPoint : NURBSPoint 1407
NURBSPointConstPoint : NURBSPoint
This class defines a dependent point that lies at a point or relative to it. It is a point constrained
relative to another point. This can be a point used to define a point surface or point curve, it can be
a trim point, or just a point in space. There are two ways to specify the displacement of the point’s
location relative to the U position:
• OnObject - the point is actually at the parent.
• Offset - the point is moved according to a relative (object space) X,Y,Z location.
Constructors:
NURBSPointConstPoint [<property>:<val>]...
Any of the object’s properties may be set via optional keyword arguments on the
constructor.
getObject <nurbsset> <index>
Properties:
<nurbspointconstpoint>.parent : integer
The parent point by NURBSet index.
<nurbspointconstpoint>.parentID : integer
The parent point by NURBSId.
<nurbspointconstpoint>.type : #onObject, #offset
<nurbspointconstpoint>.offset : point3
Offset vector if an offset type.
See also
NURBSPoint (p. 1403)
NURBSObject (p. 1402)
Value Common Properties, Operators, and Methods (p. 714)
NURBSSurfConstPoint : NURBSPoint
This class defines a dependent point on a surface or related to it. There are four ways to specify the
displacement of the point’s location relative to the UV position:
• OnObject - the point is actually on the surface of the object.
• Offset - the point is offset some distance (specified in object space) from the surface of the
object.
• Normal - the point is offset along the direction of the surface’s normal. (Negative values move
it opposite to the normal.)
• Tangent - the point is offset some U and/or V distance along the tangent from the surface. If the
value is positive it’s the tangent that heads in the direction of increasing parameter value; if
negative it’s the tangent that heads in the direction of decreasing parameter value.
1408 Chapter 11 | 3ds max Objects
Constructors:
NURBSSurfConstPoint [<property>:<val>]...
Any of the object’s properties may be set via optional keyword arguments on the
constructor.
getObject <nurbsset> <index>
Properties:
<nurbssurfconstpoint>.parent : integer
The parent surface by NURBSet index.
<nurbssurfconstpoint>.parentID : integer
The parent surface by NURBSId.
<nurbssurfconstpoint>.type : #onObject, #offset, #normal, #tangent
<nurbssurfconstpoint>.uParam : float
Parametric position along u direction.
<nurbssurfconstpoint>.vParam : float
Parametric position along v direction.
<nurbssurfconstpoint>.offset : point3
Offset vector if an offset type.
<nurbssurfconstpoint>.normal : float
Distance along the normal if a normal type.
<nurbssurfconstpoint>.uTangent : float
Distance along the u tangent if a tangent type.
<nurbssurfconstpoint>.vTangent : float
Distance along the v tangent if a tangent type.
See also
NURBSPoint (p. 1403)
NURBSObject (p. 1402)
Value Common Properties, Operators, and Methods (p. 714)
NURBSControlVertex : NURBSObject 1409
NURBSControlVertex Class
NURBSControlVertex : NURBSObject
This class defines an independent Control Vertex of a NURBS Curve or NURBS Surface. This class
shares may of the same properties as a NURBSPoint and has the added property of a rational weight.
The weight value of a CV is rational. That is, it is relative to other CVs in the curve or surface.
Changing the weight of all CVs at once has no effect, because this doesn’t change the ratio between
weights.
Constructors:
NURBSControlVertex <point3> [<weight_float>]
getCV <nurbscvcurve> <index>
getCV <nurbscvsurface> <u_index> <v_index>
Operators:
<nurbscontrolvertex> == <nurbscontrolvertex>
<nurbscontrolvertex> != <nurbscontrolvertex>
Properties:
<nurbscontrolvertex>.weight : float
The weight of the control vertex. This is a value greater than zero. Larger values cause the
CV to have a greater effect, thus the curve or surface will try to pass closer to the CV.
See also
NURBSObject (p. 1402)
Value Common Properties, Operators, and Methods (p. 714)
NURBSCurve Classes
NURBSCurve : NURBSObject
This is the parent class for all the NURBS curve classes and so is not directly constructable. The class
describes the common properties of all NURBS curves. This includes its open/closed state, and
number of trim points. The evalPos() and evalTangent() methods are used to compute points
and tangents on the curve.
Properties:
All NURBS curve classes have the following properties:
<nurbscurve>.isClosed : boolean, read-only
true if the curve is closed, false if open.
<nurbscurve>.numTrimPoints : integer, read-only
The number of trim points in the curve.
1410 Chapter 11 | 3ds max Objects
See also
NURBSObject (p. 1402)
Value Common Properties, Operators, and Methods (p. 714)
NURBSBlendCurve : NURBSCurve
This class defines a dependent Blend curve. A Blend curve connects the end of one curve to the end
of another, blending the curvature of the parents to create a smooth curve between them.
Constructors:
NURBSBlendCurve [<property>:<val>]...
Any of the object’s properties may be set via optional keyword arguments on the
constructor.
getObject <nurbsset> <index>
Properties:
<nurbsblendcurve>.parent1 : integer
The 1st parent curve by NURBSet index.
<nurbsblendcurve>.parent1ID : integer
The 1st parent curve by NURBSId.
<nurbsblendcurve>.parent2 : integer
The 2nd parent curve by NURBSet index.
<nurbsblendcurve>.parent2ID : integer
The 2nd parent curve by NURBSId.
<nurbsblendcurve>.flip1 : boolean
true to use the end of 1st parent curve; false to use the beginning, defaults to false.
<nurbsblendcurve>.flip2 : boolean
true to use the end of 2nd parent curve; false to use the beginning, defaults to false.
NURBSChamferCurve : NURBSCurve 1411
<nurbsblendcurve>.tension1 : float
The tension value for the 1st parent curve.
<nurbsblendcurve>.tension2 : float
The tension value for the 2nd parent curve.
See also
NURBSCurve (p. 1409)
NURBSObject (p. 1402)
Value Common Properties, Operators, and Methods (p. 714)
NURBSChamferCurve : NURBSCurve
This class defines a dependent Chamfer curve. A Chamfer is a curve that creates a straight line corner
between two parent curves.
Constructors:
NURBSChamferCurve [<property>:<val>]...
Any of the object’s properties may be set via optional keyword arguments on the
constructor.
getObject <nurbsset> <index>
Properties:
<nurbschamfercurve>.parent1 : integer
The 1st parent curve by NURBSet index.
<nurbschamfercurve>.parent1ID : integer
The 1st parent curve by NURBSId.
<nurbschamfercurve>.parent2 : integer
The 2nd parent curve by NURBSet index.
<nurbschamfercurve>.parent2ID : integer
The 2nd parent curve by NURBSId.
<nurbschamfercurve>.length1 : float
The length for 1st parent curve back from the end that defines the beginning of the
chamfer.
<nurbschamfercurve>.length2 : float
The length for 2nd parent curve back from the end that defines the beginning of the
chamfer.
<nurbschamfercurve>.flip1 : boolean
true to use the end of 1st parent curve; false to use the beginning, defaults to false.
<nurbschamfercurve>.flip2 : boolean
true to use the end of 2nd parent curve; false to use the beginning, defaults to false.
<nurbschamfercurve>.trim1 : boolean
Sets whether 1st parent curve is trimmed. true if the curve is trimmed; otherwise false.
1412 Chapter 11 | 3ds max Objects
<nurbschamfercurve>.trim2 : boolean
Sets whether 2nd parent curve is trimmed. true if the curve is trimmed; otherwise false.
<nurbschamfercurve>.flipTrim1 : boolean
If true the 1st parent curve is trimmed from the point towards low parameter space. If
false the curve is trimmed from the point towards high parameter space.
<nurbschamfercurve>.flipTrim2 : boolean
If true the 2nd parent curve is trimmed from the point towards low parameter space. If
false the curve is trimmed from the point towards high parameter space.
See also
NURBSCurve (p. 1409)
NURBSObject (p. 1402)
Value Common Properties, Operators, and Methods (p. 714)
NURBSCVCurve : NURBSCurve
This class defines an independent NURBS CV Curve. The position and weight of the control vertices
(CVs) controls the shape of the curve. Unlike spline vertices, CVs don’t necessarily lie on the curve
they define. The CVs define a control lattice which surrounds the curve.
Constructors:
NURBSCVCurve [<property>:<val>] [closed:<boolean>]...
Any of the object’s properties may be set via optional keyword arguments on the
constructor. If closed:true is specified, the curve is created as a closed curve, otherwise it
is an open curve.
getObject <nurbsset> <index>
Properties:
<nurbscvcurve>.order : integer
The order of the curve. This is one more than the degree of polynomial of any segment of
the curve. All curves have a degree. The degree of a curve is the highest exponent in the
equation used to represent it. A linear equation is degree 1, a quadratic equation degree 2.
NURBS curves typically are represented by cubic equations and have a degree of 3.
<nurbscvcurve>.numKnots : integer
The number of knots in the curve. If this value is changed, the previous knot data is NOT
maintained. Because they are generated mathematically, NURBS curves have a parameter
space in addition to the 3D geometric space in which they are displayed. Specifically, an
array of values called knots specifies the extent of influence of each control vertex (CV) on
the curve or surface.
<nurbscvcurve>.numCVs : integer
The number of control vertices in the curve. If this value is changed, the previous control
vertex data is NOT maintained.
NURBSCVCurve : NURBSCurve 1413
<nurbscvcurve>.transform : matrix3
The transformation matrix for the NURBSCVCurve. This controls the relative position of
the item within a NURBSSet.
<nurbscvcurve>.endsOverlap : boolean, read-only
true if the ends of the curve overlap even though the curve may not be closed (that is, the
tangents match at the ends), false otherwise.
<nurbscvcurve>.autoParam : #notAutomatic, #autoCentripetal, #autoUniform
#notAutomatic, #autoCentripetal, and #autoUniform correspond to the Automatic
Reparam options in the CV Curve rollouts: none, chord length and uniform, respectively.
Defaults to #notAutomatic.
Methods:
close <nurbscvcurve>
Forces the curve to be closed.
getKnot <nurbscvcurve> <index>
setKnot <nurbscvcurve> <index> <float>
Get and set the indexed knot’s value, indexes are 1-based. Knots are a mathematical
construct that helps define the span of control of CVs and blending functions that define
NURBS Curves and Surfaces. The knots are an array of values that determines the
parameterization of a curve. Values in the knot vector are nondecreasing. The knots
specify the region of influence of the CVs on the curve. It is a way of partitioning the
parameter space up into different segments. A B-spline curve or a NURBS curve is a curve
that is defined by a series of segments. On each one of the segments the curve is like a
polynomial, or in the case of a rational one, it’s like the ratio of polynomials. The knot
vector describes how to partition the parameter space of the curve up for each of the
different pieces of the polynomial.
getCV <nurbscvcurve> <cv_index>
Get the indexed CV as a NURBSControlVertex, indexes are 1-based.
setCV <nurbscvcurve> <cv_index> <NURBSControlVertex>
Sets the indexed CV to the given NURBSControlVertex, indexes are 1-based.
refine <nurbscvcurve> <u_param>
Add a new, interpolated CV at the given parametric point along the curve.
reparameterize <nurbscvcurve> (#centripetal | #uniform)
Reparameterizes the curve by chord length (#centripetal) or uniform (#uniform)
uniform parameterization.
Note:
CV curves and surfaces must obey the relationship that “order + number of CVs = number of knots”.
If this is not the case in most cases no object will be created and in some cases an assertion fault
might be generated.
1414 Chapter 11 | 3ds max Objects
See also
NURBSCurve (p. 1409)
NURBSObject (p. 1402)
Value Common Properties, Operators, and Methods (p. 714)
NURBSCurveOnSurface : NURBSCVCurve
This class defines a dependent Curve-on-Surface CV curve. These curves can be used for trimming
the surface they lie on.
Constructors:
NURBSCurveOnSurface [<property>:<val>] [closed:<boolean>]...
Any of the object’s properties may be set via optional keyword arguments on the
constructor. If closed:true is specified, the curve is created as a closed curve, otherwise it
is an open curve.
getObject <nurbsset> <index>
Properties:
<nurbscurveonsurface>.parent : integer
The parent surface by NURBSet index.
<nurbscurveonsurface>.parentID : integer
The parent surface by NURBSId.
<nurbscurveonsurface>.trim : boolean
If true, trims parent surface at the curve.
<nurbscurveonsurface>.flipTrim : boolean
The state of the trim flip toggle. This controls which portion of the surface is trimmed.
Note:
The values for CVs for a NURBSCurveOnSurface are values in the parameter space of the surface, not
in 3D space. CV surfaces are normally parameterized from 0 to 1, so all the CV values should have
values from 0 to 1.
Point surfaces are chord-length parameterized, which means that the CV parameter range is about
the same as the size of the surface. In most cases, NURBSCurveOnSurfaces work better when point
surfaces are used.
You may have problems generating NURBSCurveOnSurfaces on CV surfaces.
NURBSPointCurveOnSurfaces on CV surfaces are typically easier to work with.
NURBSFilletCurve : NURBSCurve 1415
See Also
NURBSCVCurve (p. 1412)
NURBSCurve (p. 1409)
NURBSObject (p. 1402)
Value Common Properties, Operators, and Methods (p. 714)
NURBSFilletCurve : NURBSCurve
This class defines a dependent Fillet curve. A Fillet is a curve that creates a circular arc corner between
two parent curves.
Constructors:
NURBSFilletCurve [<property>:<val>]...
Any of the object’s properties may be set via optional keyword arguments on the
constructor.
getObject <nurbsset> <index>
Properties:
<nurbsfilletcurve>.parent1 : integer
The 1st parent curve by NURBSet index.
<nurbsfilletcurve>.parent1ID : integer
The 1st parent curve by NURBSId.
<nurbsfilletcurve>.parent2 : integer
The 2nd parent curve by NURBSet index.
<nurbsfilletcurve>.parent2ID : integer
The 2nd parent curve by NURBSId.
<nurbsfilletcurve>.radius : float
The radius of the fillet.
<nurbsfilletcurve>.flip1 : boolean
true to use the end of 1st parent curve; false to use the beginning, defaults to false.
<nurbsfilletcurve>.flip2 : boolean
true to use the end of 2nd parent curve; false to use the beginning, defaults to false.
<nurbsfilletcurve>.trim1 : boolean
Sets whether 1st parent curve is trimmed. true if the curve is trimmed; otherwise false.
<nurbsfilletcurve>.trim2 : boolean
Sets whether 2nd parent curve is trimmed. true if the curve is trimmed; otherwise false.
<nurbsfilletcurve>.flipTrim1 : boolean
If true the 1st parent curve is trimmed from the point towards low parameter space. If
false the curve is trimmed from the point towards high parameter space.
<nurbsfilletcurve>.flipTrim2 : boolean
If true the 2nd parent curve is trimmed from the point towards low parameter space. If
false the curve is trimmed from the point towards high parameter space.
1416 Chapter 11 | 3ds max Objects
See also
NURBSCurve (p. 1409)
NURBSObject (p. 1402)
Value Common Properties, Operators, and Methods (p. 714)
NURBSIsoCurve : NURBSCurve
This class defines a dependent Iso (isoparametric) curve. U and V Iso curves are dependent curves
created along lines of constant parameter value of a NURBS surface.
Constructors:
NURBSIsoCurve [<property>:<val>]...
Any of the object’s properties may be set via optional keyword arguments on the
constructor.
getObject <nurbsset> <index>
Properties:
<nurbsisocurve>.parent : integer
The parent surface by NURBSet index.
<nurbsisocurve>.parentID : integer
The parent surface by NURBSId.
<nurbsisocurve>.dir : #U, #V
The direction of the iso curve, either #U or #V.
<nurbsisocurve>.parameter : float
The parametric position in the range of 0.0 to 1.0 in the given direction on the surface at
which the iso line will sit.
<nurbsisocurve>.trim : boolean
If true, trims parent surface at the curve.
<nurbsisocurve>.flipTrim : boolean
The state of the trim flip toggle. This controls which portion of the surface is trimmed.
<nurbsisocurve>.seed : point2
The seed location is a UV position on the parent surface.
See also
NURBSCurve (p. 1409)
NURBSObject (p. 1402)
Value Common Properties, Operators, and Methods (p. 714)
NURBSMirrorCurve : NURBSCurve 1417
NURBSMirrorCurve : NURBSCurve
This class defines a dependent Mirror curve. A Mirror curve is similar to a mirror object that you
create using the Mirror tool (on the 3ds max toolbar) or the Mirror modifier. It is the original curve
reflected about one or two axes.
Constructors:
NURBSMirrorCurve [<property>:<val>]...
Any of the object’s properties may be set via optional keyword arguments on the
constructor.
getObject <nurbsset> <index>
Properties:
<nurbsmirrorcurve>.parent : integer
The parent curve by NURBSet index.
<nurbsmirrorcurve>.parentID : integer
The parent curve by NURBSId.
<nurbsmirrorcurve>.axis : #X, #Y, #Z, #XY, #XZ, #YZ
The axis or axes of reflection for the curve.
<nurbsmirrorcurve>.distance : float
The mirror offset distance.
<nurbsmirrorcurve>.transform : matrix3
This is an additional transformation applied to the axis specification. This corresponds to
the gizmo the user may use interactively to alter the location of the mirror axis. This is
exactly equivalent to setting the transform on the gizmo of a mirror modifier.
See also
NURBSCurve (p. 1409)
NURBSObject (p. 1402)
Value Common Properties, Operators, and Methods (p. 714)
NURBSOffsetCurve : NURBSCurve
This class defines a dependent Offset curve. An Offset curve is offset from the original, parent curve.
It lies in the same plane as its parent, and is normal to the original.
Constructors:
NURBSOffsetCurve [<property>:<val>]...
Any of the object’s properties may be set via optional keyword arguments on the
constructor.
getObject <nurbsset> <index>
1418 Chapter 11 | 3ds max Objects
Properties:
<nurbsoffsetcurve>.parent : integer
The parent curve by NURBSet index.
<nurbsoffsetcurve>.parentID : integer
The parent curve by NURBSId.
<nurbsoffsetcurve>.distance : float
The distance of the offset curve from the parent.
See also
NURBSCurve (p. 1409)
NURBSObject (p. 1402)
Value Common Properties, Operators, and Methods (p. 714)
NURBSPointCurve : NURBSCurve
This class defines an independent curve that uses points to describe its shape. All the points lie on
the curve itself.
Constructors:
NURBSPointCurve [<property>:<val>]...
Any of the object’s properties may be set via optional keyword arguments on the
constructor.
getObject <nurbsset> <index>
Properties:
<nurbspointcurve>.numPoints : integer
The number of points in the point curve. If this value is changed, the previous point data
is not maintained.
<nurbspointcurve>.closed : boolean
true if the curve is closed, false if open.
<nurbspointcurve>.transform : matrix3
The transformation matrix for the NURBSPointCurve. This controls the relative position of
the item within a NURBSSet.
Methods:
close <nurbspointcurve>
Closes the curve.
getPoint <nurbspointcurve> <index>
Get the indexed curve point as a NURBSIndependentPoint
setPoint <nurbspointcurve> <index> <nurbs_independent_pt>
Set the indexed point to the given NURBSIndependentPoint
refine <nurbspointcurve> <u_param>
Adds a new, interpolated point at the given parametric position along the curve.
NURBSPointCurveOnSurface : NURBSPointCurve 1419
See also
NURBSCurve (p. 1409)
NURBSObject (p. 1402)
Value Common Properties, Operators, and Methods (p. 714)
NURBSPointCurveOnSurface : NURBSPointCurve
This class defines a dependent Curve-on-Surface Point curve. These curves can be used for trimming
the surface they lie on.
Constructors:
NURBSPointCurveOnSurface [<property>:<val>]...
Any of the object’s properties may be set via optional keyword arguments on the
constructor.
getObject <nurbsset> <index>
Properties:
<nurbspointcurveonsurface>.parent : integer
The parent surface by NURBSet index.
<nurbspointcurveonsurface>.parentID : integer
The parent surface by NURBSId.
<nurbspointcurveonsurface>.trim : boolean
If true, trims parent surface at the curve.
<nurbspointcurveonsurface>.flipTrim : boolean
The state of the trim flip toggle. This controls which portion of the surface is trimmed.
See also
NURBSPointCurve (p. 1418)
NURBSCurve (p. 1409)
NURBSObject (p. 1402)
Value Common Properties, Operators, and Methods (p. 714)
1420 Chapter 11 | 3ds max Objects
NURBSProjectNormalCurve : NURBSCurve
This class defines a dependent Normal Projected curve. A Normal Projected curve lies on a surface.
It is based on an existing curve, which is projected onto the surface in the direction of the surface’s
normals.
Constructors:
NURBSProjectNormalCurve [<property>:<val>]...
Any of the object’s properties may be set via optional keyword arguments on the
constructor.
getObject <nurbsset> <index>
Properties:
<nurbsprojectnormalcurve>.parent1 : integer
The parent surface by NURBSet index.
<nurbsprojectnormalcurve>.parent1ID : integer
The parent surface by NURBSId.
<nurbsprojectnormalcurve>.parent2 : integer
The parent curve by NURBSet index.
<nurbsprojectnormalcurve>.parent2ID : integer
The parent curve by NURBSId.
<nurbsprojectnormalcurve>.trim : boolean
If true, trims parent surface at the curve.
<nurbsprojectnormalcurve>.flipTrim : boolean
The state of the trim flip toggle. This controls which portion of the surface is trimmed.
<nurbsprojectnormalcurve>.seed : point2
The seed location is a UV position on the parent surface.
See also
NURBSPointCurve (p. 1418)
NURBSCurve (p. 1409)
NURBSObject (p. 1402)
Value Common Properties, Operators, and Methods (p. 714)
NURBSProjectVectorCurve : NURBSCurve 1421
NURBSProjectVectorCurve : NURBSCurve
This class defines a dependent Vector Projected curve. A Vector Projected curve lies on a surface. This
is almost the same as a Normal Projected curve, except that the projection from the existing curve
to the surface is in the direction of a vector that you can control.
Constructors:
NURBSProjectVectorCurve [<property>:<val>]...
Any of the object’s properties may be set via optional keyword arguments on the
constructor.
getObject <nurbsset> <index>
Properties:
<nurbsprojectvectorcurve>.parent1 : integer
The parent surface by NURBSet index.
<nurbsprojectvectorcurve>.parent1ID : integer
The parent surface by NURBSId.
<nurbsprojectvectorcurve>.parent2 : integer
The parent curve by NURBSet index.
<nurbsprojectvectorcurve>.parent2ID : integer
The parent curve by NURBSId.
<nurbsprojectvectorcurve>.trim : boolean
If true, trims parent surface at the curve.
<nurbsprojectvectorcurve>.flipTrim : boolean
The state of the trim flip toggle. This controls which portion of the surface is trimmed.
<nurbsprojectvectorcurve>.seed : point2
The seed location is a UV position on the parent surface.
<nurbsprojectvectorcurve>.pVec : point3
The projection vector.
See also
NURBSPointCurve (p. 1418)
NURBSCurve (p. 1409)
NURBSObject (p. 1402)
Value Common Properties, Operators, and Methods (p. 714)
1422 Chapter 11 | 3ds max Objects
NURBSSurfaceEdgeCurve : NURBSCurve
This class defines a dependent Surface Edge curve.
Constructors:
NURBSSurfaceEdgeCurve [<property>:<val>]...
Any of the object’s properties may be set via optional keyword arguments on the
constructor.
getObject <nurbsset> <index>
Properties:
<nurbssurfaceedgecurve>.parent : integer
The parent surface by NURBSet index.
<nurbssurfaceedgecurve>.parentID : integer
The parent surface by NURBSId.
<nurbssurfaceedgecurve>.seed : Point2
The seed location is a UV position on the parent surface.
See also
NURBSPointCurve (p. 1418)
NURBSCurve (p. 1409)
NURBSObject (p. 1402)
Value Common Properties, Operators, and Methods (p. 714)
NURBSSurfaceNormalCurve : NURBSCurve
This class defines a dependent Surface Normal curve. This is a curve created at a specified distance
from a surface and normal to it.
Constructors:
NURBSSurfaceNormalCurve [<property>:<val>]...
Any of the object’s properties may be set via optional keyword arguments on the
constructor.
getObject <nurbsset> <index>
Properties:
<nurbssurfacenormalcurve>.parent : integer
The parent curve by NURBSet index.
<nurbssurfacenormalcurve>.parentID : integer
The parent curve by NURBSId.
<nurbssurfacenormalcurve>.distance : float
The distance along the normal from the surface to the curve.
NURBSSurfSurfIntersectionCurve : NURBSCurve 1423
Note:
The parent curve must have one of the following types: surface-surface intersection, U iso, V iso,
normal projected, vector projected, CV curve on surface, or point curve on surface.
See also
NURBSPointCurve (p. 1418)
NURBSCurve (p. 1409)
NURBSObject (p. 1402)
Value Common Properties, Operators, and Methods (p. 714)
NURBSSurfSurfIntersectionCurve : NURBSCurve
This class defines a dependent Surface-Surface Intersection curve.
Constructors:
NURBSSurfSurfIntersectionCurve [<property>:<val>]...
Any of the object’s properties may be set via optional keyword arguments on the
constructor.
getObject <nurbsset> <index>
Properties:
<nurbssurfsurfintersectioncurve>.parent1 : integer
The 1st parent surface by NURBSet index.
<nurbssurfsurfintersectioncurve>.parent1ID : integer
The 1st parent surface by NURBSId.
<nurbssurfsurfintersectioncurve>.parent2 : integer
The 2nd parent surface by NURBSet index.
<nurbssurfsurfintersectioncurve>.parent2ID : integer
The 2nd parent surface by NURBSId.
<nurbssurfsurfintersectioncurve>.trimCurve1 : boolean
If true, trim the 1st parent surface at the intersection.
<nurbssurfsurfintersectioncurve>.trimCurve2 : boolean
If true, trim the 2nd parent surface at the intersection.
<nurbssurfsurfintersectioncurve>.flipTrim1 : boolean
If true the 1st parent surface is trimmed from the point towards low parameter space. If
false the surface is trimmed from the point towards high parameter space.
<nurbssurfsurfintersectioncurve>.flipTrim2 : boolean
If true the 2nd parent surface is trimmed from the point towards low parameter space. If
false the surface is trimmed from the point towards high parameter space.
<nurbssurfsurfintersectioncurve>.seed : point2
The seed location is a UV position on the parent surface.
1424 Chapter 11 | 3ds max Objects
See also
NURBSPointCurve (p. 1418)
NURBSCurve (p. 1409)
NURBSObject (p. 1402)
Value Common Properties, Operators, and Methods (p. 714)
NURBSXFormCurve : NURBSCurve
This class defines a dependent Transform (XForm) curve. A Transform curve is a copy of the original
curve with a different position, rotation, or scale.
Constructors:
NURBSXFormCurve [<property>:<val>]...
Any of the object’s properties may be set via optional keyword arguments on the
constructor.
getObject <nurbsset> <index>
Properties:
<nurbsxformcurve>.parent : integer
The parent curve by NURBSet index.
<nurbsxformcurve>.parentID : integer
The parent curve by NURBSId.
<nurbsxformcurve>.transform : matrix3
The offset transformation matrix for the NURBSCVCurve. This controls the relative
position of the item to the parent curve.
See also
NURBSPointCurve (p. 1418)
NURBSCurve (p. 1409)
NURBSObject (p. 1402)
Value Common Properties, Operators, and Methods (p. 714)
NURBSSurface : NURBSObject 1425
NURBSSurface Classes
NURBSSurface : NURBSObject
This is the parent class for all the NURBS surface classes and so is not directly constructable. The class
describes the common properties of all NURBS surfaces. This includes its material ID, texture/tiling
options, renderable state, and open/closed state, and normal inverted state. The evalPos(),
evalUTangent(), and evalVTangent() methods are used to compute points and tangents on the
surface.
Properties:
All NURBS surface classes have the following properties.
<nurbssurface>.renderable : boolean
Specifies whether the surface is renderable. true if the surface is renderable, false if not.
<nurbssurface>.flipNormals : boolean
Specifies whether all the surface’s surface normals are flipped. true if the surface normals
are to be flipped, false if not.
<nurbssurface>.generateUVs1 : boolean
If true, enables the generation of UV mapping coordinates for UVW channel 1. See the
getGenerateUVs() and setGenerateUVs() methods for generalized mapping channel
access.
<nurbssurface>.generateUVs2 : boolean
If true, enables the generation of UV mapping coordinates for UVW channel 2. See the
getGenerateUVs() and setGenerateUVs() methods for generalized mapping channel
access.
<nurbssurface>.matID : integer
The material ID of the surface.
<nurbssurface>.closedInU : boolean, read-only
true if the surface is closed in the U direction, false if open.
<nurbssurface>.closedInV : boolean, read-only
true if the surface is closed in the V direction, false if open.*
<nurbssurface>.uParameterRangeMin : float, read-only
<nurbssurface>.uParameterRangeMax : float, read-only
Contains the minimum and maximum valid values for <u_parm> in the methods
associated with NURBS Surfaces.
<nurbssurface>.vParameterRangeMin : float, read-only
<nurbssurface>.vParameterRangeMax : float, read-only
Contains the minimum and maximum valid values for <v_param> in the methods
associated with NURBS Surfaces.
1426 Chapter 11 | 3ds max Objects
<nurbssurface>.textureSurface1 : NURBSTextureSurface
<nurbssurface>.textureSurface2 : NURBSTextureSurface
Used to get and set the texture surfaces for the two mapping channels. These properties
take and return instances of the NURBSTextureSurface class. .textureSurface1 accesses
mapping channel 1 and .textureSurface2 accesses mapping channel 2. See
NURBSTextureSurface : Value (p. 1455). See the getTextureSurface() and
setTextureSurface() methods for generalized mapping channel access.
It is not possible to assign texture surfaces to NURBS objects present in the scene. You can
create new NURBSSets and the texture surface is used when you call
createNURBSObject(). However, if you do a getNURBSSet() and assign a
NURBSTextureSurface to these properties, nothing happens.
Methods:
All NURBS surface classes have the following methods:
evalPos <nurbssurface> <u_param> <v_param>
Returns the coordinates in space of the point at the given U and V parametric position on
the surface.
evalUTangent <nurbssurface> <u_param> <v_param>
Returns the U tangent vector of the surface at the given U and V parametric position on
the surface.
evalVTangent <nurbssurface> <u_param> <v_param>
Returns the V tangent vector of the surface at the given U and V parametric position on
the surface.
getTiling <nurbssurface> [channel:<index>]
setTiling <nurbssurface> <ut> <vt> [channel:<index>]
These methods get and set the tiling factor on the surface in the u and v directions. These
methods return or take a point2 value, with u tiling in the x component and v tiling in the
y component of the point2. The optional channel keyword argument can be used to
select the mapping channel which defaults to 1.
getTilingOffset <nurbssurface> [channel:<index>]
setTilingOffset <nurbssurface> <uo> <vo> [channel:<index>]
These methods get and set the tiling offset on the surface for the selected channel. These
methods return or take a point2 value, with u offset in the x component and v offset in
the y component of the point2. The optional channel keyword argument can be used to
select the mapping channel which defaults to 1.
getGenerateUVs <nurbssurface> <channel_index>
setGenerateUVs <nurbssurface> <channel_index> <boolean>
These methods get and set whether the generation of UV mapping coordinates for the
selected channel is enabled.
NURBS1RailSweepSurface : NURBSSurface 1427
See also
NURBSObject (p. 1402)
Value Common Properties, Operators, and Methods (p. 714)
NURBS1RailSweepSurface : NURBSSurface
This class defines a dependent 1-Rail Sweep surface. A 1-Rail Sweep surface uses at least two curves.
One curve, the “rail,” defines one edge of the surface. The other curves define the surface’s cross
sections. The cross-section curves should intersect the rail curve. If the cross sections don’t intersect
the rail, the resulting surface is unpredictable.
Constructors:
NURBS1RailSweepSurface [<property>:<val>]...
Any of the object’s properties may be set via optional keyword arguments on the
constructor.
getObject <nurbsset> <index>
Properties:
<nurbs1railsweepsurface>.rail : integer
The parent rail curve by NURBSet index.
1428 Chapter 11 | 3ds max Objects
<nurbs1railsweepsurface>.railID : integer
The parent rail curve by NURBSId.
<nurbs1railsweepsurface>.numCurves : integer
The number of cross-section curves.
<nurbs1railsweepsurface>.parallel : boolean
If true, ensures that the sweep surface’s normal is parallel to the rail.
<nurbs1railsweepsurface>.axisTM : matrix3
The axis of the sweep.
Methods:
appendCurve <nurbs1railsweepsurface> <curve> [flip:<boolean>] [startPoint:<float>]
Adds a curve to the end of the list of cross-section curves by specifying the index in the
NURBSSet. If flip:true is specified, the cross-section curve is reversed. startPoint
specifies the start point on the parent curve. startPoint is applicable only if the parent is
a closed curve.
appendCurveByID <nurbs1railsweepsurface> <curveID> [flip:<boolean>]
[startPoint:<float>]
Adds a curve to the end of the list of cross-section curves by specifying the NURBSId. If
flip:true is specified, the cross-section curve is reversed. startPoint specifies the start
point on the parent curve. startPoint is applicable only if the parent is a closed curve.
getCurve <nurbs1railsweepsurface> <index>
setCurve <nurbs1railsweepsurface> <index> <curve>
Get or set the indexed cross-section curve by NURBSSet index.
getCurveID <nurbs1railsweepsurface> <index>
setCurveByID <nurbs1railsweepsurface> <index> <curveID>
Get or set the indexed cross-section curve by NURBSId.
getFlip <nurbs1railsweepsurface> <index>
setFlip <nurbs1railsweepsurface> <index> <boolean>
Get or set whether the indexed cross-section curve is reversed.
getCurveStartPoint <nurbs1railsweepsurface> <index>
setCurveStartPoint <nurbs1railsweepsurface> <index> <float>
Get or set the start point of the indexed cross-section curve on the parent curve. The start
point is applicable only if the parent is a closed curve.
See also
NURBSSurface (p. 1425)
NURBSObject (p. 1402)
Value Common Properties, Operators, and Methods (p. 714)
NURBS2RailSweepSurface : NURBSSurface 1429
NURBS2RailSweepSurface : NURBSSurface
This class defines a dependent 2-Rail Sweep surface. A 2-Rail Sweep surface uses at least three curves.
Two curves, the “rails,” define the two edges of the surface. The other curves define the surface’s
cross sections. A 2-Rail Sweep surface is similar to a 1-Rail sweep. The additional rail gives you more
control over the shape of the surface.
Constructors:
NURBS2RailSweepSurface [<property>:<val>]...
Any of the object’s properties may be set via optional keyword arguments on the
constructor.
getObject <nurbsset> <index>
Properties:
<nurbs2railsweepsurface>.rail1 : integer
The 1st parent rail curve by NURBSet index.
<nurbs2railsweepsurface>.rail1ID : integer
The 1st parent rail curve by NURBSId.
<nurbs2railsweepsurface>.rail2 : integer
The 2nd parent rail curve by NURBSet index.
<nurbs2railsweepsurface>.rail2ID : integer
The 2nd parent rail curve by NURBSId.
<nurbs2railsweepsurface>.numCurves : integer
The number of cross-section curves.
<nurbs2railsweepsurface>.parallel : boolean
If false, the rail curves define a ruled surface, and the cross sections describe lofting from
this base ruled surface. If true, each cross section is associated with its best fitting plane.
This plane moves along the rails and parallel to them. If the rails are curved, the plane can
rotate. If the spacing between the rails changes, the section scales or stretches. In either
case, the surface is blended from section to section along its entire length.
Methods:
appendCurve <nurbs2railsweepsurface> <curve> [flip:<boolean>] [startPoint:<float>]
Adds a curve to the end of the list of cross-section curves by specifying the index in the
NURBSSet. If flip:true is specified, the cross-section curve is reversed. startPoint
specifies the start point on the parent curve. startPoint is applicable only if the parent is
a closed curve.
appendCurveByID <nurbs2railsweepsurface> <curveID> [flip:<boolean>]
[startPoint:<float>]
Adds a curve to the end of the list of cross-section curves by specifying the NURBSId. If
flip:true is specified, the cross-section curve is reversed. startPoint specifies the start
point on the parent curve. startPoint is applicable only if the parent is a closed curve.
1430 Chapter 11 | 3ds max Objects
See also
NURBSSurface (p. 1425)
NURBSObject (p. 1402)
Value Common Properties, Operators, and Methods (p. 714)
NURBSBlendSurface : NURBSSurface
This class defines a dependent Blend surface. A Blend surface connects the edge of one surface to the
edge of another, blending the curvature of the parents to create a smooth surface between them. You
can also blend from a surface to a curve, or from a curve to a curve.
Constructors:
NURBSBlendSurface [<property>:<val>]...
Any of the object’s properties may be set via optional keyword arguments on the
constructor.
getObject <nurbsset> <index>
Properties:
<nurbsblendsurface>.parent1 : integer
The 1st parent by NURBSet index.
<nurbsblendsurface>.parent1ID : integer
The 1st parent by NURBSId.
<nurbsblendsurface>.parent2 : integer
The 2nd parent by NURBSet index.
<nurbsblendsurface>.parent2ID : integer
The 2nd parent by NURBSId.
NURBSBlendSurface : NURBSSurface 1431
<nurbsblendsurface>.edge1 : integer
Which edge of the 1st parent surface is used for the blend. The property’s value is one of
the following:
1: The low U edge
2: The high U edge
3: The low V edge
4: The high V edge
<nurbsblendsurface>.edge2 : integer
Which edge of the 2nd parent surface is used for the blend.
<nurbsblendsurface>.flip1 : boolean
Controls the matching of parent surface normals when creating the Blend surface. For
example, normally when you create a Blend surface between two parent surfaces you don’t
want a ‘bow tie’ surface (one with the ends rotated 180 degrees so it crosses on itself in the
middle). If you simply match the parent normals you’ll occasionally get a ‘bow tie’ surface.
To prevent this you use this property to set a state indicating that one or the other should
be flipped before it’s used. In this way, when the blend is created, a ‘bow tie’ won’t occur. If
true, the 1st parent’s surface normal will be matched; if false the 1st parent’s surface
normal will not be matched.
<nurbsblendsurface>.flip2 : boolean
If true, the 2nd parent’s surface normal will be matched; if false the 2nd parent’s surface
normal will not be matched.
<nurbsblendsurface>.tension1 : float
The tension value for the 1st parent.
<nurbsblendsurface>.tension2 : float
The tension value for the 2nd parent.
<nurbsblendsurface>.curveStartPoint1 : float
<nurbsblendsurface>.curveStartPoint2 : float
Adjusts the position of the start point at the two edges of the blend. Adjusting the start
points can help eliminate unwanted twists or “buckles” in the surface. These values are not
applicable if the edges or curves are not closed.
Methods:
getParent <nurbsblendsurface> <index>
setParent <nurbsblendsurface> <index> <curve>
Get or set a parent by NURBSSet index. <index> = 1 - parent 1; 2 - parent 2.
getParentID <nurbsblendsurface> <index>
setParentID <nurbsblendsurface> <index> <curveID>
Get or set a parent by NURBSId. <index> = 1 - parent 1; 2 - parent 2.
getEdge <nurbsblendsurface> <index>
setEdge <nurbsblendsurface> <index> <edge>
Get or set which edge of the parent surface is used for the blend. <index> = 1 - parent 1; 2
- parent 2. See the edge1 property description for the <edge> value description.
1432 Chapter 11 | 3ds max Objects
See also
NURBSSurface (p. 1425)
NURBSObject (p. 1402)
Value Common Properties, Operators, and Methods (p. 714)
NURBSCapSurface : NURBSSurface
This class defines a dependent Cap surface. A Cap surface is a surface that caps a closed curve or the
edge of a closed surface. Caps are especially useful with extruded surfaces.
Constructors:
NURBSCapSurface [<property>:<val>]...
Any of the object’s properties may be set via optional keyword arguments on the
constructor.
getObject <nurbsset> <index>
Properties:
<nurbscapsurface>.parent : integer
The parent curve or surface by NURBSet index.
<nurbscapsurface>.parentID : integer
The parent curve or surface by NURBSId.
<nurbscapsurface>.edge : integer
Which edge of the parent surface is capped. This value is not applicable if the parent is a
curve. The property’s value is one of the following:
1: The low U edge
2: The high U edge
3: The low V edge
4: The high V edge
<nurbscapsurface>.curveStartPoint : integer
The start point on the parent curve. This value is only applicable if the parent is a curve.
See also
NURBSSurface (p. 1425)
NURBSObject (p. 1402)
Value Common Properties, Operators, and Methods (p. 714)
NURBSCVSurface : NURBSSurface 1433
NURBSCVSurface : NURBSSurface
This class defines an independent surface that uses control vertices (CVs) to describe its shape. The
CVs define a control lattice which surrounds the surface.
Constructors:
NURBSCVSurface [<property>:<val>]...
Any of the object’s properties may be set via optional keyword arguments on the
constructor.
getObject <nurbsset> <index>
Properties:
<nurbscvsurface>.uOrder : integer
<nurbscvsurface>.vOrder : integer
The order of the surface in the U and V directions.
<nurbscvsurface>.numUKnots : integer
<nurbscvsurface>.numVKnots : integer
The number of knots in the surface in the U and V directions. If this value is changed, the
previous knot data is NOT maintained. Because they are generated mathematically, NURBS
surfaces have a parameter space in addition to the 3D geometric space in which they are
displayed. Specifically, an array of values called knots specifies the extent of influence of
each control vertex (CV) on the surface.
<nurbscvsurface>.numCVs : point2
The number of control vertices for the surface in the U and V directions. If this value is
changed, the previous control vertex data is NOT maintained.
<nurbscvsurface>.transform : matrix3
The transformation matrix for the NURBSCVSurface. This controls the relative position of
the item within a NURBSSet.
<nurbscvsurface>.uEdgesOverlap : boolean, read-only
<nurbscvsurface>.vEdgesOverlap : boolean, read-only
true if the edges of the surface overlap in U and/or V even though the surface may not be
closed (that is, the tangents match at the edges), false otherwise.
<nurbscvsurface>.autoParam : #notAutomatic, #autoCentripetal, #autoUniform
#notAutomatic, #autoCentripetal, and #autoUniform correspond to the Automatic
Reparam options in the CV Surface rollouts: none, chord length and uniform, respectively.
Defaults to #notAutomatic.
1434 Chapter 11 | 3ds max Objects
<nurbscvsurface>.rigid : boolean
true if the surface is ‘rigid’; otherwise false. The only editing allowed on a rigid surface
is to transform it at the Surface sub-object level. You can’t move a rigid surface’s points or
CVs, or change the number of points or CVs. Rigid surfaces reduce the amount of memory
used by the NURBS model. Making surfaces rigid improves performance, especially for
large and complex models. When a surface is rigid, you can’t see its points or CVs when
you are at the Point or Surface CV sub-object levels. If the model has no nonrigid surfaces
and no point curves, the Point and Surface CV sub-object levels aren’t available at all.
Methods:
closeU <nurbscvsurface>
Closes the surface in the U direction.
closeV <nurbscvsurface>
Closes the surface in the V direction.
getUKnot <nurbscvsurface> <u_index>
Get the indexed U-direction knot; knot indexes are 1-based.
setUKnot <nurbscvsurface> <u_index> <float>
Sets the indexed U-direction knot to the given value; knot indexes are 1-based.
getVKnot <nurbscvsurface> <v_index>
Get the indexed V-direction knot; knot indexes are 1-based.
setVKnot <nurbscvsurface> <v_index> <float>
Get the indexed V-direction knot to the given value; knot indexes are 1-based.
getCV <nurbscvsurface> <u_index> <v_index>
Get the CV at the given U and V index as a NURBSControlVertex; CV indexes are 1-based.
setCV <nurbscvsurface> <u_index> <v_index> <NURBSControlVertex>
Sets the CV at the given U and V index to the supplied NURBSControlVertex; CV indexes
are 1-based.
refineU <nurbscvsurface> <v_param>
Adds new row of interpolated CVs in the U direction on the surface at the given
parametric V point.
refineV <nurbscvsurface> <u_param>
Adds new column of interpolated CVs in the V direction on the surface at the given
parametric U point.
refine <nurbscvsurface> <u_param> <v_param>
Adds a new row and column of interpolated CVs on the surface at the given parametric UV
position.
reparameterize <nurbscvsurface> (#centripetal | #uniform)
Reparameterizes the surface by chord length (#centripetal) or uniform (#uniform)
uniform parameterization.
NURBSExtrudeSurface : NURBSSurface 1435
Note:
CV curves and surfaces must obey the relationship that “order + number of CVs = number of knots”.
If this is not the case in most cases no object will be created and in some cases an assertion fault
might be generated.
See also
NURBSSurface (p. 1425)
NURBSObject (p. 1402)
Value Common Properties, Operators, and Methods (p. 714)
NURBSExtrudeSurface : NURBSSurface
This class defines a dependent Extrude surface. An Extrude surface is extruded from a curve sub-
object. It is similar to a surface created with the Extrude modifier. The advantage is that an extrude
sub-object is part of the NURBS model, so you can use it to construct other curve and surface sub-
objects.
Constructors:
NURBSExtrudeSurface [<property>:<val>]...
Any of the object’s properties may be set via optional keyword arguments on the
constructor.
getObject <nurbsset> <index>
Properties:
<nurbsextrudesurface>.parent : integer
The parent curve by NURBSet index.
<nurbsextrudesurface>.parentID : integer
The parent curve by NURBSId.
<nurbsextrudesurface>.distance : float
The length of extrusion.
<nurbsextrudesurface>.axisTM : matrix3
The extrusion axis.
<nurbsextrudesurface>.curveStartPoint : float
The start point on the parent curve. This value is only applicable if the curve is closed.
See also
NURBSSurface (p. 1425)
NURBSObject (p. 1402)
Value Common Properties, Operators, and Methods (p. 714)
1436 Chapter 11 | 3ds max Objects
NURBSFilletSurface : NURBSSurface
This class defines a dependent Fillet surface. A Fillet surface is a rounded corner surface connecting
the edges of two other surfaces.
Constructors:
NURBSFilletSurface [<property>:<val>]...
Any of the object’s properties may be set via optional keyword arguments on the
constructor.
getObject <nurbsset> <index>
Properties:
<nurbsfilletsurface>.cubic : boolean
If true, the radius is always linear. If false, the radius is treated as a cubic function,
allowing it to change based on the parent surfaces’ geometry.
Methods:
getParent <nurbsfilletsurface> <index>
setParent <nurbsfilletsurface> <index> <curve>
Get or set a parent surface by NURBSSet index. <index> = 1 - parent 1; 2 - parent 2.
setParentID <nurbsfilletsurface> <index> <curveID>
getParentID <nurbsfilletsurface> <index>
Get or set a parent surface by NURBSId. <index> = 1 - parent 1; 2 - parent 2.
getSeed <nurbsfilletsurface> <index>
setSeed <nurbsfilletsurface> <index> <point2>
The UV location of the seed value on a parent surface. <index> = 1 - parent 1; 2 - parent 2.
getRadius <nurbsfilletsurface> <index>
setRadius <nurbsfilletsurface> <index> <float>
Get or set the radius of the fillet surface. <index> = 1 - start radius; 2 - end radius.
getTrimSurface <nurbsfilletsurface> <index>
setTrimSurface <nurbsfilletsurface> <index> <bool>
Get or set whether to trim a parent’s surface. If true, trims the parent surface at the
intersection. <index> = 1 - parent 1; 2 - parent 2.
getFlipTrim <nurbsfilletsurface> <index>
setFlipTrim <nurbsfilletsurface> <index> <bool>
Get or set the direction to trim a parent’s surface. If true the parent surface is trimmed
from the point towards low parameter space. If false the surface is trimmed from the
point towards high parameter space. <index> = 1 - parent 1; 2 - parent 2.
See also
NURBSSurface (p. 1425)
NURBSObject (p. 1402)
Value Common Properties, Operators, and Methods (p. 714)
NURBSLatheSurface : NURBSSurface 1437
NURBSLatheSurface : NURBSSurface
This class defines a dependent Lathe surface. A Lathe surface is generated from a curve sub-object. It
is similar to a surface created with the Lathe modifier. The advantage is that a lathe sub-object is part
of the NURBS model, so you can use it to construct other curve and surface sub-objects.
Constructors:
NURBSLatheSurface [<property>:<val>]...
Any of the object’s properties may be set via optional keyword arguments on the
constructor.
getObject <nurbsset> <index>
Properties:
<nurbslathesurface>.parent : integer
The parent curve by NURBSet index.
<nurbslathesurface>.parentID : integer
The parent curve by NURBSId.
<nurbslathesurface>.axisTM : matrix3
The axis system for the surface of revolution.
<nurbslathesurface>.sweep : float
The angle of the revolution in degrees.
<nurbsextrudesurface>.curveStartPoint : float
The start point on the parent curve. This value is only applicable if the curve is closed.
See also
NURBSSurface (p. 1425)
NURBSObject (p. 1402)
Value Common Properties, Operators, and Methods (p. 714)
NURBSMirrorSurface : NURBSSurface
This class defines a dependent Mirror surface. A Mirror surface is similar to a mirror object that you
create using the Mirror tool (on the 3ds max toolbar) or the Mirror modifier. It is the original surface
reflected about one or two axes.
Constructors:
NURBSMirrorSurface [<property>:<val>]...
Any of the object’s properties may be set via optional keyword arguments on the
constructor.
getObject <nurbsset> <index>
1438 Chapter 11 | 3ds max Objects
Properties:
<nurbsmirrorsurface>.parent : integer
The parent curve by NURBSet index.
<nurbsmirrorsurface>.parentID : integer
The parent curve by NURBSId.
<nurbsmirrorsurface>.axis : #X, #Y, #Z, #XY, #XZ, #YZ
The axis or axes of reflection for the surface.
<nurbsmirrorsurface>.distance : float
The offset from the center of the local coordinate system for the mirror object that moves
the mirror, in the direction specified by the mirror axis.
<nurbsmirrorsurface>.transform : matrix3
This is an additional transformation applied to the axis specification. This corresponds to
the gizmo the user may use interactively to alter the location of the mirror axis. This is
exactly equivalent to setting the transform on the gizmo of a mirror modifier.
See also
NURBSSurface (p. 1425)
NURBSObject (p. 1402)
Value Common Properties, Operators, and Methods (p. 714)
NURBSMultiCurveTrimSurface : NURBSSurface
This class defines a dependent Multicurve Trim surface which is a surface that is trimmed by multiple
curves forming a loop.
Constructors:
NURBSMultiCurveTrimSurface [<property>:<val>]...
Any of the object’s properties may be set via optional keyword arguments on the
constructor.
getObject <nurbsset> <index>
Properties:
<nurbsmulticurvetrimsurface>.surfaceParent : Integer
The parent surface by NURBSet index.
<nurbsmulticurvetrimsurface>.surfaceParentID : Integer
The parent surface by NURBSId.
<nurbsmulticurvetrimsurface>.numCurves : Integer
The number of curves used for the trim loop.
<nurbsmulticurvetrimsurface>.flipTrim : Boolean
The state of the trim flip toggle. This controls which portion of the surface is trimmed.
Methods:
NURBSNBlendSurface : NURBSSurface 1439
See also
NURBSSurface (p. 1425)
NURBSObject (p. 1402)
Value Common Properties, Operators, and Methods (p. 714)
NURBSNBlendSurface : NURBSSurface
This class defines a dependent Multisided Blend surface. A Multisided Blend surface is a surface that
“fills in” the edges defined by three or four other curve or surfaces. Unlike a regular, two-sided Blend
surface, the curves or surfaces edges must form a closed loop (that is, sequence head to tail, and the
ends must match). That is, they must completely surround the opening the Multisided Blend will
cover.
Constructors:
NURBSNBlendSurface [<property>:<val>]...
Any of the object’s properties may be set via optional keyword arguments on the
constructor.
getObject <nurbsset> <index>
Properties:
There are no additional properties for NURBSNBlendSurface.
Methods:
getParent <nurbsnblendsurface> <index>
Returns the NURBSSet index of the indexed curve or surface.
setParent <nurbsnblendsurface> <index> <curve>
Sets the specified parent curve or surface by NURBSSet index as the indexed edge for the
surface.
1440 Chapter 11 | 3ds max Objects
See also
NURBSSurface (p. 1425)
NURBSObject (p. 1402)
Value Common Properties, Operators, and Methods (p. 714)
NURBSOffsetSurface : NURBSSurface
This class defines a dependent Offset surface. An Offset surface is offset a specified distance from the
original along the parent surface’s normals.
Constructors:
NURBSOffsetSurface [<property>:<val>]...
Any of the object’s properties may be set via optional keyword arguments on the
constructor.
getObject <nurbsset> <index>
Properties:
<nurbsoffsetsurface>.parent : integer
The parent surface by NURBSet index.
<nurbsoffsetsurface>.parentID : integer
The parent surface by NURBSId.
<nurbsoffsetsurface>.distance : float
The distance of the offset surface from the parent surface.
See also
NURBSSurface (p. 1425)
NURBSObject (p. 1402)
Value Common Properties, Operators, and Methods (p. 714)
NURBSPointSurface : NURBSSurface 1441
NURBSPointSurface : NURBSSurface
This class defines an independent surface that uses points to describe its shape.
Constructors:
NURBSPointSurface [<property>:<val>]...
Any of the object’s properties may be set via optional keyword arguments on the
constructor.
getObject <nurbsset> <index>
Properties:
<nurbspointsurface>.numPoints : point2
The number of points in the point surface in the U and V directions. If this value is
changed, the previous point data is not maintained.
<nurbspointsurface>.transform : matrix3
The transformation matrix for the NURBSPointSurface. This controls the relative position
of the item within a NURBSSet.
<nurbspointsurface>.closedU : boolean
true if the surface is closed in the U direction, false if open.
<nurbspointsurface>.closedV : boolean
true if the surface is closed in the V direction, false if open.
Methods:
closeU <nurbspointsurface>
Close the curve in U.
closeV <nurbspointsurface>
Close the curve in V.
getPoint <nurbspointsurface> <u_index> <v_index>
Get the indexed surface point as a NURBSIndependentPoint; point indexes are 1-based.
setPoint <nurbspointsurface> <u_index> <v_index> <NURBSIndependentPoint>
Get the indexed surface point to the given NURBSIndependentPoint; point indexes are
1-based.
refineU <nurbspointsurface> <v_param>
Add new row of interpolated points in the U direction on the surface at the given
parametric V point.
refineV <nurbspointsurface> <u_param>
Add new column of interpolated points in the V direction on the surface at the given
parametric U point.
refine <nurbspointsurface> <u_param> <v_param>
Add a new row and column of interpolated points on the surface at the given parametric
UV position.
1442 Chapter 11 | 3ds max Objects
See also
NURBSSurface (p. 1425)
NURBSObject (p. 1402)
Value Common Properties, Operators, and Methods (p. 714)
NURBSRuledSurface : NURBSSurface
This class defines a dependent Ruled surface. A Ruled surface is generated from two curve sub-
objects. It lets you use curves to design the two opposite borders of a surface.
Constructors:
NURBSRuledSurface [<property>:<val>]...
Any of the object’s properties may be set via optional keyword arguments on the
constructor.
getObject <nurbsset> <index>
Properties:
<nurbsruledsurface>.parent1 : integer
The 1st parent curve by NURBSet index.
<nurbsruledsurface>.parent1ID : integer
The 1st parent curve by NURBSId.
<nurbsruledsurface>.parent2 : integer
The 2nd parent curve by NURBSet index.
<nurbsruledsurface>.parent2ID : integer
The 2nd parent curve by NURBSId.
<nurbsruledsurface>.flip1 : boolean
Controls the matching of parent curve direction when creating the Ruled surface. For
example, normally when you create a Ruled surface between two parent curves you don’t
want a ‘bow tie’ surface (one with the ends rotated 180 degrees so it crosses on itself in the
middle). If you simply match the parent direction you’ll get a ‘bow tie’ surface. To prevent
this you use this property to set a state indicating that one or the other should be flipped
before it’s used. In this way, when the ruled surface is created, a ‘bow tie’ won’t occur. If
true, the 1st parent’s curve direction will be flipped; if false the 1st parent’s curve
direction will not be flipped.
<nurbsruledsurface>.flip2 : boolean
If true, the 2nd parent’s curve direction will be flipped; if false the 2nd parent’s curve
direction will not be flipped.
<nurbsruledsurface>.curveStartPoint1 : float
The start point on the 1st parent curve. This value is only applicable if the curve is closed.
<nurbsruledsurface>.curveStartPoint2 : float
The start point on the 2nd parent curve. This value is only applicable if the curve is closed.
NURBSULoftSurface : NURBSSurface 1443
See also
NURBSSurface (p. 1425)
NURBSObject (p. 1402)
Value Common Properties, Operators, and Methods (p. 714)
NURBSULoftSurface : NURBSSurface
This class defines a dependent U Loft surface. A U Loft surface interpolates a surface across multiple
curve sub-objects. The curves become U-axis contours of the surface.
Constructors:
NURBSUloftSurface [<property>:<val>]...
Any of the object’s properties may be set via optional keyword arguments on the
constructor.
getObject <nurbsset> <index>
Properties:
<nurbsuloftsurface>.numCurves : integer
The number of curves used by the U Loft.
Methods:
getCurve <nurbsuloftsurface> <index>
Gets the NURBSSet index of the indexed U Loft curve; curve indexes are 1-based.
setCurve <nurbsuloftsurface> <index> <curve>
Sets the indexed U Loft curve to the curve specified by the NURBSSet index.
getCurveID <nurbsuloftsurface> <index>
Gets the NURBSId of the indexed U Loft curve in the loft; curve indexes are 1-based.
setCurveByID <nurbsuloftsurface> <index> <curveID>
Sets the indexed U Loft curve to the curve specified by the NURBSId.
appendCurve <nurbsuloftsurface> <curve> [flip:<boolean>] [startPoint:<float>] \
[tension:<float>] [useTangent:<boolean>] [flipTangent:<boolean>]
Adds a curve to the end of the list of U Loft curves by specifying the NURBSSet index. If
flip:true is specified, the interpretation of the start and end of the curve to be reversed.
startPoint: specifies the start point on the curve. This value is only applicable if the
curve is closed. tension: specifies the tension of the curve. If useTangent:true is
specified and the curve is a curve on surface, causes the U Loft to use the tangency of the
surface. This can help blend a loft smoothly onto a surface. If flipTangent:true is
specified, the tangent is flipped for the curve.
appendCurveByID <nurbsuloftsurface> <curveID> [flip:<boolean>]
[startPoint:<float>] \
[tension:<float>] [useTangent:<boolean>] [flipTangent:<boolean>]
Adds a curve to the end of the list of U Loft curves by specifying the NURBSId.
1444 Chapter 11 | 3ds max Objects
See also
NURBSSurface (p. 1425)
NURBSObject (p. 1402)
Value Common Properties, Operators, and Methods (p. 714)
NURBSUVLoftSurface : NURBSSurface
This class defines a dependent UV Loft Surface. This surface is similar to the U Loft surface, but has
a set of curves in the V dimension as well as the U dimension.
Constructors:
NURBSUVLoftSurface [<property>:<val>]...
any of the object’s properties may be set via optional keyword arguments on the
constructor.
getObject <nurbsset> <index>
Properties:
<nurbsuvloftsurface>.numUCurves : integer
The number of curves in the U direction used by the UV Loft.
<nurbsuvloftsurface>.numVCurves : integer
The number of curves in the V direction used by the UV Loft.
Methods:
getUCurve <nurbsuvloftsurface> <index>
Gets the NURBSSet index of the U direction indexed UV Loft curve; curve indexes are 1-
based.
setUCurve <nurbsuvloftsurface> <index> <curve>
Sets the indexed UV Loft curve in the U direction to the curve specified by the NURBSSet
index.
getUCurveID <nurbsuvloftsurface> <index>
Gets the NURBSId of the U direction indexed UV Loft curve in the loft; curve indexes are
1-based.
setUCurveByID <nurbsuvloftsurface> <index> <curveID>
Sets the indexed UV Loft curve in the U direction to the curve specified by the NURBSId.
getVCurve <nurbsuvloftsurface> <index>
Gets the NURBSSet index of the V direction indexed UV Loft curve; curve indexes are 1-
based.
NURBSXFormSurface : NURBSSurface 1445
See also
NURBSSurface (p. 1425)
NURBSObject (p. 1402)
Value Common Properties, Operators, and Methods (p. 714)
NURBSXFormSurface : NURBSSurface
This class defines a dependent Transform (XForm) surface. A Transform surface is a copy of the
original surface with a different position, rotation, or scale.
Constructors:
NURBSXFormSurface [<property>:<val>]...
any of the object’s properties may be set via optional keyword arguments on the
constructor.
getObject <nurbsset> <index>
Properties:
<nurbsxformsurface>.parent : integer
The parent surface by NURBSet index.
<nurbsxformsurface>.parentID : integer
The parent surface by NURBSId.
1446 Chapter 11 | 3ds max Objects
<nurbsxformsurface>.transform : matrix3
The offset transformation matrix for the NURBSXFormSurface. This controls the relative
position of the item to the parent surface.
See also
NURBSSurface (p. 1425)
NURBSObject (p. 1402)
Value Common Properties, Operators, and Methods (p. 714)
NURBSTexturePoint Class
NURBSTexturePoint : NURBSObject
This class defines a single texture vertex in a NURBS texture surface.
Constructors:
NURBSTexturePoint <point2> [indices:<point2>]
Create a NURBSTexturePoint with the specified UV coordinate. If indices: is specified, it
sets the ordering the texture point in the texture surface.
getPoint <NURBSTextureSurface> <u_index> <v_index>
Properties:
<nurbstexturepoint>.pos : point2
The UV coordinate of the texture point.
Methods:
setIndices <nurbstexturepoint> <u_index> <v_index>
Sets the ordering the texture point in the texture surface.
See also
NURBSObject (p. 1402)
Value Common Properties, Operators, and Methods (p. 714)
NURBSDisplay : Value 1447
NURBSDisplay : Value
This class corresponds to the NURBS display control checkboxes in the General NURBS rollout panel.
You can exert control over the display levels in a NURBS object by either assigning NURBSDisplay
values to the .display property of a NURBSSet value or using the setSurfaceDisplay() node
function. See NURBS Node Properties and Methods (p. 1397).
Constructors:
NURBSDisplay [<property>:<val>]...
Any of the object’s properties may be set via optional keyword arguments on the
constructor.
<nurbsset>.display
Properties:
<nurbsdisplay>.displayCurves : boolean
true if curves are displayed; otherwise false.
<nurbsdisplay>.displaySurfaces : boolean
true if surfaces are displayed; otherwise false.
<nurbsdisplay>.displayLattices : boolean
true if lattices are displayed; otherwise false.
<nurbsdisplay>.displaySurfCVLattices : boolean
true if surface CV lattices are displayed; otherwise false.
<nurbsdisplay>.displayCurveCVLattices : boolean
true if curve CV lattices are displayed; otherwise false.
<nurbsdisplay>.displayDependents : boolean
true if dependent sub-objects are displayed; otherwise false.
<nurbsdisplay>.displayTrimming : boolean
true if surface trimming is displayed; otherwise false.
<nurbsdisplay>.degradeOnMove : boolean
true if the surface may degrade while transforming it; otherwise false.
<nurbsdisplay>.displayShadedLattice : boolean
true if the NURBS surfaces appear as shaded lattices in shaded viewports and wireframe
viewports display the surface’s lattice without shading. false if NURBS surfaces display as
tessellated meshes in shaded viewport and wireframe viewports surfaces display as either
iso curves or wire meshes.
See also
Value Common Properties, Operators, and Methods (p. 714)
1448 Chapter 11 | 3ds max Objects
NURBSSelection : Value
An NURBSSelection represents a set of NURBS sub-objects for a scene NURBS node as a virtual array.
As such, you can access a sub-object by index, iterate over the sub-objects, and apply mapped
functions to the sub-objects. The NURBSSelection array is dynamic, i.e., its contents will change as
the sub-objects of the NURBS node change. NURBSSelection values are mappable.
Constructors:
<node>.selectedCurveCVs
<node>.selectedCurves
<node>.selectedImports
<node>.selectedPoints
<node>.selectedSurfaces
<node>.selectedSurfCVs
<node>.curveCVs -- read-only
<node>.curves -- read-only
<node>.imports -- read-only
<node>.surfaces -- read-only
<node>.surfCVs -- read-only
<node>.points -- read-only
Properties:
<nurbsselection>.count : Integer, read-only
Returns the number of sub-objects in the NURBSSelection array.
<nurbsselection>.selSetNames : Array of names, read-only
Returns an array of names of the current named selection sets corresponding to the
NURBSSelection level for the object the NURBSSelection is associated with.
The following property is present for singleton selections (of the form $foo.curveCVs[n]):
<nurbsselection>.index : Integer, read-only
Returns the index of the selected sub-object in the NURBS object, e.g.,
$foo.selectedcurveCVs[2].index
returns the curve CV index of the 2nd curve CV in the current selection.
Note that iterating over a selection yields singleton selections in the loop body:
sCVs = for i in $foo.selectedcurveCVs collect i.index
sCVs contains selected curve CVs as array
Operators:
<node>.selectedCurveCVs = (<array> | <bitarray>)
<node>.selectedCurves = (<array> | <bitarray>)
<node>.selectedImports = (<array> | <bitarray>)
<node>.selectedPoints = (<array> | <bitarray>)
<node>.selectedSurfaces = (<array> | <bitarray>)
<node>.selectedSurfCVs = (<array> | <bitarray>)
Selects the specified sub-objects.
<nurbsselection>[<integer>]
Retrieves the indexed sub-object as a singleton NURBSSelection. Index starts at 1
NURBSSelection : Value 1449
<nurbsselection>[(<integer_array> | <bitarray>)]
Retrieves the indexed sub-objects as a NURBSSelection. Index starts at 1.
<nurbsselection>[(<#name> | <string>)]
Retrieves the sub-object level named selection set, where the name of the named selection
set can be specified as a name or string value.
<nurbsselection>[(<#name> | <string>)] = (<nurbsselection> | <integer_array> |
<bitarray>)
Sets the sub-object level named selection set to the specified edges. The name of the
named selection set can be specified as a name or string value, and the edges can be
specified as an array, bitArray, or a NURBSSelection from the same object and of the same
sub-object level.
Methods:
move <nurbsselection> <point3>
Moves the sub-objects in the NURBSSelection.
rotate <nurbsselection> <quat_or_other_rotation_form>
Rotates the sub-objects in the NURBSSelection.
scale <nurbsselection> <point3>
Scales the sub-objects in the NURBSSelection.
select <nurbsselection>
Selects the sub-objects in the NURBSSelection.
deselect <nurbsselection>
Deselects the sub-objects in the NURBSSelection.
delete <nurbsselection>
Deletes the sub-objects in the NURBSSelection.
append <nurbsselection> (<nurbsselection> | <integer>)
Appends the sub-objects(s) to the NURBSSelection.
findItem <nurbsselection> (<nurbsselection[<integer>] | <integer>)
Returns the selection index of the matching item or 0 if not found. The item is selection
index or singleton NURBSSelection.
Examples:
$foo.surfCVs[#baz] -- retrieves the surf CV selection named baz
move $foo.curves[#bar] [0,0,10] -- moves the “bar” curve selection 10 in Z
move $foo.selectedSurfCVs [0,0,10] -- moves the current surface CV selection 10 in
Z
coordsys local scale $foo.surfaces[#baz] [2,2,2]
select $foo.curveCVs[#(1,2,3,4,5)] -- select the specified curve CVs
deselect $foo.curves -- deselect all curves
delete $foo.points[#{1..31, 40..50}] -- delete the specified points
$foo.curveCVs[#fred] = $foo.selectedCurveCVs - “snapshot” the selected curve CVs
See also
Value Common Properties, Operators, and Methods (p. 714)
1450 Chapter 11 | 3ds max Objects
NURBSSet : Value
This is the class used to create NURBS objects, or retrieve data from existing NURBS objects. The
NURBSSet acts as a container for the other objects.
This class contains a table of the various NURBSObject derived entities (points, curves, surfaces) used
to make up the set. Additionally it has two ‘fuse’ tables: one for fuse curves and one for fuse surfaces.
These are used to allow the CVs in the curves or surfaces to be ‘stitched’ or ‘fused’ together so that
if one curve or surface moves the other moves with it. This class also has the surface-approximation
properties that control the object’s tessellation into triangle meshes for use in the viewports and the
production renderer.
NURBSSet values are mappable.
Constructors:
NURBSSet [<property>:<val>]...
any of the object’s properties may be set via optional keyword arguments on the
constructor
getNURBSSet <node> [#relational]
This function is used to retrieve a NURBSSet that corresponds to the specified NURBS scene
node. This allows access the internal objects inside a 3ds max editable NURBS object.
If the optional #relational parameter is not supplied, the returned NURBSSet will
contain only independent curves and surfaces, all dependent objects will be decomposed
into corresponding independent objects. So for example, if you pass an object that has a
relational model (perhaps two CV surfaces and a dependent blend surface) it will
decompose them into three CV surfaces. This will be the CV surfaces that represent the
two surfaces and the blend, but you won’t have the blend relational data. If the
#relational argument is supplied, you get back two CV surfaces and a NURBS blend
surface and the NURBSSet is an active representative for the scene object -- any changes
you make to the properties of it’s constituent NURBSObjects will be reflected directly in
the source scene object.
Properties:
<nurbsset>.numObjects : integer, read-only
<nurbsset>.count : integer, read-only
The number of internal objects in the NURBSSet.
The following properties control the surface approximation tessellation. There are dual sets of
properties, one for controlling viewport tessellation, the other for controlling renderer tessellation.
The properties correspond directly to the surface approximation controls in the NURBS surface
modifier panel. See NURBSSurfaceApproximation (p. 1453) for a description of these properties.
<nurbsset>.viewConfig : #isoOnly, #isoAndMesh, #meshOnly
<nurbsset>.viewIsoULines : integer
<nurbsset>.viewIsoVLines : integer
<nurbsset>.viewMeshUSteps : integer
<nurbsset>.viewMeshVSteps : integer
<nurbsset>.viewMeshApproxType : #parametric, #spatial, #curvature,
NURBSSet : Value 1451
: #regular, #spatialAndCurvature
<nurbsset>.viewSpacialEdge : float
<nurbsset>.viewCurvatureAngle : float
<nurbsset>.viewCurvatureDistance : float
<nurbsset>.viewViewDependent : boolean
<nurbsset>.renderConfig : #isoOnly, #isoAndMesh, #meshOnly,
: #regular, #spatialAndCurvature
<nurbsset>.renderIsoULines : integer
<nurbsset>.renderIsoVLines : integer
<nurbsset>.renderMeshUSteps : integer
<nurbsset>.renderMeshVSteps : integer
<nurbsset>.renderMeshApproxType : #parametric, #spatial, #curvature,
: #regular, #spatialAndCurvature
<nurbsset>.renderSpacialEdge : float
<nurbsset>.renderCurvatureAngle : float
<nurbsset>.renderCurvatureDistance : float
<nurbsset>.renderViewDependent : boolean
<nurbsset>.display : NURBSDisplay
Takes and returns instances of the NURBSDisplay (p. 1447) class that controls visibility of
various components of a NURBS object’s display in the viewports.
<nurbsset>.viewApproximation : NURBSSurfaceApproximation
<nurbsset>.renderApproximation : NURBSSurfaceApproximation
These properties are used to access and control surface approximation using the
NURBSSurfaceApproximation (p. 1453) class, instances of which encapsulate all the
approximation settings for either viewports or rendering. You can construct a surface
approximation setup in one of these instances and use it to set the surface approximation
for many objects.
<nurbsset>.merge : float
Controls the tessellation of surface sub-objects whose edges are joined or very nearly
joined. When input to a modifier as Mesh Select which requires a mesh, and when NURBS
surfaces are tessellated for production rendering, by default 3ds max adjusts the
tessellation of adjoining surfaces to match each other in terms of the number of faces
along the edges. The merge value controls how this is done. If merge is zero, adjoining
faces are unchanged. Increasing the value of merge increases the distance 3ds max uses to
calculate how edges should match, guaranteeing no gaps between the surfaces when they
are rendered.
Operators:
<nurbsset>[<index>]
<nurbsset>[<index>] = <nurbsobj>
The sub-objects in a NURBSSet can be accessed using the standard MAXScript array
indexing operator, []. This is equivalent to using the getObject() and setObject()
methods described below.
1452 Chapter 11 | 3ds max Objects
Methods:
appendObject <nurbsset> <nurbsobj>
Appends the given NURBSObject (instances of any of the subclasses of NURBSObject and
their subclasses, all the points, curves, surfaces) as a new sub-object to the NURBSSet. The
new sub-object receives the next available index.
setObject <nurbsset> <index> <nurbsobj>
Set the indexed sub-object to the given NURBSObject; indexes are 1-based. You use this
function to replace a previously appended object.
getObject <nurbsset> (<index> | <NURBSSelection>)
Retrieves the indexed sub-object or the set of sub-objects specified by the NURBSSelection
from the NURBSSet; sub-object indexes are 1-based. If the NURBSSelection specifies no
sub-objects, undefined is returned. If one sub-object is specified, a value of that sub-
object’s class is returned. If multiple sub-objects are specified, a NURBSSet value is
returned.
removeObject <nurbsset> <index>
Removes the given sub-object from the NURBSSet. The indexes of all the remaining
higher-indexed sub-objects are renumbered down.
disconnect <nurbsset>
Disconnect a relational NURBS set from its scene object, turning it into a non-relational
set.
deleteObjects <nurbsset>
This method deletes all the NURBSObjects in a NURBSSet, and frees its memory.
getProdTess <nurbsset> <tessType_name>
setProdTess <nurbsset> <tessType_name> <NURBSSurfaceApproximation>
getViewTess <nurbsset> <tessType_name>
setViewTess <nurbsset> <tessType_name> <NURBSSurfaceApproximation>
These methods get and set renderer and viewport NURBSSurfaceApproximation values for
individual surfaces, where <tessType_name> is one of #surface, #displacement, or
#curve corresponding to the 3 kinds of tessellation that can be controlled on a surface.
clearProdTess <nurbsset> <tessType_name>
clearViewTess <nurbsset> <tessType_name>
Resets the surface approximation settings for the surfaces in the NURBSet for the given
tessellation type, where <tessType_name> is one of #surface, #displacement, or
#curve corresponding to the 3 kinds of tessellation that can be controlled on a surface.
See also
Value Common Properties, Operators, and Methods (p. 714)
NURBSSurfaceApproximation : Value 1453
NURBSSurfaceApproximation : Value
Instances of this class contain a complete surface approximation setting that can be used to set the
approximation for NURBS objects described by NURBSSet values or directly in existing NURBS scene
node. You use the setViewApproximation() and setRenderApproximation() functions on
existing scene nodes and the .viewApproximation and .renderApproximation properties on
NURBSSet values.
Constructors:
NURBSSurfaceApproximation [<property>:<val>]...
Any of the object’s properties may be set via optional keyword arguments on the
constructor.
<nurbsset>.viewApproximation
<nurbsset>.renderApproximation
Properties:
<nurbssurfaceapproximation>.config : #isoOnly, #isoAndMesh, #meshOnly
This property determines what is displayed in the interactive or scanline renderer.
If #isoOnly is specified, only Iso lines are displayed. Iso (parametric) lines are similar to
contour lines. The lines show where the NURBS surface has a constant U or V value or
both. Iso line representations can be less crowded and easier to visualize than wire mesh
representations.
If #isoAndMesh is specified, Iso lines and the mesh are displayed. When chosen,
wireframe viewports display iso line representations of the surface, and shaded viewports
display the shaded surface.
If #meshOnly is specified, just the mesh is displayed. When chosen, wireframe viewports
display the surface as a wire mesh, and shaded viewports display the shaded surface. In
wireframe viewports, this option lets you see the curve approximation used for viewports.
<nurbssurfaceapproximation>.isoULines : integer
This is used with the ISO line display. This is the number of additional interior iso lines in
U (there are always lines along the outer edges).
<nurbssurfaceapproximation>.isoVLines : integer
This is used with the ISO line display. This is the number of additional interior iso lines in
V (there are always lines along the outer edges).
<nurbssurfaceapproximation>.meshUSteps : integer
This is used for parametric tessellation. This is the number of tessellations in U. This is the
number of sub-divisions for a knot span for the surface.
<nurbssurfaceapproximation>.meshVSteps : integer
This is used for parametric tessellation. This is the number of tessellations in V. This is the
number of sub-divisions for a knot span for the surface.
1454 Chapter 11 | 3ds max Objects
See also
Value Common Properties, Operators, and Methods (p. 714)
NURBSTextureSurface : Value 1455
NURBSTextureSurface : Value
This class contains an editable texture coordinate surface corresponding to the editable texture
surface in NURBS surfaces. You can create and apply them to any NURBSSurface value or retrieve
existing texture surfaces using the getTextureSurface() and setTextureSurface() methods
to access any of the 99 texture channels for a NURBS surface.
3ds max uses the texture surface to control how materials are mapped. In effect, changing the
texture surface stretches or otherwise changes the UV coordinates for the surface, altering the
mapping. This is a 2D (not 3D) surface that lives in the parameter space of the corresponding
NURBSSurface which controls the texture mapping used by the NURBSSurface.
It is not possible to assign texture surfaces to NURBS objects that are present in the scene. You can
create new NURBSSets and the texture surface is used when you call createNURBSObject().
However, if you do a getNURBSSet() and assign a NURBSTextureSurface to a texture channel for a
NURBS surface, nothing happens.
Constructors:
NURBSTextureSurface [<property>:<val>]...
Any of the object’s properties may be set via optional keyword arguments on the
constructor.
getTextureSurface <nurbssurface> <channel_index>
<nurbssurface>.textureSurface1
<nurbssurface>.textureSurface2
Provides backward compatibility for scripts written for 3ds max R2.5. Get and set the
texture surfaces for the first two texture channels.
Properties:
<nurbstexturesurface>.type : #default, #userDefined, #projected
The type of texture surface.
<nurbstexturesurface>.parent : integer
The parent surface by NURBSet index.
<nurbstexturesurface>.parentID : integer
The parent surface by NURBSId.
<nurbstexturesurface>.numUPoints : integer -- read-only
<nurbstexturesurface>.numVPoints : integer -- read-only
<nurbstexturesurface>.numPoints : point2
The number of U and V points.
Methods:
getPoint <nurbstexturesurface> <u_index> <v_index>
setPoint <nurbstexturesurface> <u_index> <v_index> <texturepoint>
Get or set a NURBSTexturePoint value for the texture point at the U and V index of the
texture surface.
1456 Chapter 11 | 3ds max Objects
Associated Methods:
setTextureSurface <nurbssurface> <channel_index> <NURBSTextureSurface>
This method sets the texture surface for the selected channel.
Note:
The NURBSTextureSurface class has been updated to correspond to the new texture surface
mechanism in 3ds max 4, and has different properties and methods that were defined in
3ds max R3.
See also
NURBSSurface (p. 1425)
Value Common Properties, Operators, and Methods (p. 714)
Biped : System
Constructor:
Biped systems are nor creatable by MAXScript.
Properties:
There are no properties associated with Physique.
Biped-Related Classes 1457
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Biped-Related Classes
The following classes associated with Biped systems. Instances of these classes are not creatable by
MAXScript.
Geometry:
Biped_Object : GeometryClass
This class represents the each object within the biped system.
See also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Controllers:
Vertical_Horizontal_Turn : Matrix3Controller
This class represents the transform controller for the root object within the biped system.
BipSlave_Control : Matrix3Controller
This class represents the transform controller for each object within the biped system. If
the object does not have a transform controller (that is, it is a slave of another object in the
biped), a value of undefined is returned.
Footsteps : Matrix3Controller
This class represents both the transform controller for the footsteps and the footstep
object.
See also
Controller Common Properties, Operators, and Methods (p. 1289)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
1458 Chapter 11 | 3ds max Objects
BipedExportInterface Values
The BipedExportInterface class is an interface into a Biped.
Constructor:
getBipedExportInterface <biped_node>
Returns an instance of BipedExportInterface class. The biped_node can be any node
associated with the Biped system, including the footprints.
Methods:
setNonUniformScale <BipedExportInterface> <boolean>
Biped-based bone systems created prior to character studio version R2.1 have non-uniform
scaling on the nodes that make up the biped object. This scaling can cause difficulties
when exporting the biped. This function removes or restores the non-uniform scaling on a
biped object. If <boolean> is true the non-uniform scaling will be set, and false will
remove it. All non-uniform scaling information has been removed from new bipeds
created with version R2.1 or greater of character studio, and this method is not required
for exporting these bipeds.
Physique : Modifier
Constructor:
physique ...
Properties:
There are no properties associated with Physique.
See also
Modifier Common Properties, Operators, and Methods (p. 1096)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
PhyContextExport Values
The PhyContextExport class is an interface into the physique vertex data. It can be used to retrieve
vertex data of the modifier. Currently it only supports rigid vertices (blended and non-blended). You
can use convertToRigid() to convert all vertices into rigid.
Constructor:
getPhyContextExport <node> <physique_modifier>
Returns an instance of PhyContextExport class.
Properties:
<GetPhyContextExport>.numVerts
Returns the number vertices in the object. This property is read-only.
PhyRigidVertex Values 1459
Methods:
convertToRigid <PhyContextExport> <boolean>
Converts all vertices into rigid vertices. If a true value is passed then
getVertexInterface() converts a deformable vertex into a rigid vertex and returns the
vertex. If a false value is passed then getVertexInterface() returns undefined for a
deformable vertex.
allowBlending <PhyContextExport> <boolean>
If a true value is passed then getVertexInterface() returns a PhyBlendingRigidVertex,
if a vertex is blended, otherwise undefined.
getVertexInterface <PhyContextExport> <index_integer>
Returns the vertex given the vertex index. The vertex can be either PhyRigidVertex or
PhyBlendingRigidVertex.
See also
PhyRigidVertex Values (p. 1459)
PhyBlendingRigidVertex Values (p. 1459)
PhyRigidVertex Values
The PhyRigidVertex class representing a rigid vertex in a Physique modifier. A rigid vertex can be
linked to only one node.
Constructor:
getVertexInterface <PhyContextExport> <index_integer>
Returns the vertex given the vertex index. The vertex can be either PhyRigidVertex or
PhyBlendingRigidVertex.
Methods:
getNode <PhyRigidVertex>
Returns the node the vertex is linked to.
getOffsetVector <PhyRigidVertex>
Returns the coordinates of the vertex in the local coordinates of associated node.
PhyBlendingRigidVertex Values
The PhyBlendingRigidVertex class representing a blended vertex in a Physique modifier. A blended
vertex can be linked to multiple nodes.
Constructor:
getVertexInterface <PhyContextExport> <index_integer>
Returns the vertex given the vertex index. The vertex can be either PhyRigidVertex or
PhyBlendingRigidVertex.
1460 Chapter 11 | 3ds max Objects
Properties:
<PhyBlendingRigidVertex>.numNodes
Returns the number of nodes the vertex is linked to. This property is read-only.
Methods:
getNode <PhyBlendingRigidVertex> <index_integer>
Returns the indexed node the vertex is linked to.
getOffsetVector <PhyBlendingRigidVertex> <index_integer>
Returns the coordinates of the vertex in the local coordinates of indexed node.
getWeight <PhyBlendingRigidVertex> <index_integer>
Returns the weight of the indexed node on the vertex.
Missing_RefTarget
Standin for missing Reference Target class objects.
Missing_Render_Effect
Standin for missing Render Effect class objects.
Missing_Rotation_Control
Standin for missing Rotation controller class objects.
Missing_Scale_Control
Standin for missing Scale controller class objects.
Missing_Shape
Standin for missing Shape class objects.
Missing_System
Standin for missing System class objects.
Missing_TextureMap
Standin for missing TextureMap class objects.
Missing_UVGen
Standin for missing UVGen class objects.
Missing_WSM
Standin for missing World Space Modifier class objects.
Missing_WSM_Object
Standin for missing World Space Modifier Object class objects.
Missing_XYZGen
Standin for missing XYZGen class objects.
For FFD modifiers, the animateAll() method will animate all the control points, and is equivalent
to animateVertex <ffd_modifier> #all. Its syntax is:
animateAll <ffd_modifier>
Animates all control points.
The animateVertex() and animateAll() methods effectively assign controllers to editable
meshes, spline shapes and FFD modifiers which make them appear as animatables in the Track View,
allowing further scripting of these vertex animation controllers.
1462 Chapter 11 | 3ds max Objects
Examples:
animateVertex $line01 2
animateVertex $box01 #(2,3,4,5)
animateAll $box01.ffd_3x3x3
These animateVertex() method only work on editable meshes, spline shapes and FFD modifiers
and will report an error if applied to other types of objects. You can use the functions
convertToMesh() and convertToSplineShape() to convert existing geometry into the needed
forms. Note that Line objects are SplineShapes already and don’t need conversion.
The vertices to be animated are specified by index number, with the keyword #all to animate all
vertices or control points, or #selected to animate the currently selected vertices. The #selected
keyword is not applicable to FFD modifiers. In the case of SplineShapes, the vertex index numbers
are interpreted in a special way to accommodate tangent handles and multiple curves, as follows:
• Each SplineShape vertex has three indexes, one for each in-tangent handle, vertex, and out-
tangent handle, in that order.
• The indexes run consecutively through each curve in a multi-curve shape, with the index
number for the first in-tangent handle of a curve starting after the index of the last out-tangent
handle in the prior curve.
See also Class and Object Inspector Functions (p. 799) for details on accessing the vertices, tangents, or
control points.
For information about scripting FFD control placement within FFD lattice space, see also the
getModContextBBoxMin() and getModContextBBoxMin() functions, as described in the Modifier
Common Properties, Operators, and Methods (p. 1096) topic.
For editable meshes and spline shapes, the controller values assigned to the vertices, knots, and
tangent handles is in object space. See the Using Node Transform Properties (p. 843) topic for
information on converting between world space to object space.
Chapter 12: Creating MAXScript Tools
Scripted Utilities
MAXScript provides a set of classes and functions and some special syntax to allow you to construct
custom rollouts that can be incorporated into the existing 3ds max user interface. You typically use
custom rollouts to provide a point-and-click interface to a tool that you have written or want to
write in MAXScript, so users of your tool don’t have to work with it at the script level.
There are two places in the 3ds max user interface where you can install scripted rollouts:
• In the Utilities panel. You use the utility definition construct in MAXScript to define and install
scripted utilities. Once installed, they appear in the Utilities list at the bottom of the MAXScript
rollout. If the user selects a utility in this list, its rollout(s) appear below the MAXScript rollout
and functions just like a plug-in utility.
• In special modeless rollout floater windows that you can create with the newRolloutFloater()
function. These windows appear on the desktop and function in a way similar to the Material
Editor and the Selection floater in 3ds max. You can click to alternate between them and the
main 3ds max user interface. You create individual rollout(s) for these windows using the rollout
definition construct in MAXScript and install them in a rollout floater window using the
addRollout()function.
Choosing which place is best for your scripted rollouts depends on a number of factors. It is best to
keep them in the Utilities panel if possible, as that maximizes the use of the screen and is consistent
with the 3ds max user interface conventions. However sometimes it is useful to have them in a
modeless window if the user of your tool needs to move between the various command panels while
using the tool. In some cases, you might want to provide a “float me” button on a scripted Utility
rollout, similar to the Color Clipboard utility, so the user can choose to display the rollouts in a
rollout floater window or in the Utilities panel.
The following topics provide information about scripting utility panels and rollout floater windows:
Scripted Utility Panels (p. 1464)
Utility Clauses (p. 1466)
Managing Multiple Rollouts in a Scripted Utility (p. 1468)
1464 Chapter 12 | Creating MAXScript Tools
The <var_name> is the name of an automatically created global variable to hold the value that
represents the scripted utility panel.
The <description_string> is a string which is used as the description for the utility in the
Utilities list in the MAXScript rollout.
The optional rolledUp: parameter specifies whether the utility rollout is initially rolled up. If set
to true, the utility rollout is initially rolled up. The default value is false.
The optional silentErrors: parameter controls whether MAXScript runtime error messages are
displayed while executing the scripted utility. If this parameter is set to false, error messages are
displayed to Listener and possibly to a pop-up error dialog, and continued execution of the utility
is terminated. If this parameter is set to true, error messages will not be displayed, and continued
execution of the utility is permitted. Setting this parameter to true is useful for distributed scripted
plug-ins that may confuse the user with MAXScript error messages. The default value is false.
The <utility_body> is inside the required parentheses and is a sequence of clauses that defines
the user-interface items that will appear in the utility, along with functions and event handlers that
process user interactions, as defined in detail in the Utility Clauses (p. 1466) topic.
Here is a short example that implements a utility for spreading the positions of the objects in the
current selection. It installs a Spread objects entry in the Utilities list. When opened, the Spread
objects rollout has three check boxes and one spread amount spinner. The spread spinner event
handler is called whenever the user adjusts the spinner, and the event handler expression computes
a new position for the objects in the selection, testing the state of each check box to control the
spread.
Scripted Utility Panels 1465
Script:
utility spread “Spread objects” -- define the utility name and description string
( local last_amt = 0 -- define and initialize local variable
--
checkbox x “Spread in x” -- create 3 checkboxes
checkbox y “Spread in y”
checkbox z “Spread in z”
spinner spread “Spread amount:” range:[-1000,1000,0] -- create a spinner
--
on spread changed amt do -- when spinner value changes...
( delta = amt - last_amt -- calculate difference in current and previous
for obj in selection do -- values for each selected object
(
-- calculate new position based on current position and selection center
p = obj.pos + normalize (obj.pos - selection.center) * delta
if x.checked then obj.pos.x = p.x -- if checkbox x checked, apply X position
if y.checked then obj.pos.y = p.y -- if checkbox y checked, apply Y position
if z.checked then obj.pos.z = p.z -- if checkbox z checked, apply Z position
)
last_amt = amt -- store spinner value as previous value
) -- end of “on spread changed”
) -- end of utility definition
The Utilities panel rollout created by the previous script looks like the following figure. The Close
button is automatically created by MAXScript in the utility rollout, and closes the rollout.
Evaluating a utility definition does several things. It creates a new value which is an instance of the
Rollout class and contains the utility definition. It assigns this value to the named global variable
and installs the utility description in the Utilities list in the MAXScript rollout. At this point, the user
can select the utility from the Utilities list and the utility’s rollout(s) will open.
Note: If a scripted utility already exists with the same description, the old rollout(s) is replaced with
the new one(s), even if it is currently open in the Utilities panel. This allows you to incrementally
develop a utility. Each time you modify and evaluate its definition, the old version is replaced with
the new one.
1466 Chapter 12 | Creating MAXScript Tools
Utility Clauses
The <utility_body> of a scripted utility definition is composed of a sequence of utility clauses as
follows:
<utility_body> ::= { <utility_clause> }+
where
<utility_clause> ::= <rollout_clause> |
<nested_rollout>
where
<rollout_body> ::= { <utility_clause> }+
In other words, a rollout definition is identical to a utility definition except its description string is
not displayed in the Utilities list in the MAXScript rollout. In fact, a utility can just be considered a
special case of a rollout, and both are instances of the Rollout class.
As an example, consider the following script. In this script, line 1 defines the start of the utility, and
the utility body is lines 2 through 42. The following line ranges are utility clauses: 3 (a rollout
clause), 5 to 9 (a nested rollout), 11 to 30 (a nested rollout), 32 to 35 (a rollout clause), and 37 to 40
(a rollout clause).
Script:
utility MyUtil “My Utility”
(
local pot
--
rollout bout “About My Utility”
( button aboutMU “About” width:45 height:20
on aboutMU pressed do
messagebox “My First Utility\nby ME\nVersion .1” \
title:”About My Utility”
)--end rollout bout
--
rollout creator “The Teapot”
( group “Object Creator”
( button tea “Teapot”
spinner rad “Radius” range:[10,50,20] type:#integer
spinner seg “Segments” range:[4,32,12] type:#integer scale:1
)
Utility Clauses 1467
--
on tea pressed do
( pot=teapot radius:rad.value
pot.name=”TestPot”
pot.segs=seg.value
) -- end on tea pressed
--
on rad changed value do
pot.radius=value
--
on seg changed value do
pot.segs=seg.value
--
) -- end rollout creator
--
on MyUtil open do
( addRollout bout
addRollout creator
) -- end on MyUtil open
--
on MyUtil close do
( removeRollout bout
removeRollout creator
) -- end on MyUtil close
--
)--end utility MyUtil
The Utilities panel rollouts created by the previous script look like the following:
You can also define rollouts outside utility definitions when you want to add them to a rollout
floater window that may not be associated with a scripted utility. This is described more fully in the
Rollout Floater Windows (p. 1477) topic.
1468 Chapter 12 | Creating MAXScript Tools
A value is created for a utility or rollout when the script defining the utility or rollout is executed.
In general, the lifetime of a utility value is the entire 3ds max session, unless a new utility with the
same name is executed. The lifetime of a rollout defined in a utility is the lifetime of the utility value.
The lifetime of a rollout defined outside a utility is the lifetime of the context the rollout was defined
in. For more information, see the Scope of Variables (p. 646) topic.
Such nested rollouts can contain anything a utility definition can contain with the exception of
further nested rollouts. Nested rollouts are not automatically opened or closed when the parent
utility rollout opens and closes. You need to explicitly do this in the open and close handlers or other
handlers or functions in the utility. There are two new functions for this:
addRollout <rollout> [ rolledUp:<boolean> ]
removeRollout <rollout>
The rolledUp: parameter on the addRollout() function specifies whether the rollout is added in
a rolled-up state. This defaults to false, so the rollout is added fully opened. The nested rollouts are
arranged in the order of addRollout() calls, so take care in sequencing these to ensure the order
you want.
The nested rollouts do not automatically get removed when the main utility rollout is closed. You
must make sure they are explicitly removed, typically in the close handler for the main utility.
Managing Multiple Rollouts in a Scripted Utility 1469
To always open and close extra rollouts when the main utility is opened and closed, place
addRollout() and removeRollout() calls in the main utility open and close handlers. For
example:
on foo open do
(
...
addRollout panel_1
addRollout panel_2 rolledUp:true
...
)
on foo close do
(
...
removeRollout panel_1
removeRollout panel_2
...
)
Calling removeRollout() on an already closed rollout is OK and does nothing. If, during utility
development, you forget to close a nested rollout, closing the entire MAXScript utility will remove
any remaining open scripted rollouts.
Because these rollout definitions are nested within a utility, all the locals, functions, and other items
in the utility are visible to nested rollouts, following the standard nested scoping in MAXScript. This
means you can “reach out” and access the utility’s locals, user-interface control items, and functions.
Conversely, user-interface control items and locals in nested rollouts are exposed as properties of
that rollout, so code in the main utility or other rollouts can “reach in” and access them. In the
following example, the spinner bar change handler looks at the state of a check box in the nested
rollout baz:
utility foo “name”
(
local ...
spinner bar ...
...
rollout baz “name”
(
local ...
checkbox baz_enable ...
on ...
)
...
on bar changed val do
if baz.baz_enable.checked == true then ...
1470 Chapter 12 | Creating MAXScript Tools
Rollout Clauses
Rollout clauses define the components of a rollout (utilities are considered a special case of rollouts)
and can be one of four basic things:
• Local variables, functions, or structure definitions are variables, functions, and structures whose
scope is the rollout. These locals will exist as long as the rollout value exists. The rollout value
will exist until a new value is assigned to the rollout’s variable name. Local variables are
particularly useful for storing working data associated with the rollout such as picked objects or
arrays of generated objects. The visibility of locals, and accessing rollout locals from external
code, are described in the Visibility of Locals, Functions, Structures, and User-Interface Items in
Rollout Code (p. 1478) and Accessing Locals and Other Items in a Rollout from External Code (p. 1480)
topics.
• Mouse tools are used to perform a set of actions based on mouse clicks in the 3ds max viewports,
and are described in the Scripted Mouse Tools (p. 1531) topic.
• User-interface control items are elements displayed in the rollout, such as buttons, spinners,
and list boxes.
• Event handlers are special kinds of functions associated with particular user-interface control
items. Event handlers specify the processing you want to occur when a user interacts with a user-
interface item. For example pressing a button or adjusting a spinner. These user actions generate
named events and the optional event handler you supply for that event is called when the user
action occurs. For example, if you press a button named DoIt, the on DoIt pressed event
handler expression is executed.
Formally, the syntax of a <rollout_clause> is defined as follows:
<rollout_clause> ::= <local_variable_decl> |
<local_function_decl> |
<local_struct_decl> |
<mousetool> |
<user_interface_item> |
<item_group> |
<event_handler>
Locals:
A <local_variable_decl>, <local_function_decl>, and <local_struct_decl> are exactly
the same as local variable, function, and structure definitions in MAXScript:
<local_variable_decl> ::= local <decl> { , <decl> }
<decl> ::= <name> [ = <expr> ] -- optional initial value
Global variables cannot be declared as a rollout clause, however they can be declared within event
handler scripts. If you need to ensure that a variable name references a global variable, declare the
variable name as global immediately before defining the utility in your script.
When writing scripts, it is good programming practice to explicitly declare your local and global
variables. Implicit declaration is provided as a short-hand, typically used when working in the
Listener interactively or developing short scripts. When developing extended scripts, explicitly
declaring variables can reduce errors and improve readability of the code. It is also recommend that
you declare as local all variables unless you really want them to be global variables. The reasons for
this are described in the Scope of Variables (p. 646) topic.
User-Interface Items
A <user_interface_item> defines an individual button, check box, spinner, or other user-
interface control item that will appear in the rollout. These user-interface control items are described
in the Rollout User-Interface Controls (p. 1481) topic.
An <item_group> is used to place a sequence of user-interface items in a labeled box in the rollout,
so you can organize large rollouts into meaningful groups. Its syntax is:
group <group_label_string> ( { <user_interface_item> } )
group “Exclusions/Inclusions”
( Button DispExcl “Unhide Exclusions&Inclusions”
)
1472 Chapter 12 | Creating MAXScript Tools
The Utilities panel rollout which the previous script generates looks like the following figure.
Event Handlers:
An <event_handler> is a special function definition local to a utility or rollout that you provide
to handle the processing you want to occur when a user performs an action on a user-interface item.
For example, event handlers are called when the user presses a button or adjusts a spinner, opens or
closes the utility or rollout, or resizes or moves a rollout floater window. These user actions generate
named events and any event handler you supply for that event is called when the action occurs. The
syntax for defining an event handler is as follows:
on <item_name> <event_name> [ <argument> ] do <expr>
Rollout Clauses 1473
The <item_name> specifies the name of the item to which this handler is connected. The
<event_name> specifies the type of event to be handled and the optional <argument> is used to
pass various values to the handler. The possible events you can specify depend on the item type.
These events include:
pressed
changed
picked
entered
selected
resized
moved
open
close
The available events and the arguments passed are defined in the description for each user-interface
item type, as listed in the Rollout User-Interface Controls (p. 1481) topic. The available events and the
arguments passed for utilities and rollouts are described in the Utility and Rollout Properties, Methods,
and Event Handlers (p. 1474) topic.
You can access and invoke the event handler functions in a scripted rollout by referring to the
handlers as properties on the user-interface items. The event handler functions are accessed as
sub-properties of the item, using the event name as the sub-property name. For example, if a scripted
rollout had a check box item named foo, and an on foo changed event handler was defined, you
could invoke the handler as follows:
foo.changed true -- call foo’s ‘changed’ handler function, passing argument of true
Or, if a scripted rollout had a button item named apply, and an on apply pressed event handler
was defined, you could invoke the handler as follows:
apply.pressed() -- call apply’s ‘pressed’ handler function, no argument.
You can access an event handler function as a sub-property of the item. For example,
ApplyPressedEH = apply.pressed
stores a copy of the on apply pressed event handler function value to variable ApplyPressedEH.
The event handler functions can only be read in this way. You cannot set the handler function to
another user-defined function.
1474 Chapter 12 | Creating MAXScript Tools
Event Handlers:
In addition to the event handlers you specify for particular user-interface items in a rollout, you can
define handler functions that are called when an entire rollout is first opened (open) or explicitly
closed (close) by the user. These event handlers are useful for initialization code or for cleaning up
when a rollout closes, and are necessary when managing multiple rollouts in one scripted utility. If
a rollout floater window is resized or moved, an event handler (resized or moved, respectively)
is called on the first rollout in the rollout floater window. An additional event handler (oktoclose)
is called to verify that it is OK to close a rollout. The syntax is as follows:
on <rollout_or_utility> open do <expr>
Called when the rollout or utility is opened.
on <rollout_or_utility> close do <expr>
Called when the rollout or utility is closed.
on <rollout_or_utility> oktoclose do <expr>
Called when the user clicks the rollout’s Close button so the script writer can decide
whether to allow the close to proceed. If the expression evaluates to the value true, the
rollout is allowed to close. If the expression evaluates to the value false, the action
attempting the close is ignored and the rollout or utility is left open.
on <rollout> resized <arg> do <expr>
Called on first rollout in a rollout floater window when it is resized either by the user or by
a script changing the size property of the rollout floater window. Changing the rollout
floater window size in the resized event handler expression will not cause the resized
event handler to be called again. The value of <arg> is the current width and height of the
rollout floater window. For example:
global my_rof_size
...
on my_rollout resized size do
( my_rof_size = size -- save the new window size
)
The following example keeps a log file of its actions, and uses the rollout open and close handlers
to open and close the log file:
utility frab “Optimal Frabulator”
(
local log
spinner frab_x ...
button do_it “Enfrabulate now”
...
on do_it pressed do
(
frabulate selection
format “selection frabbed at %\n” localTime to:log
)
on frab open do log = createFile “frabulator.log”
on frab close do close log
)
In the following example the utility will not close unless the “OK To Close” check button is pressed:
Script:
utility ui_oktoclose “OKToClose Test”
(
checkbutton a2 “OK To Close”
on ui_oktoclose oktoclose do a2.state
)
In the following example the on a resized event handler is called when the rollout floater window
is resized. Because the event is generated only for the first rollout in a rollout floater window, the
on b resized event handler is never called.
Script:
rollout a “Rollout A”
( button a1 “a1”
on a resized val do (format “A: %\n” val)
)
--
rollout b “Rollout B”
( button b1 “b1”
on b resized val do (format “B: %\n” val)
)
--
rof=newrolloutfloater “test” 200 200
addrollout a rof
addrollout b rof
rof.size=[300,300]
Rollout Floater Windows 1477
the resized and moved events are described in the Utility and Rollout properties, Methods, and Event
Handlers (p. 1474) topic.
Example:
rollout grin “Grin Control”
( slider happy “Happy” orient:#vertical across:5
slider sad “Sad” orient:#vertical
slider oo “OO” orient #vertical
slider ee “EE” orient #vertical
slider oh “OH” orient:#vertical
In some situations, cross-referencing means there’s no way to order definitions and still pre-define
everything. To remedy this, MAXScript lets you pre-declare local rollouts and functions, so code that
comes before the function or rollout definition will see the correct object. You do this by declaring
such rollouts and functions as uninitialized locals. In the following example, there are two rollouts,
ro1 and ro2, that each want to reference items within the other. By pre-declaring them as locals in
the main utility, this cross-referencing is possible:
Visibility of Locals, Functions, Structures, and User-Interface Items in Rollout Code 1479
As a general rule, it is recommended that all local variable names be explicitly declared as locals at
their outermost scope. This will prevent any conflicts from occurring if another script has declared
the same variable name as a global variable. While functions, structures definitions, and rollouts will
always be local to the utility they are defined in (even if they have the same name as a global
variable), declaring these as local will ensure the variables are defined, even if the order in which
they are defined is changed. Here’s an example showing these declarations:
utility foo “Object Frabulator”
(
-- local variables
local target_obj
-- local functions
local prop_name
-- local rollouts
local setup
on foo close do
removeRollout setup -- always close rollouts
label hello
pickbutton pick_tgt “Pick object”
on pick_tgt picked obj do
( target_obj = obj -- access utility local
name_box.text = obj.name -- access utility item
prop_name obj obj.name -- call utility local fn
)
)
)
The example defines the utility and places the utility object in a global variable named foo. You can
access components in the utility from the Listener or other code as properties of that object, using
the name of the variable or item as the property name. Any event-handler functions supplied for
user-interface items can also be accessed as sub-properties of the item, using the event name as the
property name. For example:
print foo.var1 -- get foo’s local variable, var1
if foo.enable then ... -- test foo’s enabled checkbox
foo.enable = false -- set it
foo.enable.changed false -- call its ‘changed’ handler function
foo.frab $box01 $box02 -- call its ‘frab’ function
foo.setup.var3=10 -- set foo’s setup rollout local variable, var3
foo.setup.doit.pressed() -- call ‘changed’ handler function for doit button in
setup rollout
Rollout User-Interface Controls Common Properties 1481
The local variables, functions, and structures in scripted utilities and rollouts are initialized as soon
as the utility or rollout is first defined, rather than when the utility or rollout is first displayed. This
allows other code to use local functions and set local values at any time after definition.
The item types correspond to the types of user-interface control items you see in typical 3ds max
rollouts. The types of user-interface control items are described in the Rollout User-Interface Control
Types (p. 1484) topic.
The <name> is used to name an automatically constructed rollout local variable that will hold the
value representing the control item, and is used to associate event handler functions with the
control item. The optional <label_string> is used as a caption, item label, or text content
depending on the control item type, as described in the topics for each type. The optional
<parameters> is a sequence of keyword arguments used to set options or influence layout for the
control item. The exact parameters that each control item type supports is also defined in the topics
for each type.
There are properties associated with each of the user-interface control item types. The properties that
are common to all user-interface control item types are described in the Rollout User-Interface Controls
Common Properties (p. 1481) topic. Properties that are unique to a user-interface control item type are
defined in the topics for each type.
As you define a sequence of control items, MAXScript will by default automatically lay them out in
the rollout, one below the other in the order they are defined. You can override this layout or make
adjustments to it using special layout parameters defined in the Rollout User-Interface Controls
Common Layout Parameters (p. 1483) topic.
$bar.pos.x = x_spinner.value
get current value from spinner x_spinner
All of the user-interface common properties except for caption (the label string value is used as the
caption) can be specified as parameters when the user-interface item is constructed. For example:
button foo “Press Me!” enabled:false
See also
Rollout User-Interface Controls (p. 1481)
Rollout User-Interface Controls Common Layout Parameters (p. 1483)
Rollout User-Interface Controls Common Layout Parameters 1483
See also
Rollout User-Interface Controls (p. 1481)
Rollout User-Interface Controls Common Properties (p. 1481)
Bitmap
A bitmap item is used to place a bitmap image on the rollout. The syntax is:
bitmap <name> [ <caption> ] \
[ fileName:<filename_string> | bitmap:<bitmap> ]
The default alignment of bitmap items is #center. There is no caption or text displayed with
bitmap items.
Example:
bitmap the_bmp fileName:”my_pic.bmp”
Parameters:
fileName:
The name of the bitmap file to load and display. The size of the bitmap image in the
rollout is the bitmap file image size. The specified file name is searched for in the following
directories (in order of search): current MAXScript directory, MAXScript startup directory,
MAXScript directory, 3ds max bitmap directories, and then the 3ds max image directory.
bitMap:
You can specify a bitMap: creation parameter in place of the fileName: parameter that is
used to specify a bitmap file. This allows you to use an existing bitmap value, such as those
generated by a call to the render function. You can set bitmap to an “empty” image of a
specified size by specifying a bitmap value constructor. For example:
bitmap BitmapImage bitmap:(bitmap 50 50)
Properties:
<bitmap>.fileName String
The bitmap item file name as a string. You can change the image at any time by setting
this property to a new name, but it will not resize the display area in the rollout; it will
always be the size set from the initial image.
<bitmap>.bitmap TextureMap
A write-only property that is used to set the image displayed from a MAXScript bitmap
value, as might be derived from functions like render() or selectBitmap(). You can
change the image at any time by setting this property to a bitmap value, but it will not
resize the display area in the rollout; it will always be the size set from the initial image.
Events:
-- none --
See also
Rollout User-Interface Items Common Properties (p. 1481)
Rollout User-Interface Items Common Layout Parameters (p. 1483)
Rollout User-Interface Control Types (p. 1484)
1488 Chapter 12 | Creating MAXScript Tools
Button
A button item is used to place a press button on the rollout which the user can click, typically to
have some task performed. The syntax is:
button <name> [ <caption> ] [ images:<image_spec_array> ] \
[ toolTip:<string> ]
Parameters:
images:
An image-specification array for providing bitmap images for the button. If this is
specified, the <label> is ignored and the contents of the button are replaced with the
bitmaps. The form is:
images:#(<image>, <maskImage>, <count_integer>, \
<enabled_out_image_index>, <enabled_in_image_index>, \
<disabled_out_image_index>, <disabled_in_image_index>)
would use sub-images 1 and 4 of bitmaps dcybtns.bmp and dcymask.bmp for the out
and in states of the button, respectively.
See also the Image Buttons (p. 1513) topic.
toolTip:
Provides text for a tooltip for the button; no tooltip if unsupplied.
Checkbox 1489
Properties:
<button>.images Array
Sets the image-specification array for the button. For example:
-- re-render, update button
bm1 = render()
foo.images = #(bm1, undefined, 1, 1, 1, 1, 1)
See also
Rollout User-Interface Items Common Properties (p. 1481)
Rollout User-Interface Items Common Layout Parameters (p. 1483)
Rollout User-Interface Control Types (p. 1484)
Checkbox
A checkbox item is used to place a check box on the rollout. The user can click to successively switch
between states. The syntax is:
checkbox <name> [ <caption> ] [ checked:<boolean> ]
...
if frab_enable.checked then frabulate master_obj
...
Parameters:
checked:
Initial state of the check box, defaults to false (unchecked).
Properties:
<checkbox>.checked Boolean
The state of the check box, on (true) or off (false).
<checkbox>.state Boolean
Synonym for .checked
1490 Chapter 12 | Creating MAXScript Tools
Events:
on <checkbox> changed <arg> do <expr>
Called when the user clicks the check box to check or uncheck it. The <arg> argument
contains the new state of the check box, on (true) or off (false).
See also
Rollout User-Interface Items Common Properties (p. 1481)
Rollout User-Interface Items Common Layout Parameters (p. 1483)
Rollout User-Interface Control Types (p. 1484)
Checkbutton
A checkbutton item is used to place a press button on the rollout that has two states, on and off, just
like a check box. The user can click to successively switch between states. The syntax is:
checkbutton <name> [ <caption> ] [ highlightColor:<color> ] \
[ toolTip:<string> ] \
[ checked:<boolean> ] \
[ images:<image_spec_array> ]
Parameters:
checked:
Initial state of the check button, defaults to off.
highlightColor:
The background color of the check button in its pressed (or on) state, defaults to a light-
gray wash in keeping with 3ds max user-interface conventions.
toolTip:
Provides text for a tooltip for the check button; no tooltip if unsupplied.
Checkbutton 1491
images:
An image-specification array for providing bitmap images for the check button. If this is
specified, the <label> is ignored and the contents of the check button are replaced with
the bitmaps. The form is:
images:#(<image>, <maskImage>, <count_integer>, \
<enabled_out_image_index>, <enabled_in_image_index>, \
<disabled_out_image_index>, <disabled_in_image_index>)
would use sub-images 1 and 4 of bitmaps dcybtns.bmp and dcymask.bmp for the out
and in states of the check button, respectively.
See also the Image Buttons (p. 1513) topic.
Properties:
<checkbutton>.checked Boolean
The state of the check button, on (true) or off (false).
<checkbutton>.state Boolean
Synonym for .checked
<checkbutton>.images Array
Sets the image-specification array for the check button. For example:
-- re-render, update button
bm1 = render()
foo.images = #(bm1, undefined, 1, 1, 1, 1, 1)
See also
Rollout User-Interface Items Common Properties (p. 1481)
Rollout User-Interface Items Common Layout Parameters (p. 1483)
Rollout User-Interface Control Types (p. 1484)
Colorpicker
A colorpicker item is used to place a 3ds max color selection swatch on the rollout. The user can click
the swatch to display a Color Selector dialog or drag colors to or from it. The syntax is:
colorpicker <name> [ <caption> ] [ color:<color> ] \
[ fieldWidth:<number> ] [ height:<number> ] \
[ title:<string> ]
Parameters:
color:
Initial color of the swatch. Defaults to blue.
title:
The title displayed on the Color Selector dialog. Defaults to “Choose a color”.
fieldWidth:
The width in pixels of the swatch. Defaults to 40.
height:
The height in pixels of the swatch. Defaults to 16.
Properties:
<colorpicker>.color Color
The current swatch color.
Events:
on <colorpicker> changed <arg> do <expr>
Called when the user selects a new color in the open Color Selector dialog for this swatch
or drops a new color on it. The <arg> argument contains the new color.
See also
Rollout User-Interface Items Common Properties (p. 1481)
Rollout User-Interface Items Common Layout Parameters (p. 1483)
Rollout User-Interface Control Types (p. 1484)
Combobox 1493
Combobox
A combobox item is used to place a combo box list in the rollout. This is a variant of the drop-down
list in which the list is always fully displayed in the rollout with an additional edit-text box at the
top of the list where the current selection is placed and may be edited. The user can scroll the list or
click to select an item in the list. The syntax is:
combobox <name> [ <caption> ] [ items:<array_of_strings> ] \
[ selection:<number> ] [ height:<number> ]
on scale_cb selected i do
format “You selected %\n!” scale_cb.items[i]
Parameters:
text:
The text string in the edit box.
items:
The array of text strings that are the items in the list
selection:
The 1-based number of the currently selected item in the list. Defaults to 1.
height:
The overall height of the combobox in number of item lines. Defaults to 10 lines. To have
a combobox display exactly N items in the list, set height to N+2.
Properties:
<combobox>.caption String
The text of the optional caption above the combo box.
<combobox>.text String
The text in the edit box.
<combobox>.items Array
The item string array.
<combobox>.selection Integer
The currently selected item number, 1-based. If the items list is an empty array, this value
is 0.
<combobox>.selected String
The text of the currently selected item. Can be used to replace individual items without
resetting the entire items array. If the items list is an empty array, this value is
undefined.
1494 Chapter 12 | Creating MAXScript Tools
Events:
on <combobox> selected <arg> do <expr>
Called when the user selects an item in the combo box list. The <arg> argument contains
the new current selection item number.
on <combobox> doubleClicked <arg> do <expr>
Called when the user double-clicks an item in the list. Note that the on selected handler
is always called on single clicks and on the first click of a double-click. The <arg>
argument contains the number of the item double-clicked. For example
combobox foo items:#(...)
on foo doubleClicked sel do ...
See also
Rollout User-Interface Items Common Properties (p. 1481)
Rollout User-Interface Items Common Layout Parameters (p. 1483)
Rollout User-Interface Control Types (p. 1484)
Dropdownlist
A dropdownlist item is used to place a drop-down list in the rollout. The user can click open the
list and scroll or click again to select an item in the list. The syntax is:
dropdownlist <name> [ <caption> ] [ items:<array_of_strings> ] \
[ selection:<number> ] [ height:<number> ]
on scale_dd selected i do
format “You selected %\n!” scale_dd.items[i]
Dropdownlist 1495
Parameters:
items:
The array of text strings that are the items in the list.
selection:
The 1-based number of the currently selected item in the list. Defaults to 1.
height:
The overall height of the dropdownlist in number of item lines. Defaults to 10 lines. To
have a dropdownlist exactly display N items in the list, set height to N+2.
Properties:
<dropdownlist>.items Array
The item string array.
<dropdownlist>.selection Integer
The currently selected item number, 1-based. If the items list is an empty array, this value
is 0.
<dropdownlist>.selected String
The text of the currently selected item. Can be set to replace individual items without
resetting the entire items array. If the items list is an empty array, this value is
undefined.
Events:
on <dropdownlist> selected <arg> do <expr>
Called when the user selects an item in the drop-down list. The <arg> argument contains
the new current selection item number.
Example:
rollout test “t”
( dropdownlist dd “dd” items:#(”1”,”2”,”3”,”4”,”5”,”6”,”7”,”8”,”9”,”10”) height:6
label l “L”
)
rof=newrolloutfloater “A” 200 200
addrollout test rof
you will get 5 items in the dropdown list. Change height to 5, and you get 3.
See also
Rollout User-Interface Items Common Properties (p. 1481)
Rollout User-Interface Items Common Layout Parameters (p. 1483)
Rollout User-Interface Control Types (p. 1484)
1496 Chapter 12 | Creating MAXScript Tools
Edittext
An edittext item is used to place an editable text field where the user can type and edit text. The
syntax is:
edittext <name> [ <caption> ] [ text:<string> ] \
[ fieldWidth:<integer> ] [bold:<boolean> ]
...
new_obj = copy master pos:[x,y,z] prefix:prefix_txt.text
...
Parameters:
text:
The text string in the edit box.
fieldWidth:
The width in pixels of the edit box. By default, the width is set to be from just after the
caption text to the right margin of the rollout.
bold:
If set to true, the text string in the edit box is displayed in bold format, if set to false, in
normal, non-bold format. The default value is false.
Properties:
<edittext>.text String
The text in the edit box.
<edittext>.caption String
The text of the optional caption next to the edit box.
<edittext>.bold Boolean
If true, the text is displayed in bold format, if false, in normal, non-bold format.
Events:
on <edittext> changed <arg> do <expr>
Called each time the user changes the text in the edit box; the <arg> argument contains
the new text in the edit box.
on <edittext> entered <arg> do <expr>
Called when the user enters text in the edit box and then presses ENTER or TAB to move
the cursor out of the field. The <arg> argument contains the new text in the edit box.
If you enter a string in the edit box and then press ENTER, the on changed handler is called once
per character and once for the ENTER. The on entered handler is just called once, for the ENTER.
Label 1497
See also
Rollout User-Interface Items Common Properties (p. 1481)
Rollout User-Interface Items Common Layout Parameters (p. 1483)
Rollout User-Interface Control Types (p. 1484)
Label
A label item is used to place static text on the rollout, perhaps a label for another item or a text
message. The syntax is:
label <name> [ <string> ]
Properties:
No additional properties for label.
Events:
-- none --
See also
Rollout User-Interface Items Common Properties (p. 1481)
Rollout User-Interface Items Common Layout Parameters (p. 1483)
Rollout User-Interface Control Types (p. 1484)
Listbox
A listbox item is used to place a list box in the rollout. This is another variant of the drop-down list
in which the list is always fully displayed in the rollout. Unlike combobox, it has no edit-text field
at the top and it is just a simple scrollable list. The user can scroll the list or click to select an item.
The syntax is:
listbox <name> [ <caption> ] [ items:<array_of_strings> ] \
[ selection:<number> ] [ height:<number> ]
on selns selected i do
copy obj_array[i] pos:[rand_x, rand_y, rand_z]
selns.selection = 2
1498 Chapter 12 | Creating MAXScript Tools
Parameters:
items:
The array of text strings that are the items in the list.
selection:
The 1-based number of the currently selected item in the list. The default selection value
is 1.
height:
The overall height of the listbox in number of item lines. Defaults to 10 lines. To have a
listBox display exactly N items, set height to N.
Properties:
<listbox>.items String
The item string array.
<listbox>.selection Integer
The currently selected item number, 1-based. If the items list is an empty array, this value
is 0.
<listbox>.selected String
The text of the currently selected item. Can be used to replace individual items with
resetting the entire items array. If the items list is an empty array, this value is
undefined.
Events:
on <listbox> selected <arg> do <expr>
Called when the user selects an item in the list. The <arg> argument contains the new
current selection item number.
on <listbox> doubleClicked <arg> do <expr>
Called when the user double-clicks on an item in the list. Note that the on selected
handler is always called on single clicks and on the first click of a double-click. The <arg>
argument contains the number of the item double-clicked. For example,
listbox foo items:#(...)
on foo doubleClicked sel do ...
See also
Rollout User-Interface Items Common Properties (p. 1481)
Rollout User-Interface Items Common Layout Parameters (p. 1483)
Rollout User-Interface Control Types (p. 1484)
Mapbutton 1499
Mapbutton
A mapbutton item is used to place a button in the rollout that will display the 3ds max Material/
Map Browser dialog when clicked. Only texture maps will be displayed in the Material/Map Browser
dialog. The syntax is:
mapbutton <name> [ <caption> ] [ map:<texturemap> ] \
[ images:<image_spec_array> ] [ toolTip:<string> ]
Parameters:
map:
The initial textureMap value returned by the map property before the user has selected a
texture map using the mapbutton. Defaults to undefined.
images:
An image-specification array for providing bitmap images for the mapbutton. If this is
specified, the <label> is ignored and the contents of the mapbutton are replaced with
the bitmaps. The form is:
images:#(<image>, <maskImage>, <count_integer>, \
<enabled_out_image_index>, <enabled_in_image_index>, \
<disabled_out_image_index>, <disabled_in_image_index>)
would use sub-images 1 and 4 of bitmaps dcybtns.bmp and dcymask.bmp for the out
and in states of the mapbutton, respectively.
See also the Image Buttons (p. 1513) topic.
1500 Chapter 12 | Creating MAXScript Tools
toolTip:
Provides text for a tooltip for the mapbutton. No tooltip if unsupplied.
Properties:
<mapbutton>.map TextureMap
The current textureMap value for the mapbutton, or the textureMap value specified by the
map parameter if the user has not yet selected a texture map.
<mapbutton>.images Array
Sets the image-specification array for the mapbutton. For example:
-- re-render, update button
bm1 = render()
foo.images = #(bm1, undefined, 1, 1, 1, 1, 1)
See also
Rollout User-Interface Items Common Properties (p. 1481)
Rollout User-Interface Items Common Layout Parameters (p. 1483)
Rollout User-Interface Control Types (p. 1484)
Materialbutton
A materialbutton item is used to place a button in the rollout that will display the 3ds max Material/
Map Browser dialog when clicked. Only materials will be displayed in the Material/Map Browser
dialog. The syntax is:
materialbutton <name> [ <caption> ] [ material:<material> ] \
[ images:<image_spec_array> ] \
[ toolTip:<string> ]
Example:
label smtl_lbl “Set selected object’s material to:”
materialbutton choosemtl “Pick Material”
Parameters:
material:
The initial material value returned by the material property before the user has selected a
material using the materialbutton. Defaults to undefined.
images:
An image-specification array for providing bitmap images for the materialbutton. If this
is specified, the <label> is ignored and the contents of the materialbutton are replaced
with the bitmaps. The form is:
images:#(<image>, <maskImage>, <count_integer>, \
<enabled_out_image_index>, <enabled_in_image_index>, \
<disabled_out_image_index>, <disabled_in_image_index>)
where <image> and <maskImage> can be either a bitmap file name string or a
MAXScript bitmap value. <count_integer> specifies the number of sub-images in
the bitmaps, and the image_index values specify which sub-image in the bitmaps is
to be used for each of the four materialbutton states. For example:
bm1 = render camera:$cam01 outputSize:[80,60]
...
materialbutton foo images:#(bm1, undefined, 1, 1, 1, 1, 1)
would use sub-images 1 and 4 of bitmaps dcybtns.bmp and dcymask.bmp for the out
and in states of the materialbutton, respectively.
See also the Image Buttons (p. 1513) topic.
toolTip:
Provides text for a tooltip for the materialbutton. No tooltip if unsupplied.
1502 Chapter 12 | Creating MAXScript Tools
Properties:
<materialbutton>.material Material
The current material value for the materialbutton, or the material value specified by the
material parameter if the user has not yet selected a material.
<materialbutton>.images Array
Sets the image-specification array for the materialbutton. For example:
-- re-render, update button
bm1 = render()
foo.images = #(bm1, undefined, 1, 1, 1, 1, 1)
See also
Rollout User-Interface Items Common Properties (p. 1481)
Rollout User-Interface Items Common Layout Parameters (p. 1483)
Rollout User-Interface Control Types (p. 1484)
MultiListBox
A MultiListBox item is used to place a list box in the rollout. This is a variant of the ListBox in which
multiple items in the list can be selected. The syntax is:
MultiListBox <name> [ <caption> ] [ items:<array_of_strings> ] \
[ selection:{<bitarray> | <number_array> | <number>} ] \
[ height:<number> ]
Example:
rollout test “test”
(MultiListBox mlb “MultiListBox” items:#(”A”,”B”,”C”) selection:#(1,3)
on mlb selected val do format “selected: % - %\n” val mlb.selection[val]
on mlb doubleclicked val do format “doubleclicked: % - %\n” val
mlb.selection[val]
on mlb selectionEnd do format “selectionEnd: %\n” mlb.selection
)
rof=newrolloutfloater “tester” 200 300
addrollout test rof
test.mlb.items
test.mlb.selection=1
test.mlb.selection=#(1,3)
test.mlb.selection=#{}
Parameters:
items:
The array of text strings that are the items in the list.
selection:
A BitArray signifying the currently selected items in the list. The default selection value
is #{}.
height:
The overall height of the MultiListBox in number of item lines. Defaults to 10 lines. To
have a MultiListBox display exactly N items, set height to N.
Properties:
<listbox>.items Array of Strings
The item string array.
<listbox>.selection BitArray
The currently selected items. When setting the selection via a script, the selection can be
specified as a BitArray, Array of numbers, or a number. If the items list is an empty array,
this value is 0.
Events:
on <listbox> selected <arg> do <expr>
Called when the user selects or deselects an item in the list. The <arg> argument contains
the index of the item that was selected or deselected. Since multiple items can be selected
or deselected at once, this handler is called for each item in the list, starting from the top
of the list, whose selection has changed.
on <listbox> doubleClicked <arg> do <expr>
Called when the user double-clicks on an item in the list. Note that the on selected
handler is always called on single clicks and on the first click of a double-click. The <arg>
argument contains the number of the item double-clicked.
on <listbox> selectionEnd do <expr>
Called when the user selects or deselects an item in the list, but after all the calls to the on
selected handler have been made.
1504 Chapter 12 | Creating MAXScript Tools
Notes:
There isn’t a way to deselect all the items in the list by clicking in the list somewhere. To clear the
list selection you will need a “Clear Selection” button that sets selection=#{}.
Pickbutton
A pickbutton item is used to place a scene object-picker button on the rollout. It operates like a
normal pick button in the 3ds max user interface, turning light-green when pressed and causing an
object-pick mode to be entered. The user can then choose a scene object by clicking on it. The pick
mode exits and the button returns to its unpressed state. The user can right-click to cancel the pick
mode. The syntax is:
pickbutton <name> [ <caption> ] [ message:<string> ] \
[ filter:<function> ] [ toolTip:<string> ]
Parameters:
message:
The optional text to be displayed in the 3ds max status line while in the pick mode.
Default is no message.
filter:
The optional filter function that will be called to test the eligibility of the scene object
under the cursor for picking. It must be a function of one argument, which will be the
object under test, and return true if the object is eligible or false if not. For example, the
following filter function allows only objects whose names begin with “foo” to be pickable:
fn foo_filt obj = findString obj.name “foo” == 1
Default is no filtering.
toolTip:
Provides text for a tooltip for the button. No tooltip if unsupplied.
Properties:
<pickbutton>.object Node
The last object picked using the pickbutton, undefined if no object has been picked.
This property is read-only.
ProgressBar 1505
Events:
on <pickbutton> picked <arg> do <expr>
Called when the user selects an object in the scene while in the pickbutton pick mode.
The <arg> argument contains the selected object. The handler is not called if the user
cancels out of the pick mode.
See also
Rollout User-Interface Items Common Properties (p. 1481)
Rollout User-Interface Items Common Layout Parameters (p. 1483)
Rollout User-Interface Control Types (p. 1484)
ProgressBar
A progressBar item is used to place a progress bar on the rollout. The syntax is:
progressBar <name> [ value:<number> ] [ color:<color> ] \
[ orient:<name> ]
on doit pressed do
( for i = 1 to objArray.count do
( doit_prog.value = 100.*i/objArray.count
...
)
doit_prog.value = 0
)
Parameters:
value:
The initial progress percentage value (0 – 100). The default value is 0. This is an Integer
value.
color:
The color of the progress bar. The default color value is [30,10,190].
orient:
Specifies whether the progress bar should fill from left to right (orient:#horizontal) or
bottom to top (orient:#vertical). Default value is #horizontal.
1506 Chapter 12 | Creating MAXScript Tools
Properties:
<progressbar>.value Integer
The progress bar complete percentage (0 – 100).
<progressbar>.color Color
The color of the progress bar.
<progressbar>.orient Name
The orientation of the progress bar fill: #horizontal - left to right; #vertical - bottom
to top.
Events:
on <progressbar> clicked <arg> do <expr>
Called when user clicks on the progress bar. The <arg> argument contains the percentage
value at the clicked point.
See also
Rollout User-Interface Items Common Properties (p. 1481)
Rollout User-Interface Items Common Layout Parameters (p. 1483)
Rollout User-Interface Control Types (p. 1484)
Radiobuttons
A radiobuttons item is used to place a set of radio buttons on the rollout, only one of which can be
checked at a time. The user can click different buttons in the set to change states. The syntax is:
radiobuttons <name> [ <caption> ] labels:<array_of_strings> \
[ default:<number> ] [ columns:<number> ]
...
copyfn = case copy_type.state of
( 1: copy
2: instance
3: reference
)
...
Slider 1507
Parameters:
labels:
An array of strings that specifies the number of radio buttons and the text label for
each one.
default:
The number of the radio button initially selected. Default is 1.
columns:
Number of columns across in which to arrange the buttons. By default, MAXScript will
attempt to lay out all the radio buttons side-by-side on one line, and if they won’t fit,
vertically in a single column. You can force the layout system to array the buttons in
multiple columns using this parameter. Each column is given the same width, which is the
width of the widest label in all columns and it left-adjusts the radio buttons in these
columns.
Properties:
<radiobuttons>.state Integer
The 1-based number of the currently selected radio button in the order specified in the
labels: array.
Events:
on <radiobuttons> changed <arg> do <expr>
Called when the user clicks one of the radio buttons in the set. The <arg> argument
contains the new state of the radio buttons array, which is the 1-based number of the
newly selected button.
See also
Rollout User-Interface Items Common Properties (p. 1481)
Rollout User-Interface Items Common Layout Parameters (p. 1483)
Rollout User-Interface Control Types (p. 1484)
Slider
A slider item is used to place a slider on the rollout, as an alternative to a spinner. The user can drag
the slider’s pointer around to set its value. The syntax is:
slider <name> [ <caption> ] [ range:[min,max,val] ] \
[ type:#float ] [ ticks:10 ] \
[ orient:#horizontal ]
Example:
slider tilt “Head tilt” orient:#vertical ticks:0 range:[-30,30,0]
Parameters:
range:
A Point3 value containing the minimum, maximum and initial values for the slider in the
x, y, and z components, respectively. Defaults to [0,100,0].
type:
The type of the slider, #float or #integer. Defaults to #float.
orient:
The layout orientation of the slider in the rollout, either #vertical or #horizontal.
Defaults to #horizontal.
ticks:
Specifies how many ticks to place along the slider bar. No ticks are drawn if you specify
ticks:0. Defaults to 10.
Properties:
<slider>.range Point3
The current range and value for the slider, as a Point3 like the range: parameter.
<slider>.value Float
The current value of the slider.
<slider>.ticks Integer
The number of ticks along the slider.
Events:
on <slider> changed <arg> do <expr>
Called when the user moves the slider pointer. The <arg> argument contains the new
value of the slider.
on <slider> buttondown do <expr>
Called when the user first clicks the slider.
on <slider> buttonup do <expr>
Called when the user releases the slider.
The buttonDown and buttonUp events effectively notify you of the start and end of a slider
“twiddle”, allowing you to perform some setup for the adjustment. A typical use for this is to bring
scene nodes that are being modified in the on <slider> changed handler into the foreground
plane to speed up screen redraw. For example:
spinner foo “height: “
Notes:
If you are using a slider to interactive adjust a property of an on-screen object, you can improve the
interactive speed by moving the object to the foreground plane. Objects placed in the foreground
plane are redrawn individually and so interactive changes to them are much faster. An object is
moved to the foreground or background plane using the flagForeground() method:
flagForeground <node> <boolean> -- mapped
The boolean argument puts the scene node(s) into the foreground plane if true, or into
the background plane if false.
You should be judicious in putting objects in the foreground plane, because putting too many
objects in the foreground plane reduces the foreground plane’s effectiveness. Remember to return
objects to the background plane when you don’t need to interactively control them any more.
See also
Rollout User-Interface Items Common Properties (p. 1481)
Rollout User-Interface Items Common Layout Parameters (p. 1483)
Rollout User-Interface Control Types (p. 1484)
Spinner
A spinner item is used to place a 3ds max value spinner on the rollout. The user can drag the spinner
arrows or type values into the spinner edit field. The syntax is:
spinner <name> [ <caption> ] [ range:[min,max,val] ] \
[ type:<name> ] [ scale:<float> ] \
[ fieldWidth:<integer> ] [ controller:<controller> ]
Parameters:
range:
A Point3 value containing the minimum, maximum, and initial values for the spinner in
the x, y, and z components, respectively. Defaults to [0,100,0].
type:
The type of the spinner: #float, #integer, or #worldunits. Defaults to #float. If
type is #worldunits, the value is displayed in the current 3ds max display units, but the
value is always in internal system units.
1510 Chapter 12 | Creating MAXScript Tools
scale:
The scale of the spinner specifies the smallest value increment. Defaults to 0.1 for floats, 1
for integers.
fieldwidth:
The width in pixels of the spinner text-edit field. By default, the spinner is placed so the
left edge of the edit field is exactly in the center of the rollout and right edge is placed at
the right margin. You can control how wide the field is using this parameter.
controller:
Links the spinner to the specified controller. This lets you establish a direct link between
the spinner and the controller. Changes to the spinner will automatically update the
controller (and its controlled objects). Changes to the controller automatically update the
spinner. For example, say you have a sphere called $ball with a float controller already
assigned to its radius, then the following code:
utility foo “foo”
(
spinner ball_radius “Ball radius” range:[0,1000,1] \
controller:$ball.radius.controller
)
sets up a spinner that automatically affects and tracks the radius of the scene node $ball.
Any changes to the spinner update $ball’s radius. Any other changes to $ball’s radius, say
in the Modify panel or because of animation, will update the spinner. Note that this links
to controllers, so the specified controller must already exist before creating the spinner
user-interface item. You can either specify a controller already assigned to the parameter
you want to link to, or you can create the controller in your script and then assign that
controller to the parameter of interest. For example:
utility foo “foo”
(
local myController=bezier_float()
spinner ball_radius “Ball radius” range:[0,1000,1] \
controller:myController
button apply “Apply Radius Controller”
on apply pressed do
( animate off at time 0 $ball.radius=myController.value
$ball.radius.controller=myController
)
)
Properties:
<spinner>.range Point3
The current range and value for the spinner, as a Point3 like the range: parameter.
<spinner>.value Float
The current value of the spinner.
Spinner 1511
Events:
on <spinner> changed <arg> do <expr>
Called when the user spins the spinner, or when the user enters a value in the spinner field
then presses ENTER or presses TAB to move the cursor out of the field. The <arg>
argument contains the new value of the spinner.
on <spinner> entered do <expr>
Called when the user types a number into a spinners edit field and then presses ENTER or
presses TAB to move the cursor out of the field. The on <spinner> changed handler, if
supplied, has already been called at this point and the spinner’s value property is up to
date.
on <spinner> buttondown do <expr>
Called when the user first clicks the spinner.
on <spinner> buttonup do <expr>
Called when the user releases the spinner.
The buttonDown and buttonUp events effectively notify you of the start and end of a spinner
“twiddle”, allowing you to perform some setup for the adjustment. A typical use for this is to bring
scene nodes that are being modified in the on <spinner> changed handler into the foreground
plane to speed up screen redraw. For example:
spinner foo “height: “
Notes:
If you are using a spinner to interactive adjust a property of an on-screen object, you can improve
the interactive speed by moving the object to the foreground plane. Objects placed in the
foreground plane are redrawn individually and so interactive changes to them are much faster. An
object is moved to the foreground or background plane using the flagForeground() method:
flagForeground <node> <boolean> -- mapped
The boolean argument puts the scene node(s) into the foreground plane if true, or into
the background plane if false.
You should be judicious in putting objects in the foreground plane, because putting too many
objects in the foreground plane reduces the foreground plane’s effectiveness. Remember to return
objects to the background plane when you don’t need to interactively control them any more.
See also
Rollout User-Interface Items Common Properties (p. 1481)
Rollout User-Interface Items Common Layout Parameters (p. 1483)
Rollout User-Interface Control Types (p. 1484)
1512 Chapter 12 | Creating MAXScript Tools
Timer
A timer item generates tick events at set intervals. Timer is unlike the remainder of the user-interface
items as it is not a visible control. Timer lets the user interface react, animate, or change without user
interaction, such as having animations playing on the rollout, checking for certain conditions or
events before continuing, displaying nag/splash screens, and so on. The syntax is:
timer <name> [ interval:<number> ] [ active:<boolean> ]
Example:
utility test “test1”
(
timer clock “testClock” interval:400
label test “1”
on clock tick do
( valUp = (test.text as integer)+1
test.text = valUp as string
)
)
Parameters:
interval:
An integer value specifying the time in milliseconds between tick events. Default value
1000 (1 second).
active:
Specifies whether the timer emits tick events. Default value true.
Properties:
<timer>.interval Integer
Integer value specifying the time in milliseconds between tick events.
<timer>.active Boolean
Specifies whether the timer emits tick events (true) or not (false). When first set to
true, the first tick event is generated in interval milliseconds.
Events:
on <timer> tick do <expr>
Called when timer ticks.
See also
Rollout User-Interface Items Common Properties (p. 1481)
Rollout User-Interface Items Common Layout Parameters (p. 1483)
Rollout User-Interface Control Types (p. 1484)
Timer 1513
Image Buttons
Four rollout user-interface item types, button, checkbutton, mapbutton, and materialbutton,
can be either simple text buttons containing text labels or image buttons inside of which bitmaps
can be displayed instead of text. The images to be displayed in these buttons are specified using the
definition-line parameter images:. The parameter form is:
images:#(<image>, <maskImage>, <count_integer>, \
<enabled_out_image_index>, <enabled_in_image_index>, \
<disabled_out_image_index>, <disabled_in_image_index>)
where <image> and <maskImage> can be either a bitmap file-name string or a MAXScript
bitmap value. <count_integer> specifies the number of sub-images in the bitmaps, and the
image_index values specify which sub-image in the bitmaps is to be used for each of the four
button states. For example:
bm1 = render camera:$cam01 outputSize:[80,60]
...
checkbutton foo images:#(bm1, undefined, 1, 1, 1, 1, 1)
Example:
checkbutton decay images:#(”dcybtns.bmp”, “dcymask.bmp”, 6, 1, 4, 1, 4)
In this example, the images are in a file dcybtns.bmp and the masks in dcymask.bmp. These bitmap
files each have six images across and the out-state is image 1 and the in-state is image 4. Both enabled
and disabled here are given as the same image, presumably because this particular button will never
be disabled.
where:
<var_name> is the name of an automatically created global variable to hold the rcmenu value
that represents the right-click menu.
<rcmenu_body> is enclosed in the required parentheses and is a sequence of clauses that define
the menu items that will appear in the utility, along with functions and event handlers that
process user interactions. These clauses are defined in detail in the RCMenu Clauses (p. 1515)
topic.
The following methods let you register and unregister scripted right-click menus:
registerRightClickMenu <rcmenu>
registers the specified right-click menu
unRegisterRightClickMenu <rcmenu>
unregisters the specified right-click menu
unRegisterAllRightClickMenus()
unregisters all right-click menus
Example:
The following script adds two items to the right-click menu: Cast Shadows and Receive Shadows.
These items will be enabled only if one object is selected. If enabled, the items will be checked or
unchecked based on the current state of the selected object. Choosing a menu item will flip the state
of the corresponding object property.
RCMenu Clauses 1515
Script:
rcmenu MyRCmenu
(
menuItem mi_cs “Cast Shadows” checked:false
menuItem mi_rs “Receive Shadows” checked:false
--
on MyRCmenu open do
( local sel = (selection.count == 1)
--
-- Enable if only one object is selected
mi_cs.enabled = mi_rs.enabled = sel
--
-- Set check state of items
if sel do
( mi_cs.checked = $.castShadows
mi_rs.checked = $.receiveShadows
)
)
--
-- set up event handlers for items
on mi_cs picked do $.castShadows = (not $.castShadows)
on mi_rs picked do $.receiveShadows = (not $.receiveShadows)
)
-- register the rcmenu
registerRightClickMenu MyRCmenu
You can register as many scripted right-click menus as you like. Each scripted right-click menu
registered is appended to the right-click menu window. If a scripted right-click menu with the same
name is registered twice, the old one is over written by the new one.
If a runtime error occurs while executing a scripted right-click menu, an error message is displayed
in Listener. The right-click menu will not be disabled.
RCMenu Clauses
The <rcmenu_body> of a right-click menu definition is made up of a sequence of scripted right-click
menu clauses as follows:
<rcmenu_body> ::= { <rcmenu_clause> }+
Scripted right-click menu clauses define the components of a scripted right-click menu and can be
one of three basic things:
• Local variables, functions or structure definitions are variables, functions, and structures whose
scope is the scripted right-click menu. These locals will exist as long as the scripted right-click
menu value exists. The scripted right-click menu value will exist until the scripted right-click
menu value is redefined or deleted. Local variables are particularly useful for storing working
data associated with the right-click menu such as picked objects.
• User-interface items are displayed in the right-click menu, such as menu items, separators, and
submenus.
1516 Chapter 12 | Creating MAXScript Tools
• Event handlers are special kinds of functions that are associated with particular user-interface
items. Event handlers specify the processing you want to occur when a user interacts with an
user-interface item, for example pressing a menu item or opening a submenu. These user actions
generate named events and the optional event handler you supply for that event is called when
the user action occurs.
The visibility of locals, and accessing scripted right-click menu locals from external code, are the
same as described for utility rollouts, and described in the Visibility of Locals, Functions, Structures,
and User-Interface Items in Rollout Code (p. 1478) and Accessing Locals and Other Items in a Rollout from
External Code (p. 1480) topics. In both utility rollouts and scripted right-click menus, the name given
to a user-interface item is used to name an automatically constructed local variable that will hold
the value representing the item. It is also used to associate event handler functions with the item.
One difference between the scoping of these variables is that they are local to the rollout in utility
rollouts, and local to the scripted right-click menu in scripted right-click menus. This means that all
user-interface items in a scripted right-click menu must have a unique name within the scripted
right-click menu, even for those items present in a subMenu.
Formally, the syntax of a <rcmenu_clause> is defined as follows:
<rcmenu_clause> ::= <local_variable_decl> |
<local_function_decl> |
<local_struct_decl> |
<user_interface_item> |
<event_handler>
Locals:
A <local_variable_decl>, <local_function_decl>, and <local_struct_decl> are exactly
the same as local variable, function, and structure definitions in MAXScript:
<local_variable_decl> ::= local <decl> { , <decl> }
<decl> ::= <name> [ = <expr> ] -- optional initial value
Global variables cannot be declared as a scripted right-click menu clause, however they can be
declared within event-handler scripts. If you need to ensure that a variable name references a global
variable, declare the variable name as global immediately before defining the right-click menu in
your script.
RCMenu Clauses 1517
When writing scripts, it is good programming practice to explicitly declare your local and global
variables. Implicit declaration is provided as a short-hand, typically used when working in the
Listener interactively or developing short scripts. When developing extended scripts, explicitly
declaring variables can reduce errors and improve readability of the code. It is also recommend that
you declare as local all variables unless you really want them to be global variables. The reasons for
this are described in the Scope of Variables (p. 646) topic.
User-Interface Items:
A <user_interface_item> defines an individual menu item, separator, or submenu user-interface
item that will appear in the right-click menu. These user-interface items are described in the RCMenu
User-Interface Items (p. 1518) topic.
Event Handlers:
An <event_handler> is a special function definition local to a scripted right-click menu that you
provide to handle the processing you want to occur when a user clicks on a menu item. This user
action generates a named event and any event handler you supply for that event is called when the
action occurs. The syntax for defining a handler is as follows:
on <item_name> <event_name> do <expr>
The <item_name> specifies the name of the item for which this handler is connected. The
<event_name> specifies the type of event to be handled. There is only one type of user-interface
item event:
picked
The picked handler expression is executed when a menu item is picked from the right-click menu.
Any MAXScript action like creating a object, adding a modifier, and so on can be performed in this
expression.
In addition to the event handlers you specify for particular menu items in a right-click menu, you
can define a handler function that is called when the entire right-click menu is first opened by the
user. This event handler is useful for initialization code. The syntax for this event handler is as
follows:
on <rcmenu> open do <expr>
See also
Scripted Right-Click Menus (p. 1514)
1518 Chapter 12 | Creating MAXScript Tools
menuItem
A menuItem is used to place a pickable item in the right-click menu. The syntax for a menuItem is:
menuItem <name> <label> [ checked:<boolean> ] [ enabled:<boolean> ] [
filter:<function> ]
Parameters:
name:
Used to refer to when writing an event handler.
label:
The string that appears in the right-click menu.
checked:
Specifies if a check mark appears before the label in the right-click menu. If true the item
is checked, otherwise the item is unchecked.
enabled:
Specifies if the item is enabled for interaction when the right-click menu is opened. If
true the item is enabled, otherwise the item is disabled and appears unavailable.
filter:
A function that returns a Boolean value. The filter function is evaluated when the
right-click menu is first opened. If the filter function returns true the menuItem appears
in the menu, otherwise it is not displayed.
Properties:
<menuitem>.text String
The string that appears in the right-click menu.
<menuitem>.checked Boolean
Specifies if a check-mark appears before the label in the right-click menu. If true the item
is checked, otherwise the item is unchecked.
<menuitem>.enabled Boolean
Specifies if the item is enabled for interaction when the right-click menu is opened. If
true the item is enabled, otherwise the item is disabled and appears as unavailable.
Events:
on <menuitem> picked do <expr>
Called when the user clicks the menu item.
separator 1519
Example:
Script:
rcmenu RCmenuRenderable
( fn onlyOneSelected = selection.count == 1 -- define filter function
menuItem mi_r “Renderable” filter: onlyOneSelected -- display if only 1 object
selected
on RCmenuRenderable open do -- perform following on rcmenu open
( if selection.count == 1 then -- if only one object selected...
( mi_r.text = $.name + “ | “ + “Renderable” -- change text of menu item
if isKindOf $ Shape then -- if shape set renderable property to
$.renderable=$.renderable -- itself to get shape and node renderable
-- properties the same
mi_r.checked=$.renderable -- turn on menu item check if renderable
)
)
on mi_r picked do $.renderable = not $.renderable -- when menu item picked,
flip renderable value
)
--
registerRightClickMenu RcmenuRenderable -- register the rcmenu
See also
RCMenu Clauses (p. 1515)
Scripted Right-Click Menus (p. 1514)
separator
A separator is used to place a separator line in the right-click menu, and is normally used to group
menu items. The syntax for a separator is:
separator <name> [ filter:<function> ]
Parameters:
name:
Used to name an automatically constructed local variable that will hold the value
representing the separator.
filter:
A function that returns a Boolean value. The filter function is evaluated when the right-
click menu is first opened. If the filter function returns true the separator appears in the
menu, otherwise it is not displayed.
Example:
Script:
rcmenu MyRCmenu
(
fn flt_objects = ($ != undefined) -- objects filter
--
menuItem mi_cs “Cast Shadows” checked:false
1520 Chapter 12 | Creating MAXScript Tools
See also
RCMenu Clauses (p. 1515)
Scripted Right-Click Menus (p. 1514)
subMenu
A subMenu is used to place an item in the right-click menu that, if the cursor is placed on, opens a
submenu containing additional user-interface items. The syntax for a subMenu is:
subMenu <label> [ filter:<function> ] ( <submenu_body> )
Parameters:
label:
The string that appears in the right-click menu.
filter:
A function that returns a Boolean value. The filter function is evaluated when the
right-click menu is first opened. If the filter function returns true the subMenu appears in
the menu, otherwise it is not displayed.
Example:
Script:
rcmenu MyRCmenu
(
fn flt_objects = ($ != undefined) -- objects filter
fn flt_shapes = (isKindOf $ Shape) -- shapes filter
--
menuItem mi_cs “Cast Shadows” checked:false
menuItem mi_rs “Receive Shadows” checked:false
--
separator sep2 filter:flt_objects
--
subMenu “Modifiers” filter:flt_objects -- begin subMenu
( -- Add common objects
subMenu 1521
See also
RCMenu Clauses (p. 1515)
Scripted Right-Click Menus (p. 1514)
For example:
macroScript Free_Camera category:”Cameras” tooltip:”Free Camera”
Icon:#(”Cameras”,2)
(
StartObjectCreation FreeCamera
)
macroScript Target_Camera category:”Cameras”
tooltip:”Targeted Camera” Icon:#(”Cameras”,1)
(
StartObjectCreation TargetCamera
)
After MAXScript evaluates a macroScript construct, the Macro Script definition will show up in
the Macro Scripts list in the Customize User-Interface dialog. The following figure shows a
Customize User Interface dialog containing the previous two Macro Scripts.
subMenu 1523
<name> is the name shown in the Customize User-Interface dialog. Unlike other similar constructs
(Scripted Utilities, Functions, and right-click menus), macroScript does not create a variable with
this name. Rather, Macro Scripts are stored as pointers into files, as described below.
The category: argument specifies in which category in the Customize User-Interface dialog the
Macro Script name will be listed. The use of categories is intended to help you organize your Macro
Scripts into groupings so that the Macro Script names are less likely to clash. If you do not specify a
category, a default category of “unknown” is used.
The toolTip: argument specifies the tooltip for the button. If no tooltip is specified, no tooltip is
displayed for the button.
The buttonText: argument specifies the text that will appear in the button, and the icon:
argument specifies the icon that will appear in the button. You can choose in the Customize User
Interface dialog whether the buttonText or icon appears in the button. If no buttonText:
argument is specified, the Macro Script name is used as the buttonText.
The icon: argument specifies the icon bitmap file and the icon image within the icon bitmap file.
The icon bitmap file must be located in the current 3ds max user-interface directory. Icon bitmap
files have a base name, such as “MyToolbar”, followed by a suffix, such as “_24i.bmp”, that specifies
the individual icon size and icon bitmap file type. The icon: argument string is just the base name,
with no extensions present. This base name is the name shown in the Image Group list in the
Customize User-Interface dialog. Each icon bitmap file can have any number of individual icons,
lined up side-by-side in the file. If the icon bitmap file contains multiple icons, <index> specifies
which icon in the icon bitmap file to use. The left-most icon has an <index> of 1. The 3ds max
internal icons (Image Group Internal in the Customize User-Interface dialog) are not stored in an
icon file, and are referenced by using an empty string as the icon: argument.
So, the icon: argument can be either a two-element array containing the icon bitmap file’s base
name as a string and the icon’s index in that file, or just a base name string, with the index 1
assumed. For example:
macroScript Box category:”Objects” tooltip:”Box”
icon:#(”standard”, 1) -- use first icon in standard
(
StartObjectCreation Box
)
macroScript Sphere category:”Objects” tooltip:”Sphere”
icon:#(”“, 2) -- use second icon in internal icons
(
StartObjectCreation Sphere
)
macroScript Cone category:”Objects” tooltip:”Cone”
icon:”myicon” -- use first icon in myicon
(
StartObjectCreation Cone
)
See the Creating Icon Bitmap Files (p. 1530) topic for more information.
1524 Chapter 12 | Creating MAXScript Tools
The silentErrors: parameter gives control over whether MAXScript runtime error messages are
displayed while executing the Macro Script. If this parameter is set to true, error messages will not
be displayed. This may be useful for distributed Macro Scripts that may confuse the user with
MAXScript error messages. The default value is false.
The <macro_script_body> is any valid MAXScript expression, and can contain global and local
variables, functions, and structure definitions. The <macro_script_body> is compiled in its own
local scope, and the locals are only visible inside the scope of the Macro Script. Macro Script locals
are heap-based locals, which are slightly different from normal (stack-based) locals.
Normal locals are visible in the current scope and have a lifetime of one execution of that scope.
Heap-based locals are also visible only in the current scope, but have a lifetime equal to the lifetime
of the top-level expression where they are defined. A Macro Script’s locals are created the first time
you execute the Macro Script, initialized to a value of undefined, or to their specified initialization
value. These values are stored in a separate memory stack. On entry to each function (or top level
script) in the Macro Script, a ‘frame’ in the memory stack is marked and when the function (or top
level script) exits, all of the values in the frame are freed from the memory.
Because a Macro Script’s name is not created as a variable, you cannot access a Macro Script’s locals
outside the scope of the Macro Script. So, for example, you can create a rollout in a Macro Script,
and the rollout’s event handlers can access the locals defined in the Macro Script because the rollout
is executing within the scope of the Macro Script. However, you cannot access the Macro Script’s
locals from another utility or from the Listener, because they are not executing within the scope of
the Macro Script. See the Scope of Variables (p. 646) topic for more information.
When you execute a macroScript definition, the return value is an integer Macro Script ID value.
MAXScript internally stores information about each Macro Script in an array, and the returned
Macro Script ID value is the array index for that Macro Script. The information stored for each Macro
Script consists of the file in which that Macro Script is defined and a pointer into that file specifying
where the Macro Script definition begins. The Macro Script definition is only compiled when you
first press a toolbar button that contains the script, or execute the Macro Script using the
macros.run() method.
There are five ways a Macro Script can be defined:
• The default user-interface directory and its subdirectories will be automatically scanned at
startup for files of type .mcr, which will be parsed for Macro Script definitions.
• A Macro Script definition is executed in an Editor window, in a script file that you execute, or
in a startup script file.
• If you evaluate a Macro Script definition in the Listener window, a file will automatically be
created to contain the Macro Script definition. This file is stored in the MacroScripts directory
under the current user-interface directory.
• MAXScript supports text drag onto toolbars to create Macro Script buttons. You can select and
drag text from any text window, such as Listener window panes or Editor windows, onto any
visible toolbar. The cursor changes to an arrow with + sign when it is OK to drop the text. If you
drop it, a Macro Script button is added to the toolbar with the dropped text as the body of the
Macro Script. The classic case here would be to drag some text from the Macro Recorder pane in
subMenu 1525
the Listener window onto a toolbar to make a button that does the sequence of events just
recorded. Remember that tabbed elements on the Shelf are toolbars and can accept dropped
text. MAXScript will automatically enclose the text in a Macro Script definition with a Macro
Script name of DragAndDrop-MacroN, where N is a number that will make the Macro Script
name unique. The category will be DragAndDrop and no tooltip is specified. As with Macro
Scripts defined in the Listener window, a file will automatically be created to contain the Macro
Script definition. This file is stored in the MacroScripts directory under the current user-interface
directory.
• A Macro Script can be defined using the macros.new() method described next. As with Macro
Scripts defined in the Listener window, a file will automatically be created to contain the Macro
Script definition. This file is stored in the MacroScripts directory under the current user-interface
directory.
If you move or delete a file that contains a Macro Script definition that has been loaded, and try to
execute the Macro Script, you will get an error message. Further, if you edit a file containing Macro
Script definitions, take care to save and re-evaluate the entire file so any other Macro Scripts defined
in that file will have their file pointer updated. If you don’t do this, you may get an error message
saying the currently loaded definition no longer matches its file.
If you reevaluate a Macro Script definition, any button using that Macro Script will see any changes
you make.
Any macroScript definition evaluated in MAXScript or created by dropping text onto a toolbar has
a separate definition .mcr file created in the MacroScripts directory under the current user-interface
directory (typically UI\MacroScripts). The name of the file is <category_name>-<macro_name>.mcr,
for example,
DragAndDrop-Macro12.mcr for macroScript Macro12 category:”DragAndDrop”
NURBS-Map_Updater.mcr for macroScript Map_Updater category:”NURBS”
If you evaluate a macroScript definition in the Listener or drop text on a toolbar, its recorded
definition file is this backing file in UI\MacroScripts. This definition file is the one that gets opened
if you hit Edit Macro Script in the CUI customize menus or dialogs. For macroScript definitions
evaluated in Listener, this means the same definition will be updated each time you evaluate it,
rather than having separate backing file for each evaluation.
If you evaluate macroScript definitions in a .ms or .mcr file that does not already reside in the
UI\MacroScripts directory, a copy for each will be placed in a separate file in UI\MacroScripts, but
the recorded definition file will be the original source file, so that hitting Edit Macro Script will go
to that file.
This means that if any buttons containing such macroScript definitions are added to toolbars in the
startup.cui file, the backing .mcr file in UI\MacroScripts will be used as its definition at the next
3ds max startup. When you start 3ds max, the macroScript definitions will taken from the backing
files in UI\MacroScripts. If these Macro Scripts are also defined in MAXScript startup script files, they
will be re-defined at MAXScript startup and so the definition file of record will be updated to point
to the script file.
1526 Chapter 12 | Creating MAXScript Tools
MAXScript provides several methods that allow you to access and run Macro Scripts from within a
script. These Macro Script functions are in a structure package named macros. The Macro Script
methods are:
macros.load [ <path_name_string> ]
Loads all of the Macro Script definition (.mcr) files in the current user-interface directory
path, or in directory path specified by <path_name_string>. This method does not
change the current user-interface directory path. You can get the current user-interface
directory path with the function:
local ui_dir = cui.getDir ()
Examples:
The following Macro Script will save the active viewport’s image to a bitmap file.
Script:
MacroScript GrabViewport category:”Tools” tooltip:”Grab Viewport”
(
---------------------------------------------------------------------
--GRABVIEWPORT MACROSCRIPT
--Created:3/23/99
--Edited:4/28/99
--by Borislav Petrov
--bobo@email.archlab.tuwien.ac.at
---------------------------------------------------------------------
--Snapshot Active Viewport to Bitmap
--Filename in format:
--VPGRAB_MaxFileName_ViewportName_CurentFrame.ImageFormatExtension
subMenu 1527
---------------------------------------------------------------------
--
--Init Variables
local grab_bmp --bitmap to put the snapshot into
local bmp_name --name of the bitmap to save
local get_viewport_name --viewport name
local gac,gct,mfn --variables to hold ActiveCamera, CurrentTime, MaxFileName
--
--Start Macro
grab_bmp = gw.getViewportDib() --get the viewport bitmap into variable
get_viewport_name = viewport.GetType() --get viewport name
gvn = get_viewport_name as string --convert viewport name to string
gvn = substring gvn 6 (gvn.count-5) --cut the string
if gvn == “camera” then --if the remaining string is “camera”
( gac = getActiveCamera() --get the camera
gvn = gac.name --get the name of the camera
)
mfn = MaxFileName --get max file name
if mfn == ““ then --if there is no name
mfn = “Untitled” --use “Untitled”
else
mfn = getFileNameFile mfn --use the file name without .MAX extension
gct = SliderTime as string --get current frame time
--
bmp_name = “VPGRAB_”+ mfn +”_” +gvn + “_” + gct --build the output file name
--
--Display file save dialog
bmp_name = getSaveFileName caption:”Save Viewport to:” filename:bmp_name \
types:”BMP(*.bmp)|*.bmp|TIFF(*.tif)|*.tif|JPG(*.jpg)|*.jpg|TGA(*.tga)|*.tga|”
--
if bmp_name != undefined then --if user has confirmed / entered a valid name
( grab_bmp.filename = bmp_name --set output name to the one entered in the save
file dialog
save grab_bmp --save the bitmap
display grab_bmp --display the bitmap in a VFB
)
)--end of script
The following Macro Script allows you to render directly to the RAMPlayer. This Macro Script shows
the use of rollouts and rollout floater windows in Macro Scripts.
Script:
-- MacroScript to Render to RamPlayer
-- Author: Alexander Bicalho
--****************************************************************
-- MODIFY THIS AT YOUR OWN RISK
-- This utility will allow you to render directly to the RamPlayer
--
MacroScript RAM_Render category:”Tools” tooltip:”Render to Ram”
(
-- declare local variables and define some functions
local get_names existFile
1528 Chapter 12 | Creating MAXScript Tools
try(closerolloutfloater r_dialogue);catch()
-- put up new rollout floater and add rollout to it.
r_dialogue = newrolloutfloater “Render to RAM” 400 300
addrollout r_size r_dialogue
-- end of Macro Script, rollout takes over...
)
This tool allows the user to click in a viewport at which point a box is created. Dragging the mouse
positions the box and releasing the mouse button stops the tool.
You’d start this tool by executing:
startTool foo
The syntax for tools is similar to that for utility definition constructs. They have local variables,
functions, and event handlers, but tools have no user-interface items.
A tool is created using the tool definition construct in MAXScript. The top-level syntax is as follows:
tool <tool_name> [ prompt:<string> ] [ numPoints:<number> ]
( <tool_body> )
where:
<tool_name> is the name of an automatically created variable to hold the value that represents
the tool. The scope of this variable is the current MAXScript scope. This value is also returned
as a result of the tool declaration. The class of this value is MouseTool.
The optional prompt keyword argument specifies the prompt string displayed in the 3ds max
Prompt Line while the tool is executing.
The optional numPoints keyword argument specifies the maximum number of points (mouse
clicks) the tool will use. If the tool is still executing when you reach the numPoints number of
mouse clicks, the tool will stop and return a value of #stop.
<tool_body> is enclosed in the required parentheses and is a sequence of clauses that define
the functions and event handlers that process mouse clicks. These clauses are defined in detail
in the Mouse Tool Clauses (p. 1532) topic.
The following method invokes a tool:
startTool <tool_name> [ prompt:<string> ] [ snap:#3D|#2D ] \
[ numPoints:<number> ]
where:
<tool_name> is the tool name used in a tool definition.
1532 Chapter 12 | Creating MAXScript Tools
The optional prompt keyword argument specifies the prompt string displayed in the 3ds max
Prompt Line while the tool is executing. If specified, this string overrides the prompt string
specified in the tool definition.
The optional snap keyword argument specifies the upper limit on snapping. specifying a snap
parameter does not turn on snap, only the user can turn it on in the interface. When 2.5D or
3D snapping is turned on by the user, the snap parameter restricts snapping to the specified
level.
The optional numPoints keyword argument specifies the maximum number of points (mouse
clicks) the tool will use. If specified, this value overrides the number of points specified in the
tool definition.
The return value from startTool() will be either #stop if a called change handler returns the
value #stop or the numPoints value is reached, or #abort if the user aborts the tool using a
right-click or presses the ESC key.
A currently executing tool can also be aborted using the following method:
stopTool <tool_name>
where:
<tool_name> is the tool name used in a tool definition.
This method would typically be called in a callback function or change handler (see the Change
Handlers and Callbacks (p. 1649) topic), or in a timer event handler in a rollout (see the Timer
(p. 1512) topic).
Tool clauses define the components of a tool and can be one of two basic things:
• Local variables, functions or structure definitions are variables, functions, and structures whose
scope is the tool. The <tool_body> is compiled in its own local scope and the locals are only
visible inside the scope of the tool. Tool locals are heap-based locals, which are slightly different
from normal (stack-based) locals. Normal locals are visible in the current scope and have a
lifetime of one execution of that scope. Heap-based locals are also visible only in the current
scope, but have a lifetime equal to the lifetime of the top-level expression where they are
defined. A tool’s locals are created the first time you execute the tool and are kept permanently
in the heap (unless and until you redefine the tool). This means things like rollouts created in
a tool that live beyond the simple execution of the tool can refer to these locals and the locals
will still exist. Each time you execute a tool, its local variables are initialized to a value of
undefined, or to their specified initialization value. For example, you can create a rollout in a
tool, and the rollout’s event handlers can access the locals defined in the tool because the rollout
is executing within the scope of the tool. You cannot access the tool’s locals from another utility
Mouse Tool Clauses 1533
or from Listener, because they are not executing within the scope of the tool. See the Scope of
Variables (p. 646) topic for more information.
• Event handlers are special kinds of functions associated with particular events. Event handlers
specify the processing you want to occur when a user clicks or moves a mouse, right-clicks, or
starts or stops the tool. These actions generate named events and the optional event handler
you supply for that event is called when the action occurs.
Formally, the syntax of a <tool_clause> is defined as follows:
<tool_clause> ::= <local_variable_decl> |
<local_function_decl> |
<local_struct_decl> |
<event_handler>
Locals:
A <local_variable_decl>, <local_function_decl>, and <local_struct_decl> are exactly
the same as local variable, function, and structure definitions in MAXScript:
<local_variable_decl> ::= local <decl> { , <decl> }
<decl> ::= <name> [ = <expr> ] -- optional initial value
Global variables cannot be declared as a tool clause, however they can be declared within event
handler scripts. If you need to ensure a variable name references a global variable, declare the
variable name as global immediately before defining the tool in your script.
When writing scripts, it is good programming practice to explicitly declare your local and global
variables. Implicit declaration is provided as a short-hand, typically used when working in the
Listener interactively or developing short scripts. When developing extended scripts, explicitly
declaring variables can reduce errors and improve readability of the code. It is also recommend that
you declare as local all variables unless you really want them to be global variables. The reasons for
this are described in the Scope of Variables (p. 646) topic.
Within the functions and event handlers of a tool, 13 pre-defined locals variables are always
accessible. Each one holds a useful value relating to the mouse action that just occurred:
viewPoint Point2
The current mouse position in viewport pixel coordinates.
worldPoint Point3
The current mouse position projected on the active grid in world coordinates.
worldDist Point3
The distance in X, Y, and Z from the previous click point to the current click point in
world coordinates.
worldAngle Point3
The angles around the world X, Y, and Z axes from the previous click point to the current
click point in world coordinates.
1534 Chapter 12 | Creating MAXScript Tools
gridPoint Point3
The current mouse position projected on the active grid in the coordinate system of the
active grid. If the active grid is the home grid, the coordinate system is the home grid
plane active in the current viewport (that is, the construction plane). See the discussion of
grid versus world values below.
gridDist Point3
The distance in X, Y, and Z from the previous click point to the current click point in the
coordinate system of the active grid. If the active grid is the home grid, the coordinate
system is the home grid plane active in the current viewport (that is, the construction
plane). See the discussion of grid versus world values below.
gridAngle Point3
The angles around the world X, Y, and Z axes from the previous click point to the current
click point in the coordinate system of the active grid. If the active grid is the home grid,
the coordinate system is the home grid plane active in the current viewport (that is, the
construction plane). See the discussion of grid versus world values below.
shiftKey Boolean
true if SHIFT key was down.
ctrlKey Boolean
true if CTRL key was down.
altKey Boolean
true if ALT key was down.
lButton Boolean
true if left mouse button was down.
mButton Boolean
true if middle mouse button was down.
rButton Boolean
true if right mouse button was down.
When a create mouse tool is used in a level 5 scripted plug-in, an additional local variable is
accessible:
nodeTM Matrix3
Provides read/write access to the transform of the node currently being created. This value
is in the current grid coordinate system.
See the Scripted Plug-ins (p. 1538) topic for more information.
When writing SimpleObject scripted plug-ins, you should always use the gridPoint, gridDist,
and gridAngle values rather than corresponding world values, as object-creation in SimpleObject
scripted plug-ins is managed in the active grid coordinate system.
For gridDist, the .X and .Y components are the delta X and Y between the previous clicked point
and the current mouse point in the plane of the current grid. The .Z component is a projection from
the current Y screen coordinates onto a Z-vector (in the grid coordinate system) based at the last
point clicked on the grid, such that the .Z value is the projected height up the Z-vector. For non-
orthogonal viewports this is as expected, but for orthogonal viewports (in which you are always
Mouse Tool Clauses 1535
dragging in the XY plane of the grid), this is always the same as gridDist.y. If you are using the
gridDist value to build the portion of an object on the grid, or determine the distance on the current
grid from the last point, you want to use only the .X and .Y components. For example,
side1Len = gridDist.x
side2Len = gridDist.y
dist=length [gridDist.x,gridDist.y]
If you are specifying the height off of the current grid, you would typically use the .Z component.
For example,
height = gridDist.z
For worldDist, the behavior is similar to that for gridDist, however the projected component is
dependent on the construction plane of the viewport. For the Top, Bottom, and non-orthogonal
viewports, the projected height is contained in the .Z component. For Left and Right viewports, the
projected height is contained in the .X component. For Front and Back viewports, the projected
height is contained in the .Y component.
When you create a node in the 3ds max user-interface, the local Z axis of the node is perpendicular
to the construction plane. When you create a node using MAXScript, by default the local Z axis of
the node points along the direction of the world Z axis. If you create a node in a tool (other than in
a SimpleObject scripted plug-in), you must take into account the construction plane orientation if
you want to duplicate 3ds max’s behavior when creating a node. The easiest way to do this is to
create the node in a coordsys grid context and specify the position of the node during creation
in grid coordinate space. An example of this is shown in the following script.
Script:
tool PointCreator
( local p, createpoint
-- define a function to perform actual node creation. Setting coordsys to
-- ‘grid’ in order for the alignment of the node’s local Z axis to be
-- perpendicular to the construction grid
fn createpoint = in coordsys grid p=point pos:gridPoint
--
-- set up so that a node is created on a mouse button down, move node
-- drag, release node at mouse button up.
--
-- if clickno == 1, then we are at first mouse click, which is a mouse
-- button down. If clickno != 1, at following mouse button up.
on mousePoint clickno do
( if clickno == 1
then createPoint()
-- if p == undefined, then clicked twice without mouse movement
-- (double clicked). No point object present, so just ignore this click.
else if p != undefined do (p.pos=worldPoint;p=undefined)
)
--
-- if p != undefined, we are moving a previously created node
-- if p == undefined, and left mouse button is down, create a node
on mouseMove clickno do
1536 Chapter 12 | Creating MAXScript Tools
( if p != undefined
then p.pos=worldPoint
else if lbutton do createPoint()
)
)
-- start the tool. No exit condition defined, so right-click to exit.
startTool PointCreator
Event Handlers:
An <event_handler> is a special function definition local to a tool that you provide to handle the
processing you want to occur when a user clicks in a viewport, right-clicks, or starts or stops the tool.
Each user action generates a named event and any event handler you supply for that event is called
when the action occurs. The available event handlers are:
on start do <expr>
Called when the tool starts.
on end do <expr>
Called when the tool ends.
on freeMove do <expr>
Called when the mouse moves prior to the first click.
on mousePoint <arg> do <expr>
Called for each mouse click, parameter arg contains the number of the click.
on mouseMove <arg> do <expr>
Called when the mouse moves anytime after the first click.
on mouseAbort <arg> do <expr>
Called when the user right-clicks to cancel or presses the ESC key.
The <arg> parameter on each of the mouse event handlers lets you know which mouse click you
are in. Mouse clicks are actually only the mouse click release, except for the initial mouse click. If
you do a mouse click, drag, release, move, click, drag, and release, the on mousePoint event handler
is called three times: the first click, the first release, and the second release, with <arg> values of 1,
2, and 3, respectively. The mouse click counter is incremented after processing the on mousePoint
event handler, so the <arg> parameter for the mouseMove and mouseAbort event handlers specify
the click count for the next mouse click. In the previous example, when you drag between the first
click and first release, the <arg> value for a mouseMove event handler will have a value of 2. During
the following move, click, and drag it will have a value of 3.
The following script simply demonstrates when the various event handlers are called. Simply run
this script and drag in the viewports. Right-click or press the ESC key to stop the tool’s execution.
Mouse Tool Clauses 1537
Script:
tool foo
( on freeMove do print “Free Moving”
on mousePoint clickno do format “Point: %\n” clickno
on mouseAbort clickno do format “Abort: %\n” clickno
on mouseMove clickno do format “Moving: %\n” clickno
on start do print “Starting”
on end do print “Ending”
)
startTool foo prompt:”Hello!”
All of the mouse action event handlers may return the special value #stop which causes the tool to
stop. In the following mousePoint event handler example, the first click creates the box and the
release (second click) terminates the tool.
on mousePoint clickno do
if clickno == 1
then b = box pos:worldPoint
else #stop
Example:
The following script implements the following functions: on mouse click three spot lights are
created at the mouse point. While holding the mouse button down, drag the mouse to position the
classical key, back and fill light positions. During this drag, holding down the SHIFT key will flip the
fill light side. Release the mouse button and move the mouse to change the elevation of the lights.
Click the mouse button when the lights are at the correct height. The back light is raised 1.5 times
the key light’s height, and the fill light is raised 0.75 times the key light’s height.
To start this tool, you’d say:
startTool three_lights
See also
Scripted Mouse Tools (p. 1531)
Scripted Plug-ins
MAXScript supports several levels of scripted plug-ins, as follows:
The scripted plug-in appears in the user interface as a new class but does not allow instances of itself
in the scene. It lets you define a mouse tool that creates other objects in the scene, but once you’ve
finished creation, there is no instance of the class left in the scene to modify or save. Examples of
this currently in 3ds max are the System classes such as RingArray.
The scripted plug-in extends an existing plug-in, either adding to or replacing the command panel
parameter rollouts for the existing plug-in. For example, you might create a new “glass” material
which extends StandardMaterial and provides a custom, presumably smaller, Material Editor rollout
that just has glass parameters which set up and modify various properties in the underlying material
plug-in as appropriate. Or, you want to create a new light type that is actually a system of
coordinated lights, that also has a “controlling” dummy object created. This controlling dummy
keeps track of the lights in the system and has a Create/Modify panel rollout that allows coordinated
manipulation of the system. In this case, you’d create a new helper plug-in that extends Dummy,
has locals to store the lights, and define a rollout. You would also create a new light plug-in with a
create tool that builds the system.
The scripted plug-in is given a unique and permanent class ID value by the script writer and so can
be instanced in the scene and stored in scene files. All 3ds max plug-ins have a unique class ID and
3ds max uses this class ID to associate stored scene objects with the code that handles them each
time you open a scene file, hence it has to be unique and permanent. In the level 1 scripted plug-in
above, MAXScript allocates a temporary class ID that is not permanent across executions of 3ds max
and thus prevents instancing in the scene.
The scripted plug-in defines one or more parameter blocks, containing directly animatable parameters
that are saved to and restored from scene files. These are the permanent parameters for the plug-in
and are distinct from the local variables in the example above which only live during creation.
Mouse Tool Clauses 1539
A parameter block can be associated with a rollout in the scripted plug-in that provides a user
interface for the parameters in the parameter block. When associated in this way, the parameters are
“wired” to their spinners and checkboxes, etc., and both update automatically as the other changes.
The general form for a scripted plug-in is:
plugin <superclass> <varname> {keyword:val}
( <plugin_body> )
where:
<superclass> is one of the currently-supported plug-in superclasses:
Geometry
SimpleObject
Shape
Light
Helper
Modifier
SimpleMod
Material
TextureMap
RenderEffect
Atmospheric
<varname> is the name that will be given to the global variable that contains this plug-in class.
This class value is just like a normal plug-in class (like box, sphere, etc.) and you can create an
instance of the plug-in in MAXScript by applying the class value.
{keyword:val} is an optional sequence of keyword/value pairs defining options for the
plug-in. These pairs are:
name:<string>
The optional name: parameter specifies the name of the plug-in as seen in the
3ds max user-interface. For example, if the superclass of the plug-in is geometry or
light, this name would be displayed on the plug-in’s button in the Create panel; if
the superclass of the plug-in is modifier, this name would be displayed on the plug-
in’s button in the Modify panel; and if the superclass of the plug-in is material or
textureMap, this name would be displayed in the Material/Map Browser. The default
name is the plug-in’s <varname>.
category:<string>
The optional category: parameter specifies in which object category (access via the
object category list) the plug-in will appear in. This parameter is applicable only to
plug-ins that appear in the Create panel. The default category in “Standard”. Note that
there is a fixed number of buttons available in the Create panel for each category. If a
button for your plug-in does not show up in the appropriate Create panel, you may
need to make a new category for it.
1540 Chapter 12 | Creating MAXScript Tools
classID:#(<integer>,<integer>)
You supply the classID:#(<integer>,<integer>) parameter if you want the
plug-in to be creatable and storable in the scene. This ID becomes the permanent ID
for the class and is used by 3ds max to identify objects as they are saved and loaded in
the scene. You don’t need to supply a class ID value if the plug-in is to be like a System
object that only creates other types of objects in the scene. The class ID is basically a
pair of numbers, chosen randomly so that (hopefully) they won’t conflict with
another plug-in. MAXScript provides a method to generate a fresh random class ID
each time you run it:
genClassID()
This method generates a random class ID similar to #(0x9b7ea231,
0xb6db86ef), and prints it to Listener. You can just cut and paste this class ID
into your script to use the generated ID.
extends:<maxClass>
The extends:<maxClass> parameter is supplied if you want to base your plug-in on
an existing plug-in. This basically lets you add a new class that works internally
exactly like the one you are extending, but with an expanded or replaced user
interface. The class you specify must have the same superclass as specified in the
scripted plug-in header. Current limitations prevent certain plug-ins from being
extended, in particular those with custom creation managers. These include target
lights and cameras and all the System plug-ins. You can tell if a plug-in is not
extendable if your new rollouts do not appear.
When you create an object of scripted plug-in that extends another, MAXScript also
creates an internal object of the extends: plug-in and passes most of 3ds max’s
interaction with your plug-in onto the internal object. This is called delegation and the
internal extends: plug-in object is the delegate. The delegate is visible in your plug-
in’s objects in Track View and you can access the delegate in your scripts to control it
as needed. See the locals section below for more information. The delegate is not
shown in TV if replaceUI:true is specified.
replaceUI:<boolean>
The replaceUI: parameter is used only when extends: is supplied to indicate
whether the rollouts in your plug-in should add-to or replace the extended plug-ins
rollouts. The default is false, which means your rollouts will be appended at the end
of the extended plug-in’s. Another current limitation when extending plug-ins whose
objects are created in the Create panel only allows user interface replacement in the
Modifier panel; the original plug-in’s rollouts are always displayed along with the
scripted rollouts in the Create panel.
version:<integer>
The optional version: parameter specifies the version number of the scripted plug-
in. The value assigned to this parameter is used when updating the scripted plug-in
definition. The default value for this parameter is 1. See the Updating Scripted Plug-ins
(p. 1553) topic for more information on this parameter.
Mouse Tool Clauses 1541
invisible:<boolean>
The optional invisible: parameter gives control over whether the plug-in is visible
in the Create panel Object Type rollout or in the Material/Map Browser, etc. This is
useful for component or controlling objects created as part of a group, say in a System-
style plug-in that should not be creatable on their own. Set this parameter to true to
hide the plug-in.
silentErrors:<boolean>
The optional silentErrors: parameter gives control over whether MAXScript run-
time error messages are displayed when executing handlers in the scripted plug-in. If
this parameter is set to true, error messages will not be displayed. This may be useful
for distributed scripted plug-ins that may confuse the user with MAXScript error
messages.
<plugin_body> is enclosed in the required parentheses and is a sequence of clauses that define
the local variables and functions, parameters, user-interface items, and event handlers that
define the plug-in. These clauses are defined in detail in the Scripted Plug-in Clauses (p. 1542)
topic.
If you load a scene file that uses a level 3 or higher scripted plug-in, and you have not defined that
scripted plug-in, a Missing DLL dialog will be displayed after the load, indicating the definition for
the scripted plug-in is missing. The file will then load using a standin for the object with the missing
definition, just as it would for other objects missing their DLL definitions. 3ds max treats scripted
plug-ins as it does C++ plugins, requiring the definition to be in place, either in a script file in the
plugins directory when 3ds max starts, or having been defined by running some script prior to
loading the file.
See also
Scripted Plug-in Clauses
Scripted Plug-in Methods
Updating Scripted Plug-ins
Scripted Geometry Plug-ins
Scripted SimpleObject Plug-ins
Scripted Shape Plug-ins
Scripted Light Plug-ins
Scripted Helper Plug-ins
Scripted Modifier Plug-ins
Scripted SimpleMod Plug-ins
Scripted Material Plug-ins
Scripted TextureMap Plug-ins
Scripted RenderEffect Plug-ins
Scripted Atmospheric Plug-ins
1542 Chapter 12 | Creating MAXScript Tools
Plug-in clauses define the components of a scripted plug-in and can be one of five basic things:
• Local variables, functions or structure definitions are variables, functions, and structures whose
scope is the plug-in. These locals will exist as long as the instance of the plug-in exists. The
visibility of locals, and accessing scripted plug-in locals from external code, are described in the
Visibility of Locals, Functions, Structures, and User-Interface Items in Rollout Code (p. 1478) and
Accessing Locals and Other Items in a Rollout from External Code (p. 1480) topics.
• Parameter blocks define a set of parameters for the plug-in, which are like plug-in local
variables, but are directly animatable and are saved to and restored from scene files. You can also
associate each parameter with appropriate user-interface elements in one of the plug-ins
rollouts. When associated in this way, the parameters are “wired” to their spinners and
checkboxes, etc., and both update automatically as the other changes, so you don’t have to
write any user-interface event handlers for them. These parameters correspond to the visible
parameters you see in other 3ds max plug-ins.
• Mouse tools are used to perform a set of actions based on mouse clicks in the 3ds max viewports,
and are described in the Scripted Mouse Tools (p. 1531) topic.
• Rollouts can be displayed for the scripted plug-in. For scripted plug-ins that extend an existing
plug-in, these rollouts can be displayed in addition to or replace the existing plug-in’s rollouts.
Rollout definitions are described in the Utility Clauses (p. 1466) topic.
• Event handlers are special kinds of functions associated with particular events. Event handlers
specify the processing you want to occur when a user creates an instance of the scripted plug-in
or when 3ds max calls the scripted plug-in. These actions generate named events and the
optional event handler you supply for that event is called when the action occurs.
Formally, the syntax of a <plugin_clause> is defined as follows:
<plugin_clause> ::= <local_variable_decl> |
<local_function_decl> |
<local_struct_decl> |
<parameters> |
<tools> |
<rollouts> |
<event_handler>
Scripted Plug-in Clauses 1543
Locals:
A <local_variable_decl>, <local_function_decl>, and <local_struct_decl> are exactly
the same as local variable, function, and structure definitions in MAXScript:
<local_variable_decl> ::= local <decl> { , <decl> }
<decl> ::= <name> [ = <expr> ] -- optional initial value
Global variables cannot be declared as a plug-in clause, however they can be declared within event
handler scripts. If you need to ensure a variable name references a global variable, declare the
variable name as global immediately before defining the plug-in in your script.
When writing scripts, it is good programming practice to explicitly declare your local and global
variables. Implicit declaration is provided as a short-hand, typically used when working in the
Listener interactively or developing short scripts. When developing extended scripts, explicitly
declaring variables can reduce errors and improve readability of the code. It is also recommend that
you declare as local all variables unless you really want them to be global variables. The reasons for
this are described in the Scope of Variables (p. 646) topic.
Plug-in locals are attached to plug-in objects, and each new instance of the scripted plug-in has its
own local storage area. When you reference a plug-in local in a plug-in function or handler, it
accesses the local storage of the currently active object, for example, the object currently open in the
command panel. Plug-in local storage is not permanent across scene saves and loads (unlike
<parameters>). You can provide initial values for locals, as elsewhere in MAXScript, and the locals
are re-initialized when a saved scripted plug-in object is loaded again as part of a scene file open. You
can also do this by hand in a create event handler if you supply one in the plug-in.
Plug-in locals are accessible to script code outside a plug-in as a normal property on the object, but
note that they may be hidden by parameters or other common object properties if they have the
same name. When accessing a property on a scripted plug-in object, MAXScript first looks in the
common properties (such as .pos, .scale, .parent, etc. on a node), then in the parameters, and
then in the locals for a property name match.
There are three predefined local variables accessible in all scripted plug-ins:
version
Yields the current version of the object as an Integer value.
this
Yields the instance of the scripted plug-in.
delegate
Yields the instance of the plug-in you are extending in an extends: plug-in.
1544 Chapter 12 | Creating MAXScript Tools
The version local variable contains the version number specified in the scripted plug-in definition.
See the Updating Scripted Plug-ins (p. 1553) topic for more information on this variable.
The this local variable always contains the MAXScript value corresponding to the current instance
of the scripted plug-in. This variable provides a guaranteed way of accessing parameters on the new
object within plug-in code (in case there are locals or globals with the same name), and it is a way
of referencing the plug-in in case you want to store it to a variable.
The delegate local variable contains the MAXScript value corresponding to the instance of the
plug-in being extended. To access common properties or subAnim properties in the instance of the
plug-in being extended, you need to do so via the delegate local variable. For example,
delegate.width = thisWidth
inside a plug-in function or handler would set the .width property in the instance of the
plug-in being extended. The delegate local variable in a scripted plug-in that creates a
scene object does not contain the node itself, but a the BaseObject of that node. As such,
you can not access the node level properties of the object being created. An exception to
this is the node’s transform, which is exposed to the scripted plug-in through a local
variable called nodeTM. This variable is described in the applicable scripted plug-in
type topics.
If the extends: parameter is not supplied for a plug-in, delegate returns undefined.
As well as local variables, you can define local functions and local structures, just as you can with
scripted utilities and rollouts.
Parameters:
You can define one or more parameter blocks in a scripted plug-in. A parameter block has the form:
parameters <name> [type:#class] [rollout:<name>]
(
{ <param_defs> }+
{ <event_handler> }
)
A parameter block defines a set of parameters for the plug-in, which are like plug-in local variables,
but are directly animatable and are saved to and restored from scene files. You can also associate each
parameter with appropriate user-interface elements in one of the plug-ins rollouts. When associated
in this way, the parameters are “wired” to their spinners and checkboxes, etc., and both update
automatically as the other changes, so you don’t have to write any user-interface event handlers for
them. These parameters correspond to the visible parameters you see in other 3ds max plug-ins.
Parameters in the parameter block do not participate in 3ds max’s undo system, therefore changes
to the parameter values are not undoable.
The <name> you give to a parameter block becomes permanently associated with the parameter
block and is used by MAXScript to connect to the right parameter block in a plug-in object that is
being loaded from a scene file. This becomes important as you modify a plug-in script and yet there
are still objects corresponding to the old definition in other files. When the old-version object is
loaded, MAXScript attempts to convert it to the new definition, using the current parameter block
definition as a guide. In order to properly do this, each parameter in a parameter block is also given
Scripted Plug-in Clauses 1545
a permanent name. So, if you have existing objects of your plug-in in other files, don’t go randomly
changing parameter block names or they won’t be loadable.
The optional type:#class specifies that the parameters in the parameter block are “class”
parameters. This means that there is one copy of each parameter for the *all* the objects of this plug-
in class; they all share the parameter. Examples of existing class parameters are the creation type and
type-in parameters in a typical geometry primitive.
The optional rollout:<name> specifies a rollout definition elsewhere in the plug-in body to use as
the user-interface rollout for the parameter block’s parameters. A limitation of the internal
parameter block mechanism requires that each parameter block be associated with a separate rollout
and each rollout be associated with only one parameter block. This means that each rollout you
want to have in the plug-ins user interface must have its own separate parameter block.
The <param_defs> are definitions for each parameter in the parameter block. They have the form:
<name> type:<#name> [tabSize:<integer>] [tabSizeVariable:<boolean>] \
[default:<operand>] [animatable:<boolean>] \
[subAnim:<boolean>] [ui:<ui_def>]
The <name> is permanently associated with the parameter in the same sense as parameter block
names. They are used to connect to the right parameter when loading objects of the scripted plug-
in and allow you to make certain changes to a script and yet still be able to load old version objects.
So, as with parameter block names, don’t change or re-use parameter names if you have scene files
with old version objects you want to get at.
The type:<#name> parameter is required and defines the parameter type. It can be one of the
following:
#float animatable
#integer animatable
#color animatable
#point3 animatable
#boolean animatable
#angle animatable
#percent animatable
#worldUnits animatable
#string
#filename
#colorChannel animatable
#time animatable
#radiobtnIndex
#material
#texturemap
#bitmap
#node
#maxObject
1546 Chapter 12 | Creating MAXScript Tools
or one of the following types which are arrays of the above base types:
#floatTab
#intTab
#colorTab
#point3Tab
#boolTab
#angleTab
#percentTab
#worldUnitsTab
#stringTab
#filenameTab
#colorChannelTab
#timeTab
#radiobtnIndexTab
#materialTab
#texturemapTab
#bitmapTab
#nodeTab
#maxObjectTab
#worldUnits and #worldUnitsTab specify that a parameter holds a world distance value, kept
internally as a system units float. For example:
parameters main rollout:params
(
height type:#worldUnits ui:heightSpin
)
Note that this doesn’t cause any spinner display to be automatically shown in current display units,
you need to also specify type:#worldUnits on the associated rollout spinner definition.
#node and #nodeTab are used to store references to nodes. The nodes stored in these parameters
cannot create a circular dependency. If, for example, you were creating a scripted helper, and set the
helper as a target or parent of a camera, you can not store the camera node in a #node or #nodeTab
parameter. Likewise, if you created a scripted modifier or material, and store a node in a #node or
#nodeTab parameter, you cannot apply the modifier or material to that node.
Scripted Plug-in Clauses 1547
The various xxTab parameter types allow you to store an array of values having the corresponding
type. The initial size of the array is specified using the tabSize: specifier. If
tabSizeVariable:true is specified, the size of the array will be automatically expanded when you
assign to an higher array index. For example:
parameters main rollout:params
(
mapAmounts type:#floatTab tabSize:4 tabSizeVariable:true \
ui:(map1Amount, map2Amount, map3Amount)
)
defines an array parameter containing 4 float elements (defined by the tabSize:
parameter). You can associate a separate rollout element with each array parameter
element. These parameters appear as arrays when accessed in plug-in handler code, for
example:
a = mapAmounts[i]
You can also increase or decrease the array size by assigning a value to the .count property.
Each element in an array parameter whose base type is a number of some kind (floatTab, intTab,
percentTab, etc.) is independently and automatically animatable, unless you specify
animatable:false. You can get at and assign individual controllers via the .controller
property. For example:
c = mapAmounts[i].controller
The optional parameter default:<operand> specifies a initial default value for the parameter. The
<operand> expression has to be convertible by MAXScript to the base type of the parameter.
The optional parameter animatable:<boolean> specifies whether the parameter is animatable
and hence visible in the track view. Only those base types marked as animatable in the above type
list can be specified as animatable. Defaults to true.
The optional parameter subAnim:<boolean> can be specified for the 3ds max object types: #node,
#material, #textureMap, and #maxObject. If specified as true, the 3ds max object is made
visible as a sub-object track in track view. Defaults to false.
The optional parameter ui:<ui_def> is used to specify which user-interface element in the
parameter block’s associated rollout is to be linked to this parameter. When so linked, the handling
of user actions for these elements are automatic and they also update automatically to follow any
changes to the parameter caused by animation, scripts, etc. For example, in the following, the
parameter block named main is associated with the rollout named params. The parameters height
and spread are then linked with the spinners named height and spread in that rollout:
1548 Chapter 12 | Creating MAXScript Tools
Once this is done, the parameter and spinner are linked, such that changes in one are reflected
immediately and automatically in the other. Further, if the parameter is animated, the spinner will
show red keyframe highlights when the time slider is positioned at a keyframe for that parameter,
as with other 3ds max plug-ins. The kinds of user-interface items that can be linked to particular
parameter types is limited to the following sensible combinations:
Parameter type Rollout user-interface item
#integer spinner, slider, radioButtons, checkbox, checkbutton
#float spinner, slider
#time spinner, slider
#color colorpicker
#angle spinner, slider
#percent spinner, slider
#colorChannel spinner, slider
#boolean checkbox, checkbutton
#node pickButton
#textureMap mapButton
#material materialButton
#worldUnits spinner, slider
handler in used in the previous example to update the light positions when the height
parameter value changes.
The set handlers are also called when an instance is created or loaded so that common
dependent actions can be taken, such as setting up other dependent system object or
delegate properties.
If a parameter is animated and has a set handler supplied, the handler will be called
whenever the 3ds max time changes, say by dragging the time slider around or within an
animation rendering.
on <name> get <arg> do <expr>
A get handler can be supplied for any of the parameters in the block and it will be called
whenever the parameter value is retrieved. This will occur when the user interface updates
itself, a script accesses the parameter, a viewport is redraw, a render occurs. In all these
cases, the animated value is retrieved one or more times. The get handler is called with a
single argument which is the current value stored in the paramblock (or underlying
controller if the parameter is animated). The currentTime variable is set to the time at
which the value is being retrieved and not necessarily the current slider time, since you
can ask a parameter for its value for any specified time. If you implement the get handler,
you must return a value, and that value is returned as the value of the parameter to the
value requester. If you don’t want to modify the value, but just monitor accesses, return
the argument. You can also compute and return any value of the appropriate type.
Tools:
Plug-ins can define local mouse tools. Although you can have any number of local tools and start
them as needed, you would typically supply a single tool with the reserved name create. This is
taken to be the create tool for objects created in the Create panel and is invoked automatically when
you create scripted plug-in objects. Tool definitions are described in the Scripted Mouse Tools (p. 1531)
topic.
Creatable scene scripted plug-ins (scripted plug-ins that are not invisible, temporary, or extend
another plug-in) require a create tool. A create tool, if present on a non-temporary extending
plug-in, will override the delegate’s create tool. The animate state is implicitly turned off while the
create tool is executed.
A local variable nodeTM is accessible within the create tool. This variable contains a Matrix3 values.
This value is in the active grid coordinate system. This variable allows the create tool to set the
transform of the node currently being created. Also, within the create tool you should use the
gridX values rather than worldX values in all cases, since object-creation is managed in the active
grid coordinate system.
Rollouts:
Plug-ins can define local rollouts. These have the same syntax as local rollouts in scripted utilities.
Unlike utility local rollouts, these rollouts are automatically opened as appropriate for the plug-in
type (in the command panel or Material Editor, etc.).
1550 Chapter 12 | Creating MAXScript Tools
Note that rollout local variables only live as long as the rollout is open in the user interface. It gets
opened and closed each time it is displayed and so the rollout open and close events are signalled at
this time. If you want to load any spinners or other user-interface elements from the currently
editing plug-in object, supply an on <rollout> open event handler to pick up these values.
Rollout definitions are described in the Utility Clauses (p. 1466) topic.
Event Handlers:
As with mouse tools, scripted plug-ins respond to certain actions in 3ds max by implementing
handler functions. All types of scripted plug-ins support the following event handlers. You can use
these event handlers to perform any extra initialization needed, such as loading up plug-in local
variables or initializing properties of the plug-in’s delegate.
on create do <expr>
The create event handler that is called whenever an instance of a scripted plug-in is
created in a scene file. The animate state is implicitly turned off while the create event
handler expression is executed.
on load do <expr>
The load event handler that is called whenever an instance of a scripted plug-in is loaded
from a scene file. The animate state is implicitly turned off while the load event handler
expression is executed.
on update do <expr>
The update event handler that is called whenever an instance of a scripted plug-in is
present in the scene file, and the definition of the scripted plug-in is changed (i.e., if you
define a scripted plug-in, create an instance of the plug-in object in the scene, and then
change and execute the script defining the scripted plug-in, the update event handler
defined in the new definition of the scripted plug-in script is called for each instance of the
plug-in object in the scene). See the Updating Scripted Plug-ins topic for more
information.
Specific classes of scripted plug-ins implement additional event handlers, and are described with
description of the scripted plug-in type.
Runtime errors in certain event handlers cause the plug-in to be disabled until it is re-defined. When
disabled, none of the plug-in event handlers are called. For example, errors in the map event handler
expression in SimpleMods and the buildMesh event handler expression in SimpleObject disable
the plug-in, since they are called so frequently. You will need to correct any problems and re-evaluate
the plug-in definition again to re-enable the plug-in event handlers.
See also
Scripted Plug-ins (p. 1538)
Scripted Plug-in Methods 1551
In the following example, a variation of the three light mouse tool example presented in the Mouse
Tool Clauses (p. 1532) topic is set into permanent, editable classes. It defines two new classes. The
helper class lightMaster is used as a master object for the light system. The light class
threeLights is what you create to layout the initial system. It also creates a lightMaster and sets
its parameters to point at the lights. The lightMaster rollout allows subsequent editing of the
system in the Modifier panel, and storing the lights in a parameter block makes the setup persistent
over scene saves and loads.
Script:
plugin helper lightMaster
name:”Light Master”
classID:#(12345,54321)
extends:Dummy
replaceUI:true
invisible:true
(
parameters main rollout:params
( key type:#node subAnim:true
fill type:#node subAnim:true
back type:#node subAnim:true
height type:#worldUnits default:0 ui:height
spread type:#worldUnits default:0 ui:spread
angle type:#angle default:90 ui:angle
--
-- check value of key since lights don’t exist at initial creation
on height set val do if key != undefined then coordsys key.target
( key.pos.z = val
back.pos.z = val * 1.5
fill.pos.z = val * 0.5
)
--
on spread set val do if key != undefined then coordsys key.target
( -- compute normal vector pointing at key in the target’s XY plane
-- (kuv) and reposition everything based on that and the current
-- spread and angle values
local kuv = normalize ([key.pos.x, key.pos.y, 0])
key.pos = [kuv.x * spread, kuv.y * spread, height]
back.pos = [kuv.x * -spread, kuv.y * -spread, height * 1.5]
-- position fill by placing it under the key and then rotating in
-- about the target
1552 Chapter 12 | Creating MAXScript Tools
on mouseMove click do
( if click == 2 then -- drag out & round on x-y plane
( -- place the key on the grid then set the spread and the
-- ‘on set spread’ handler will
-- move the lights to the correct heights
master.key.pos = worldPoint
master.spread = distance master.key master.key.target
)
else if click == 3 then -- drag up to elevate lights
master.height = gridDist.z
)
--
on mouseAbort click do
( if master != undefined then
( if master.fill != undefined then delete master.fill
if master.back != undefined then delete master.back
if master.key != undefined then delete master.key
delete master
)
)
)
)
See also
Scripted Plug-ins (p. 1538)
You can specify an update event handler in a scripted plug-in and it will be called whenever the
object is updated by this schema migration mechanism. To make this more useful, MAXScript
supports a version number on scripted plug-ins. The version for any particular instance of the plug-
in can be accessed via the version special local variable in any plug-in local function or handler.
When the update event handler is called during a schema-migration, the old version number is still
in force, but is updated to the current version number immediately after update. For example:
plugin helper lightMaster
name:”Light Master”
classID:#(12345,54321)
extends:Dummy
invisible:true
replaceUI:true
version:3 -- set current version to 3
(
parameters main rollout:params
...
on update do
(
if version == 1 then ... -- do something special for v1 instances
)
...
)
Note that you only need to use this explicit version access and update scheme if you want to do some
special manual conversion over-and-above the automatic migration described above.
Finally, if there are no existing instances of the plug-in, either in the current scene or in other scenes
that you care about keeping, you can simply delete them and make whatever changes you like the
scripted plug-in definition. The above version update considerations come into play only when you
wish to support old version objects of your scripted plug-in.
See also
Scripted Plug-ins (p. 1538)
Scripted Geometry Plug-ins 1555
This adds a new geometry category with one button to the Create panel. Pressing the FooBar button
starts a mouse command mode that creates a row of 10 boxes where you click and adds a rollout to
the command panel with one spinner that lets you adjust the separation of the boxes. This is very
similar to a System object like the RingArray, except it lives in the Geometry tab. This is the simplest
type of scripted of plug-in; it has no specific scene object and no storable parameters.
In the tool handlers, you can set the delegate properties as needed. For example:
Script:
plugin geometry Cuboid
name:”Cuboid”
classID:#(0x133067, 0x54374)
category:”Scripted Primitives”
extends:Box
( fn fmax val1 val2 = if val1 > val2 then val1 else val2
tool create
( on mousePoint click do
case click of
( 1: nodeTM.translation = gridPoint
2: #stop
)
--
on mouseMove click do
if click == 2 then
1556 Chapter 12 | Creating MAXScript Tools
delegate.width = delegate.length =
delegate.height = 2 * fmax (abs gridDist.x) (abs gridDist.y)
)
)
See also
Updating Scripted Plug-ins (p. 1553)
Scripted Plug-in Methods (p. 1551)
Scripted Plug-in Clauses (p. 1542)
Scripted Plug-ins (p. 1538)
Scripted Mouse Tools (p. 1531)
In this script a new primitive called Tower is defined. It constructs a (very) simple tower form; the
first drag sets the base and the second drag sets the height. It contains three animatable rollout
parameters, height, width and depth, that set the object’s basic bounds. The key components here
are the create tool and the on buildMesh handler and they work together in a fairly simple way.
The create tool sets the values of the parameters and the on buildMesh handler constructs a mesh
based on those parameter values.
The create tool can also access and set the position of the node that is being created to contain the
new object through the Matrix3 value in the pre-defined mouse tool local variable nodeTM. In this
case, the position portion of the node’s TM is set to the initial mouse down world position. The on
mouseMove handler sets the width and depth during click 2 and the height during click 3.
The on buildMesh handler constructs the desired mesh in the TriMesh value in the pre-defined
plug-in local variable mesh. Typically, it does this by building the mesh from scratch each time the
handler is called. In the example above, the mesh is initially set to a simple, two-face rectangular
plane (via setMesh()) and then the 2 faces are extruded up and scaled-down twice to get the
simple tower.
The mesh plug-in local variable is accessible in any of the plug-in’s handlers, but is typically only
built in the on buildMesh handler. You can either modify the existing TriMesh value in place using
the TriMesh methods, or construct a new TriMesh value and assign it to the mesh plug-in local
variable. The TriMesh created must be valid or a 3ds max crash may occur. All face, vertex, material
ID, and texture vertex arrays allocated must be filled in the handler.
1558 Chapter 12 | Creating MAXScript Tools
There are three additional event handlers that may be implemented for a scripted SimpleObject:
on OKtoDisplay do <boolean_expr>
If the OKtoDisplay event handler is implemented, <boolean_expr> should return true
or false depending on whether it is OK to display the current mesh. This is useful in
situations where a mesh might be in some degenerate state for particular parameter
settings and so should not be displayed in the viewports. The default implementation is
true. Note, empty meshes are OK to display.
on hasUVW do <boolean_expr>
If the hasUVW event handler is implemented, <boolean_expr> should return true or
false depending on whether UVW coordinates are present on the mesh. In many
primitive objects, a Generate Mapping Coords checkbox is provided for the user to control
UVW coordinate generation and the hasUVW handler expression would return the state of
this checkbox. The default implementation returns true or false depending on whether
the mesh has texture vertices present or not. At present, only a single map channel is
supported.
on setGenUVW <onOff> do <expr>
The setGenUVW event handler is called when 3ds max wants the plug-in to automatically
generate mapping coordinates, as happens when you first render an object that has a
material applied, but not mapping coordinates. It is called with a switch argument
<onOff> which is true or false to turn on or off the mapping coordinates. If your plug-
in is managing mapping coordinates, it should implement this handler and generate
mapping coordinates when called with a true argument. For example:
on setGenUVW onOff do
(
genMapCoords = onOff
if genMapCoords and gen_mapping_coords()
)
In this example, the parameters and rollouts are handled in a similar manner to the first example,
but the buildMesh handler generates the mesh in an indirect way. The final object is in the form of
a rectangular pipe, a box with a box hole through the middle. Two plug-in locals (box1 and box2)
are made to contain Box base objects whose size parameters are set according to the plug-in’s
parameters, box2 is the outer box, box1 is the hole. The final mesh is made by boolean subtraction
of box1 from box2. In this case, a separate new mesh is created and assigned to the mesh plug-in
local variable, in contrast to the first example which modified the object’s original mesh directly.
Either technique is OK.
The createInstance() method is used to directly create the box base objects. This method creates
the geometry associated with the specified object, but does not create a node. This method is used
since SimpleObject plug-in must not perform any scene related actions such as creating scene nodes
or building modifier stacks.
1560 Chapter 12 | Creating MAXScript Tools
See also
Updating Scripted Plug-ins (p. 1553)
Scripted Plug-in Methods (p. 1551)
Scripted Plug-in Clauses (p. 1542)
Scripted Plug-ins (p. 1538)
Scripted Mouse Tools (p. 1531)
See also
Updating Scripted Plug-ins (p. 1553)
Scripted Plug-in Methods (p. 1551)
Scripted Plug-in Clauses (p. 1542)
Scripted Plug-ins (p. 1538)
Scripted Mouse Tools (p. 1531)
Scripted Light Plug-ins 1561
See also
Updating Scripted Plug-ins (p. 1553)
Scripted Plug-in Methods (p. 1551)
Scripted Plug-in Clauses (p. 1542)
Scripted Plug-ins (p. 1538)
Scripted Mouse Tools (p. 1531)
See also
Updating Scripted Plug-ins (p. 1553)
Scripted Plug-in Methods (p. 1551)
Scripted Plug-in Clauses (p. 1542)
Scripted Plug-ins (p. 1538)
Scripted Mouse Tools (p. 1531)
1562 Chapter 12 | Creating MAXScript Tools
Script:
plugin modifier NSpline
name:”Normal. Spline”
classID:#(0x133067, 0x54374)
extends:normalize_spline
replaceUI:true version:1
( parameters main rollout:params
( seglen type:#float animatable:true ui:seglen default:20
on seglen set val do delegate.length = val
)
--
rollout params “Parameters”
( spinner seglen “Seg Length: “ range:[0.01,1e9,20]
)
)
See also
Updating Scripted Plug-ins (p. 1553)
Scripted Plug-in Methods (p. 1551)
Scripted Plug-in Clauses (p. 1542)
Scripted Plug-ins (p. 1538)
Scripted Mouse Tools (p. 1531)
Scripted SimpleMod Plug-ins 1563
This script defines a new SimpleMod plug-in named SaddleDeform. It applies a saddle-type
deformation to an object, curving up 2 opposite corners and curving down the other two opposite
corners (try it on a plane object to see this best). There is a single parameter spinner, amount that
specifies how much deformation to apply. The key component of a SimpleMod plug-in is the map
handler. Its form is:
on map <index> <point> do <expr>
This event handler is called once for every point in the object (or current point selection in the
object) being modified. These points may be mesh vertices, spline vertices, NURBS CVs, and so on.
The <index> argument gives the number of the point, but this index may not correspond to a
vertex number in a mesh or a spline. The <point> argument supplied to the map handler gives the
current object-space coordinates of the point as a Point3. The function should modify the supplied
point value as appropriate and return it as the result of the map handler call. In the example above,
the map handler applies a Z-coordinate deformation, using the equation z = sin(x * y), so that
all the points retain their X and Y coordinates and the Z is moved up or down so as to follow the
saddle function. Note that all coordinates are object-local.
The <index> value is 1-based, however the scripted plug-in is called with a <index> value of 0 to
signal that this particular map call is being used by the gizmo bounding box drawing code to
compute points in the gizmo box to draw. This occurs hit testing is performed on the object the
1564 Chapter 12 | Creating MAXScript Tools
SimpleMod modifier is applied to and the gizmo bounding box is displayed. This will be the case if
the object is selected, the Modifier panel is active, and the SimpleMod modifier is selected in the
object’s modifier stack.
It is basically up to the object being modified to decide what index value to pass. For meshes, for
example, it is the actual mesh vertex index. For patches, it is the control points first all in one
sequence, followed by the in and out vectors for each control point in control point order. For
splines, it is control point, in vector, out vector in control point sequence within the curve sequence.
This ordering may change in future versions of 3ds max.
Since the map handler can be called many times, even on simple objects, it is highly recommended
that you minimize the number of values that are created in the map handler. This will reduce the
need for garbage collection to be run. If you need several local variables in the map handler, it is
recommended that you declare one or more Point2 or Point3 values in the scripted plug-in
definition, and then store values to the component values of the Point2 or Point3 values. This will
prevent new local variables from being allocated in the map handler.
You should not try to access the object being modified from within the map handler as this will
attempt to evaluate the scripted modifier again. This will result in an infinite loop and hang
3ds max.
There are also three pre-defined plug-in locals you can access in the map handler, as follows:
min -- the modifier context’s bounding box min coordinate
max -- the modifier context’s bounding box max coordinate
center -- the modifier context’s bounding box center coordinate
extent -- the modifier context’s bounding box extent or size
In the example above, the map handler use the extent pre-defined local variable to compute a
scaling for the saddle function, so that it gets a 1/8th cycle of the function (22.5 degrees) across the
whole object. These bounding box locals relate to the modifier’s context, either the whole object or
group of objects if applied to a scene node selection, or sub-object selection if there is a sub-object
selection modifier below it on the stack (such as a Mesh Select).
You can also use some other built-in capabilities of SimpleMod to implement modifier limits as in
Bend and Taper. To do this, implement handlers for the following (you must implement all if you
implement any):
on modLimitZMin do <expr>
on modLimitZMax do <expr>
on modLimitAxis do <expr>
If called, the on modLimitZMin and on modLimitZMax handler expressions must evaluate to float
values corresponding to the minimum and maximum limits and the on modLimitAxis handler
expression must return #x, #y or #z to specify the limit axis. The MAXScript global variable
currentTime contains the time at which these values should be computed, although, normally,
simple access to parameter values will yield the correct currentTime value automatically. The
simplest way to implement these handlers is to maintain limit parameters and associated spinners
and checkboxes, and simply pass these parameter values back.
Scripted Material Plug-ins 1565
The Modify panel actually creates a fresh instance of every modifier when it is to be shown in the
More... list or the buttons in the Modifiers rollout. This will cause the create handler to be called
for a scripted SimpleMod plug-in. No special handling in the create handler is required for this
case.
See also
Updating Scripted Plug-ins (p. 1553)
Scripted Plug-in Methods (p. 1551)
Scripted Plug-in Clauses (p. 1542)
Scripted Plug-ins (p. 1538)
Scripted Mouse Tools (p. 1531)
See also
Updating Scripted Plug-ins (p. 1553)
Scripted Plug-in Methods (p. 1551)
Scripted Plug-in Clauses (p. 1542)
Scripted Plug-ins (p. 1538)
Scripted Mouse Tools (p. 1531)
See also
Updating Scripted Plug-ins (p. 1553)
Scripted Plug-in Methods (p. 1551)
Scripted Plug-in Clauses (p. 1542)
Scripted Plug-ins (p. 1538)
Scripted Mouse Tools (p. 1531)
getPixel() and setPixel() functions. This modified bitmap is then passed onto the
next render effect in the list or to the render output if it is the last effect.
To allow scripted Effects to take advantage of the g-buffer channel access, the following handlers are
present:
on channelsRequired do <expr>
The handler expression must evaluate to an array of the g-buffer channel names that are
required. The g-buffer channel names are:
#zDepth
#matID
#objectID
#UVCoords
#normal
#unClamped
#coverage
#node
#shaderColor
#shaderTransparency
#velocity
#weight
)
--
on channelsRequired do g_channels
--
on preApply map do if theNode != undefined then
( if cm == undefined then
( cm = getChannelAsMask map #node node:theNode \
fileName:(scriptsPath + “__fxtmp.bmp”)
save cm
tx.bitmap = cm
)
else
getChannelAsMask map #node node:theNode to:cm
)
--
on create do
( delegate.selMaskActive = true
delegate.selImageActive = false
delegate.selMaskMap = tx
)
)
Script:
plugin renderEffect myColorBalanceFx
name:”Super Color Balance FX”
classID:#(64425,45761)
extends:Color_Balance version:1
( parameters main rollout:params
( redness type:#integer animatable:true ui:redness default:0.0
on redness set val do delegate.red = val
)
--
rollout params “Super Color Balance Parameters”
( spinner redness “Redness: “ type:#integer range:[-100,100,0]
)
)
Script:
plugin renderEffect Negative
name:”Negative”
classID:#(0xb7aa794c, 0xc3bd78ab)
( parameters main rollout:params
( Color type:#color default:blue ui:Color
)
--
rollout params “Negative Parameters”
( colorpicker Color “Base color: “ align:#center
)
--
on apply bmp do
( for h=0 to (bmp.height-1) do
Scripted Atmospheric Plug-ins 1569
See also
Updating Scripted Plug-ins (p. 1553)
Scripted Plug-in Methods (p. 1551)
Scripted Plug-in Clauses (p. 1542)
Scripted Plug-ins (p. 1538)
Scripted Mouse Tools (p. 1531)
See also
Updating Scripted Plug-ins (p. 1553)
Scripted Plug-in Methods (p. 1551)
Scripted Plug-in Clauses (p. 1542)
Scripted Plug-ins (p. 1538)
Scripted Mouse Tools (p. 1531)
1570 Chapter 12 | Creating MAXScript Tools
Chapter 13: Interacting with the 3ds max User Interface
Command Panels
The following methods are used to get or set which command panel is active:
setCommandPanelTaskMode mode:<panel_name>
Sets the specified command panel as active. The valid panel_name values are:
#create -- Create Panel
#modify -- Modify Panel
#hierarchy -- Hierarchy Panel
#motion -- Motion Panel
#display -- Display Panel
#utility -- Utility Panel
getCommandPanelTaskMode()
Returns the current command panel as a name value. The name values correspond to the
panel_name values for SetCommandPanelTaskMode().
The following 3ds max system global variables are associated with the command panel:
cui.commandPanelOpen
Lets you get and set whether the command panel is displayed. A Boolean value - true if
the command panel is displayed, false if not displayed. This global variable is not
available in 3ds max.
Specific methods and 3ds max global variables are associated with the Create and Modify panels.
These methods and global variables are described in the following topics:
Create Panel (p. 1572)
Modify Panel (p. 1572)
1572 Chapter 13 | Interacting with the 3ds max User Interface
Create Panel
The startObjectCreation() method is used to simulate the user finding a Create Panel button
for a given object class and pressing that button, putting 3ds max into create mode for that object
class. The form is:
startObjectCreation <scene_object_class>
For example:
startObjectCreation box
startObjectCreation targetSpot
This method simply opens up the Create Panel at the right tab and category and depresses the
appropriate object button.
This method is primarily intended for use in macroScripts, but can be used in generalized scripts.
Script execution will continue immediately after entering the create mode, and you must ensure that
the script does not interfere with the object creation.
Modify Panel
The following methods are associated with the Modify panel:
enableShowEndRes <boolean>
If the boolean parameter is true, allows the Show End Result On/Off Toggle icon to
remain pressed in. If false, the Show End Result On/Off Toggle icon will return to the off
state after being pressed. This method must be used in true/false pairs, as its effect is
“sticky” when selecting other objects or modifiers, or when switching away from and back
to the Modify panel.
IsSubSelEnabled()
Returns true if the user is allowed to enter Sub-Object mode, false otherwise.
enableSubObjSel <boolean>
If the boolean parameter is true, allows the user to enter Sub-Object mode for those
objects/modifiers that have Sub-Object modes defined. If false, the Sub-Object button is
disabled. This method must be used in true/false pairs, as its effect is “sticky” when
selecting other objects or modifiers, or when switching away from and back to the Modify
panel.
modPanel.addModToSelection <modifier>
Applies a modifier to the current selection opened in the Modify panel. It should be used
in place of addModifier() in places where the target is a selection or group or where you
have the stack open at a particular place in the Modify panel with a sub-object selection
active and you want the modifier applied to that selection. addModifier() adds the
modifier separately to each object in the selection or group and does not honor the
current active sub-object selection in all cases. The Modify panel must be open on the
selection you want to apply the modifier to, otherwise the function does nothing.
Modify Panel 1573
modPanel.getCurrentObject()
Returns the modifier or base object currently selected in the Modify panel stack. If the
Modify panel is not open, this function returns undefined.
modPanel.getModifierIndex <node> <modifier>
Returns the index of the given modifier in the modifier stack for the given node. This
index corresponds to the modifiers position in the <node>.modifiers array. This
function returns undefined if the given modifier is not in the node’s modifier stack.
modPanel.setCurrentObject < modifier | node | node_baseobject >
Sets the specified object in the current modifier stack to be the active object in the
modifier stack. The Modify panel must be open on the object containing the modifier or
base object to be selected, otherwise the function does nothing.
Examples:
modPanel.addModToSelection (bend()) -- apply bend modifier to current
selection
modPanel.getModifierIndex $ foo -- returns index of modifier foo
modPanel.setCurrentObject $ -- open on base object
modPanel.setCurrentObject $.baseObject -- same as above
modPanel.setCurrentObject $.taper -- open on taper modifier in object
modPanel.setCurrentObject $.modifiers[3] -- open on 3rd modifier
modPanel.setCurrentObject foo -- open on foo object or modifier
The following 3ds max system global variables are associated with the Modify panel:
numSubObjectLevels
Lets you get the number of sub-object levels supported by the object or modifier currently
selected in the modifier stack. If the Modify panel is not open or no objects are selected,
the global contains the value undefined.
subObjectLevel
Lets you get and set the sub-object level in the Modify panel if it is open. An Integer value
of zero or greater up to the number of sub-object levels supported by the currently open
modifier, typically in the order shown in the Sub-Object drop-down list. A subObjectLevel
of 0 means sub-object mode is off. If the Modify panel is not open or sub-object level
setting not permitted in the current modifier, the global contains the value undefined.
For example:
b=box() -- create a box
em=edit_mesh() -- create an Edit Mesh modifier
addModifier $box01 em -- add edit mesh mod
max modify mode -- open mod panel
select $box01 -- select object box01
print subObjectLevel -- print the current subobject level
subObjectLevel = 2 -- set sub-object level to Edge
showEndResult
Lets you get and set the state of the Show End Result Toggle icon in the Modify panel. A
Boolean Value – true if Show End Result is on, false if off.
1574 Chapter 13 | Interacting with the 3ds max User Interface
Main Toolbar
The following methods are associated with 3ds max’s main toolbar:
enableUndo <boolean>
Enables or disables the Undo icon.
hitByNameDlg()
Opens the standard 3ds max Select By Name dialog allowing users to select objects.
Returns false if the user cancels out of the Select by Name dialog, true otherwise.
toolMode.uniformScale()
Set scale mode to Uniform Scale.
toolMode.nonUniformScale()
Set scale mode to Non-uniform Scale.
toolMode.squashScale()
Set scale mode to Squash.
enableRefCoordSys <boolean>
Enables or disables the Reference Coordinate System drop-down list.
toolMode.coordsys <mode_name>
Sets the Reference Coordinate System. Valid <mode_name> values are:
#view
#screen
#world
#parent
#local
#grid
getRefCoordSys()
setRefCoordSys <mode_name>
Get and set the Reference Coordinate System. Valid <mode_name> values are:
#hybrid -- View
#screen -- Screen
#world -- World
#parent -- Parent
#local -- Local
#object -- Pick object or Grid – not valid for setRefCoordSys()
enableCoordCenter <boolean>
Enables or disables the Coordinate System Center icon.
getCoordCenter()
setCoordCenter <name>
Get and set the Coordinate System Center. Valid <name> values are:
#local -- Use Pivot Point Center
#selection -- Use Selection Center
#system -- Use Transform Coordinate Center
Modify Panel 1575
toolMode.transformCenter()
Sets Coordinate System Center to Transform Coordinate System.
toolMode.selectionCenter()
Sets Coordinate System Center to Selection Center.
toolMode.pivotCenter()
Sets Coordinate System Center to Pivot Point Center.
getNumAxis()
This method reflects the Coordinate System Center state. If it is set to Pivot Point Center
then this method returns #individual otherwise #all.
setToolBtnState <name> <boolean>
Set the specified tool buttons on or off. This method does not put into the mode, it just
changes the state of the tool button. This method does not change the state of any button
other than the specified button. The valid <name> values are:
#move -- Move button on/off
#rotate -- Rotate button on/off
#nuscale -- Scale button on/off – doesn’t change scale type
#uscale -- Scale button on/off – doesn’t change scale type
#squash -- Scale button on/off – doesn’t change scale type
#select -- Select button on/off
getToolbtnState <name>
Returns whether the specified tool button is on or off as a <boolean> value. Valid name
values are:
#select
#move
#rotate
#uscale-- returns true if any of the scale button states is on
#nuscale-- returns true if any of the scale button states is on
#squash-- returns true if any of the scale button states is on
The following methods deal with the Named Selection Set drop-down list. These methods are not
intended for casual usage.
clearCurSelSet()
Clears the edit field of the Named Selection Set drop-down list. Does not deselect the
currently selected objects.
clearSubSelSets()
Clears the named selections from the Named Selection Set drop-down list. The named
selection sets still exist, they just don’t show in the drop-down list. This command can be
dangerous to use unless you are in Sub-Object mode in the Modify panel, as there is not a
direct method to rebuild the Named Selection Set list. When in Sub-Object mode in the
Modify panel, the namedSelSetListChanged() method will rebuild the list.
namedSelSetListChanged()
When in Sub-Object mode in the Modify panel, this method will rebuild the named
selection set list.
1576 Chapter 13 | Interacting with the 3ds max User Interface
setCurNamedSelSet <string>
Sets the edit field of the Named Selection Set drop-down list to the specified string. This
method not change the current selection set or add the specified string to the named
selection set list.
appendSubSelSet <string>
Appends the specified string to the Named Selection Set drop-down list. This method not
change the current selection set. Modifiers in 3ds max use this method to add sub-object
named selection sets to the Named Selection Set drop-down list. This is done whenever the
selection level changes.
The following 3ds max system global variables are associated with the main toolbar:
preferences.constantReferenceSystem
Lets you get and set whether to use a constant Reference System for the Move, Rotate, and
Scale tools. A Boolean value - true if Constant is on, false if off. This variable matches
the Constant check box in Customize menu > Preferences > General > Reference
Coordinate System.
toolmode.commandmode
Get/set the 3ds max command mode. The return value when getting the command mode
is a <name> value if the command mode is a recognized command mode, otherwise the
return value is an integer value. The recognized command modes are:
#SELECT
#MOVE
#ROTATE
#NUSCALE
#USCALE
#SQUASH
#VIEWPORT
#HIERARCHY
#CREATE
#MODIFY
#MOTION
#ANIMATION
#CAMERA
#NULL
#DISPLAY
#SPOTLIGHT
#PICK
When setting the 3ds max command mode, only the following command modes are valid:
#SELECT
#MOVE
#ROTATE
#NUSCALE
#USCALE
#SQUASH
Prompt Line 1577
toolmode.axisConstraints
Get/set the 3ds max axis constraints. The axis constraints values are:
#X
#Y
#Z
#XY
#YZ
#ZX
Status Bar
The methods and 3ds max global variables associated with 3ds max’s Status Bar are described in the
following topics:
Prompt Line (p. 1577)
Coordinate Display (p. 1578)
Progress Bar Display (p. 1578)
Status Bar Buttons (p. 1579)
Prompt Line
The following methods are associated with 3ds max’s Status Bar Prompt Line:
displayTempPrompt <string> <milliseconds_integer>
Displays the specified string on the Prompt Line for the specified number of milliseconds.
After the time elapses, the string is popped from the stack. This may be used to put up a
temporary error message for example. Control is returned to MAXScript immediately after
the call, that is, MAXScript execution continues even while the temporary prompt is
displayed.
removeTempPrompt()
Removes the temporary prompt immediately.
replacePrompt()
Replaces the string on the top of the prompt stack.
pushPrompt <string>
Pushes the currently displayed prompt onto the prompt stack, and displays the specified
string as the prompt.
popPrompt()
Pops the currently displayed prompt off the prompt stack. The previous prompt will be
restored.
1578 Chapter 13 | Interacting with the 3ds max User Interface
Coordinate Display
The following methods are associated with 3ds max’s Status Bar Coordinate Display:
disableStatusXYZ()
Disables mouse tracking and display of coordinates to the X, Y, Z status boxes.
enableStatusXYZ()
Enables mouse tracking and display of coordinates to the X, Y, Z status boxes.
setStatusXYZ <format_name> <point3>
Displays the component values of the Point3 value in the X, Y, Z status boxes. The format
of the displayed values is controlled by format_name. The valid format_name types are:
#universe
display point3 as position in current units
#scale
display point3 as percentages – a point3 component value of 1 displays as 100%
#angle
display point3 as angles – point3 component values are in radians
#other
display point3 as straight floating point values.
Note: Using a <format_name> value of #other for setStatusXYZ() does not correctly
display the specified point3 value. The X and Y component values are displayed in the Y
and Z status boxes, and the X status box is blank.
getProgressCancel()
A low-overhead function that checks whether the user has canceled the operation via the
Cancel button in the progress bar. You may want to call this function frequently within
deep loops in your code to reduce cancel latency for the user, because you should only call
progressUpdate() as needed to show significant progress bar changes to keep overhead
low. The getProgressCancel() function, as well as progressUpdate(), displays a
confirmation dialog if the use hits the cancel button and returns the cancel status from
that confirmation. Unlike progressUpdate(), this function returns true if the user has
made a confirmed cancel request and false otherwise.
setProgressCancel <boolean>
Sets or clears the Cancel flag for the progress bar. By passing a value of true, the Cancel
flag is set and will be detected by progressUpdate() and getProgressCancel(). By
passing a value of false, the Cancel flag is cleared if set.
The following 3ds max system global variable is associated with the Progress Bar display:
escapeEnable
Lets you get and set a Boolean value defining whether ESC key interrupt detection is on or
off. Setting enableEscape to false turns ESC key interrupt detection off, setting it to
true turns it on again. This variable is useful when used in conjunction with a Progress
Bar. You can set enableEscape to false when you don’t want the user to be able to
interrupt a script running a long computation and you have set up a progress bar with its
own Cancel button.
The following 3ds max system global variables are associated with the Status Bar buttons. These
global variables are not available in 3ds max.
snapMode.active
Lets you get and set a Boolean value defining the Snap toggle state - on (true) or off
(false). This global variable is not available in 3ds max.
snapMode.type
Lets you get and set a Name value defining whether 2D (#2D), 2.5D (#2_5D), or 3D (#3D) is
the current snap type. This global variable is not available in 3ds max.
Time Control
The following methods and 3ds max system global variables are associated with the 3ds max
Time Controls:
animButtonEnabled
A Boolean value that specifies whether the user can change the state of the Animate
button. If set to false, the user can not change the Animate button state. If set to true,
the user can change the Animate button state. A script can change the state of the Animate
button using animButtonState regardless of the animButtonEnabled value.
animButtonState
Lets you to get and set the state of the Animate button. A Boolean value - true if Animate
is on, false if Animate is off.
sliderTime
Lets you get and set a Time value that defines the time associated with the 3ds max
time slider.
Two functions are provided for starting and stopping the 3ds max animation playback, which are
essentially equivalent to pressing the Play button in the 3ds max user interface. The functions are:
playAnimation [ #selOnly ]
stopAnimation()
If you specify the optional argument, #selOnly, to playAnimation()only the currently selected
objects are animated.
There is an important restriction to understand when using these functions:
Calling playAnimation() is a thread-blocking call internally in 3ds max and does not return until
the playback is stopped by the user clicking the Stop Play button or another thread executing a
stopAnimation(). The only way to achieve the latter in MAXScript currently is to call
stopAnimation() from a scripted rollout panel handler such as a button press handler or from a
scripted controller script. If you invoke playAnimation() in code run from the Listener, you will
not be able to invoke stopAnimation() from the Listener, because the Listener is blocked inside
the playAnimation() call.
Also see the Time Configuration Dialog (p. 1616) topic for methods for setting options in the Time
Configuration dialog.
Accessing Active Viewport Info, Type, and Transforms 1581
Trackbar
The following methods are associated with the Trackbar:
trackbar.getPreviousKeyTime()
gets the previous key time. If no previous key is present, returns undefined. For example:
at time sliderTime trackbar.getPreviousKeyTime()
trackbar.getNextKeyTime()
gets the next key time. If no next key is present, returns undefined.
The following 3ds max system global variables are associated with the Trackbar:
trackbar.filter Name
get and set the filter specifying which types of keys to show in the Trackbar. The valid
values are: #all, #TMOnly, #currentTM, #object, and #mat.
trackbar.visible Boolean
get and set whether the trackbar is visible - true if the trackbar is visible, false if invisible
Viewports
viewport.getType()
viewport.setType <name>
Get and set the view type for the current viewport. Valid <name> values are:
#view_top -- Top
#view_bottom -- Bottom
#view_right -- Right
#view_left -- Left
#view_front -- Front
#view_back -- Back
#view_persp_user -- Perspective
#view_iso_user -- User
#view_camera -- Camera
#view_spot -- Light
#view_shape -- Shape
#view_track -- Track View
#view_grid -- Grid
Notes: If the current viewport is an extended viewport (that is, a Track View, Asset
Manager, or MAXScript Listener viewport), getType() will return undefined. If a
Camera or Light viewport is specified with setType(), and there is not exactly one
camera or light selected, a dialog will be displayed for the user to select the camera or light
to use.
viewport.setType returns a boolean - true if successful, false if not. Can also get a return
value of #view_none. If none of the viewports have focus, a value of false is returned from
viewport.getType.
Accessing Active Viewport Info, Type, and Transforms 1583
Example:
viewport.setType #view_track -- no viewport is active after this command
viewport.getType() -– will return false
viewport.ResetAllViews()
This function will reset all viewports in Max to the default layout.
getActiveCamera()
viewport.getCamera()
Returns the camera node associated with the active view if any, undefined if none.
viewport.setCamera <camera_node>
Sets the active viewport to a Camera view, using the specified camera.
getViewTM()
viewport.getTM()
viewport.setTM <matrix3>
Get or set the active view screen-to-world transform matrix for non-orthographic
(perspective and isometric user views) viewports. This is the affine camera or viewport
matrix. setTM only operates on Perspective viewports, and returns a value of true if the
view transform matrix was successfully set, false otherwise.
The following function returns as a Ray value the “eye” location and direction for the active
viewport. The viewport needs to be a non-orthographic viewport.
Script:
fn getViewDirectionRay =
(
-- The affine TM transforms from world coords to view coords
-- so we need the inverse of this matrix
local coordSysTM = Inverse(getViewTM())
-- The Z axis of this matrix is the view direction.
local viewDir = -coordSysTM.row3
-- get the view position from this matrix
local viewPt = coordSysTM.row4
return ray viewPt viewDir
)
getViewFOV()
Returns the Field of View for the active viewport. If the viewport is an orthographic
viewport, a value of 57.2958 degrees (1 radian) is returned.
getViewSize()
Returns the active view size as point2 in pixels.
getScreenScaleFactor <point3>
Returns the active view scale factor, giving the width in world-space units at the point’s
distance from the view space origin.
mapScreenToWorldRay <pixel_coord_point2>
Returns a Ray value in world space through the given viewport pixel coordinates in the
current active view, and perpendicular to the viewport plane.
1584 Chapter 13 | Interacting with the 3ds max User Interface
completeRedraw()
forceCompleteRedraw [ doDisabled:<boolean> ]
Calling this method will cause all the viewports to be completely redrawn. This method
literally forces everything (every object, every screen rectangle, every view) to be marked
invalid and then the whole scene is regenerated. The individual object pipeline caches are
not flushed, however. This routine is guaranteed to be slow. If the optional doDisabled:
boolean argument for ForceCompleteRedraw is true, disabled viewports will also be
redrawn.
disableSceneRedraw()
Turns viewport scene redraw off (disables it). All calls to DisableSceneRedraw()/
EnableSceneRedraw() must be in pairs, since an internal counter is used in 3ds max to
actually do the redraw enable/disable action.
enableSceneRedraw()
Turns viewport scene redraw on (enables it). All calls to DisableSceneRedraw()/
EnableSceneRedraw() must be in pairs, since an internal counter is used in 3ds max to
actually do the redraw enable/disable action.
isSceneRedrawDisabled()
Returns true if scene redraw is disabled, false if it is enabled.
nodeInvalRect <node>
Invalidates the rectangle in the viewports that the node is occupying. Rectangles flagged
as invalid will be updated on the next screen redraw.
getBkgORType <start_end_integer>
setBkgORType <start_end_integer> <name>
Get and set the background image Start Processing and End Procession options.
<start_end_integer> = 0 – Start Processing; 1 – End Processing
Valid <name> values are:
#blank -- Blank Before Start/After End
#hold -- Hold Before Start/After End
#loop -- Loop After End
getBkgRangeVal()
Get the background image Use Frame range as a Point2 value. The first component of the
Point2 value is the Start Frame, the second component is the End Frame.
setBkgFrameRange <point3>
Set the background image Use Frame range and step value. First component of <point3>
is Start Frame, second component is End Frame, and third component is Step Frame.
getBkgStartTime()
setBkgStartTime <time>
Get and set the background image Start At frame.
getBkgSyncFrame()
setBkgSyncFrame <integer>
Get and set the background image Synch Start To Frame frame.
The following 3ds max system global variable is associated with the Viewport Background dialog:
backgroundImageFileName
Lets you get and set a String value that defines the viewport background image bitmap file
name. It contains the corresponding bitmap file name set in the Viewport Background
dialog.
Viewport Grids
The following methods control the display and spacing of grid lines in the viewports.
getGridSpacing()
Returns the spacing between grid lines in units.
getGridMajorLines()
Returns the number of grid lines between major grid lines.
The following 3ds max system global variable is associated with the Viewport grids:
activeGrid
Contains the currently active grid. If the home grid is active, returns the value undefined.
You can assign a grid node object to this variable to make it the currently active grid.
1588 Chapter 13 | Interacting with the 3ds max User Interface
Mouse Cursors
The following methods control the mouse cursor.
setWaitCursor()
setArrowCursor()
These functions can be used to display the system wait cursor during some prolonged
computation and then replace it with the normal cursor. You might want to do this
instead of putting up a 3ds max progress bar, which may be too heavy-weight in some
situations. Note that in some cases, 3ds max may itself restore the arrow cursor
underneath this one (for example, with loadMAXFile()), and you may need to redisplay
it after such calls.
setSysCur <name>
Sets the current system cursor to one of the standard 3ds max cursors. Valid <name>
values are:
#move
#rotate
#uscale
#nuscale
#squash
#select
#arrow
The pickPoint() function lets the user pick a 3D point in a 3ds max viewport or type in
a 3D point in the Listener. When called, the function puts 3ds max into a special point-
picking command mode and the cursor changes to a cross-hair. The user can either click in
one of 3ds max’s viewports or type a 3D point into the Listener and the function returns
that point as a MAXScript Point3 value in world-space coordinates.
The function takes an optional prompt: string argument which it prints in the Listener as
a prompt message. There is also an optional snap: keyword argument that controls
viewport point picking if Snap is turned on in the 3ds max interface. If #3D is specified,
the cursor snaps to points anywhere in 3D space, if #2D is specified (the default), the
cursor only snaps on the current active grid construction plane. If Snap is off in the
3ds max interface, the clicked point is always taken to be on the current active grid
construction plane.
The user can either press the ESC key or click the right mouse button at any time to abort
the point picking and the function immediately returns the special MAXScript value
#escape if the escape key is pressed or #rightClick if the right mouse button is clicked.
You can get the pickPoint() function to display a rubberbanding dashed line during
point input by supplying the optional keyword argument
rubberBand:<start_point3>. If you include this on a call to pickPoint(), it
rubberbands a dashed line from the specified start point to follow the mouse. You would
use it in a chain of point picks by specifying the last picked point as the rubberBand:
start point for each successive pick. The start point given to rubberBand: should be in
world coordinates.
You can also set up a mouse move callback function for tracking free mouse moves during
point input. The optional keyword argument for this is mouseMoveCallback: and it has
two forms:
mouseMoveCallback:fn
mouseMoveCallback:#(fn, arg)
The second form allows you to supply an argument value that is sent to the callback
function each time it is called.
The fn you supply should take one argument in the first form above and two in the
second. When the callback function is called, the first argument it gets is always the
current world coordinates of the mouse and the second if given is the arg you supplied.
You can use a callback function to implement a more sophisticated form of
rubberbanding, for example by adjusting a spline’s vertex or a box’s height to follow the
mouse. If you do this, make sure you call any needed update() mesh or spline functions.
1590 Chapter 13 | Interacting with the 3ds max User Interface
Often, the pickPoint() function will be used repeatedly within a script to request
multiple points, such as successive vertices in a line. You may need to use the new
function, redrawViews(), to force a viewport update as you gradually construct new
scene objects this way. MAXScript normally delays viewport redraw until the script
finishes running.
pickOffsetDistance [ prompt:<string> ] [ pt2Prompt:<string> ] \
[ errPrompt:<string> ] [ snap:#2D|#3D ] \
[ keyword:<string> ]
This function issues the prompt message, if any, to Listener and waits for the user to either
click in a viewport (which determines a point exactly like the pickPoint() function), to
type in a number ended by ENTER (which determines a number), or to type all or the
beginning of the keyword ended by ENTER. If the user types the keyword, the function
returns true. If the user types a number, the function returns its value. If the user clicks a
point, the function issues the pt2Prompt message, if any, to Listener and waits for a
second point to be clicked, and then returns the world-space distance between the two
points. If the user types something which is not a number and does not match the
keyword, the function issues the errPrompt message, if any, otherwise the prompt
message, if any, and waits for the user to try again.
1592 Chapter 13 | Interacting with the 3ds max User Interface
#dualPlanes
If a driver has dual-planes support it returns true. The standard 3ds max OpenGL
display driver only returns true for this if the underlying display driver has
implemented a custom OpenGL extension that allows 3ds max to handle this
efficiently.
#swapModel
This returns true if 3ds max has to redraw the whole scene any time the viewports are
exposed.
#incrUpdate
This returns true if the driver can update a rectangular subset of the viewport without
trashing the image outside that rectangle. This is true for most drivers that blit the
viewport region and false for those that do page-flipping in the hardware. For
OpenGL, this is true if the display driver implements the Microsoft
glSwapRectHintWIN extension.
#passDecal
This is true if the driver can handle decalling with only one pass. Currently, this is
true for OpenGL, but false for HEIDI and D3D.
#driverConfig
This is true if the driver has a configuration dialog. This is true for all three of
3ds max‘s standard drivers.
#texturedBkg
This is true if the viewport background is implemented as a textured rectangle, and
false if it is a blitted bitmap.
#virtualVpts
This is true if the driver allows viewports to be made larger than the physical window
they are attached to. Currently, this is only true for OpenGL.
#paintDoesBlit
This is true if WM_PAINT messages result in a blit of the backbuffer (as opposed to a
page-flipping swap). This allows 3ds max to do quick damage region repair, and works
together with the #swapModel flag.
#wireframeStrips
This is true if the driver wants 3ds max to send down wireframe models using
triangle strips instead of a bundle of 2-point segments. This is only used by the
OpenGL driver, and it is there as a user-choosable performance-accuracy tradeoff
(since the strips are faster and are back-culled, but they display hidden edges as
though they are visible).
1594 Chapter 13 | Interacting with the 3ds max User Interface
gw.getYonCoord()
This method returns the smallest device Z value. Note: this method does not return the
proper Z depth value in 3ds max and VIZ R3.
DIB (Device-Independent Bitmap) Methods
gw.getViewportDib()
This method returns the active viewport’s graphics window image as a Bitmap value. The
size of the bitmap is the same size as the viewport.
Script:
MacroScript GrabViewport category:”Tools” tooltip:”Grab Viewport”
(
---------------------------------------------------------------------
--GRABVIEWPORT MACROSCRIPT
--Created:3/23/99
--Edited:4/28/99
--by Borislav Petrov
--bobo@email.archlab.tuwien.ac.at
---------------------------------------------------------------------
--Snapshot Active Viewport to Bitmap
--Filename in format:
--VPGRAB_MaxFileName_ViewportName_CurentFrame.ImageFormatExtension
---------------------------------------------------------------------
--
--Init Variables
local grab_bmp --bitmap to put the snapshot into
local bmp_name --name of the bitmap to save
local get_viewport_name --viewport name
local gac,gct,mfn --variables to hold ActiveCamera, CurrentTime, MaxFileName
--
--Start Macro
grab_bmp = gw.getViewportDib() --get the viewport bitmap into variable
get_viewport_name = viewport.GetType() --get viewport name
gvn = get_viewport_name as string --convert viewport name to string
gvn = substring gvn 6 (gvn.count-5) --cut the string
if gvn == “camera” then --if the remaining string is “camera”
( gac = getActiveCamera() --get the camera
gvn = gac.name --get the name of the camera
)
mfn = MaxFileName --get max file name
if mfn == ““ then --if there is no name
mfn = “Untitled” --use “Untitled”
else
mfn = getFileNameFile mfn --use the file name without .MAX extension
gct = SliderTime as string --get current frame time
--
bmp_name = “VPGRAB_”+ mfn +”_” +gvn + “_” + gct --build the output file name
--
--Display file save dialog
bmp_name = getSaveFileName caption:”Save Viewport to:” filename:bmp_name \
types:”BMP(*.bmp)|*.bmp|TIFF(*.tif)|*.tif|JPG(*.jpg)|*.jpg|TGA(*.tga)|*.tga|”
1596 Chapter 13 | Interacting with the 3ds max User Interface
--
if bmp_name != undefined then --if user has confirmed / entered a valid name
( grab_bmp.filename = bmp_name --set output name to the one entered in the save
file dialog
save grab_bmp --save the bitmap
display grab_bmp --display the bitmap in a VFB
)
--
)--end of script
Drawing Setup
gw.resetUpdateRect()
This method resets the update rectangle. The update rectangle is the region of the screen
that needs to be updated to reflect items that have changed. When the system is done
rendering items, the goal is to only update the region of the viewport that has actually
been altered. This method sets the update rectangle (the region that will be blitted to the
display) to a special “empty” value. This way when gw.enlargeUpdateRect() is later
called, the Box2 region passed will be used as the region.
gw.enlargeUpdateRect ( <Box2> | #whole )
This method enlarges the update rectangle to include the Box2 value passed. If #whole is
specified, the whole viewport will later be updated
gw.getUpdateRect()
This method retrieves the current update rectangle as a Box2 value. Returns a special an
Box2 “empty” value if no region of the viewport needs to be updated.
gw.setRndLimits <render_limits_name_array>
Sets the rendering limits used by primitive calls. Setting the rendering limits is used in
communication between the various parts of 3ds max that handle the display of objects.
For example, setting this limit to #polyEdges and then drawing a polygon won’t result in a
polygon drawn with edges. It only sets a flag that indicates the edge should be drawn.
What happens is as follows. Inside the upper level 3ds max, part of the code knows that
polygon edges have been turned on. However this is not related through the object
oriented architecture to the part of 3ds max that does the actual drawing. When 3ds max
goes to draw objects it will see that the polygon edge flag is on. This tells it to do two
drawing passes -- one to draw the polygon, then it calls outlinePass() call with true,
draws a bunch of edges, then calls outlinePass() with false. Thus, the drawing
routine is responsible for looking at the flags and drawing appropriately. This method is
only responsible setting the limit which can later be checked.
<render_limits_name_array> specifies the rendering limits used by the viewport as an
array of <render_limits_name> values. The valid <render_limits_name> values are:
#allEdges
All edges of the item are shown (including hidden ones).
#boxMode
Objects are shown using their bounding box.
Viewport Drawing Methods 1597
#backcull
Backface culling is used. Entities whose surface normal face away from the view
direction are not drawn.
#colorVerts
This turns on color-per-vertex display.
#flat
Flat (facet) shading mode.
#illum
This indicates that you have colors per vertex in your polygons and that they should
be used. If you had colors per vertex but this flag was not set, the colors would be
ignored.
#lighting
This is the same as setting #illum and #specular.
#noAtts
No attributes are specified.
#perspCorrect
In this mode textures are corrected for perspective display.
#pick
This indicates hit testing will be performed (not rendering).
#polyEdges
This mode causes polygon edges (Edged Faces) to be on.
#shadeCverts
This modifies #colorVerts. If set, lighting is enabled and the vertex colors are used
to modulate the colors that result from lighting. If off, the colors on each vertex are
used directly to shade the triangle. When 3ds max uses #shadeCverts mode, it puts a
white diffuse-only material on the object so that it appears that the colors are shaded
without distortion.
Described further, when #shadeCverts is OFF, then the vertex colors are used
directly. This is equivalent to saying that they are modulated by a pure white self-
illuminated material.
When #shadeCverts is ON, the diffuse white material is illuminated by the scene
lighting, resulting in shades ranging from black to white, with most vertices being
some shade of pure gray. When the vertex colors are modulated by the material color,
they get multiplied (in general) by a number less than 1, which makes them appear
darker.
The RGB components of the colors are modulated uniformly, so that there is no shift
from, say, red to green. That would happen if the underlying material was not evenly
weighted (that is, a pure gray lying between black and white). Said another way, only
the intensity of the vertex colors is changed when shading is on, not luminance,
chrominance, etc.
1598 Chapter 13 | Interacting with the 3ds max User Interface
#specular
This enables specular highlight display.
#texture
This enables texture display.
#twoSided
Faces are displayed regardless of their surface normal orientation.
#vertTicks
This mode is really a pseudo-mode, in that it doesn’t actually cause the graphics
drivers to do anything differently, but rather is tested by the Mesh class, which sends
down vertex markers (+) if the mode is on.
#wireframe
Wireframe rendering mode.
#zBuffer
When coordinates are specified for drawing primitives they have x, y, and z values.
Sometimes when drawing entities in the viewports it is desirable to ignore the z
values. For example in the 3ds max viewports the text that display the type of
viewport (Front, Left, and so on) are drawn without z values. So are the arc-rotate
circle control and the axis tripods. These items are drawn without this flag being set so
they always show up in front.
gw.getRndLimits()
Retrieves the rendering limits used by primitive calls as an array of names. See
gw.setRndLimits() for a list of the returned name values.
gw.getRndMode()
Returns the current rendering mode used by the viewport as an array of names. This is a
subset of the rendering limit, in that any limits imposed by the rendering limit are forced
onto the current mode. See gw.setRndLimits() for a list of the returned name values.
gw.setSkipCount <skip_count_integer>
Sets the number of triangles skipped when the viewport is set as a ‘Fast View Display’
viewport. To disable fastview, specify 1. Since triangles are handed down to graphics driver
one at a time, it is up to the code that feeds triangles to the graphics driver to skip the
specified number of triangles. The mesh rendering in 3ds max uses the skip count in
this way.
<skip_count_integer> specifies that every ‘n-th’ triangle should be drawn. If set to 2,
every other triangle should be drawn.
gw.getSkipCount()
Returns the current skip count setting.
Viewport Drawing Methods 1599
gw.hTransPoint <point3>
This method converts the point3 coordinate to a “h” format device coordinate. Each
component of the return value is in integer format in the native device coordinates for the
graphics driver. For HEIDI and OpenGL, the origin is at the lower left. For Direct3D the
origin is at the upper left.
gw.wTransPoint <point3>
This method converts the point3 coordinate to a “w” format device coordinate. Each
component of the return value is in integer format with the origin at the upper left.
gw.transPoint <point3>
This method converts the point3 coordinate to a “h” floating point coordinate. Each
component of the return value is in float format with the origin at the upper left. This is
just a helper routine to avoid building up round-off error. 3ds max uses it just for IK.
1600 Chapter 13 | Interacting with the 3ds max User Interface
Drawing Methods
Methods that start with “h” take integer device coordinates with the origin at the lower-left.
Methods that start with “w” in front take Windows device coordinates with the origin at the upper
left. These “h” and “w” routines perform NO clipping unless otherwise noted. Drawing outside the
allowable region is likely to cause 3ds max to crash. These coordinate systems are left-handed.
Methods that don’t start with “h” or “w” map points from the graphic window’s current transform
to device space. This coordinate system is right-handed. If the graphic window’s transform is set to
the identity matrix then the mapping is done from points specified in world space. Otherwise the
points given are transformed by the graphic window’s transform, and are then considered to be in
world space. Thus, to get a world-space to screen-space conversion, you need to set the graphic
window’s transform to the identity with:
gw.setTransform(Matrix3 1)
After completing any drawing to the graphics window with the methods described in this section,
you need to call gw.updateScreen() to update the viewport display.
gw.updateScreen()
Updates the viewport display to display any text, markers, polylines, polygons, or tristrips
written to the graphics window via the methods described below.
gw.text <point3> <string> [ color:<color> ]
gw.hText <point3> <string> [ color:<color> ]
gw.wText <point3> <string> [ color:<color> ]
Draws 2D fixed font annotation string text to the specified location using the specified
(optional) color. If the color is not specified, a default color of red is used.
Note: This routine DOES perform clipping of the text if it is off the screen.
gw.Marker <point3> <marker_name> [ color:<color> ]
gw.hMarker <point3> <marker_name> [ color:<color> ]
gw.wMarker <point3> <marker_name> [ color:<color> ]
Draws a marker at the specified location. This is can be paired with pickpoint() to
quickly show where the user has clicked. These markers are temporary and will be erased
whenever the viewports are updated. If the color is not specified, a default color of red is
used. The valid <marker_name> types are:
#point
#hollowBox
#plusSign
#asterisk
#xMarker
#bigBox
#circle
#triangle
#diamond
#smallHollowBox
#smallCircle
#smallTriangle
#smallDiamond
Viewport Drawing Methods 1601
gw.enlargeUpdateRect #whole
gw.updateScreen()
start the rasterization. This results in a significant speed increase. This routine does no
clipping so all the vertices passed must be within view. The parameters are the same as for
the gw.Polygon(). However, how the <vertex_point3_array> is handled is different.
After the first two vertices, each new vertex is used to create a new triangle. For instance, to
draw a quad, the first three vertices specify the first triangle and the next one is combined
with the previous two to complete the square
The following is an example of using the above functions:
Script:
-- Draw some primitives
gw.hPolyline #([300,50,16], [300,200,8], [450,250,4]) true
--
gw.hPolygon #([200,100,16], [280,100,8], [250,200,4]) \
#(red, blue, green) \
#([1.0,.5,0], [0.5,0.5,0], [0,0,0.5])
--
gw.hTriStrip #([50,50,0], [175,100,0], [25,100,0], [150,250,0]) \
#(red, blue, green, white) \
#([1.0,.5,0], [0.5,0.5,0], [0,0,0.5], [0.5,1,0])
--
-- Update the viewports
gw.enlargeUpdateRect #whole
gw.updateScreen()
preferences.useVertexDots
Lets you get and set whether to represent vertices as dots. A Boolean value set to true
when you want to use dots as the representation of the vertices in a mesh. If set to false,
ticks will be used. This variable contains the corresponding value set in the Viewports page
of Customize > Preferences.
Material Editor
The following functions are specific to materials and the use of materials with the Material Editor:
getMeditMaterial <slot_index>
you can get the materials in the material editor slots 1 through 24. For example:
foo = getMeditMaterial 3
saveMaterialLibrary <filename_string>
Saves the current material library into the named file. Returns true if the save succeeds,
false if it fails.
fileOpenMatLib()
This method displays the File Open dialog and allows the user to select a material library
to load.
fileSaveAsMatLib()
Displays the standard Save File As dialog to allow the user to save the current material
library.
fileSaveMatLib()
If the current material library has been saved previously (has been named) this method
saves the material library to the same file. Otherwise it displays the standard Save File As
dialog to allow the user to save the current material library.
getMatLibFileName()
Returns the current material library file name as a String value.
renderMap <textureMap> [ into:<bitmap> ] \
[ size:<point2> ] \
[ filename:<string> ] \
[ scale:<float> ] \
[ filter:<boolean> ] \
[ display:<boolean> ]
provides access to the Render Map function available in the Material Editor. The function
returns a Bitmap value containing a rendering of the given texture map. If you specify the
optional into: argument, the function renders the map into the supplied bitmap, taking
size and other attributes from the existing bitmap. If you don’t, a new bitmap value is
created using the size: and fileName: arguments in its creation. If the into: and
size: parameters are not specified, the default size in [200,200].
The scale: argument is a scale factor applied to 3D TextureMaps. This is the scale of the
surface in 3d space that is mapped to UV and controls how much of the texture appears in
the bitmap representation.
If the filter: argument is true, the bitmap is filtered. It is quite a bit slower to rescale
bitmaps with filtering on. Defaults to false.
If the display: argument is true, the resulting bitmap is displayed using the virtual
frame buffer; otherwise it is not. Defaults to false.
Example:
rm = renderMap $foo.material.diffuseMap size:[640,480] \
fileName:”foodif.bmp”
save rm
close rm
The above will render a map to a bitmap and save it as a .bmp file.
1608 Chapter 13 | Interacting with the 3ds max User Interface
Note that for multimaterials, you need to specify the appropriate sub-material (using [] indexing, for
example).
The following 3ds max system global variables are applicable to the Material Editor:
currentMaterialLibrary
Contains a virtual array of materials and root level maps corresponding to the currently
opened material library. You can get library materials via array indexing and iterate over
them in a for loop. The array can be indexed by number, or by name or string to select by
material name. This variable is read-only. See the MaterialLibrary Values (p. 795) topic for
more information.
meditMaterials
Contains a virtual array of materials and root level maps corresponding to the slots in the
material editor. You can access material editor materials and root level maps via array
indexing and iterate over them in a for loop. The array can be indexed by number to
specify slot number or name or string to select by material and root level map name. For
example:
$foo.material = meditMaterials[1]
meditMaterials[”foo mat”].diffuse = red
for m in meditMaterials do print m.diffuseMap
meditMaterials[1]=standard()
print meditMaterials.count -- number of slots
This variable is read-only, but the elements (the materials in the slots) are assignable. See
the MaterialLibrary Values (p. 795) topic for more information.
sceneMaterials
Contains a virtual array of materials and root level maps corresponding to the materials
and root level maps present in the scene. You can get scene materials and root level maps
via array indexing and iterate over them in a for loop. The array can be indexed by
number, or by name or string to select by material or root level map name. This variable is
read-only. See the MaterialLibrary Values (p. 795) topic for more information.
Miscellaneous Viewport Methods and System Globals 1609
Track View
The Track View window functions are in a structure package named trackView. These functions
operate on named Track Views, and in many cases you identify the Track View window by this name.
The Track View functions are:
trackView.open <name_string>
Opens an existing Track View with the specified name, or creates a new Track View with
specified name. Returns the value true.
trackView.zoomSelected <name_string>
Zoom the named Track View on the currently selected object. The World track must be
expanded for this function to operate. The Object track will automatically be expanded if
is closed. The hierarchy display is scrolled such that the selected object’s track is placed at
the top of the window. If multiple objects are selected, the first object in the hierarchy that
is selected will be placed at the top of the window. If there are no selected objects, no
operation occurs. This method will return true, except when the named Track View does
not exist or is not open, when it returns false.
trackView.close <name_string>
Closes the named Track View. This method will return true, except when the named
Track View does not exist or is not open, when it returns false.
trackView.numTrackViews()
Returns the number of named Track Views defined
trackView.getTrackViewName <index_integer>
Returns the name of the indexed Track View as a String. Index values are 1-based.
trackView.setFilter “name_string” {<filter_flag_name>} [#noRedraw]
trackView.clearFilter “name_string” {<filter_flag_name>} [#noRedraw]
These methods allow you to set and clear display filters flags to control what is visible in a
named Track View. This method will return true, except when the named Track View does
not exist or is not open, when it returns false. You can supply as many filter flags as
desired per call. The valid filter flag names are:
#all -- set or clear all flags
#default -- set default view flags
#selectedObjects
#selectedTracks
#animatedTracks
#spacewarpBindings
#modifiedObjects
#transforms
#baseObjects
#positionX
#positionY
#positionZ
#rotationX
#rotationY
#rotationZ
#scaleX
1610 Chapter 13 | Interacting with the 3ds max User Interface
#scaleY
#scaleZ
#red
#green
#blue
#controllerTypes
#noteTracks
#sound
#materialsMaps
#materialParameters
#visibilityTracks
#hideGeometry
#hideShapes
#hideLights
#hideCameras
#hideHelpers
#hideSpacewarps
#visibleObjects
#position
#rotation
#scale
#curveX
#curveY
#curveZ
#staticValues
#hierarchy
#objects
The following 3ds max system global variables are applicable to Track View:
globalTracks
Contains a MAXTVNode value that defines the top-level Global Tracks node in Track View.
See Track View Nodes (p. 1382). This variable is read-only.
trackViewNodes
Contains a MAXTVNode value that defines top-level World node in Track View. See Track
View Nodes (p. 1382). This variable is read-only.
videoPostTracks
Contains a MAXTVNode value that defines the top-level Video Post Track View node. See
Track View Nodes (p. 1382). This variable is read-only. This variable contains the value
undefined in 3D Studio VIZ.
Miscellaneous Viewport Methods and System Globals 1611
renderDisplacements
Lets you get and set whether to perform displacement mapping during a render. A Boolean
value - true if displacement mapping is to be performed, false if not.
renderEffects
Lets you get and set whether to perform Render Effects after a scene render. A Boolean
value - true if Render Effects are to be performed, false if not.
renderHeight
Lets you get and set an Integer value that defines the output size height for the active
renderer.
renderPixelAspect
Lets you get and set an Integer value that defines the output pixel aspect for the active
renderer.
renderWidth
Lets you get and set an Integer value that defines the output size width for the active
renderer.
1612 Chapter 13 | Interacting with the 3ds max User Interface
rendOutputFilename
Lets you get and set a String value that defines the output file name for the active renderer.
It contains the corresponding value set in the Render Scene dialog. If this global variable is
set to ““ then Save File check box in the Render Scene dialog is unchecked.
skipRenderedFrames
Lets you get and set whether to skip rendered frames during a render. A Boolean Value –
true if rendered frames are to be skipped, false if not.
Note: The following globals should not be used if the Render Scene dialog is open. These globals do
not update the dialog if it is open, and closing the dialog or rendering from the dialog will cause the
displayed settings to be stored and used.
rendTimeType -- integer
Get/set the type of time range to be rendered. One of the following values:
1 - A single frame.
2 - The active time segment.
3 - The user specified range.
4 - The user specified frame pickup string (for example “1,3,5-12”).
rendStart -- time
Get/set the renderer’s start time setting.
rendEnd -- time
Get/set the renderer’s end time setting.
rendNThFrame -- integer
Get/set the renderer’s ‘n-th’ frame setting. Minimum value = 1
rendShowVFB -- boolean
Get/set the state of the renderer’s show virtual frame buffer flag. TRUE = on; FALSE = off
rendSaveFile -- boolean
Get/set the state of the renderer’s save file flag. TRUE = on; FALSE = off
rendUseDevice -- boolean
Get/set the state of the renderer’s use device flag. TRUE = on; FALSE = off
rendUseNet -- boolean
Get/set the state of the renderer’s use net flag. TRUE = on; FALSE = off
rendFieldRender -- boolean
Get/set the renderer’s field render flag. TRUE = on; FALSE = off
rendColorCheck -- boolean
Get/set the renderer’s color check flag. TRUE = on; FALSE = off
rendSuperBlack -- boolean
Get/set the renderer’s super black flag. TRUE = on; FALSE = off
rendHidden -- boolean
Get/set the renderer’s render hidden objects flag. TRUE = on; FALSE = off
rendForce2Side -- boolean
Get/set the renderer’s force two-sided flag. TRUE = on; FALSE = off
Miscellaneous Viewport Methods and System Globals 1613
rendAtmosphere -- boolean
Get/set the renderer’s uses atmospheric effects flag. TRUE = on; FALSE = off
rendDitherTrue -- boolean
Get/set the renderer’s dither true color flag. TRUE = on; FALSE = off
rendDither256 -- boolean
Get/set the renderer’s dither 256 color flag. TRUE = on; FALSE = off
rendMultiThread -- boolean
Get/set the renderer’s multi-threaded flag. TRUE = on; FALSE = off
rendNThSerial -- boolean
Get/set the output file sequencing nth serial numbering setting. TRUE = on; FALSE = off
rendVidCorrectMethod -- integer
Get/set the video color check method. One of the following values:
1 = FLAG
2 = SCALE_LUMA
3 = SCALE_SAT
rendFieldOrder -- integer
Get/set the rendering field order. One of the following values:
1 is Even
2 is Odd
rendNTSC_PAL -- integer
Get/set the video color check NTSC or PAL setting. One of the following values:
1 is NTSC
2 is PAL
rendSuperBlackThresh -- integer
Get/set the super black threshold setting. Range 0 to 255.
rendFileNumberBase -- integer
Get/set the File Number Base in the ‘Common Parameters’ rollup of the Render
Scene dialog.
rendPickupFrames -- string
Get/set the Frames string in the ‘Common Parameters’ rollup of the Render Scene dialog.
The following 3ds max system global variables are applicable to the Renderer, but corresponds to the
Gbuffer Layers Maximum Number parameter in the Rendering page of the Preference Settings
dialog:
preferences.maximumGBufferLayers
Lets you get and set an Integer value that specifies the maximum number of g-buffer layers
generated during a render.
1614 Chapter 13 | Interacting with the 3ds max User Interface
The following 3ds max system global variables are specific to 3ds max’s default scanline A-Buffer
renderer. These variables return undefined if the current renderer is not 3ds max’s default scanline
A-Buffer renderer.
scanlineRender.antiAliasFilter
Lets you get and set the anti-aliasing filter. For a list of all of the anti-aliasing filters you
can say:
showClass “*:filter*”
For example:
scanlineRender.antiAliasFilter = quadratic()
The anti-aliasing filters and their parameters are described in the 3ds max Scanline A-Buffer
Renderer Anti-Aliasing Filters (p. 1614) topic.
scanlineRender.antiAliasFilterSize
Contains a float value that defines the anti-aliasing filter size.
scanlineRender.enablePixelSampler
Lets you enables and disables global super sampling. A Boolean value - true if Disable all
Samplers is off, false if on.
Note:
Changing the render scene dialog settings via the scripter should be done with the actual
render scene dialog in a closed state. Leaving the dialog open will make the attempted
scripter modifications non-sticky.
For example:
scanlineRender.antiAliasFilter = quadratic()
Blackman:
Blackman()
3ds max Scanline A-Buffer Renderer Anti-Aliasing Filters 1615
Blendfilter:
Blendfilter ...
<Blendfilter>.Blend Float default: 0.3
Catmull_Rom:
Catmull_Rom()
Cook_Variable:
Cook_Variable()
Cubic:
Cubic()
Mitchell_Netravali:
Mitchell_Netravali ...
<Mitchell_Netravali>.Blur Float default: 0.3333
<Mitchell_Netravali>.Ringing Float default: 0.3333
Sharp_Quadratic:
Sharp_Quadratic()
Soften:
Soften()
Video:
Video()
Schematic View
The Schematic View window functions are in a structure package named schematicView. These
functions operate on named Schematic Views, and in many cases you identify the Schematic View
window by this name. The Schematic View functions are:
schematicView.open <name_string>
Opens an existing Schematic View with the specified name, or creates a new Schematic
View with specified name. Returns the value true.
schematicView.zoomSelected <name_string>
Zooms the named Schematic View on the currently selected objects. The display is zoomed
such that all of the selected objects are displayed. If there are no selected objects, no
operation occurs. This method will return true, except when the named Schematic View
does not exist or is not open, when it returns false.
1616 Chapter 13 | Interacting with the 3ds max User Interface
schematicView.close <name_string>
Closes the named Schematic View. This method will return true, except when the named
Schematic View does not exist or is not open, when it returns false.
schematicView.numSchematicViews()
Returns the number of named Schematic Views defined
schematicView.getSchematicViewName <index_integer>
Returns the name of the indexed Schematic View as a String. Index values are 1-based.
timeConfiguration.playActiveOnly
Lets you get and set whether to playback the active viewport only. It contains the
corresponding value set in the Time Configuration dialog. A Boolean value - true if Active
Viewport Only is on, false if off.
timeConfiguration.playbackSpeed
Get/set viewport playback speed as an indexed <integer>. The valid values for theinteger
are: 1 - 1 / 4x, 2 - 1 / 2x, 3 - 1x, 4 - 2x, 5 - 4x.
timeConfiguration.realTimePlayback
Lets you get and set whether to playback in real time mode. It contains the corresponding
value set in the Time Configuration dialog. A Boolean value - true if Real Time is on,
false if off.
timeConfiguration.useTrackBar
Lets you get and set the state of the Time Configuration dialog ‘Key Steps / Use TrackBar’
check box. A Boolean Value – true if checked, false if not.
RAMPlayer
The following method is associated with the RAMPlayer:
RAMPlayer <filename1_string> <filename2_string>
Opens RAMPlayer with filename1 as Channel A and filename2 as Channel B. You can pass
a null string (““) as a filename string, in which case no file is loaded into that channel.
<trackViewPick>.subNum : integer
The subAnim index for anim in client.
Here is an example:
-- Create a sphere and apply a bend modifier and execute
tvp=trackview.pickTrackDlg()
-- pick objects->Sphere01->Modified object->Bend->Angle
tvp.anim -- returns SubAnim:Angle
tvp.client -- returns Bend:Bend
tvp.subNum -- returns 3
tvp.name -- returns “Angle”
tvp.client[tvp.subNum] -- returns SubAnim:Angle
The filter: function takes a MAXScript function of one argument that is called
whenever the cursor is over an object in the scene and is passed that object under the
cursor. It returns true if the object is eligible for picking, or false if not. Typically, the
function would contain some object class testing, for example:
fn shapeFilt o = superClassOf o == Shape
which you could use like this:
pickObject prompt:”enter a shape” filter:shapeFilt
The optional keyword argument select: controls whether the picked objects
become the new current selection in the 3ds max scene. If you supply true for
that argument, the current selection is replaced with the objects that you pick.
The default is false in which case the picker doesn’t affect the selection set.
showHidden:<boolean> controls whether hidden and frozen objects are eligible for
display. The default value is false.
single:<boolean> controls whether single or multiple objects may be selected in the
selector. The default is false, meaning multiple objects may be selected, and they are
returned in an array. If single:true is specified, a single object may be selected and is
returned directly, not in an array.
If the user cancels out of the dialog, the function returns the value undefined.
1620 Chapter 13 | Interacting with the 3ds max User Interface
will print the names of all nodes completely within a circular region, where the center of
the circle is the center of the viewport and the point on the circle is located one quarter of
the distance from the edge to the center of the viewport.
fencePickNode <point2_array> [crossing:<boolean>]
Returns an array of the nodes within the specified fenced region. The fenced area is
defined by the array of point2 values. The default crossing: value is true.
Picking Scene Nodes By Region 1621
Miscellaneous Dialogs
For methods associated with the Render Effects dialog, see the RenderEffect : MAXWrapper (p. 1347)
topic.
For methods associated with the Render Environment dialog, see the Atmospheric : MAXWrapper
(p. 1337) topic.
exclusionListDlg()
Displays the Exclude/Include dialog used for Lights, and returns an array of the node
names moved into the Include/Exclude list.
configureBitmapPaths()
This method puts up the Configure Bitmap Paths dialog to let the user configure the
bitmap loading paths. Returns false if the user cancels out of the Configure Bitmap Paths
dialog, true otherwise.
materialBrowseDlg [#mats] [#maps] [#incNone] [#instanceOnly]
This method puts up the Material/Map Browser. This method returns undefined if no
Material or TextureMap is picked, otherwise a copy or instance of the Material or
TextureMap is returned. The definition of the parameters are:
#mats
Display Materials only.
#maps
Display TextureMaps only.
#incNone
Include “None” as a Material and TextureMap.
#instanceOnly
If the selected Material or TextureMap already exists, the returned value contains an
instance. Otherwise a dialog is displayed for the user to specify Copy or Instance.
If neither #mats or #maps is specified, both Materials and TextureMaps are displayed. If
both are specified, TextureMaps are displayed.
mtlBrowser.browseFrom [#mtlLibrary | #mtlEditor | #activeSlot | #selected | #scene
| #new]
Lets you set the Browse From: source for the modeless material browser.
nodeColorPicker()
This method displays the Object Color picker dialog, and returns the selected color as a
Color value.
OSnap()
This method displays the Grid and Snap Settings dialog.
USetup()
This method displays the Units Setup dialog.
1622 Chapter 13 | Interacting with the 3ds max User Interface
And the MessageBox will be displayed 4 times, once each time before the value of _t is printed
to Listener.
Picking Scene Nodes By Region 1623
The reason for this is that Listener is looking for expressions to compile and run in a background
thread. In the above example there are 2 expressions – the for loop expression and the final print
expression. The messageBox() function goes on waiting for and processing UI events in the main
UI thread, but the compiler has already compiled ahead and scheduled the print “Should print last”.
To prevent this out-of-order execution, you need to bracket the script in parenthesis. This will force
the sequencing to be correct because the script would now contain a single expression rather
than two.
Keyboard Entry
The following are keyboard input functions for doing simple interactivity directly in the Listener or
Mini Listener. All keyboard input functions take input from Mini Listener if Listener is closed, but if
it is open, input will always be taken from Listener.
getKBValue [ prompt:<string> ]
The getKBValue() function lets the user enter a MAXScript value into the Listener. The
optional prompt: keyword argument takes a string that is displayed in the Listener as a
prompt message. Any valid MAXScript expression can be entered into the Listener and is
evaluated to become the result of the getKBValue() function. Expressions include the
literals for integer, float, string, name, array, point2, point3, and scene object pathnames,
or they can be expressions involving math operations and functions, script supplied
functions, global variables, etc. You can test the type of value returned using MAXScript’s
classOf function.
Example:
v = getKBValue prompt:”Enter object count:”
if classOf v != integer then
print “Value entered must be an integer”
The user can abort the entry by pressing the ESC key in which case the function returns
the special value #escape.
getKBLine [ prompt:<string> ]
getKBChar [ prompt:<string> ]
These functions let the user type characters into the Listener that are returned as a
MAXScript string. getKBLine() returns all the characters up until the user presses ENTER,
getKBChar() returns each character immediately as it is entered. The user can abort the
entry by pressing the ESC key in which case the function returns the special value
#undefined.
getKBPoint [ prompt:<string> ]
This function lets the user type in a 3D point in the syntax supported by the
pickPoint() function. See the pickPoint() description above for details about the
syntax. The function interprets the 3D point as relative to the current active grid
construction plane and returns a Point3 in world-coordinates.
1624 Chapter 13 | Interacting with the 3ds max User Interface
Macro Scripts
The Macro Script functions are in a structure package named macros. These functions allow you to
access and run Macro Scripts. See the Defining Macro Scripts (p. 1521) topic for information on
creating Macro Scripts. The Macro Script functions are:
macros.load [ <path_name_string> ]
Loads all of the Macro Script definition (.mcr) files in the current UI directory path, or in
directory path specified by <path_name_string>. You can get the current UI directory
path with the function:
local ui_dir = cui.getDir ()
The following functions let you get, add or delete Bitmap and XRef paths, corresponding to the
Bitmaps and XRefs tabs in the Configure Paths dialog in 3ds max. Any changes made through these
functions are immediately reflected in the 3dsmax.ini file and so are persistent.
mapPaths.add <path_string>
Appends the specified path to the list of Bitmap search paths.
mapPaths.count()
Returns the number of Bitmap search paths defined.
mapPaths.get <index>
Returns the indexed Bitmap search path as a string. The index is 1-based.
mapPaths.delete() <index>
Deletes the indexed Bitmap search path. The index is 1-based.
sysinfo.getSystemMemoryInfo()
Returns a 7 element array containing system memory status data. The array elements
contain the following, respectively:
percent of memory in use
bytes of physical memory
free physical memory bytes
bytes of paging file
1626 Chapter 13 | Interacting with the 3ds max User Interface
Returns:
percent of memory in use:0
total physical memory:255.359 MB
free physical memory:16.5156 MB
used physical memory:238.844 MB
total paging file size:1016.3 MB
free paging file size:757.898 MB
used paging file size:258.398 MB
total virtual memory:2047.88 MB
free virtual memory:1846.55 MB
used virtual memory:201.328 MB
OK
sysinfo.getMAXMemoryInfo()
Returns a 9 element array containing 3ds max memory status data. The array elements
contain the following, respectively:
Page Fault Count
Peak Working Set Size
Working Set Size
Quota Peak Paged Pool Usage
Quota Paged Pool Usage
Quota Peak NonPaged Pool Usage
Quota NonPaged Pool Usage
Pagefile Usage
Peak Pagefile Usage
Picking Scene Nodes By Region 1627
Example:
(
r=sysinfo.getMAXMemoryInfo()
for i=2 to 9 do r[i] /= (1024*1024.)
format “Page Fault Count:\t\t\t%\n” r[1]
format “Peak Working Set Size:\t\t% MB\n” r[2]
format “Working Set Size:\t\t\t% MB\n” r[3]
format “Quota Peak Paged Pool Usage:\t% MB\n” r[4]
format “Quota Paged Pool Usage:\t\t% MB\n” r[5]
format “Quota Peak NonPaged Pool Usage:\t% MB\n” r[6]
format “Quota NonPaged Pool Usage:\t\t% MB\n” r[7]
format “Pagefile Usage:\t\t\t% MB\n” r[8]
format “Peak Pagefile Usage:\t\t\t% MB\n” r[9]
ok
)
Returns:
Page Fault Count:32948
Peak Working Set Size:70.3594 MB
Working Set Size:70.3594 MB
Quota Peak Paged Pool Usage:0.166186 MB
Quota Paged Pool Usage:0.161236 MB
Quota Peak NonPaged Pool Usage:0.0213509 MB
Quota NonPaged Pool Usage:0.0213509 MB
Pagefile Usage:58.9023 MB
Peak Pagefile Usage:58.9219 MB
xrefPaths.add <path_string>
Appends the specified path to the list of XRef search paths.
xrefPaths.count()
Returns the number of XRef search paths defined.
xrefPaths.get <index>
Returns the indexed XRef search path as a string. The index is 1-based.
xrefPaths.delete <index>
Deletes the indexed XRef search path. The index is 1-based.
1628 Chapter 13 | Interacting with the 3ds max User Interface
Headers are items like General, Mesh Totals, etc. that appear in contents page. For
example, an array of headers from contents page obtained using:
getPropertyValue #contents “Headers”
will return
#(”General”, “Mesh Totals”,…)
Picking Scene Nodes By Region 1629
fileProperties.getItems <header_string>
Returns an array of strings containing all the items under the given header. For example,
fileProperties.getItems “Mesh Totals”
might return
#(”Vertices: 488”, “Faces: 968”)
MAXScript allows you to invoke 3ds max menu and toolbar commands from within scripts using
the max construct. For example:
max file open
max unhide all
max hold
max time play
The keyword max is followed by one or more words that describe the command. The available
commands can be displayed using the ‘?’ character in a partial max command:
max time ? -- show all the time-related commands
max sel ? -- show all the commands with ‘sel’ in them as a substring
max ? -- show all the commands (there are a lot!)
Note: The max spacebar max command appears to do nothing when invoked from the Listener
window, because the spacebar command is window-specific and only locks selections in the active
window. Because it is the Listener window that is active, 3ds max effectively ignores this command.
#promptDups
Throw up the duplicates resolution dialog for the user to choose.
Returns true if the file was found and loaded successfully.
If you don’t specify a full path name, the file is looked for in the 3ds max scene directory,
then in the 3ds max executable directory, and then in the PATH environment directories.
getMAXSaveFileName filename: <seed_filename_string>
Displays standard 3ds max file save dialog, returns file name or value ‘undefined’ if
canceled.
getMAXOpenFileName filename: <seed_filename_string> dir:<seed_directory_string>
Displays standard 3ds max file open dialog, returns file name or value ‘undefined’ if
canceled.
getMAXFileObjectNames <max_filename_string>
Returns an array of names, one for each of the names of the objects in the given 3ds max
file. This provides a way to get a preview list of the objects in another scene file (by name)
to set up user selection of the objects to be merged under script control using the
mergeMAXFile() function, for example.
Example:
p=[1000,1000,1000]
for i = 1 to 5 do box pos:(random p -p) -- create some boxes
savemaxfile “mergetest.max” -- save to file
for obj in objects do obj.name = “_”+obj.name -- rename the boxes
objects.pos += [0,-1000,0] -- move them off to the side
fobj_names = getmaxfileobjectnames “mergetest.max” -- get the object names from the
file
deleteitem fobj_names 3 -- delete the third name from the array
mergemaxfile “mergetest.max” fobj_names #select -- merge in the objects and select
them
selection.count -- should be 4
objects.count -- should be 9
saveMaxFile <filename_string>
Saves the scene to the current 3ds max scene directory if there is no explicit directory path
on the supplied file name. If no filename extension is specified, “.max” is automatically
appended to the filename.
holdMaxFile()
Equivalent to the 3ds max Edit > Hold operation.
fetchMaxFile()
Equivalent to the 3ds max Edit > Fetch operation.
importFile <filename_string> [ #noPrompt ]
Lets you import files using any of the import plug-ins that are available. The kind of file
imported is determined by the file name suffix such as DFX for .dxf, 3DS DOS for .3ds, etc.
The #noPrompt flag prevents any configuration or control dialogs from being displayed in
which case the default configuration is used.
Bitmap Files 1641
See also
External File Methods (p. 1645)
File Name Parsing (p. 1644)
Standard Open and Save File Dialogs (p. 1643)
Bitmap Files
The following method is used to collect a list of the bitmap files used in a scene. For the properties
and methods associated with bitmap values, including reading and writing bitmap files, see the
Bitmap Values (p. 755) topic.
enumerateFiles [ <maxwrapper_obj> ] <function> [ <arg> ] \
[ #inactive ] [ #videoPost ] [ #render ] [ #missing ] \
[ #localOnly ]
Lets you run through all the bitmap files currently used in the scene or in an individual
object. You can filter this so it just gives you those for video post or the renderer or the
ones that are inactive or missing.
The enumerator works by calling a function you give it once for each of the file names it
finds corresponding to the filters switches and other arguments you set.
The only required argument is the <function> argument. The details are:
<maxwrapper_obj>
An optional 3ds max object, such as a node or a material. Supplying this argument
causes the enumerator to only consider files associated with this object. See the
#localOnly switch for more info.
1642 Chapter 14 | File Access
<function>
The function to be called for each file found. It should be a function of one or two
arguments, the first one is the string file name supplied by the enumerator. See
example below.
<arg>
If specified is passed to the <function> as its second argument by the enumerator.
This is useful if you have a general purpose enumerator function that can be
conditioned by the argument you pass in on a particular enumeration, or if you want
to pass in an array that the found names should be appended to.
#inactive
Include the inactive files.
#videoPost
Include the files used in video post.
#render
Include the files used during rendering.
#missing
include files that are missing in the file system
If you don’t specify any of the above filter flags, all the files are enumerated.
#localOnly
use in conjunction with the <maxwrapper_obj> argument. If specified, limits the
enumeration to those files used directly in the object, if not then any referenced
objects are scanned.
For example:
function get_names name a = append a name
files = #()
enumerateFiles get_names files #missing
Example:
The following script will print out a sorted list of all the bitmap files used in the current scene file:
Script:
(
local mapfiles=#()
fn addmap mapfile =
( local mapfileN=mapfile as name
local index=finditem mapfiles mapfileN
if index == 0 do append mapfiles mapfileN
)
enumeratefiles addmap
sort mapfiles
for mapfile in mapfiles do print (mapfile as string)
)
XRef Files 1643
See also
External File Methods (p. 1645)
File Name Parsing (p. 1644)
Standard Open and Save File Dialogs (p. 1643)
XRef Files
See the XRefObject (p. 1037) and XRefScene (p. 1038) topics for information on XRef object and XRef
scene files.
getSaveFileName [ caption:<title>] \
[ filename:<seed_filename_string> ] \
[ types:<description1>|<pattern1>|<description2>|<pattern2>|...| ]
Both functions return a fully-specified file path name or undefined if the user cancels
out. The types: parameter lets you specify custom file types and suffixes for the file type
drop-down list in the open and save dialogs. You supply a string for this argument that is
formatted in a special way, as follows:
“<description1>|<pattern1>|<description2>|<pattern2>|...|”
1644 Chapter 14 | File Access
In other words, a sequence of file type descriptions and file type patterns each separated by
a ‘|’ vertical bar and terminated by a ‘|’ vertical bar. For example:
f = getOpenFileName \
types:”Data(*.dat)|*.dat|Excel(*.csv)|*.csv|All|*.*|”
Specifies three types in the file type drop-down list, the first reading “Data(*.dat)” and
matching *.dat and the second reading “Excel(*.csv)” and matching *.csv and the third
reading “All” and matching any file.
The getSaveFileName() function tests for the pre-existence of the file with the chosen
file type suffix added.
getSavePath [ caption:<window_caption_string> ]
This function displays a folder selection browser for the user to select a folder. Returns a
string path name for the selected folder or the value undefined if the user presses Cancel
in the folder browser.
See also
Filestream Values (p. 763)
External File Methods (p. 1645)
File Name Parsing (p. 1644)
See also
Filestream Values (p. 763)
External File Methods (p. 1645)
Standard Open and Save File Dialogs (p. 1643)
getFiles() can also be used to determine if a file exists. For example, the following
function will return true if the specified file name exists:
fn existFile fname = (getfiles fname).count != 0
getDirectories <wild_card_directory_name_string>
Returns an array of directory paths that match the given wild-card directory path name.
makeDir <directory_path_string>
Creates a new directory with the given name. Returns true on success, false on failure.
deleteFile <filename_string>
Deletes the named file. Fails if the file is open in MAXScript. Returns true on success,
false on failure.
renameFile <old_filename_string> <new_filename_string>
Renames the old file to the new file. This can also be used to move a file between
directories. Fails if new file already exists or if the old file is open in MAXScript. Returns
true on success, false on failure.
copyFile <existing_filename_string> <new_filename_string>
Copies the existing file to the new file. Fails if the new file already exists, the new file
cannot be created, or the existing file is open in MAXScript. Returns true on success,
false on failure.
1646 Chapter 14 | File Access
getFileModDate <filename_string>
Returns a String value containing the modification date for the specified file, for example
“1/29/99 1:52:05 PM”.
getFileCreateDate <filename_string>
Returns a String value containing the creation date for the specified file.
getFileVersion <filename_string>
Returns the file and product version for the specified file, or unknown if this data is not
specified in the file. This data is typically specified only for executable and application
extension (i.e., .dll) files. For example:
GetFileVersion “g:\\3dsmax25\3dsmax.exe”
See also
Filestream Values (p. 763)
File Name Parsing (p. 1644)
Standard Open and Save File Dialogs (p. 1643)
Encrypted Files 1647
Encrypted Files
encryptFile <in_filename_string> <out_filename_string> <key_integer>
Creates an encrypted copy of the file named by <in_filename_string> using the
integer supplied as a key, naming the encrypted file <out_filename_string>.
openEncryptedFile <filename_string> <key_integer>
Opens the encrypted file using the given integer key and returns a FileStream value that
you can then do read calls on, exactly as you can on FileStreams returned from the
openFile() function.
encryptFile() and openEncryptedFile() let you encrypt a text file with your own
key and open an encrypted file via a key for reading. Among other things, you can use this
to write and read an encrypted file containing a hardware lock ID for doing authorization-
based piracy protection.
For example, here’s some code that creates an encrypted lock ID file in some
authorization process:
f = createFile “lock.tmp”
format “%” hardwareLockID to:f
close f
encryptFile “lock.tmp” “lock.dat” 5476557
deleteFile “lock.tmp”
The following code can be used to read and check the lock ID (obviously, all this is only
safe if the creation and checking scripts are themselves encrypted):
f = openEncryptedFile “lock.dat” 5476557
id = readValue f
close f
if id != hardwareLockID then
(
message “Lock ID’s don’t match”
return 0
)
If the specified file, section, or key is not found, a null string is returned.
1648 Chapter 14 | File Access
If the specified file, section, or key is not found, a new file, section, or key is created.
If the specified file is read-only, or the file is open in MAXScript, the key value is not
written to the file.
Change Handlers and Callbacks are used to detect when certain types of events occur to scene
objects or within 3ds max.
Change Handlers are applied to individual MAXWrapper objects and specify an attribute to monitor
for that object and an expression to evaluate when that attribute changes. Example attributes that
can be monitored are geometry, name, transform, and parameters. Change Handlers are not stored
in a 3ds max scene.
Callbacks are used to register with 3ds max functions that are called when specific events occur
within 3ds max. Events that can be monitored are changes to the time slider time and redrawing of
viewports. Callbacks are not stored in a 3ds max scene.
MAXScript also provides several methods that automatically tie into 3ds max’s Callback system.
These methods are used to register and unregister 3ds max scripts that are called for a variety of
3ds max events. These scripts can optionally be saved with the currently-open file and stay
permanently with it, running whenever the scene is loaded, until they are explicitly removed.
The above are described in more detail in the following topics:
Change Handlers and When Constructs (p. 1650)
Time Change Callback Mechanism (p. 1654)
Viewport Redraw Callback Mechanism (p. 1655)
RenderEffect Progress Callback Mechanism (p. 28)
General Event Callback Mechanism (p. 29)
MAXScript also allows you to register a scripted menu that is invoked when the user performs a
right-click in a 3ds max viewport. See the Scripted Right-Click Menus (p. 1514) topic for more
information.
1650 Chapter 15 | Change Handlers and Callbacks
These specify the attribute of the given object(s) to be tracked for change (see below for more details).
The second form tracks object deletion by the user or other scripts. For object deletion events, the
handler is called after the object is deleted, so you cannot perform any 3ds max operations on it.
This is typically used if you have tables or other structures containing MAXScript object values and
you want to remove deleted objects from them as the user modifies the scene.
In both forms, the <objects> argument can be one of the following:
• a single 3ds max object, such as a scene node, controller, modifier, or material, etc.
• one of the object sets, such as ‘selection’, or ‘cameras’, etc.
• a wild-card pathname like $foo*.
• an array of 3ds max objects.
Change Handlers and When Constructs 1651
If more than one object is specified, the handler is called each time the given attribute of any of the
objects is signaled as changed by the 3ds max core.
The optional id: parameter specifies an ID for one or more handlers as a name literal. The ID name
can later be used to delete the handler and, if the same name is given to several handlers, they can
be deleted as a group.
The optional handleAt: parameter signals that the change handler expression should not be
executed immediately upon notification, but delayed until the either the 3ds max viewports are
redrawn (#redrawViews) or current 3ds max animation time is changed (#timeChange). Delaying
the processing of the change handler expression is highly recommended, as described in the
Caution section below. An example usage of the handleAt: parameter is:
when select $ changes id:#foo handleAt:#redrawViews do ...
The optional <object_parameter> lets you specify the name of a parameter variable that will be
accessible in the do <expr> and will hold the actual object that has changed. You typically specify
this parameter name if the handler will respond to changes in many objects, so you can determine
which one has changed. The <expr> can be a single expression or block expression.
Examples:
when transform $box01 changes do
$box02.pos = $box01.pos + delta
parameters
signaled when any parameters are changed in the object. This is something of a catch all,
because the core signals this event in many situations.
subAnimStructure
signaled when the dynamic subAnim structure changes, such as when a new vertex
becomes animated in an editable mesh, or when a new controller is added to a list
controller. Also called when subAnims are reassigned, for example, when a material is
changed in an object.
controller
signaled when a new controller is assigned to one of the object’s tracks.
children
signaled when an object has immediate children added or removed.
You can use the following two methods for deleting change handlers:
deleteChangeHandler <change_handler>
deletes specified change handler. change_handler is the value returned by a
when construct.
deleteAllChangeHandlers [ id:<name> ]
If optional id: parameter is not specified, deletes all change handlers. If optional id:
parameter is specified, deletes all change handlers with the specified id. For example:
deleteAllChangeHandlers id:#foo
For efficiency reasons, you don’t want irrelevant change handlers running in the background, so it
is essential that you delete those that you no longer need.
Special Considerations
• If a runtime error occurs in the body of a change handler while it is being executed, an error
message is displayed and that handler is permanently disabled.
• If all of the objects being tracked by a change handler are deleted, the change handler is
also deleted.
• The do <expr> change handler code is executed in a special context and not in the context of
the code that created it. This means that the <expr> code cannot contain references to local
variables in outer code nestings surrounding the when, since those variables are on an execution
stack that does not exist at the time the when handler is called. The compiler detects any illegal
references to outer locals and generates a compiler message. An important exception to this is
utility and rollout panel locals, such as local functions, rollout variables and nested rollouts. You
can refer to them in change handler code inside rollout code as they are associated directly with
their rollout or utility object.
• Change handlers are called only for user initiated events, and not for changes resulting from a
change in controller values. For example, a change handler on the transform attribute of a node
would be called when the user moves the node. If the position of the node is animated, and you
play back the animation, the transform attribute change handler is not called.
Change Handlers and When Constructs 1653
• If you assign a change handler to an attribute on multiple objects, the change hander is called
once per object if that object’s attribute changes. For example, if you say:
when select $ changes obj do update_modifier_list obj
function update_modifier_list is called whenever any object is selected or
deselected. This is true even if you do an Edit/Select All. In this case,
update_modifier_list will be called once for each object currently selected (as the
objects are deselected), and then once for all objects in the scene (as the objects are
selected). If update_modifier_list is at all processor-intensive, a significant system
slowdown can occur.
• Change handlers are only applied to object already present in the scene. Change handlers are
not automatically applied to newly created objects.
• If you have multiple change handlers defined, the order in which the change handlers are called
is somewhat arbitrary.
• Due to the way that 3ds max internally processes notification signals, the $ form of accessing
selected objects is not recommended in a select change handler. To access the selected objects,
you should use the selection objectset. This is because $ relies on information that has not yet
been set in the selection processing whereas selection uses a different method of accessing
selections and the information it uses has been set up.
Caution:
The change handler system is based on 3ds max’s internal notification system which essentially
drives all animation and interactivity within 3ds max. There are cases when the core sends many,
many signals for the same change, so setting up change handlers on many objects that do vast
amounts of computing can significantly slow down the system. Strictly speaking, change handlers
are supposed to be used to just set “dirty flags” in a lightweight, order-independent way, and then
use Redraw Views or Time Change callbacks to actually cause the triggered processing. You should
attempt to use change handlers judiciously, and not, for example, as a simple way to get scripted
controllers. If you do find that a desired setup is being flooded with unnecessary signals, you should
use the handleAt: to delay the actual processing of the event handler script until a redrawViews or
timeChange event occurs.
1654 Chapter 15 | Change Handlers and Callbacks
You can register as many functions as you like. Each one is individually called whenever the time
changes. The functions you register must take no arguments. They can access the updated current
time through the MAXScript system variable currentTime.
Example:
fn time_p = print currentTime
registerTimeCallback time_p
In the above example, the registered function causes the current time to be printed in the Listener
window whenever the user moves the time slider or plays the animation.
Special Considerations
• If a runtime error occurs in a callback function while it is being executed, an error message is
displayed and that callback function is permanently disabled.
• The time callback is not called during rendering, even if multiple frames are rendered.
• The registered function is executed in a special context and not in the context of the code that
created it. This means that the function cannot contain references to local variables in outer
code nestings surrounding the function definition since those variables are on an execution
stack that does not exist at the time the function is called. An important exception to this is
utility and rollout panel locals, such as local functions, rollout variables and nested rollouts. You
can refer to them in change handler code inside rollout code as they are associated directly with
their rollout or utility object.
• Note that it is the function value that is being registered, not the function name or global
variable. This means that redefining the same-named function after registering it does not
change the callback. You either need to unregister, re-define the function and then register it
again, or make the registered function an intermediary which calls another function, for
example:
fn time_cb = print currentTime
fn tcb = time_cb()
registerTimeCallback tcb
In this case, the registered callback function, tcb, calls the real call back, time_cb, (by
referencing the global variable it is defined in), meaning you can redefine time_cb() as often
as you need and the callback will always invoke the latest definition. This is a useful technique
to employ while you are developing and debugging a callback.
• Callback functions remain registered after loading a new file or performing a 3ds max reset.
Viewport Redraw Callback Mechanism 1655
You can register as many functions as you like. Each one is individually called whenever the
viewports are redrawn. The functions you register must take no arguments.
Example:
fn redrawviews_p = print “Viewports Redrawn”
registerRedrawViewsCallback redrawviews_p
In the above example, the registered function causes the string “Viewports Redrawn” to be printed
in the Listener window whenever the 3ds max viewports are redrawn.
Special Considerations
• If a runtime error occurs in a callback function while it is being executed, an error message is
displayed and that callback function is permanently disabled.
• The registered function is executed in a special context and not in the context of the code that
created it. This means that the function cannot contain references to local variables in outer
code nestings surrounding the function definition since those variables are on an execution
stack that does not exist at the time the function is called. An important exception to this is
utility and rollout panel locals, such as local functions, rollout variables and nested rollouts. You
can refer to them in change handler code inside rollout code as they are associated directly with
their rollout or utility object.
• Note that it is the function value that is being registered, not the function name or global
variable. This means that redefining the same-named function after registering it does not
change the callback. You either need to unregister, re-define the function and then register it
again, or make the registered function an intermediary which calls another function, for
example:
fn redrawviews_cb = print currentTime
fn rvcb = redrawviews_cb()
registerRedrawViewsCallback rvcb
In this case, the registered callback function, rvcb, calls the real call back, redrawviews_cb,
(by referencing the global variable it is defined in), meaning you can redefine
redrawviews_cb() as often as you need and the callback will always invoke the latest
definition. This is a useful technique to employ while you are developing and debugging
a callback.
• Callback functions remain registered after loading a new file or performing a 3ds max reset.
1656 Chapter 15 | Change Handlers and Callbacks
callbacks.show ()
This method lists out the current callback scripts in the Listener window.
callbacks.broadcastCallback <callback_type_name>
This method provides a way for you to simulate one of the events and have all the callback
scripts for it executed. Within 3ds max, the #preRenderFrame and #preRenderFrame
callbacks can only be called by the renderer. These callbacks can not be called by using this
method.
The following is a list of valid callback event type names:
#unitsChange
Sent if the user changes the unit setting.
#timeunitsChange
Sent if the user changes the time format setting.
#viewportChange
Sent if the user changes the viewport layout.
#spacemodeChange
Sent if the user changes the reference coordinate system.
#modPanelSelChanged
Sent whenever the Modify panel opens on a new selection, either because the Modify
panel was just selected or because a new selection is made in the scene. The notify occurs
at a point just prior to panel redraw but after the selection has been established, so that
callback functions can modify the panel state without it being overwritten.
System Notifications
#systemPreReset
Sent before 3ds max is reset.
#systemPostReset
Sent after 3ds max is reset.
#postSystemStartup
Sent when the software goes live.
#pluginLoaded
Sent whenever a plug-in is loaded.
#systemPreNew
Sent just before 3ds max is reset.
#systemPostNew
Sent just after 3ds max is reset.
#preSystemShutdown
Sent just before the software enters the shutdown process.
#postSystemShutdown
Sent just before the software finishes the shutdown process.
#colorChanged
Sent when the system is updating it’s custom colors.
1658 Chapter 15 | Change Handlers and Callbacks
File Notifications
#filePreOpen
Sent before a new file is opened.
#filePostOpen
Sent after a new file is opened successfully.
#filePreMerge
Sent before a file is merged.
#filePostMerge
Sent after a file is merged successfully.
#filePreSave
Sent before a file is saved.
#filePostSave
Sent after a file is saved.
Renderer Notifications
#preRender
Sent before rendering is started. This notification is sent out before the renderer creates the
render instance objects, which means that you can create nodes and other objects as a
response to this event. When rendering multiple frames, this event is sent only once at the
beginning of the rendering phase, and not on a per-frame basis. In the #preRender
callback, you can’t change any of the render parameters (height, width, aliasing, etc) and
effect the current render sessions. Those parameters have already been set up internally in
3ds max, and so changes to them won’t occur until the next render session occurs.
#postRender
Sent after rendering has finished. This notification is sent out after the renderer destroys
the render instance objects, which means that you can create nodes and other objects as a
response to this event. When rendering multiple frames, this event is sent only once at the
end of the rendering phase, and not on a per-frame basis.
#preRenderEval
Sent just before the renderer starts evaluating objects.
#preRenderFrame
Sent just before each frame is rendered by the renderer. This notification is sent out after
the renderer has taken a snapshot of the scene geometry. At the time of this call the scene
cannot be modified. The renderer has already called GetRenderMesh() on all the object
instances, and the materials and lights are already updated. If you don’t modify anything
that is rendered, then it is okay to use this callback. The current frame being rendered is set
into the MAXScript currentTime context and system global, so any references to other
scene object properties will automatically be resolved at the currently rendering frame’s
time. This notification is not sent out when the renderer is called to update the Material
Editor sample spheres, only during output rendering.
General Event Callback Mechanism 1659
#postRenderFrame
Sent just after each frame is rendered by the renderer. The current frame being rendered is
set into the MAXScript currentTime context and system global, so any references to other
scene object properties will automatically be resolved at the currently rendering frame’s
time. This notification is not sent out when the renderer is called to update the Material
Editor sample spheres, only during output rendering.
#renderParamsChanged
Sent whenever the common renderer parameters have changed.
Import/Export Notifications
#preImport
Sent before a file is imported.
#postImport
Sent after a file is imported successfully.
#importFailed
Sent if import fails.
#preExport
Sent before a file is exported.
#postExport
Sent after a file is exported successfully.
#exportFailed
Sent if export fails.
#nodePreMaterial
Sent just before a node gets a new material
#nodePostMaterial
Sent just after a node gets a new material
#sceneNodeAdded
Sent just after a node is added to the scene.
#selNodesPreDelete
Sent just before selected nodes are deleted.
#selNodesPostDelete
Sent just after selected nodes are deleted.
#nodeMaterialChanged
Sent after the material is changed for the selected nodes.
#nodeWSCacheUpdated
Sent whenever the modifier stack display is reevaluated.
VIZ-Only Notifications
#heightMenuChanged
Sent when a user operated the height menu.
#fileLinkPreBind
Sent just before a file link bind.
#fileLinkPostBind
Sent just after a file link bind.
General Event Callback Mechanism 1661
#fileLinkPreDetach
Sent just before a file link detach.
#fileLinkPostDetach
Sent just after a file link detach.
#fileLinkPreReload
Sent just before a file link reload.
#fileLinkPostReload
Sent just after a file link reload.
#fileLinkPreAttach
Sent just before a file link attach.
#fileLinkPostAttach
Sent just after a file link attach.
Other Notifications
#wmEnable
Sent when main window gets an wm_enable (BOOL enabled).
#selectionSetChanged
Sent after the selection set has changed.
#bitmapChanged
Sent after a bitmap is reloaded.
1662 Chapter 15 | Change Handlers and Callbacks
Chapter 16: Miscellaneous Functions
freeSceneBitmaps()
Frees up all the memory used by the image file bitmap caches. This is useful if memory is
fragmented with a lot of different bitmaps and you want to have just the ones currently
active reloaded.
rescaleWorldUnits <factor> [ #selOnly ]
This method provides functionality similar to that of Rescale World Utility plug-in in
3ds max. <factor> is the factor the objects should be scaled by. If #selOnly is specified
then only the selected objects are scaled.
IsNetServer()
Returns true if 3ds max is operating in network rendering mode and false if operating
in normal interactive mode.
loadDllsFromDir <directory_path_string> <filename_wildcard_string>
Load all the plug-ins found in the specified directory. The directory_path_string must
be terminated with a ‘\’. For example:
LoadDllsFromDir “f:\\maxsdk\\plugin\\“ “*.dlc”
maxVersion()
Returns an Array with three integers like #(3000, 6, 0) with 3ds max release number, max
API number, revision number of the SDK.
swap <destination> <destination>
Takes two valid assignment destinations (property, array index, or variable) as arguments
and swaps their values. For example:
swap myMaterial.diffuseMap.map1 myMaterial.diffuseMap.map2
1664 Chapter 16 | Miscellaneous Functions
Time Stamping
The timeStamp() function gives time-of-day in milliseconds.
The form is:
timeStamp()
The function returns the number of milliseconds since 00:00 hours that day. This is useful for timing
operations (presuming you are not timing across midnight.)
Example:
start = timeStamp()
process_mesh() -- do some big job
end = timeStamp()
format “Processing took % seconds\n” ((end - start) / 1000.0)
[ outputheight: <number> ]
Defaults to current render height.
[ outputSize: <point2> ]
An alternative way to specify the output size of the rendered image. The point2 value
is in the form: [width,height]
[ pixelaspect: <number> ]
Defaults to 1.0.
[ renderhiddenobjects: <boolean> ]
Defaults to current renderer Render Hidden Objects state.
[ superblack: <boolean> ]
Defaults to current renderer Superblack state.
[ force2sided: <boolean> ]
Defaults to current renderer Force 2 Sided state.
[ renderatmosphericeffects: <boolean> ]
Defaults to current renderer Render Atmospheric Effects state.
[ renderfields: <boolean> ]
Defaults to current renderer Render Fields state.
[ fieldorder: #odd | #even ]
Defaults to current renderer preferences Field Order state.
[ outputfile: <string> ]
The frame number is appended to the filename if the file image type is a single image
type (.bmp, .jpg, .tga, etc.), and a frame range is being rendered. Defaults to rendering
to just the virtual frame buffer.
[ vfb: <boolean> ]
Defaults to current renderer Show VFB state.
[ netrender: <boolean> ]
Defaults to current renderer Net Render state.
[ renderer: #draft | #production]
Allows the selection of draft or production renderer. By default, the currently selected
renderer is used.
[ renderType: #normal | #region | #regionCrop | #blowup | #selection ]
[ region: #(left,top,right,bottom) ]
Provides control over the type of rendering, corresponding to the Render Type menu
in the 3ds max toolbar. If #region or #blowUp is selected, the region: parameter
may be used to override the currently set regions for the active viewport, specified as
pixel coordinates relative to the top-left corner in the bitmap (VFB). Note that
#region and #blowUp can only be selected for an active viewport rendering. An error
will be reported if they are specified for a camera rendering. Defaults to #normal.
[ to: <bitmap> ]
Specifies an existing bitmap to render into. The render() function takes image size
and other parameter settings from the existing bitmap. If not supplied, a new bitmap
is created and returned by the render() function.
1666 Chapter 16 | Miscellaneous Functions
[ channels: <array_of_channel_names> ]
Specifies which g-buffer channels should be created during the rendering. For example:
bm = render camera:$cam2 channels:#(#zDepth, #coverage, #objectID)
causes $cam2 to be rendered into a new bitmap that will contain z-depth, pixel coverage
and object g-buffer ID channels. The channels: argument must always be an array of
channels identifiers, chosen from the following:
#zDepth
#matID
#objectID
#UVCoords
#normal
#unClamped
#coverage
#node
#shaderColor
#shaderTransparency
#velocity
#weight
The following are also available if the 3ds max standard scanline renderer is being used:
[ antiAliasing: <boolean> ]
Defaults to current renderer Anti-Aliasing state.
[ antiAliasFilterSize: <float> ]
Defaults to current renderer Anti-Aliasing Filter Size value.
[ antiAliasFilter: <filter> ]
Defaults to current renderer Anti-Aliasing filter.
[ enablePixelSampler: <boolean> ]
Defaults to the current renderer Global SuperSampling state. This state is true if
Disable all Samplers is checked, otherwise false.
[ mapping: <boolean> ]
Defaults to current renderer Mapping state.
[ shadows: <boolean> ]
Defaults to current renderer Shadows state.
[ autoReflect: <boolean> ]
Defaults to current renderer Auto-Reflect/Refract and Mirrors state.
[ forceWireframe: <boolean> ]
Defaults to current renderer Force Wireframe state.
[ wireThickness: <float> ]
Defaults to 1.0.
[ filterMaps: <boolean> ]
Defaults to current renderer Anti-Aliasing Filter Maps state.
[ objectMotionBlur: <boolean> ]
Defaults to current renderer Object Motion Blur Apply state.
[ objectBlurDuration: <float> ]
Defaults to 0.5.
[ objectBlurSamples: <integer> ]
Defaults to 10.
[ objectBlurSubdivisions: <integer> ]
Defaults to 10.
[ imageMotionBlur: <boolean> ]
Defaults to current renderer Image Motion Blur Apply state.
[ imageBlurDuration: <float> ]
Defaults to 0.5.
[ autoReflectLevels: <integer> ]
Defaults to 1.
You can invoke the renderer and have it do one or more of four things with the rendered output:
• Display it in a virtual frame buffer (the default), controlled with the vfb: parameter.
• Store the rendering in an image file by supplying an outputfile: parameter. The type of image
file to be created is determined from the file suffix you specify.
1668 Chapter 16 | Miscellaneous Functions
• Return the result as a MAXScript Bitmap value that you can perform Bitmap operations on (see
the Bitmap Values (p. 755) topic).
• Store the rendering in an existing MAXScript Bitmap value by supplying the to: parameter.
Supplying this parameter causes settings such as height, width, aspect, gamma, file name, etc.
to be taken from the supplied bitmap.
Notes:
The render() function interruptible mid-frame using the ESC key.
Examples:
render camera:$cam01 outputwidth:320 outputheight:240
for c in cameras do render c outputFile:(c.name + “.bmp”) vfb:off
rollout1.image.bitmap = render camera:$cam01 ...
Examples:
DOSCommand “delete c:\\temp\\foo.dat”
DOSCommand (”copy “ + source_file + “ “ + dest_folder)
You can use this function to launch other programs, for example, or perform such tasks as gathering
all the material texture and displacement image files in your scene into one folder.
The DOSCommand() function returns an integer which is the status result returned by the executed
system command.
ShellLaunch() emulates a user double-clicking on a specified file in Windows. It has the form:
ShellLaunch <filename_string> <parameters_string>
Whatever you send to ShellLaunch will be run by the Windows shell automatically, ie:
ShellLaunch “E:\\tests\\lookup.html” ““
would launch Netscape/Ie4 with lookup.html.
If a file-name extension is not specified in <filename_string>, Windows will search the specified
directory for executable files. If no directory is specified, Windows will search the paths in the Path
environment variable for the executable file. For example:
shellLaunch “e:/program files/ucalc/ucalc” ““
will execute the ucalc.exe file in the specified directory.
Exiting and Resetting 3ds max 1669
If the #noPrompt optional argument is not specified and there are unsaved changes in the scene,
3ds max will prompt with its standard save changes dialog.
Additionally, you can control the scene save and undo states in 3ds max with the following
functions:
setSaveRequired <boolean>
lets you set the 3ds max system “dirty” flag. If this flag is set or there are entries in the
Undo buffer, the user is asked if they want to save the scene file on a File > New or File >
Reset.
getSaveRequired()
returns true if the 3ds max system “dirty” flag is set to true or if the Undo buffer is not
empty. If the Undo buffer if not empty, this function will still return true, even if you just
called setSaveRequired false.
clearUndoBuffer()
empties the Undo buffer, both providing a way to reset the undo state and another way to
control the save-changes requester.
Normally, if there are entries in the Undo buffer when the scene is closed, 3ds max will prompt with
a save-changes requester. In some cases, where you are controlling undo in MAXScript, you may
want to force the need for a save-changes prompt.
The resetMAXFile() function lets you reset 3ds max under script control. This function is
typically used in batch processing or render scripts. The function has the form:
resetMaxFile() [ #noPrompt ]
If the #noPrompt optional argument is not specified and there are unsaved changes in the scene,
3ds max will prompt with its standard save changes dialog.
1670 Chapter 16 | Miscellaneous Functions
Chapter 17: OLE Automation
OLE Server
OLE Automation capability is provided in MAXScript that allows 3ds max to act as an OLE
Automation server for applications such as Visual Basic, Excel, Paradox, etc. With it, you can publish
MAXScript functions that can then be called from OLE Automation clients like VB and Excel to
generate models or animations or return data from the current scene, etc. There is an example
supplied in the script samples that defines a set of simple business graphing MAXScript functions
and an Excel spreadsheet with some Excel VB-scripted menus that will pass a selection of cells across
to these MAXScript functions to generate an animated bar chart.
This facility has the following features and limitations:
• It exposes a single server object to which you can attach a list of MAXScript functions that then
appear as the methods of that object to an OLE Automation client. Future releases will allow you
to construct any number of OLE Automation objects and give them any number of interfaces.
• It is registered as a separate process, local server supporting multiple use of its exposed object.
• It does not support in-place activation or object linking and embedding and provides no
containers for other OLE objects. In future versions, you will be able to pass rendered images
and animations to OLE clients for direct linking and embedding.
• It supports only the IDispatch form of interface with no accessible type information -- clients
need to declare their reference to the 3ds max server object as an untyped generic object.
• It supports the following method argument and result data types:
integers
reals (floats)
currency (floats)
string
boolean
empty (an empty spreadsheet cell, for example)
the equivalent MAXScript value for empty is undefined
OLE Objects (interfaces)
1672 Chapter 17 | OLE Automation
• You need to have 3ds max running and MAXScript activated before OLE Clients can access
3ds max. MAXScript is activated (and the startup.ms script run) when you first access its
Utility panel rollout. Alternatively, you can use launch script facilities described in Running
Scripts from the Command Line (p. lvii) to establish an OLE server interface as soon as
3ds max runs.
• You need to have registered 3ds max with Windows as an OLE server using the registration script
supplied with this release. See the instructions in the Setting Up MAXScript OLE Automation
(p. 1673) for details.
OLE Client
With the MAXScript OLE Automation Client system, you can use MAXScript to create OLE
Automation (now called Active-X) objects within 3ds max and control the associated OLE
Automation Servers servers with MAXScript, such as making an Excel spreadsheet and inserting
3ds max object information directly into cells there.
The function createOLEObject() is used for establishing a connection to OLE Auto Servers. The
return value of createOLEObject() is an instance of the OLEObject class. For example,
xl = createOLEObject “Excel.Sheet”
opens a connection to Excel and creates a sheet object and puts it in the variable xl. The
single argument to this function is an OLE progID string. You can then access properties
and call methods on the new OLE object. For example,
xl.application.name
will return
“Microsoft Excel”
xl.application.visible = true
will make Excel visible on the desktop. You get properties on OLE objects with the dot ‘.’
notation, just as you do in MAXScript. You also refer to OLE object methods as properties
of the OLE object. For example, the Sheet has a method ‘cells’ which takes a cell
coordinate and returns a Cell OLE object.
xlc = xl.application.cells 1 1
puts the top-left-hand cell into xlc. Set its value like this:
xlc.value = 123.45
The server application that was attached with createOLEObject() is released and terminated
when the created MAXScript OLE object is eventually garbage-collected. You can explicitly
disconnect from an OLE server application with the releaseOLEObject() function. The form is:
releaseOLEObject <ole_object>
The OLE object becomes disabled once releaseOLEObject() has been called on it and further
attempts to use it results in a descriptive error message.
Setting Up MAXScript OLE Automation 1673
You can explicitly disconnect from all active OLE server applications with the
releaseAllOLEObjects() function. Its form is:
releaseAllOLEObjects()
After calling this function, all existing OLE objects become disabled and any attempt to use them
further will generate a runtime error.
For example:
registerOLEInterface #(get_object_count,
get_object_name,
get_object_position)
Each time you call this function, it replaces the current set of exposed functions with the new set --
it does not add to the existing set. The functions you expose should limit themselves to passing and
returning only the following data types: integers, reals (floats), currency, string, boolean and empty
(undefined).
1674 Chapter 17 | OLE Automation
Trigonometric Functions
This topic is a quick review for readers who need a reminder about this area of mathematics. If you’re
familiar with trigonometry, you can skip this topic. If you find this topic difficult to follow, you
might consult a more basic reference on mathematics.
Trigonometric functions are principally used to model or describe:
• The relation between angles in a triangle (hence the name).
• Rotations about a circle, including locations given in polar coordinates.
• Cyclical or periodic values, such as sound waves.
The three basic trigonometric functions are derived from an angle rotating about a unit circle.
The tangent function is undefined for x = 0. Another way to define the target is:
Because XYR defines a right-angled triangle, the relation between the sine and cosine is:
The graphs of the basic trigonometric functions illustrate their cyclical nature.
The sine and cosine functions yield the same values, but the phase differs along the X-axis by ?/2:
in other words, 90 degrees.
The inverse functions for the trigonometric functions are the arc functions—the inverse only applies
to values of x restricted by –?/2 = X = ?/2. The graphs for these functions appear like the basic
trigonometric function graphs, but turned on their sides.
The hyperbolic functions are based on the exponential constant e instead of on circular
measurement. However, they behave similarly to the trigonometric functions and are named for
them. The basic hyperbolic functions are:
Vector Arithmetic
This topic is a quick review for readers who need a reminder about vector arithmetic. If you’re
familiar with vectors and vector calculations, you can skip this topic. If this topic is difficult to
follow, you might consult a more basic reference on mathematics.
A vector expresses a length and a direction in a particular space. The vector is expressed as a point;
for example, [5, 5, 7]. The length is the distance from the origin to that point, and the direction is
similarly from the origin to (and through) the point.
In 3ds max, vectors have three values and describe positions in three-dimensional space. They can
also represent percent scaling in X, Y, and Z; and—more abstractly—describe locations in RGB
color space.
1678 Chapter 18 | Trigonometric Functions and Vector Arithmetic
Subtracting two vectors gives the vector between the two points.
Vector Arithmetic 1679
The distance between two points is the length of the vector between them.
MAXScript Grammar
The following is the complete MAXScript grammar in EBNF form. It differs slightly in factoring from
the syntax forms given in the online reference, so that all precedence is explicit in the rules.
These rules, or syntax definitions, follow the standard EBNF notation (Extended Backus-Naur Form).
The rules typically contain a number of characters with special meanings. For example, brackets
enclose optional items, such as the minus sign in front of the number. Braces enclose items you can
use repeatedly, and bars separate multiple items from which you can choose one. Sometimes, rules
are given names so they can be referred to in the documentation or as parts of other rules. The
special characters in the rules have the following meaning:
[...] -- items inside the brackets are optional
(...|...|...) -- choose one of the items separated by the bars
{...} -- you can specify the braced item ZERO or more times
{...}+ -- you can specify the braced item ONE or more times
::= -- define a name for a syntax rule
<rule> -- you can insert what is defined by the named rule
bold_characters -- characters or token as written
Syntax Definition
[-]{<digit>} an optional minus sign (the sign), followed by
0 or more digits (the integer part), followed by
[.{<digit>}] an optional sequence (the fraction part) comprised of:
a period character, followed by
0 or more digits, followed by
1682 Chapter 19 | MAXScript Grammar and Class Hierarchy
Syntax Definition
[(e | E)[+ | -]{<digit>}+] an optional sequence (the exponent part) comprised of:
either an ‘e’ or ‘E’, followed by
an optional plus or minus sign, followed by
one or more digits.
<program> ::= { <expr> }+
<rcmenu_item_type>::= menuitem
separator
submenu
Interval
LabelControl
ListBoxControl
MAXClass
MAXFilterClass
MAXKey
MAXKeyArray
MAXMeshClass
MAXModifierArray
MAXNoteKey
MAXNoteKeyArray
MAXObject
MAXRootNode
MAXScriptFunction
MAXSuperClass
MAXTVNode
MSPluginClass
MapButtonControl
MapSupportClass
MaterialLibrary
Matrix3
MeditMaterialsClass
Menuitem
ModifierClass
MotionTracker
MouseTool
MtlButtonControl
MultiMaterialClass
NURBSDisplay
NURBSObject
NURBSControlVertex
NURBSCurve
NURBSBlendCurve
NURBSCVCurve
NURBSCurveOnSurface
NURBSChamferCurve
NURBSFilletCurve
NURBSIsoCurve
NURBSMirrorCurve
NURBSOffsetCurve
NURBSPointCurve
NURBSPointCurveOnSurface
NURBSProjectNormalCurve
NURBSProjectVectorCurve
NURBSSurfSurfIntersectionCurve
NURBSSurfaceEdgeCurve
NURBSSurfaceNormalCurve
NURBSXFormCurve
NURBSPoint
NURBSCurveConstPoint
NURBSCurveIntersectPoint
1690 Chapter 19 | MAXScript Grammar and Class Hierarchy
NURBSCurveSurfaceIntersectPoint
NURBSIndependentPoint
NURBSPointConstPoint
NURBSSurfConstPoint
NURBSSurface
NURBS1RailSweepSurface
NURBS2RailSweepSurface
NURBSBlendSurface
NURBSCVSurface
NURBSCapSurface
NURBSExtrudeSurface
NURBSFilletSurface
NURBSLatheSurface
NURBSMirrorSurface
NURBSMultiCurveTrimSurface
NURBSNBlendSurface
NURBSOffsetSurface
NURBSPointSurface
NURBSRuledSurface
NURBSULoftSurface
NURBSUVLoftSurface
NURBSXFormSurface
NURBSTexturePoint
NURBSSelection
NURBSSet
NURBSSurfaceApproximation
NURBSTextureSurface
Name
NodeChildrenArray
NoteTrack
Number
OLEMethod
OLEObject
Object
OkClass
PathName
PhyBlendedRigidVertex
PhyContextExport
PhyRigidVertex
PickerControl
Point2
Point3
ProgressBar
Quat
RadioControl
Ray
RolloutControl
RolloutFloater
SelectionSet
SelectionSetArray
Set
MAXScript Class Hierarchy 1691
SliderControl
SpinnerControl
StandardMaterialClass
String
StringStream
StructDef
SubAnim
Time
Timer
TriMesh
UndefinedClass
UnsuppliedClass
UserGeneric
VertexSelection
WindowStream
XRefScene
MAXWrapper
atmospheric
Combustion
Fog
Missing_Atmospheric
RenderEnvironment
Volume_Fog
Volume_Light
filter
Area
Blackman
Blendfilter
Catmull_Rom
Cook_Variable
cubic
Mitchell_Netravali
Plate_Match_MAX_R2
Plate_Match_VIZ_R2
Quadratic
Sharp_Quadratic
Soften
Video
FloatController
AudioFloat
bezier_float
Block
Float_Expression
float_list
Float_Motion_Capture
Float_Reactor
float_script
linear_float
LOD_Controller
Missing_Float_Control
Noise_float
1692 Chapter 19 | MAXScript Grammar and Class Hierarchy
On_Off
SlaveFloat
tcb_float
Waveform_Float
Layer_Manager
MasterBlockController
Block_Control
Free_Center
MasterBlock
material
Blend
compositematerial
DoubleSided
doubleSidedMat
Matte
MatteShadow
Missing_Mtl
Morphermaterial
Multimaterial
multiSubMaterial
NoMaterial
RaytraceMaterial
Shellac
standard
Standardmaterial
TexOutputClass
StandardTextureOutput
textureMap
Adobe_Photoshop_Plug_In_Filter
Adobe_Premiere_Video_Filter
bitmapTex
Bitmaptexture
Bricks
Cellular
Checker
compositeTexture
CompositeTexturemap
Dent
falloff
fallofftextureMap
FlatMirror
Gradient
Gradient_Ramp
Marble
Mask
maskTex
Missing_TextureMap
Mix
Noise
NoTexture
output
MAXScript Class Hierarchy 1693
Paint
Particle_Age
Particle_MBlur
Perlin_Marble
Planet
Raytrace
Reflect_Refract
RGB_Multiply
RGB_Tint
Smoke
Speckle
Splat
Stucco
Swirl
Thin_Wall_Refraction
Vertex_Color
Water
Wood
TopBottom
topBottomMat
UVGenClass
Missing_UVGen
StandardUVGen
XYZGenClass
Missing_XYZGen
StandardXYZGen
Matrix3Controller
IK_ControllerMatrix3Controller
Link_Control
Link_Transform
lookat
Missing_Matrix3_Control
prs
Slave_Control
TVDummyControl
modifier
Affect_Region
Bend
Bevel
Bevel_Profile
CameraMap
Cap_Holes
CrossSection
DeleteMesh
DeleteSplineModifier
Displace
Disp_Approx
Edit_Mesh
Edit_Patch
Edit_Spline
Extrude
1694 Chapter 19 | MAXScript Grammar and Class Hierarchy
Face_Extrude
FFDBox
FFDCyl
FFD_2x2x2
FFD_3x3x3
FFD_4x4x4
FFD_Select
Fillet_Chamfer
Flex
Lathe
Lattice
Linked_xform
MaterialByElement
Materialmodifier
Melt
MeshSmooth
Mesh_Select
MIrror
Missing_OSM
Morpher
NCurve_Sel
Noisemodifier
Normalize_Spline
Normalmodifier
NSurf_Sel
optimizeValue
ActionPredicate
ActiveXControl
AngleAxis
AngleControl
Array
ArrayParameter
AtmosphericClass
AttributeDef
Layer_Manager
BigMatrix
BigMatrixRowArray
BinStream
BitArray
bitmap
BitmapControl
BooleanClass
Box2
ButtonControl
ccCurve
ccPoint
CCRootClass
ChangeHandler
CharStream
CheckBoxControl
CheckButtonControl
MAXScript Class Hierarchy 1695
class
color
ColorPickerControl
ComboBoxControl
Control
CTBitMap
CTMotionTracker
CurveCtlGeneric
CurvePointsArray
EdgeSelection
EditTextControl
EffectClass
EmptyClass
EulerAngles
FaceSelection
FileStream
float
Generic
GeomObject
GroupBoxControl
GroupEndControl
GroupStartControl
HashTable
ImgTag
integer
Interface
InterfaceFunction
Interval
IObject
LabelControl
LinkControl
ListBoxControl
MapButtonControl
MappedGeneric
MappedPrimitive
MapSupportClass
MaterialLibrary
Matrix3
MAXAKey
MAXClass
MAXCurveCtl
MAXFilterClass
MAXKey
MAXKeyArray
MAXMeshClass
mesh
MAXModifierArray
MAXNoteKey
MAXNoteKeyArray
MAXObject
MAXRefTarg
1696 Chapter 19 | MAXScript Grammar and Class Hierarchy
MAXRootNode
MAXScriptFunction
MAXSuperClass
MAXTVNode
MeditMaterialsClass
menuitem
MixinInterface
ModifierClass
MotionTracker
MouseTool
MPassCamEffectClass
MSComMethod
MSCustAttribDef
MSDispatch
MSPluginClass
MtlButtonControl
MultiListBoxControl
MultiMaterialClass
name
NodeChildrenArray
NodeGeneric
NoteTrack
Number
NURBSDisplay
NURBSObject
NURBSControlVertex
NURBSCurve
NURBSBlendCurve
NURBSChamferCurve
NURBSCVCurve
NURBSCurveOnSurface
NURBSFilletCurve
NURBSIsoCurve
NURBSMirrorCurve
NURBSOffsetCurve
NURBSPointCurve
NURBSPointCurveOnSurface
NURBSProjectNormalCurve
NURBSProjectVectorCurve
NURBSSurfaceEdgeCurve
NURBSSurfaceNormalCurve
NURBSSurfSurfIntersectionCurve
NURBSXFormCurve
NURBSPoint
NURBSCurveConstPoint
NURBSCurveIntersectPoint
NURBSCurveSurfaceIntersectPoint
NURBSIndependentPoint
NURBSPointConstPoint
NURBSSurfConstPoint
NURBSSurface
MAXScript Class Hierarchy 1697
NURBS1RailSweepSurface
NURBS2RailSweepSurface
NURBSBlendSurface
NURBSCapSurface
NURBSCVSurface
NURBSExtrudeSurface
NURBSFilletSurface
NURBSLatheSurface
NURBSMirrorSurface
NURBSMultiCurveTrimSurface
NURBSNBlendSurface
NURBSOffsetSurface
NURBSPointSurface
NURBSRuledSurface
NURBSULoftSurface
NURBSUVLoftSurface
NURBSXFormSurface
NURBSTexturePoint
NURBSSelection
NURBSSet
NURBSSurfaceApproximation
NURBSTextureSurface
object
OkClass
OLEMethod
OLEObject
PathName
PickerControl
Point2
point3
Primitive
progressBar
Quat
RadioControl
Ray
RCMenu
RolloutClass
RolloutControl
RolloutFloater
SelectionSet
SelectionSetArray
Set
ObjectSet
SliderControl
SpinnerControl
StandardMaterialClass
StaticMethodInterface
String
StringStream
StructDef
subAnim
1698 Chapter 19 | MAXScript Grammar and Class Hierarchy
TextureClass
time
Timer
TriMesh
UndefinedClass
UnsuppliedClass
UserGeneric
ValueRef
VertexSelection
WindowStream
XRefScene
MAXWrapper
atmospheric
Fire_Effect
Fog
Missing_Atmospheric
RenderEnvironment
Volume_Fog
Volume_Light
BitmapIO
Autodesk_Animator_Flic
AVI
BMP
bmpio
CIN
CMB
EPS_Image
GIF
IFL
JPEG
jpegio
pngio
Portable_Network_Graphics
PSD_I_O
QTime
rgb
RLA
RPF
Targa
tgaio
TIF
YUV
CustAttrib
Missing_Custom_Attribute_Plugin
filter
Area
Blackman
Blendfilter
Catmull_Rom
Cook_Variable
cubic
MAXScript Class Hierarchy 1699
Filter_kernel_plug_in_not_found
Mitchell_Netravali
Plate_Match_MAX_R2
Quadratic
Sharp_Quadratic
Soften
Video
FloatController
AudioFloat
bezier_float
Block
Float_Expression
float_list
Float_Motion_Capture
Float_Reactor
float_script
Float_Wire
FloatList
FloatReactor
linear_float
LOD_Controller
Missing_Float_Control
Noise_float
On_Off
SlaveFloat
tcb_float
Waveform_Float
WireFloat
GlobalUtilityPlugin
MaxRenderer_COM_Server
Plugin_Manager
IKSolver
IKHISolver
IKLimb
MasterBlockController
Block_Control
Master_Controller_plugin_not_found
MasterBlock
MasterList
material
Blend
compositematerial
DoubleSided
doubleSidedMat
Matte
MatteShadow
Missing_Mtl
Morphermaterial
Multimaterial
multiSubMaterial
NoMaterial
1700 Chapter 19 | MAXScript Grammar and Class Hierarchy
RaytraceMaterial
Shellac
standard
Standardmaterial
TexOutputClass
StandardTextureOutput
textureMap
Adobe_Photoshop_Plug_In_Filter
Adobe_Premiere_Video_Filter
bitmapTex
Bitmaptexture
Bricks
Cellular
cellularTex
Checker
Combustion
compositeTexture
CompositeTexturemap
Dent
dents
falloff
fallofftextureMap
Flat_Mirror
flatMirror
Gradient
Gradient_Ramp
Marble
Mask
maskTex
Missing_TextureMap
Mix
mixTexture
Noise
NoTexture
output
Particle_Age
Particle_MBlur
particleBlur
Perlin_Marble
perlinMarble
Planet
Raytrace
Reflect_Refract
reflectRefract
RGB_Multiply
RGB_Tint
rgbMult
rgbTint
Smoke
Speckle
Splat
MAXScript Class Hierarchy 1701
Stucco
Swirl
Thin_Wall_Refraction
thinWallRefraction
Vertex_Color
Water
Wood
TopBottom
topBottomMat
UVGenClass
Missing_UVGen
StandardUVGen
XYZGenClass
Missing_XYZGen
StandardXYZGen
Matrix3Controller
IK_ControllerMatrix3Controller
IKChainControl
IKControl
Link
Link_Constraint
lookat
Missing_Matrix3_Control
prs
Slave_Control
transform_script
TVDummyControl
modifier
Affect_Region
Bend
BendMod
Bevel
Bevel_Profile
CameraMap
Cap_Holes
ConvertToPatch
CrossSection
DeleteMesh
DeletePatch
DeleteSplineModifier
Disp_Approx
Displace
Edit_Mesh
Edit_Patch
Edit_Spline
Extrude
Face_Extrude
FFD_2x2x2
FFD_3x3x3
FFD_4x4x4
FFD_Select
1702 Chapter 19 | MAXScript Grammar and Class Hierarchy
FFD2x2x2
FFD3x3x3
FFD4x4x4
FFDBox
FFDCyl
Fillet_Chamfer
Flex
HSDS_Modifier
HSDSObject
Lathe
Lattice
Linked_XForm
LinkedXForm
MaterialByElement
Materialmodifier
Melt
Mesh_Select
MeshSelect
meshsmooth
MIrror
Missing_OSM
Morpher
MultiRes
NCurve_Sel
Noisemodifier
Normalize_Spl
Normalize_Spline
Normalmodifier
NSurf_Sel
optimize
Patch_Select
PatchDeform
PathDeform
Point_Cache
PointCache
Poly_Select
Preserve
Push
Relax
Ripple
Skew
Skin
SliceModifier
smooth
SmoothModifier
Spherify
SplineSelect
Squeeze
STL_Check
Stretch
surface
MAXScript Class Hierarchy 1703
SurfDeform
Taper
tessellate
Trim_Extend
Turn_to_Mesh
Turn_to_Patch
Turn_to_Poly
Twist
Unwrap_UVW
UVW_Xform
Uvwmap
UVWUnwrap
Vertex_Colors
VertexPaint
Vol__Select
VolumeSelect
Wave
XForm
MorphController
Barycentric_Morph_Controller
Cubic_Morph_Controller
Missing_Morph_Control
MPassCamEffect
Depth_of_FieldMPassCamEffect
Motion_BlurMPassCamEffect
multiPassDOF
multiPassMotionBlur
Standin_for_missing_MultiPass_Camera_Effect_Plugin
node
camera
Freecamera
Missing_Camera
Targetcamera
GeometryClass
Apollo_Param_Container
apolloParamContainer
Blizzard
BoneGeometry
BoneObj
Boolean2
Box
C_Ext
Capsule
ChamferBox
ChamferCyl
Cone
Conform
Connect
ControlContainer
CV_Surf
Cylinder
1704 Chapter 19 | MAXScript Grammar and Class Hierarchy
Damper
Editable_mesh
Editable_Patch
Editable_Poly
EditablePolyMesh
Gengon
GeoSphere
Hedra
Hose
L_Ext
Loft
LoftObject
Mesher
meshGrid
Missing_GeomObject
Morph
Nurbs
NURBS_Imported_Objects
NURBSSurf
OilTank
OldBoolean
PArray
particleMesher
PCloud
Plane
Point_Surf
Point_SurfGeometry
PolyMeshObject
Prism
Pyramid
Quadpatch
RingWave
RmModel
RmModelGeometry
Scatter
ShapeMerge
SlidingDoor
SlidingWindow
Snow
Sphere
Spindle
Spray
Spring
SuperSpray
Targetobject
Teapot
Terrain
Torus
Torus_Knot
TriMeshGeometry
Tripatch
MAXScript Class Hierarchy 1705
Tube
helper
Anchor
AudioClip
Background
Billboard
Bone
BoxGizmo
CamPoint
Compass
Cone_Angle
ConeAngleManip
CylGizmo
Dummy
Falloff_Manipulator
FalloffManip
FogHelper
grid
Hotspot_Manip
HotspotManip
IK_Chain_Object
IK_Swivel_Manip
IKSwivelManip
Inline
LOD
Missing_Helper
NavInfo
Plane_Angle
PlaneAngleManip
Point
PointHelperObj
Position_Manip
PositionManip
Protractor
ProxSensor
radiusManip
Reactor_Angle_Manip
Reactor_Vector_Handle_Manip
ReactorAngleManip
ReactorVectorHandleManip
Rotation_
Rotation_Valuehelper
RotationValueManip
Slider_Manip
SliderManip
sliderManipulator
Sound
SphereGizmo
Tape
TimeSensor
TouchSensor
1706 Chapter 19 | MAXScript Grammar and Class Hierarchy
uvwMappingHeightManip
uvwMappingLengthManip
uvwMappingUTileManip
uvwMappingVTileManip
uvwMappingWidthManip
light
Directionallight
freeSpot
Missing_Light
Omnilight
TargetDirectionallight
targetSpot
NodeObject
shape
Arc
Circle
CV_Curve
CV_Curveshape
Donut
Ellipse
Helix
line
LinearShape
Lines
Missing_Shape
Ngon
NURBSCurveShape
Point_Curve
Point_Curveshape
Rectangle
section
Simple_Shape
Simple_Spline
SplineShape
Star
text
SpacewarpObject
BendModWSM
Bomb
CameraMapSpaceWarp
ConformSpaceWarp
Deflector
Drag
gravity
MapScalerSpaceWarp
Missing_WSM_Object
Motor
Path_Follow
PathDeformSpaceWarp
PBomb
PDynaFlect
MAXScript Class Hierarchy 1707
PDynaflector
POmniFlect
PSpawnflector
PushSpaceWarp
SDeflector
SDynaFlect
SDynaflector
SOmniFlect
SpaceBend
Spacedisplace
SpaceFFDBox
SpaceFFDCyl
SpaceNoise
Spaceripple
SpaceSkew
SpaceStretch
SpaceTaper
SpaceTwist
Spacewave
SSpawnflector
UDeflector
UDynaDeflector
UDynaFlect
UOmniFlect
USpawnDeflector
Vortex
Wind
System
Bones
Missing_System
Ring_Array
Sunlight
XRefObject
ParamBlock
ParamBlockParamBlock
ParamBlock2
ParamBlock2ParamBlock2
Point3Controller
AudioPoint3
bezier_color
bezier_point3
Color_RGB
Missing_Point3_Control
Noise_point3
Point3_Expression
point3_list
Point3_Motion_Capture
Point3_Reactor
point3_script
Point3_Wire
Point3_XYZ
1708 Chapter 19 | MAXScript Grammar and Class Hierarchy
Point3List
Point3Reactor
Point3Spring
Slave_Point3
SlavePoint3
SpringPoint3Controller
tcb_point3
WirePoint3
PositionController
Attachment
AudioPosition
bezier_position
Dynamics_Position_Controller
linear_position
Missing_Position_Control
Noise_position
path
Path_Constraint
Position_Constraint
Position_Expression
position_list
Position_Motion_Capture
Position_Reactor
position_script
Position_Wire
Position_XYZ
PositionList
PositionReactor
PositionSpring
SlavePos
SpringPositionController
Sunlight_Slave_Controller
Surface_position
tcb_position
WirePosition
QuatController
RadiosityEffect
Missing_Radiosity
ReferenceMaker
CurveControl
CustAttribContainer
Deform_Curve
HSUtil
Material_Editor
MeshCollision
Missing_RefMaker
MtlBaseLib
MtlLib
NamedSelSetList
NodeNamedSelSet
PlanarCollision
MAXScript Class Hierarchy 1709
Scene
SphericalCollision
StdDualVS
Texmaps
TexmapsReferenceMaker
ReferenceTarget
Auto_Secondary_Element
Bulge_Angle_Deformer
gizmoBulge
gizmoJoint
gizmoJointMorph
Glow_Element
Gradient_GradCtlData
IK_Controller
JAngleData
JBinaryData
JBoolData
JColor3Data
JColorData
JFlagCtlData
JFlagSetData
JFloat3Data
JFloatData
JGradCtlData
Joint_Angle_Deformer
Joystick_Input_Device
JPercent3Data
JPercentData
JSubtex
JWorld3Data
JWorldData
LZFlare_AutoSec_Base
LZFlare_AutoSec_Data
LZFlare_Aux_Data
LZFlare_Data
LZFlare_Glow_Data
LZFlare_Inferno_Data
LZFlare_ManSec_Base
LZFlare_ManSec_Data
LZFlare_Prefs_Data
LZFlare_Rays_Data
LZFlare_Rend_Data
LZFlare_Ring_Data
LZFlare_Star_Data
LZFlare_Streak_Data
LZFocus_Data
LZGlow_Aux_Data
LZGlow_Data
LZGlow_Rend_Data
LZHilight_Aux_Data
LZHilight_Data
1710 Chapter 19 | MAXScript Grammar and Class Hierarchy
LZHilight_Rend_Data
Manual_Secondary_Element
MIDI_Device
Missing_RefTarget
Morph_Angle_Deformer
Mouse_Input_Device
Ray_Element
Ray_Engine
Raytrace_Engine_Global_Parameters
Raytrace_Texture_ParamBlock
RenderElementMgr
Ring_Element
Star_Element
Streak_Element
This_Data
TVNode
renderEffect
blur
Brightness_and_Contrast
briteCon
Color_Balance
colorBalance
Depth_of_Field
DOFEffect
File_Output
fileOut
Film_Grain
FilmGrain
imageMotionBlur
Lens_Effects
Missing_Render_Effect
Motion_Blur
RenderElement
Alpha
alphaRenderElement
Atmosphere
atmosphereRenderElement
BackgroundRenderElement
Beauty
beautyRenderElement
bgndRenderElement
BlendRenderElement
clrShadowRenderElement
Colored_Shadow
Diffuse
diffuseRenderElement
emissionRenderElement
Missing_Render_Element_Plug_in
Reflection
reflectionRenderElement
Refraction
MAXScript Class Hierarchy 1711
refractionRenderElement
Self_Illumination
ShadowRenderElement
Specular
specularRenderElement
Z_Depth
ZRenderElement
RendererClass
Default_Scanline_Renderer
DefaultScanlineRenderer
Missing_Renderer
VUE_File_Renderer
RotationController
AudioRotation
bezier_rotation
Dynamics_Rotation_Controller
Euler_XYZ
linear_rotation
Local_Euler_XYZ
LookAt_Constraint
Missing_Rotation_Control
Noise_rotation
Orientation_Constraint
rotation_list
Rotation_Motion_Capture
Rotation_Reactor
rotation_script
Rotation_Wire
RotationList
RotationReactor
SlaveRotation
tcb_rotation
WireRotation
ScaleController
AudioScale
bezier_scale
linear_scale
Missing_Scale_Control
Noise_scale
Scale_Expression
scale_list
Scale_Motion_Capture
Scale_Reactor
scale_script
Scale_Wire
ScaleList
ScaleReactor
ScaleXYZ
SlaveScale
tcb_scale
WireScale
1712 Chapter 19 | MAXScript Grammar and Class Hierarchy
Shader
Anisotropic
Blinn
Blinn2
BlinnShader
Metal
Metal2
Missing_Shader_Plug_in
Multi_Layer
MultiLayer
Oren_Nayar_Blinn
OrenNayarBlinn
Phong
Phong2
Strauss
Shadow
raytraceShadow
shadowMap
SpacewarpModifier
Bombbinding
Deflectorbinding
Displace_Mesh
Displace_NURBS
Displacebinding
DragMod
FFD_Binding
Gravitybinding
MapScaler
Missing_WSM
MotorMod
Particle_Cache
ParticleCache
Path_FollowMod
PBombMod
PDynaFlectMod
Point_CacheSpacewarpModifier
PointCacheWSM
POmniFlectMod
PushMod
Ripplebinding
SDeflectMod
SDynaFlectMod
SimpleOSMToWSMMod
SOmniFlectMod
SpaceCameraMap
SpaceConform
SpacePatchDeform
SpacePathDeform
SpaceSurfDeform
Surface_Mapper
UDeflectorMod
MAXScript Class Hierarchy 1713
UDynaFlectMod
UOmniFlectMod
VortexMod
Wavebinding
Windbinding
ToneOperator
Automatic_Exposure_Control
AutomaticAdaptiveExposureControl
Missing_Exposure_Control
UtilityPlugin
ASCII_Object_Output
Asset_Browser
Assign_Vertex_Colors
Camera_Match
Camera_Tracker
collapse
Color_Clipboard
COM_DCOM_Server_Control
Dynamics
Follow_Bank
IFL_Manager
Level_of_Detail
Link_Inheritance__Selected
MapPath_Editor
MAX_File_Finder
MAXScript
Measure
Motion_Capture
Polygon_Counter
Rescale_World_Units
Reset_XForm
Resource_Collector
Shape_Check
Strokes
Surface_Approximation
UVW_Remove
Visual_MAXScript
VisualMSUtil
1714 Chapter 19 | MAXScript Grammar and Class Hierarchy
Chapter 20: Using the HTML Help Viewer
See also
Finding Information Fast (p. 1717)
Searching for Help Topics (p. 1718)
Note: Most of information about using the HTML Help Viewer has been supplied directly by
Microsoft. It has been made freely available for inclusion in HTML help projects such as this one.
This information has been edited and reformatted to match the Discreet online information
systems.
1716 Chapter 20 | Using the HTML Help Viewer
Procedures
To find a help topic
1. In the Navigation pane, click one of the following tabs:
• To browse through a table of contents, click the Contents tab. The table of contents is an
expandable list of important topics.
• To see a list of index entries, click the Index tab, and then type a word or scroll through the
list. Topics are often indexed under more than one entry.
• To locate every occurrence of a word or phrase that may be contained in a help file, click the
Search tab, and then type the word.
2. Click the contents entry, index entry, or search results entry to display the corresponding topic.
Contents Tab
The Contents tab displays the main sections of this 3ds max online system as book icons. When
you click a book, it expands to show the list of topics contained within it, like chapters in hard-copy
books.
Index Tab
The Index is an alphabetical listing of keywords found in each topic. A single keyword may be linked
to more than one topic. You may type the first few letters of a subject to jump to an index entry that
matches what you are looking for.
Search Tab
The Search tab summons a full-text search engine that operates on a database of every word in the
help system, created when the HTML Help system was compiled. You can use tools on the Search
tab to find the help topics (p. 1718) containing any word or phrase.
1718 Chapter 20 | Using the HTML Help Viewer
Turn on Match Similar Words to include minor grammatical variations for the phrase you search.
Searching for Help Topics 1719
Note: The |, &, and ! characters don’t work as Boolean operators (you must use OR, AND, and NOT).
Procedures
To go to a topic from the Search tab
1. Click the Search tab, and then type the word or phrase you want to find.
2. Click the Boolean button (to the right of the test field) to add Boolean operators to your
search.
3. Click List Topics, choose the topic you want, and then click Display.
4. To sort the topic list alphabetically, click the Title column heading.
1720 Chapter 20 | Using the HTML Help Viewer
You can precisely define a search by using wildcard expressions, nested expressions, and Boolean
operators.
You can request similar word matches, search only the topic titles, or search the results of a previous
search.
You can set the Help Viewer to highlight all instances of search terms that are found in topic files.
Click the Options button, and then click Search Highlight On.
• Click the down arrow on the text-entry field and choose a previously used search string, and
then click List Topics.
Favorites Tab
Use tools on the Favorites tab to create a set of topics you use often; you can name them as you
choose.
Procedures
To create a list of favorite help topics
1. Locate the help topic you want to make a favorite topic.
2. Click the Favorites tab, and then click Add.
Internet Options: Displays a dialog to change Internet Explorer (IE) settings. The 3ds max
information systems do not use this feature. Making changes here does not affect these systems,
but will alter your IE browser settings. We do not recommend you use this option.
Print: Same as the Print button, above.
Search Highlight On/Off: Toggles highlighting on and off for each occurance of a word or phrase
found with a search.
Command Description
Right-click in the table of contents, and then click Opens all books or folders in the table of contents. This
Open All. command only works if the Contents tab is displayed.
Right-click in the table of contents, and then click Closes all books or folders. This command only works if
Close All. the Contents tab is displayed.
Right-click in the Topic pane, or an entery in the table of Prints the topic.
contents, and then click Print.
Right-click an entry in the Favorites tab. Choose to display, add, remove, or rename a topic.
Help Viewer
To Press
Close the Help Viewer. ALT+F4
Switch between the Help Viewer and other open ALT+TAB
windows.
Display the Options menu. ALT+O
Hide or show the Navigation pane. ALT+O, and then press T
Print a topic. ALT+O, and then press P, or right-click in the Topic pane
and choose Print.
Move back to the previous topic. ALT+LEFT ARROW, or ALT+O, and then press B
Move forward to the next topic (provided you have ALT+RIGHT ARROW, or ALT+O, and then press F
viewed it just previously).
Turn on or off search highlighting. ALT+O, and then press O
Refresh the topic that appears in the Topic pane (this is F5, or ALT+O, and then press R
useful if you have linked to a Web page).
Keyboard Shortcuts in the Help Viewer 1723
To Press
Return to the home page (help authors can specify a ALT+O, and then press H
home page for a help system).
Switch between the Navigation and Topic panes. F6
Scroll through a topic. UP ARROW and DOWN ARROW, or PAGE UP and PAGE
DOWN
Scroll through all the links in a topic or through all the TAB
options on a Navigation pane tab.
Contents Tab
To Press
Display the Contents tab. ALT+C
Open and close a book or folder. PLUS SIGN and MINUS SIGN, or LEFT ARROW and RIGHT
ARROW
Choose a topic. DOWN ARROW and UP ARROW
Display the selected topic. ENTER
Index Tab
To Press
Display the Index tab. ALT+N
Type a keyword to search for. ALT+W, and then type the word
Choose a keyword in the list. UP ARROW and DOWN ARROW
Display the associated topic. ALT+D
Search Tab
To Press
Display the Search tab. ALT+S
Type a keyword to search for. ALT+W, and then type the word
Start a search. ALT+L
Choose a topic in the results list. ALT+T, and then UP ARROW and DOWN ARROW
Display the selected topic. ALT+D
Search for a keyword in the result list of a prior search. ALT+U
Search for words similar to the keyword. For example, ALT+M
to find words like “running” and “runs” for the
keyword “run.”
Only search through topic titles. ALT+R
1724 Chapter 20 | Using the HTML Help Viewer
Favorites Tab
To Press
Display the Favorites tab. ALT+I
Add the currently displayed topic to the Favorites list. ALT+A
Choose a topic in the Favorites list. ALT+P, and then UP ARROW and DOWN ARROW
Display the selected topic. ALT+D
Remove the selected topic from the list. ALT+R
Notes:
• There are also shortcut menu commands (p. 1722) that can be accessed through the keyboard.
• Every time you use a shortcut key in the Navigation pane, you lose focus in the Topic pane. To
return to the Topic pane, press F6.
• The Match Similar Words check box, on the Search tab, will be turned on if you used it for your
last search.
Chapter 21: character studio 3 MAXScript Extensions
Notes:
Load/Save a Figure (*.FIG) file
-- Score File Access Methods
biped.LoadScoreFile <biped_ctrl> <filename>
biped.SaveScoreFile <biped_ctrl> <filename>
Score files are Step files which save footsteps, but don’t save body keyframes. They are an
ASCII file format that enables developers to write programs that generate step files for
biped motion. The online document stp.rtf, provided with character studio in the
\cstudio\docs directory, describes the .stp format.
Notes:
Load/Save a Step (*.STP) file
-- Motion Capture File Access Methods
biped.loadMocapFile <biped_ctrl> <file_name> [#prompt]
Load a motion capture (.BIP, .BVH, .CSM) file. If #prompt is specified, the file is not
automatically loaded, rather the Motion Capture Conversion Parameters dialog is
displayed with the specified file as the motion capture file.
-- Talent File Access Methods
biped.adjustTalentPose <biped_ctrl>
After loading a marker file, use Adjust Talent Pose to correct the biped position relative to
the markers. Align the biped limbs to the markers then call biped.adjustTalentPose to
compute this offset for all the loaded marker data.
Note:
Calibration controls are only enabled when a marker or .bvh file is imported in its raw form. Do not
use key reduction or extract footsteps when you import a marker file for the first time.
biped.saveTalentFigFile <biped_ctrl> <file_name>
After changing the biped scale in Talent Figure mode, save the changes into a .fig file. Use
this file in the Motion Capture Conversion Parameters dialog to adjust marker files created
by the same actor.
biped.saveTalentPoseFile <biped_ctrl> <file_name>
Save a Talent Pose adjustment as a .cal file.
Save a .cal file after adjusting the biped relative to the markers. A .cal file is used for
processing marker files that require the same adjustment. A .cal file can be loaded in the
Motion Capture Conversion Parameters dialog during marker file importation.
-- Layer related methods
biped.collapseAtLayer <biped_ctrl> <index>
Collapses all layers till the specified layer. All underneath should be active for this function
to work. Return true if successful, otherwise false.
biped.createLayer <biped_ctrl> <index> <name>
Creates a layer at the specified position, maximum index value can be NumLayers + 1
Biped Creation 1727
See Also
Biped Creation (p. 1727)
Biped Controllers (p. 1735)
Biped MaxScript Extensions (p. 1725)
Biped Creation
The following properties and methods are applicable to any created Biped.
Constructor:
biped.createNew <height_float> <angle_float> <wpos_point3> . . .
Creation Properties:
<biped>.arms Boolean Default: True
Specifies whether or not arms will be generated for the current biped.
<biped>.neckLinks Integer Default: 1
Specifies the number of links in the biped neck.
<biped>.spineLinks Integer Default: 4
Specifies the number of links in the biped spine.
<biped>.legLinks Integer Default: 3
Specifies the number of links in the biped legs.
<biped>.tailLinks Integer Default: 0
Specifies the number of links in the biped tail. A value of 0 specifies no tail.
<biped>.ponytail1Links Integer Default: 0
Specifies the number of Ponytail links.
<biped>.ponytail2Links Integer Default: 0
Specifies the number of Ponytail links.
<biped>.fingers Integer Default: 1
Specifies the number of biped fingers.
<biped>.fingerLinks Integer Default: 3
Sets the number of links per finger.
<biped>.toes Integer Default: 5
Specifies the number of biped toes.
<biped>.toeLinks Integer Default: 3
Specifies the number of links per toe.
<biped>.ankleAttach Float Default: 0.2
Specifies the right and left ankles’ point of attachment along the corresponding foot block.
The ankles may be placed anywhere along the center line of the foot block from the heel
to the toe.
A value of 0 places the ankle attachment point at the heel. A value of 1 places the ankle
attachment point at the toes.
<biped>.trianglePelvis Boolean Default: True
Select this control to create links from the upper legs to the lowest biped spine object
when Physique is applied. Normally, the legs are linked to the biped pelvis object.
The pelvis area can be a problem when the mesh is deformed with Physique. Triangle
Pelvis creates a more natural spline for mesh deformation.
Biped Display Preferences Access 1729
Notes:
Creates a new Biped with the given keyword parameters. All UI limit constraints apply on keyword
parameters, example: fingers and fingerLinks parameters are not respected when arms is set to false.
The following example will create a Biped with specific non default values and facing the front.
Script Example:
bipObj = biped.createNew 100 -90 [0,0,0] arms:true neckLinks:2 \
spineLinks:4 legLinks:4 tailLinks:1 ponyTail1Links:1 \
ponyTail2Links:1 fingers:5 fingerLinks:2 toes:4 \
toesLinks:2 ankleAttach:0.3 trianglePelvis:True
See also
Biped MAXScript Extensions (p. 1725)
The following example will display the Biped Display Preferences dialog:
Script Example:
bipObj = biped.createNew 100 100 [0,0,0]
select bipObj
bip = bipObj.transform.controller
-- Display properties
biped.displayPrefsDlg bip
See Also
Biped Creation (p. 1727)
Biped Controllers (p. 1735)
Biped MaxScript Extensions (p. 1725)
1730 Chapter 21 | character studio 3 MAXScript Extensions
See also
Biped MAXScript Extensions (p. 1725)
biped_object : GeometryClass
This class represents the individual Biped body part and footstep nodes’ baseobject.
Properties:
<biped_object>.rootNode Node Default: Varies -- Read-only
The controller for the biped_object. For the COM, the controller type is
Vertical_Horizontal_Turn. For footsteps, the controller type is FootSteps. For the remaining
biped body parts, the controller type is BipSlave_Control.
See Also
Vertical_Horizontal_Turn Matrix3 Controller (p. 1736)
FootSteps : Matrix3 Controller (p. 1744)
BipSlave_Control Controllers (p. 1745)
Biped Layers 1731
Biped Layers
Layer Related Methods
biped.collapseAtLayer <biped_ctrl> <index_integer>
Collapses all layers till the specified layer. All underneath must be active for this function
to work. Return true if successful, otherwise false.
biped.createLayer <biped_ctrl> <index_integer> <name_string>
Creates a layer at the specified position, maximum index value can be NumLayers + 1.
biped.deleteLayer <biped_ctrl> <index_integer>
Deletes the specified layer
biped.getCurrentLayer <biped_ctrl>
Returns the position of the currently active layer in the UI.
biped.getLayerActive <biped_ctrl> <index_integer>
Returns true if the specified layer is active.
biped.getLayerName <biped_ctrl> <index_integer>
Returns the specified layer name.
biped.numLayers <biped_ctrl>
Returns the number of layers.
biped.setCurrentLayer <biped_ctrl> <index_integer>
Sets the active layer in the UI to the specified layer.
biped.setLayerActive <biped_ctrl> <index_integer> <boolean_val>
Sets the specified layer to active/inactive based upon the boolean_val passed.
biped.setLayerName <biped_ctrl> <index_integer> <name_string>
Sets the specified layer name to the value passed.
The top level and their link nodes in character studio 3 are:
Example:
bipObj = biped.createNew 100 100 [0,0,0] -- create a biped
nn = biped.maxNumNodes bipObj
nl = biped.maxNumLinks bipObj
for i = 1 to nn do
( anode = biped.getNode bipObj i
if anode != undefined do
( format “% :\t%\n” i anode.name
for j = 1 to nl do
( alink = biped.getNode bipObj i link:j
if alink != undefined do
format “% : % \t%\n” i j alink.name
)
)
)
The rest of the nodes are links just like what you see in the structure rollout.
UpperArm
L Hand
Finger2
Calf
Foot
...etc
You can get to left hand as follows: biped.getNode $ #lArm link:4
If the link argument is not specified then the top(first) node is returned.
The following are examples showing how the crowd system “PerFrameFn” (p. 1771) can be used to
dynamically change the biped preferred clip.
Example:
-- changes the preferred clip as a function of frame number.
fn PerFrameFn crwd t = (
if (t == 200f) then
(
a = $bip100
a = a.transform.controller
biped.addprefclip a “jog_L45”
))
Example:
-- changes the preferred clip as a function of the current clip.
fn PerFrameFn crwd t = (
a = $bip100
a = a.transform.controller
if (biped.getcurrentclip a == “jog_L135”) then
biped.addprefclip a “jog_L45”
)
See Also
Crowd : helper (p. 1771)
Biped Controllers
The Biped controller, referred to as “<biped_ctrl>” in this documentation, is called the Biped
Vertical_Horizontal_Turn(Body):Matrix3 Controller (p. 1736). This is sometimes also called the body
controller because it is equivalent to the Biped’s.transform.controller.
The Biped footsteps have a controller. It is referred to as “<footsteps_ctrl>” in this documentation.
See Biped Footsteps (p. 1745) for details regarding the FootSteps:Matrix3 Controller.
Individual Biped body part objects and the Vertical, Horizontal, and Turning tracks of the Biped
Vertical Horizontal Turn(Body):Matrix3_Controller (p. 1736) use the Biped Slave
ControllerBiped_Slave_Controller Biped_Slave_Controller. This type of controller is attached to the
transform track.
See also
Biped Slave Controller (p. 1745)
Biped MAXScript Extensions (p. 1725)
1736 Chapter 21 | character studio 3 MAXScript Extensions
or:
<biped_ctrl>=$bip01.controller
Properties:
All the following properties are get/set properties unless specified.
-- Structure properties
<biped_ctrl>.rootName String Default: BipXX,
where XX is a number
The name of the biped center of mass object. The center of mass (COM) is the root of the
biped hierarchy, and is visible as a diamond shaped object in the biped pelvis area. The
Root Name is appended to all the links of the biped hierarchy.
<biped_ctrl>.rootNode Node Default: Varies -- Read-only
The root node (COM) of the Biped system this biped_ctrl belongs to.
<biped_ctrl>.arms Boolean Default: True
Specifies whether or not arms will be generated for the current biped.
<biped_ctrl>.neckLinks Integer Default: 1 range: 1-5
Specifies the number of links in the biped neck.
<biped_ctrl>.spineLinks Integer Default: 4 range: 1-5
Specifies the number of links in the biped spine.
<biped_ctrl>.legLinks Integer Default: 3 range: 3-4
Specifies the number of links in the biped legs.
<biped_ctrl>.tailLinks Integer Default: 0 range: 0-5
Specifies the number of links in the biped tail. A value of 0 specifies no tail.
<biped_ctrl>.ponytail1Links Integer Default: 0 range: 0-5
Specifies the number of Ponytail links.
<biped_ctrl>.ponytail2Links Integer Default: 0 range: 0-5
Specifies the number of Ponytail links.
<biped_ctrl>.fingers Integer Default: 1 range: 0-5
Specifies the number of biped fingers.
<biped_ctrl>.fingerLinks Integer Default: 3 range: 1-3
Sets the number of links per finger.
Note: If the number of fingers is 0, fingerLinks is always equal to 1.
<biped_ctrl>.toes Integer Default: 5 range: 1-5
Specifies the number of biped toes.
Biped Vertical_Horizontal_Turn(Body):Matrix3 Controller 1737
Note:
If the number of pony tail links is 0, you cannot set Separate Ponytail Tracks to true.
<biped_ctrl>.sepNeckTracks Boolean Default: False
Turn on to create separate transform tracks for the neck links.
<biped_ctrl>.sepTailTracks Boolean Default: True
Turn on to create separate transform tracks for each tail link.
<biped_ctrl>.sepSpineTracks Boolean Default: False
Turn on to create separate spine transform tracks.
-- Modes
<biped_ctrl>.figureMode Boolean Default: False
-- cannot be in Buffer mode to enter figureMode
Use Figure mode to fit a biped to the mesh or mesh objects representing your character.
Leave Figure Mode on when you attach the mesh to the biped with Physique. Figure mode
is also used to scale a biped with a mesh attached, to make biped “fit” adjustments after
Physique is applied, and to correct posture in motion files that need a global posture
change.
<biped_ctrl>.footstepMode Boolean Default: False
Create and edit footsteps; generate a walk, run, or jump footstep pattern; edit selected
footsteps in space; and append footsteps using parameters available in Footstep mode.
<biped_ctrl>.motionMode Boolean Default: False
-- cannot be in Buffer mode to enter motionMode
Create scripts and use editable transitions to combine .bip files together (to create character
animation) in Motion Flow mode. After creating a script and editing transitions, use Save
Segment on the General rollout to store a script as one long .bip file. Save a .mfe file, this
enables you to continue Motion Flow work in progress.
<biped_ctrl>.bufferMode Boolean Default: False
Footsteps are required in the buffer to enter bufferMode.
Edit segments of an animation in Buffer mode. Copy footsteps and associated biped keys
into the buffer using Copy Footsteps on the Footstep Operation rollout first, then turn on
Buffer mode to view and edit the copied segment of your animation.
Note:
Paste buffered motion back to the original animation repeatedly to create looping motions.
Edit footsteps and biped animation that has been copied into the buffer using Copy Footsteps on
the Footsteps Operation rollout. The changes can be pasted back by turning off Buffer Mode, turning
on Paste Footsteps on the Footstep Operation rollout and overlapping the buffered footsteps with
the original footsteps. The buffered motion is spliced into the original animation.
1740 Chapter 21 | character studio 3 MAXScript Extensions
Note:
Trajectories do not display when In Place mode is active.
-- Track Selection
<biped_ctrl>.trackSelection Integer Default: 0
0 - No track selection
While a trackSelection value of 0 is a valid return value, setting trackSelection to 0 is
meaningless and will not change the current track selection.
1 - Body Horizontal
Turn on to prevent adaptation of body horizontal keys when footsteps are edited in space.
2 - Body Vertical
Turn on to prevent adaptation of body vertical keys when footsteps are edited in space.
3 - Body Rotation
Turn on to prevent adaptation of body turning keys when footsteps are edited in space.
-- Display properties
<biped_ctrl>.displayBones Boolean Default: False
Displays biped bones. Bones are represented as yellow lines, which do not render. Selecting
Bones is useful for seeing exactly where the joints fall in relation to the biped objects.
<biped_ctrl>.displayObjects Boolean Default: True
Displays biped body objects (objects).
<biped_ctrl>.displayFootsteps Boolean Default: True
Displays biped footsteps in the viewport. Footsteps are represented as green and blue foot-
shaped outlines by default; these are also visible in preview renderings. Turning off the
Footsteps button also turns off the footstep numbers and the center of mass shadow.
<biped_ctrl>.displayFSNumbers Boolean Default: True
Displays biped footstep numbers. Footstep numbers specify the order in which the biped
will move along the path created by the footsteps. Footstep numbers are displayed in
white and do not render, but do appear in preview renderings.
<biped_ctrl>.displayTrajectories Boolean Default: False
Displays trajectories for selected biped limbs.
-- Layers
<biped_ctrl>.visibleBefore Integer Default: 1
Set the number of preceding layers too display as stick figures.
<biped_ctrl>.visibleAfter Integer Default: 0
Set the number of succeeding layers too display as stick figures.
<biped_ctrl>.keyHighlight Boolean Default: False
Display keys by highlighting the stick figures.
1742 Chapter 21 | character studio 3 MAXScript Extensions
fsGaitMode can be set to any of the three gaits: #walk, #run, #jump
Note:
Calibration controls are only enabled when a marker or .bvh file is imported in its raw form. Do not
use key reduction or extract footsteps when you import a marker file for the first time.
-- Object Space Object
<biped_ctrl>.osObject Node Default: Undefined
The Object Space Object for the currently selected body part. The osObject can be specified
for the Clavicle or any of its decendents, and the Thigh or any of its decendents. The
osObject is undefined for all other body parts. The osObject is normally specified in the IK
Key Info rollout.
-- SubAnim Properties (as seen in Track View)
<biped_ctrl>.vertical Matrix3 -- Animatable
The vertical track of controller
<biped_ctrl>.horizontal Matrix3 -- Animatable
The horizontal track of controller
<biped_ctrl>.turning Matrix3 -- Animatable
The turning track of controller
<biped_ctrl>.Ease_Curve Point3 -- Animatable
Animated over range 0 to 1
Script Example:
bipObj = biped.createNew 100 100 [0,0,0]
select bipObj
bip = bipObj.transform.controller
-- Display properties
bip.displayBones = true
bip.displayObjects = false
bip.displayFootsteps = false
bip.displayFSNumbers = false
-- Animations properties
bip.gravAccel = 700
bip.dynamicsType = 1
See Also
Biped Creation (p. 1727)
1744 Chapter 21 | character studio 3 MAXScript Extensions
or:
<footsteps_ctrl>=$’Bip01 Footsteps’.controller
Notes:
This controller is attached to the transform track of the named Biped footstep object.
Properties:
<footsteps_ctrl>.freeFormMode Boolean Default: False
false - Edit Footsteps
true - Edit Free Form (no physics)
See Also
Biped Footprints (p. 1745)
Biped Keys (p. 1759)
See also
Biped MAXScript Extensions (p. 1725)
Biped Footprints
Methods:
biped.addFootprint <biped_ctrl> <matrix3> [append:<boolean>]
Specifies the position and rotation of the footstep. The scale portion of the matrix3 should
always be the identity matrix ([1,1,1]).
Creates a single footprint for the biped, where matrix3 specifies the position and rotation
of the footstep. The scale portion of the matrix3 should always by unity ([1,1,1]).
Notes:
Creates a single footprint for the Biped.
1746 Chapter 21 | character studio 3 MAXScript Extensions
Global Properties:
biped.fsAddSide Integer Default:0
0 - Start Right
1 - Start Left
Notes:
For multiple footstep creation, the starting foot needs to be identified. There is a UI radio button in
the Multiple Footstep Creation dialog “Start Right/Start Left”. The biped global property,
fsAddSide, exposes access to this UI element.
This property also effects the start foot when manually creating footsteps in the viewports and when
using biped.addFootprint. If the biped.fsAddSide is 1, a left footstep is created. If 0, a right
footstep is created. When you create a footstep in the viewports or by using biped.addFootprint,
the value of biped.fsAddSide is flipped, resulting in alternating footsteps being created by default.
Methods:
biped.multipleFSDlg <biped_ctrl>
Displays the Multiple Footstep Creation dialog
biped.getMultipleFSParams <gait_type_name>
Returns an instance of MultFprintParams, gait_type_name can be #walk, #run or #jump.
For information on MultFprintParams and gait_type_name see Biped MultFprintParams
ClassBiped_MultFprintParams_Class.
The following example will obtain the MultipleFSParams for a walk cycle, set several of its values and
then show all of the properties.
Script Example:
walk = biped.getMultipleFSParams #walk
walk.numFootsteps = 5
walk.actualStrideWidth = 2.5
walk.paramStrideWidth = 2.5
walk.actualStrideLength1 = .6
walk.paramStrideLength1 = .6
walk.actualStrideHeight1 = .6
walk.cycle1 = 6
walk.actualStrideLength2 = .7
walk.paramStrideLength2 = .7
walk.actualStrideHeight2 = .7
walk.cycle2 = 7
walk.autoTiming = true
walk.interpTiming = true
walk.alternate = true
walk.multiInsertInTime = true
showProperties walk
Biped Footprints 1747
Method:
biped.addMultipleFootprints <biped_ctrl> <MultFprintParams>
Create footsteps for a Biped based on the MultFprintParams value
biped.newFootprintKeys <biped_ctrl>
Activates all inactive footsteps. Activation creates default keys for any footsteps that do not
have them. If a footstep does not have keys, it is displayed as bright green (right foot) or
bright blue (left foot). After keys are created for the footsteps, the footsteps change color to
pastel green and pastel blue.
Create Biped keys for inactive footsteps on the Biped
The following example will create a biped, create 10 footsteps and then have Biped create default
keys for the footsteps.
Script Example:
-- create a Biped
bipObj = biped.createNew 100 100 [0,0,0]
-- get the transform controller for the Biped
bip = bipObj.transform.controller
-- get the multiple footstep parameters interface
mfsp=biped.getMultipleFSParams #walk
-- set the number of footsteps to 10
mfsp.numFootsteps=10
-- create the inactive footsteps
biped.addMultipleFootprints bip mfsp
-- create the Biped keys for inactive footsteps
biped.newFootprintKeys bip
See Also
Biped Controllers (p. 1735)
Biped MultFprintParams Class (p. 1748)
Biped MaxScript Extensions (p. 1725)
Biped Keys (p. 1759)
1748 Chapter 21 | character studio 3 MAXScript Extensions
Since MultFprintParams is biped independent, the actual stride lengths and heights are not
accessible in this class. To convert from a paramStrideWidth value to an actualStrideWidth
value, multiply the paramStrideWidth value by the width of the pelvis. Given a biped_ctrl, the
pelvis width can be calculated by:
thePelvis = biped.getNode biped_ctrl #pelvis
pelvisWidth = in coordsys thePelvis (thePelvis.max- thePelvis.min).z
if ((biped_ctrl.rootnode).controller.leglinks) > 3 do
See Also
Biped Vertical_Horizontal_Turn(Body):Matrix3 Controller (p. 1736)
Biped Slave Controller (p. 1745)
FootSteps : Matrix3 Controller (p. 1744)
Biped Footsteps (p. 1745)
Biped MAXScript Extensions (p. 1725)
or:
<footsteps_ctrl>=$’Bip01 Footsteps’.controller
Notes:
This controller is attached to the transform track of the named Biped footstep object.
Properties:
<footsteps_ctrl>.freeFormMode Boolean Default: False
false - Edit Footsteps
true - Edit Free Form (no physics)
BipedFSKey : MAXObject 1751
See Also
Biped Footprints (p. 1745)
Biped Keys (p. 1759)
BipedFSKey : MAXObject
This class represents a Biped footstep in the viewports and trackview.
Properties:
<fskey>.time Time Default: Varies
A value indicating when in time the key occurs.
<fskey>.duration Time Default: Varies
The number of frames in each footstep.
1752 Chapter 21 | character studio 3 MAXScript Extensions
See Also
Biped Controllers (p. 1735)
Biped Footsteps (p. 1745)
Biped Vertical_Horizontal_Turn(Body):Matrix3 Controller (p. 1736)
Biped Keys (p. 1759)
Biped MAXScript Extensions (p. 1725)
MoFlow : MaxWrapper
This class can be used to access features in the Biped Motion Flow panel. An instance of this class is
returned by the .motionFlow property of a Biped Body Controller (p. 1736).
Properties:
<moflow>.scripts Array Default: #()
-- Read-only
An array of motion flow scripts (MoFlowScript values).
A Script is a list of clips (.bip files) that are executed sequentially to animate a character.
<moflow>.activeScript MoFlowScript Default:undefined
Get/set which MoFlowScript in scripts array is the active script. If the specified
MoFlowScript is not in the scripts array, no action occurs.
MoFlow : MaxWrapper 1753
Load a Motion Flow Editor file (.mfe). Motion Flow Editor files include:
Clips: references to biped animation files.
Transitions: The names, attributes, and connections between clips.
Scripts: different paths through a set of connected clips and transitions.
saveMoFlowFile <moflow> <file_name>
Save a Motion Flow Editor file (.mfe).
Load/Save a motion flow (.MFE) file.
Note:
The location of the referenced .bip files is saved in the .mfe file. If the .bip file cannot be found, the
program looks to the motion flow directory specified in \plugcfg\biped.ini. By default, this setting is
MoFlowDir=<maxdir>\cstudio\scripts
If a referenced .bip file cannot be found in its current location, you will need to move it to the
specified Motion Flow directory. You can change the location of this directory at any time by editing
your biped.ini file with a text editor. The new directory will be used the next time you restart
3ds max. You can also add multiple search paths to your biped.ini file by repeating the MoFloDir=
line multiple times. The program will search the directories in the order they appear and will use the
first instance of the file that it finds.
loadSnippetFiles <moflow>
Loads the snippet files whose file names are assigned. This function should be called
whenever new snippets are added.
Clips represent all or part of a .bip file.
addScript <moflow> <name>
Scripts represent different paths through the clips in the Motion Flow Graph.
Creates a new motion flow script with the given name and adds it to the motion flow.
Returns the new MoFlowScript.
1754 Chapter 21 | character studio 3 MAXScript Extensions
See also
Biped Controllers (p. 1735)
MoFlowScript : MaxWrapper (p. 1754)
MoFlowSnippet : MaxWrapper (p. 1755)
Biped MAXScript Extensions (p. 1725)
MoFlowScript : MaxWrapper
Constructor:
addScript <moflow> <script_name>
Create a new motion flow script with the given name to the motion flow. Returns the new
MoFlowScript.
Properties:
<MoFlowScript>.startFrame Integer Default: 0f
<MoFlowScript>.snippets Array Default: #() -- Read-only
Array of MoFlowSnippet values defined in the motion flow script
<MoFlowScript>.name String Default: Varies
<MoFlowScript>.startPos Point3 Default: [0,0,0]
<MoFlowScript>.startRot Float Default: 0
MoFlowScript : MaxWrapper 1755
Methods:
addSnippet < MoFlowScript > < MoFlowSnippet >
Adds the specified MoFlowSnippet to a motion flow script. Returns the MoFlowSnippet
value.
insertSnippet < MoFlowScript > < MoFlowSnippet > <index_integer>
Inserts the snippet at the location specified and returns the new script item. Returns the
MoFlowSnippet value.
deleteSnippet < MoFlowScript > <index_integer>
Deletes the indexed MoFlowSnippet from the motion flow script.
Related Methods:
deleteScript <moflow> <index_integer>
Deletes the indexed MoFlowScript from the motion flow.
computeAnimation <moflow> [redraw:<true>] [incGlobals:<false>]
Computes the global flow network. This function has to be called to update any changes
made to the motion flow network. redraw:true will redraw the viewports. incGlobals:true
will also include the global motion flow network
NotesC:
Changes to the MoFlowScript property values do not cause an immediate update of the biped.
ComputeAnimation must be called on the MoFlow value to recompute the biped motion.
Constructor:
newSnippet <moflow> <filename> <point2_pos> <redraw:true> <load:true>
Adds a new MoFlowSnippet to the motion flow network, from the given .bip file.
<point2_pos> is the position in windows coordinates where the origin is the top left of the
snippet in the motion flow graph. Redraw :true will redraw the graph window. Load:true
will immediately load the snippet. Returns the new MoFlowSnippet.
Properties:
<MoFlowSnippet>.start Integer Default: 0
The start frame in the snippet file.
<MoFlowSnippet>.end Integer Default: Varies
The end frame in the snippet file.
<MoFlowSnippet>.clipName String Default: Varies
<MoFlowSnippet>.fileName String Default: Varies
<MoFlowSnippet>.pos Point2 Default: Varies
The coordinates of the snippet in the Motion Flow Graph.
<MoFlowSnippet>.active Boolean Default: True
<MoFlowSnippet>.transitions Array Default: #(MoFlowTransition :
[X,X]) – read only
An array of the transitions defined for the snippet (MoFlowTransition values). The
MoFlowTransition values printed show the the from and to MoFlowSnippet names.
<MoFlowSnippet>.randomStartProbability Integer Default: 100
1756 Chapter 21 | character studio 3 MAXScript Extensions
Methods:
addTransition <from_MoFlowSnippet > <to_MoFlowSnippet > <bool_optimize>
Adds a new MoFlowTransition to a motion flow Snippet. The optimize parameter acts as
the “Optimize Selected Transition” in the Motion Flow Editor.
deleteTransition < MoFlowSnippet > <index_integer>
Deletes the indexed MoFlowTransition emanating from the MoFlowSnippet.
deleteTransitionTo <from_MoFlowSnippet > <to_MoFlowSnippet >
Deletes the transition that’s emanating to the specified snippet.
Related Methods:
addSnippet < MoFlowScript > < MoFlowSnippet >
Adds the specified MoFlowSnippet to a motion flow script. Returns the MoFlowSnippet
value.
insertSnippet < MoFlowScript > < MoFlowSnippet > <index_integer>
Inserts a snippet at the location specified and returns the new script item. Returns the
MoFlowSnippet value.
deleteSnippet < MoFlowScript > <index_integer>
Deletes the indexed MoFlowSnippet from the motion flow script.
loadSnippetFiles <moflow>
Loads all of the snippet files whose file names are assigned. This function should be called
whenever new snippets are added.
getSnippetIndex <moflow> <MoFlowSnippet>
Given the snippet, returns its index in the motion flow’s .snippets array.
computeAnimation <moflow> [redraw:<true>] [incGlobals:<false>]
Computes the global flow network. This function has to be called to update any changes
made to the motion flow network. redraw:true will redraw the viewports. incGlobals:true
will also include the global motion flow network
Notes:
Changes to the MoFlowSnippet property values do not cause an immediate update of the biped.
ComputeAnimation must be called on the MoFlow value to recompute the biped motion.
MoFlowTranInfo : MaxWrapper
Constructor:
addTranInfo < MoFlowTransition >
Adds a new MoFlowTranInfo to the MoFlowTransition and returns the newly created
MoFlowTranInfo.
Properties:
<MoFlowTranInfo>.length Integer Default: 25
The transition length in frames.
<MoFlowTranInfo>.angle Float Default: 0.0
The direction of the destination clip
MoFlowTranInfo : MaxWrapper 1757
Related Methods:
deleteTranInfo < MoFlowTransition > <index_integer>
Deletes the indexed MoFlowTranInfo from the MoFlowTransition. . If the MoFlowTranInfo
is the only MoFlowTranInfo in MoFlowTransition, it is not deleted.
computeAnimation <moflow> [redraw:<true>] [incGlobals:<false>]
Computes the global flow network. This function has to be called to update any changes
made to the motion flow network. redraw:true will redraw the viewports. incGlobals:true
will also include the global motion flow network
Notes:
Changes to the MoFlowTranInfo property values do not cause an immediate update of the biped.
ComputeAnimation must be called on the MoFlow value to recompute the biped motion.
The following example will find the transition information from the first clip (snippet) to the next
in the first script defined for the Biped motion flow.
Script Example:
CSPATH = “f:\\3dsmax31_86\\cstudio\\“
bipObj = biped.createNew 100 100 [0,0,0]
select bipObj
max motion mode
bip = bipObj.transform.controller
-- get the MoFlow value from the biped controller:
mf=bip.motionFlow
-- go into motion flow mode and load a motion flow file
bip.motionmode=true
loadMoFlowFile mf (CSPATH + “scripts\\4floloop.mfe”)
--
-- get the script of interest from the MoFlow:
mfs=mf.scripts[1]
1758 Chapter 21 | character studio 3 MAXScript Extensions
See also
Biped MAXScript Extensions (p. 1725)
MoFlowTransition : MaxWrapper
Constructor:
addTransition <from_MoFlowSnippet > <to_MoFlowSnippet > <bool_optimize>
Adds a new MoFlowTransition from the from_MoFlowSnippet to the
to_MoFlowSnippet if one doesn’t already exist. The optimize parameter acts as the
“Optimize Selected Transition” in the Motion Flow Editor.
Properties:
<MoFlowTransition>.fromSnippet MoFlowSnippet Default: Varies
Specifies the MoFlowSnippet transitioning from.
<MoFlowTransition>.toSnippet MoFlowSnippet Default: Varies
Specifies the MoFlowSnippet transitioning to.
<MoFlowTransition>.active Boolean Default: True -- Read-only
Specifies whether the MoFlowTransition is active.
<MoFlowTransition>.selected Boolean Default: False
Specifies whether the MoFlowTransition line is selected in the Motion Flow Graph.
<MoFlowTransition>.tranInfos Array Default: #(MoFlowTranInfo :[X,X])
-- Read-only
Array of motion flow transition info blocks (MoFlowTranInfo values). The element of this
array used is determined by the <mfscriptItem>.tranIndex property.
Methods:
addTranInfo < MoFlowTransition >
Adds a new MoFlowTranInfo to the MoFlowTransition and returns the newly created
MoFlowTranInfo.
MoFlowTransition : MaxWrapper 1759
See also
Biped MAXScript Extensions (p. 1725)
Biped Keys
All common MAXScript key functions like deleteKey, selectKeys, moveKeys etc. can be used with
Biped keys. The exceptions addNewKey and deleteKeys are substituted with the following methods.
Method:
biped.addNewKey <biped_controller> <time> [ #select ]
<time> Adds a new key to the controller track at the time specified.
[ #select ] The new key is also selected if the #select optional argument is
specified.
The value for the new key is the interpolated controller value at the specified time. The
value for the new key is the interpolated controller value at that time. The new key is also
selected if the #select optional argument is specified.
addNewKey() will not add a key if a key already exists at the specified time. The return
value is the key located at the specified time.
Method:
biped.deleteKeys <biped_controller> [ #allKeys ] [ #selection ]
[ #allKeys ]
[ #selection ]
Deletes either all keys or all selected keys from the controller. If neither #allKeys or
#selection is specified, all keys are deleted.
1760 Chapter 21 | character studio 3 MAXScript Extensions
Notes:
Returns an instance of BipedKey for Biped body controllers and BipedFSKey for footstep controllers.
BipedKey and BipedFSKey are defined below.
Not all of the Biped elements contain a transform controller. Rather, a controller on an object
typically higher in the hierarchy may store the transform key for an element. For example, the
transforms for all the fingers on a hand are stored in either the Finger0 or Clavicle transform
controller. This depends on whether “Separate Tracks for Arms” is set to true or false, respectively.
The following example will get the first key for each of the subcontrollers of the $Bip01
Vertical_Horizontail_Turn transform controller and show their properties. Additionally, the first key
of the $Bip01 Footstep transform controller will have its properties shown.
Script Example:
bip = $Bip01.transform.controller
-- Obtain the subcontrollers
vertCont = bip.vertical.controller
horzCont = bip.horizontal.controller
turnCont = bip.turning.controller
-- Get the first key for each subcontroller
vk = biped.getKey vertCont 1
hk = biped.getKey horzCont 1
tk = biped.getKey turnCont 1
-- Show the properties for the individual subcontroller key types
showProperties vk
showProperties hk
showProperties tk
-- Obtain the Biped’s Footstep controller
fsCont = $’Bip01 Footsteps’.transform.controller
-- Show the Footstep controller properties
showProperties fsCont
-- Get the first Footstep controller key
fk = biped.getkey fsCont 1
showProperties fk
See also
BipedKey : MAXObject (p. 1761)
BipedKey : MAXObject 1761
BipedKey : MAXObject
All Biped vertical, horizontal, turning, and body keys are represented by this class.
Properties:
<bipedkey>.time Time Default: Varies
Enter a value to specify when in time the key occurs.
<bipedkey>.selected Boolean Default: False
<bipedkey>.tension Float Default: 25.0
Controls the amount of curvature in the animation curve.
High Tension produces a linear curve. It also has a slight Ease To and Ease From effect.
Low Tension produces a very wide, rounded, curve. It also has a slight negative Ease To and
Ease From effect.
<bipedkey>.continuity Float Default: 25.0
Controls the tangential property of the curve at the key. The default setting is the only
value that produces a smooth animation curve through the key. All other values produce a
discontinuity in the animation curve causing an abrupt change in the animation.
<bipedkey>.bias Float Default: 25.0
Controls where the animation curve occurs with respect to the key.
<bipedkey>.easeTo Float Default: 0.0
Slows the velocity of the animation curve as it approaches the key.
High Ease To causes the animation to decelerate as it approaches the key.
The default setting causes no extra deceleration.
<bipedkey>.easeFrom Float Default: 0.0
Slows the velocity of the animation curve as it leaves the key.
High Ease From causes the animation to start slow and accelerate as it leaves the key.
The default setting causes no change of the animation curve.
<bipedkey>.type Name Default: Varies
-- Read-only
Contains #vertical, #horizontal, #turning, or #body based on the key type
There are additional properties based on the type of the key:
-- #vertical
<vertkey>.z Float Default: Varies
Reposition the selected biped part in z.
<vertkey>.dynamicsBlend Float Default: 1.0
Control the amount of gravity in an airborne period, as in a running or jumping motion.
This parameter has no effect on a walking motion where footsteps overlap.
<vertkey>.ballisticTension Float Default: 0.5
Control the amount of spring or tension when the biped lands or takes off from a jump or
run step. The change is subtle.
A walk cycle will not activate this value. The biped has to be airborne, then the Lift and
Touch vertical keys will display a Ballistic Tension value.
1762 Chapter 21 | character studio 3 MAXScript Extensions
-- #horizontal
<horzkey>.x Float Default: Varies
Reposition the selected biped part in x.
<horzkey>.y Float Default: Varies
Reposition the selected biped part in y.
<horzkey>.balanceFactor Float Default: 1.0
Position the biped’s weight anywhere along a line that extends from the center of mass to
the biped’s head. A value of 0 places the biped’s weight at the center of mass. A value of 1
places the biped’s weight above the center of mass. A value of 2 places the biped’s weight
in the head.
-- #body
<bodykey>.ikBlend Float Default: 0.0
Determines how forward kinematics and inverse kinematics are blended to interpolate an
intermediate position.
<bodykey>.ikSpace Integer Default: 0
0 - Body
The biped limb is in biped coordinate space.
1 - Object
The biped limb is either in World coordinate space or the coordinate space of the selected
object. Coordinate space can be blended between keys.
<bodykey>.ikAnkleTension Float Default: 0.0
Adjusts the precedence of the ankle joint over the knee joint. When set to 0, the knee takes
precedence. When set to 1, the ankle takes precedence.
<bodykey>.ikJoinedPivot Boolean Default: True
Put the biped foot in the coordinate space of the previous key.
<bodykey>.ikPivotIndex Integer Default: 1
Index into <bodykey>.ikPivots array of active (selected) pivot
<bodykey>.ikNumPivots Integer Default: Varies – Read only
Number of pivot points in <bodykey>.ikPivots array
<bodykey>.ikPivots Array Deafult: Varies - Array of Point3 values
Array of positions of all the pivot points for the body part
Here is an example:
Script Example:
k = biped.getKey $’bip01 L clavicle’.transform.controller 2
showProperties k
k.ikBlend = .5
k.ikSpace = 0
k.ikAnkleTension = .8
k.ikJoinedPivot = false
k.ikPivotIndex = 8
k.ikNumPivots = 2
k.ikPivots
-- to add a new one
k = biped.addNewKey $’bip01 L clavicle’.transform.controller 10f
BipedFSKey : MAXObject 1763
BipedFSKey : MAXObject
This class represents a Biped footstep in the viewports and trackview.
Properties:
<fskey>.time Time Default: Varies
A value indicating when in time the key occurs.
<fskey>.duration Time Default: Varies
The number of frames in each footstep.
<fskey>.selected Boolean Default: False
<fskey>.edgeSel Integer Default: 0
0 - no edges selected
1 - left edge Selected
2 - right edge selected
3 - both edges Selected
See Also
Biped Controllers (p. 1735)
Biped Footsteps (p. 1745)
Biped Vertical_Horizontal_Turn(Body):Matrix3 Controller (p. 1736)
Biped Keys (p. 1759)
Biped MAXScript Extensions (p. 1725)
-- Footstep Extraction
mocap.fsExtractionTol Float Default: 0.05
Set the sensitivity of footstep extraction. Biped determines if the footstep is there by
checking that the foot does not move beyond the distance determined by the Extraction
Tolerance value. Smaller numbers are more sensitive and extract more footsteps. Value is a
percentage of foot length.
-- range: 0+
-- range: 0+
Set All: Force all tracks to the values set in these fields.
Higher values here can determine how much key reduction is possible while preserving the
original motion.
Filter: Clear to prevent filtering of the motion capture data into a track. If this is cleared, there
will be no key reduction for the track.
mocap.allTol Float Default: 0.0
-- range: 0+
-- range: 0+
-- range: 0+
-- range: 0+
-- range: 0+
-- range: 0+
-- range: 0+
-- range: 0+
-- range: 0+
BipedFSKey : MAXObject 1767
-- range: 0+
-- range: 0+
-- range: 0+
-- range: 0+
-- range: 0+
-- range: 0+
-- range: 0+
-- range: 0+
-- range: 0+
-- range: 0+
1768 Chapter 21 | character studio 3 MAXScript Extensions
-- range: 0+
-- range: 0+
-- range: 0+
-- range: 0+
-- range: 0+
-- Limb orientation
Angle: Move the knee or Elbow position to create the biped joint key.
Point: Rotate the shoulder-elbow-wrist or hip-knee-ankle to create the biped joint key.
Auto: Auto reads exact hand and foot positions from the motion capture data, character studio
then places the knees and elbows in a natural position. For marker files involving running and
walking, this option can clean up the data nearly instantly, regardless of how many markers
were used (and where they were placed).
mocap.kneeOrient Integer Default: 0
0 - angle
1 - point
2 - auto
The biped knee hinge joints are perpendicular to the triangles formed by the hip-knee-
ankle. Resolve errors in the motion capture data that break this rule by using either the
angle or point method.
BipedFSKey : MAXObject 1769
0 - angle
1 - point
2 - auto
The biped elbow hinge joints are perpendicular to the triangles formed by the shoulder-
elbow-wrist. Resolve errors in the motion capture data that break this rule by using either
the angle or point method.
mocap.footOrient Integer Default: 0
0 - angle
1 - auto
The biped foot hinge joints are perpendicular to the triangles formed by the hip-knee-
ankle respectively. Resolve errors in the motion capture data that break this rule by using
either the angle or point method.
mocap.handOrient Integer Default: 0
0 - angle
1 - auto
The biped hand hinge joints are perpendicular to the triangles formed by the shoulder-
elbow-wrist. Resolve errors in the motion capture data that break this rule by using either
the angle or point method.
-- Talent Definition
mocap.talentFigStrucFile String Default: ““ -- figure
structure file (.fig)
A .fig file containing changes made to the biped scale while in Talent Figure mode.
mocap.useTalentFigStrucFile Boolean Default: False
Turn on useTalentFigStrucFile to use the file whose string is defined in
mocap.talentFigStrucFile.
mocap.talentPoseAdjFile String Default: ““ -- pose
adjustment file (.cal)
A .cal file containing changes made to the biped while in Adjust Talent Pose mode.
mocap.useTalentPoseAdjFile Boolean Default: False
Turn on useTalentPoseAdjFile to use the file whose string is defined in mocap.
talentPoseAdjFile.
1770 Chapter 21 | character studio 3 MAXScript Extensions
Crowds
Crowd : helper
Constructor:
crowd ...
Properties:
<crowd>.simStart Integer Default: 0
The first frame of the simulation.
<crowd>.solveStart Integer Default: 0
The frame at which you begin solving.
<crowd>.solveEnd Integer Default: 100
Specifies the last frame considered for the solution.
<Crowd>.deleteKeys Boolean Default: False
When true, Crowd deletes the keys of active delegates in the range over which the solution
takes place.
<Crowd>.saveNthPos Integer Default: 1
Saves every nth position frame after the solution.
<Crowd>.saveNthRot Integer Default: 1
Saves every nth rotation frame after the solution.
<Crowd>.flashing Boolean Default: True Alias:
Hilite_Delegates_During_Assignments
<crowd>.vectorScale Float Default: 1.0
Globally scales all force and velocity vectors that are displayed during the simulation.
Scaling vectors up helps to see them better when they are very small. It does not effect the
simulation.
<Crowd>.useScript Boolean Default: False
When true, Crowd executes a script at each frame of the solution.
<Crowd>.functionName String Default: “PerFrameFn” Alias:
Script_Context_Name
The name of the function to be executed. This name must also be specified in the script.
<Crowd>.script String Default: Undefined
<crowd>.update Boolean Default: True Alias:
Update_Display_During_Solve
When true, motion produced during solution of a crowd simulation appears in the
viewports.
<Crowd>.updateFrequency Integer Default: 1
How often the display is updated during the solution. If 1, the update occurs every frame.
If 2, the update occurs every other frame, and so on.
1772 Chapter 21 | character studio 3 MAXScript Extensions
See Also
Biped and Crowd Interaction (p. 1734)
Delegate : Helper
The Delegate helper object is a special pyramidal object used in crowd animation. By default, the
point of the pyramid indicates the forward direction.
The Crowd object controls the delegate or delegates, whose motion can then be imparted to a biped
or other object.
Constructor:
Delegate ...
CrowdDelegate ...
Properties:
<Delegate>.width Float Default: 0.0 -- world units
The width of the Delegate object.
<Delegate>.depth Float Default: 0.0 -- world units
The depth of the Delegate object.
<Delegate>.height Float Default: 0.0 -- world units
The height of the Delegate object.
<Delegate>.velocityColor Color Default: (color 0 0 0)
When showVelocity is true, uses the specified color to draw a vector in the delegate’s
center during the simulation solution. The vector length indicates the delegate’s relative
speed.
<Delegate>.active Boolean Default: True
The delegate object is subject to control by a Crowd object.
<Delegate>.showForces Boolean Default: True
The forces being applied to a delegate by any applicable behaviors are drawn as vectors
whose length indicate the extent of the forces. For example, if the delegate is affected by a
Space Warp behavior and a Wander behavior, the vectors (using default colors) are yellow
and blue-green, respectively. These vectors are visible only during solution of the crowd
simulation.
1774 Chapter 21 | character studio 3 MAXScript Extensions
See Also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
CrowdScatter:
These properties correspond to the Scatter Objects dialog displayed by clicking the Scatter
Objects icon.
Clone Tab Properties:
<crowd.scatter>.cloneObject Node Default: Undefined
Object in the scene to be cloned.
<crowd.scatter>.numClones Integer Default: 10
The number of clones to be generated.
<crowd.scatter>.cloneType Integer Default: 0 Alias
(0_copy__1_reference__2_instance)
0 - copy
1 - Instance
2 - Reference
Specify how the object is cloned. It can be cloned as a copy, an instance, or a reference.
CrowdScatter: 1779
Smooth Properties:
These properties correspond to the Smoothing dialog displayed by clicking the Smooth Paths button
in the Solve rollout.
<Crowd.smooth>.objects ArrayParameter Default: #() -- node array;
Alias: Objects_to_Smooth
Specify which objects’ positions and/or rotations to smooth.
<Crowd.smooth>.filterDelegates Boolean Default: True Alias:
Filter_Delegate_Selection
When true, the Select dialog opened by the Select Objects to Smooth button shows only
delegates. When off, it shows all scene objects.
<Crowd.smooth>.wholeAnim Integer Default: 0
0 - Whole Animation: Smoothes all animation frames.
1 - Animation Segment: Smoothes only the frame ranges specified in the From and
To fields.
<Crowd.smooth>.from Integer Default: 0 Alias:
smooth_from_frame
When Animation Segment is chosen, specifies the first animation frame for smoothing.
<Crowd.smooth>.to Integer Default: 0 Alias:
smooth_to_frame
When Animation Segment is chosen, specifies the last animation frame for smoothing.
<Crowd.smooth>.positions Boolean Default: True Alias:
Smooth_positions
When true, selected objects’ animation paths generated via the simulation are smoothed
after the simulation has finished.
<Crowd.smooth>.rotations Boolean Default: True Alias:
Smooth_rotations
When true, selected objects’ rotations generated via the simulation are smoothed after the
simulation has finished.
CrowdAssignment : MAXObject
Constructor:
CrowdAssignment ...
Properties:
<crowdassignment>.team CrowdTeam Default: Undefined
A named group of delegates.
<crowdassignment>.delegate Node Default: Undefined
A delegate object. See the CrowdDelegate : Helper (p. 1773) topic.
<crowdassignment>.behavior MAXObject Default: Undefined
One of the Crowd Behavior (p. 1792) classes.
CrowdTeam : ReferenceTarget 1785
See also
CrowdTeam : MAXObject (p. 1785)
Crowd Behaviors (p. 1792)
CogControl : MAXObject (p. 1791)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
CrowdTeam : ReferenceTarget
Constructor:
CrowdTeam ...
CrowdGroup ...
Properties:
<crowdteam>.name String Default: “CrowdTeam”
The default team name is Team followed by number one more than the last added team.
<crowdteam>.members ArrayParameter Default: #() -- array
of Delegate nodes
Participants of the current team.
1786 Chapter 21 | character studio 3 MAXScript Extensions
Notes:
You can perform the following MAXScript operations
deleteitem <array> <itemnumber>
<array> = #(item,item...)
<array> = append <array> <item>
on all of the properties containing an ArrayParamater of objects listed below. You can also
undo/redo these operations.
<CrowdTeam>.members -- array of Delegate nodes
Notes:
The following MAXScript operations will cause Crowd to fail, either right away or later:
NEVER set a Members ArrayParameter element to undefined.
Assigning a non-Delegate node to the Members ArrayParameter.
See also
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
CrowdState:ReferenceTarget
Constructor:
CrowdState ...
Properties:
<crowdstate>.name String Default: “State”
The name of the state.
<crowdstate>.behaviors ArrayParameter Default: #() -- array of
behaviors
See Notes below.
The names of all behaviors associated with the state.
<crowdstate>.weights ArrayParameter Default: #() -- array of floats
See Notes below.
Specifies the selected behavior’s weight. The higher the weight in relation to other
behaviors’ weights, the more evident the results of the behavior in the state. Default=1.0.
Range=0.0 to 1.0.
<crowdstate>.transitions ArrayParameter Default: #() -- array of
CrowdTransition objects
See Notes below.
Notes:
You can perform the following MAXScript operations:
deleteitem <array> <itemnumber>
<array> = #(item,item...)
CrowdTransition : MAXObject 1787
The following MAXScript operations will cause Crowd to fail, either right away or later:
NEVER set Behavior ArrayParameter element to undefined.
NEVER set a Behavior ArrayParameter element to anything other than an object of the
appropriate type.
See Also
Crowd Behaviors (p. 1792)
CrowdTransition : MAXObject (p. 1787)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
CrowdTransition : MAXObject
Constructor:
CrowdTransition ...
Transition ...
Properties:
<crowdtransition>.priority Integer Default: 0
Sets the transition’s priority.
<crowdtransition>.duration Integer Default: 25
The number of frames the software takes to affect the transition between states.
<crowdtransition>.easeIn Float Default: 0.5
Ease in value for the source clip.
<crowdtransition>.easeOut Float Default: 0.5
Ease out value for the destination clip.
<crowdtransition>.functionName String Default: “transFunc” Alias:
Script_Context_Name
The name of the MAXScript conditional that specifies when/how the transition is to occur.
<crowdtransition>.script String Default: Undefined
<crowdtransition>.from CrowdState Default: Undefined Alias:
FromState
The state that the transition originated from.
1788 Chapter 21 | character studio 3 MAXScript Extensions
where del is the delegate node, trans is the CrowdTransition value, and t is the time value
of the frame being evaluated. The 3ds max time context will also be frame being
evaluated. The return value must be an integer value. If the return value is 0, the transition
is not taken. For any other return value, the transition is taken.
The <CrowdTransition>.script is not evaluated for a delegate while the delegate is in
transition between states.
The following MAXScript operations will cause Crowd to fail, either right away or later:
NEVER set the from or to properties to undefined.
NEVER set the from or to properties to anything other than a CrowdState object.
See also
CrowdState : MAXObject (p. 1786)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Crowds - Methods
crowds.solve <crowd_node>
Equivalent to clicking Solve in the crowd’s Solve rollout. .solve starts the solving, based on
all other current crowd parameter settings.
crowds.genclones <crowd_node>
Equivalent to clicking Generate Clones in the Scatter Objects dialog, Clone tab, displayed
by clicking the Scatter Objects icon. Generates clones based on all other current crowd
parameter settings.
crowds.genlocations <crowd_node>
Equivalent to clicking Generate Locations in the Scatter Objects dialog, Position tab,
displayed by clicking the Scatter Objects icon. Generates locations based on all other
current crowd parameter settings.
Crowds - Methods 1789
crowds.genrotations <crowd_node>
Equivalent to clicking Generate Orientations in the Scatter Objects dialog, Rotation tab,
displayed by clicking the Scatter Objects icon. Generates rotations based on all other
current crowd parameter settings.
crowds.genscales <crowd_node>
Equivalent to clicking Generate Scales in the Scatter Objects dialog, Scale tab, displayed by
clicking the Scatter Objects icon. Generates scales based on all other current crowd
parameter settings.
crowds.scatterall <crowd_node>
Equivalent to clicking Scatter button in the Scatter Objects dialog, All Ops tab. Scatters
objects based on all other current crowd parameter settings.
crowds.alignObjects <crowd_node>
Equivalent to clicking Align Objects with Delegates in the Object/Delegates dialog
displayed by clicking the Associate Objects with Delegates icon. Aligns objects based on all
other current crowd parameter settings.
crowds.linkObjects <crowd_node>
Equivalent to clicking Link Objects to Delegates in the Object/Delegates dialog displayed
by clicking the Associate Objects with Delegates icon. Links objects based on all other
current crowd parameter settings.
crowds.assignControllers <crowd_node>
Equivalent to clicking Assign Delegate Controllers to Objects in the Object/Delegates
dialog displayed by clicking the Associate Objects with Delegates icon. Assigns controllers
based on all other current crowd parameter settings.
crowds.smooth <crowd_node>
Equivalent to clicking OK in the Smoothing dialog displayed by clicking the Smooth Paths
button in the Solve rollout. Smooths objects motions based on all other current crowd
parameter settings.
crowds.assignGridProximityPriorities <crowd_node>
Equivalent to clicking Proximity to a Grid/Assign in the Priority rollout. Assigns priorities
to the delegates specified in <Crowd.priority>.delegates based on their distance from the
grid specified in <Crowd.priority>.grid.
crowds.assignObjectProximityPriorities <crowd_node>
Equivalent to clicking Proximity to an Object/Assign in the Priority rollout. Assigns
priorities to the delegates specified in <Crowd.priority>.delegates based on their distance
from the object specified in <Crowd.priority>.object.
crowds.assignRandomPriorities <crowd_node>
Equivalent to clicking Assign Random Priorities in the Priority rollout. Assigns random
priorities to the delegates specified in <Crowd.priority>.delegates.
crowds.assignUniquePriorities <crowd_node>
Equivalent to clicking Make Priorities Unique in the Priority rollout. Ensures that the
priorities of the delegates specified in <Crowd.priority>.delegates are unique. If two
delegates share the same priority, one of them will be given a new priority.
1790 Chapter 21 | character studio 3 MAXScript Extensions
crowds.incrementPriorities <crowd_node>
Equivalent to clicking Increment Priorities in the Priority rollout. Increments the priorities
of the delegates specified in <Crowd.priority>.delegates by the value in
<Crowd.priority>.increment.
Notes - MAXScript Group:
The MAXScript group of the Solve Rollout has a feature to control the execution of a MAXScript
script at each frame.
Use MAXScript: When on, a user-specified script is executed at each frame during the
solution. Default=off.
Function Name: The name of the function to be executed. This name must be identical to
the one specified in the script.
Edit MAXScript: Click this button to open a MAXScript window for displaying and
modifying the script.
The crowd function needs two parameters defined. The 1st parameter passed in is the current
crowd and the 2nd parameter passed in is the solve frame.
Here is simple example:
fn g_PerFrameFn current_crowd the_frame_time =
(
if the_frame_time == 1f then
(_g_mydebugwindow = newScript()
format “% %\n” current_crowd the_frame_time to:_g_mydebugwindow
)
)
Notes:
You can perform the following MAXScript operations:
deleteitem <array> <itemnumber>
<array> = #(item,item...)
<array> = append <array> <item>
on all of the properties containing an ArrayParamater of objects listed below. You can also
undo/redo these operations.
<Crowd>.behaviors -- array of Behavior objects
<Crowd>.teams -- array of CrowdTeam objects
<Crowd>.assignments -- array of Assignment objects
<Crowd>.cogcontrols -- array of CognotiveController objects
<Crowd.scatter>.ObjectsToScatter -- node array
<Crowd.objAssoc>.objects -- node array
<Crowd.objAssoc>.delegates -- node array
<Crowd.smooth>.objects -- node array
The following MAXScript operations will cause Crowd to fail, either right away or later:
NEVER set a Crowd ArrayParameter element to undefined.
NEVER set a Crowd ArrayParameter element to to anything other than an object of the
appropriate type.
CogControl : MAXObject
Constructor:
CogControl ...
Properties:
<cogcontrol>.name String Default: “ CognitiveControl”
The name of the state diagram.
<cogcontrol>.startState CrowdState Default: Undefined
Set the starting CrowdState (p. 1786). By default the state that executes first in a cognitive
controller is the one that was added first.
<cogcontrol>.states ArrayParameter Default: #() -- array of
CrowdState objects
All of the states used by this cognitive controller.
Notes:
You can perform the following MAXScript operations
deleteitem <array> <itemnumber>
<array> = #(item,item...)
<array> = append <array> <item>
on all of the properties containing an ArrayParamater of objects listed below. You can also
undo/redo these operations.
<CogControl>.states -- array of CrowdState objects
See also
CrowdState:MAXObject (p. 1786)
CrowdAssignment : MAXObject (p. 1784)
CrowdTeam : MAXObject (p. 1785)
CogControl : MAXObject (p. 1791)
1792 Chapter 21 | character studio 3 MAXScript Extensions
See Also
Crowd : helper (p. 1771)
Crowd Behaviors
Avoid_Behavior : MAXObject (p. 1793)
Orientation_Behavior : MAXObject (p. 1794)
Path_Follow_Behavior : MAXObject (p. 1796)
Repel_Behavior : MAXObject (p. 1798)
Scripted_Behavior : MAXObject (p. 1799)
Seek_Behavior : MAXObject (p. 1807)
Space_Warp_Behavior: MAXObject (p. 1809)
Speed_Vary_Behavior : MAXObject (p. 1809)
Surface_Arrive_Behavior : MAXObject (p. 1811)
Surface_Follow_Behavior : MAXObject (p. 1814)
Wall_Repel_Behavior : MAXObject (p. 1816)
Wall_Seek_Behavior : MAXObject (p. 1817)
Wander_Behavior : MAXObject (p. 1819)
Avoid_Behavior : MAXObject 1793
Avoid_Behavior : MAXObject
Constructor:
Avoid_Behavior ...
AvoidBehavior ...
Properties:
<Avoid_behavior>.name String Default: “Avoid”
The following MAXScript operations will cause Crowd to fail, either right away or later:
NEVER set a Crowd/Behavior ArrayParameter element to undefined.
See also
Crowd : Helper (p. 1771)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Orientation_Behavior : MAXObject
Constructor:
Orientation_Behavior ...
OrientationBehavior ...
Properties:
<orientation_behavior>.name String Default: “Orientation”
The minimum number of degrees a delegate can incline or decline. This number should be
lower than the Max Pitch value. Range=-180 to 180.
<orientation_behavior>.maxpitch Float Default: 180.0 Alias: PitchMax
– animatable
The maximum number of degrees a delegate can incline or decline. This number should be
higher than the Min Pitch value. Range=-180 to 180.
<orientation_behavior>.maxpitchVel Float Default: 1.0 Alias:
maxPitchVelocity – animatable
Specifies how much the delegate’s pitch can change per frame. This controls angular
acceleration and deceleration.
<orientation_behavior>.pitchresponse Float Default: 1.0 – animatable
Determines how quickly the pitch follows the direction the object is moving in. A value of
1.0 indicates maximum responsiveness while a lower value means that it is less responsive.
Range=0 to 1.
<orientation_behavior>.maxbank Float Default: 30.0 – animatable
The maximum number of degrees the delegate can bank.
<orientation_behavior>.maxbankAccel Float Default: 3.0 Alias:
MaxBank_Change – animatable
The maximum number of degrees the delegate’s bank angle can change per frame. This
controls angular acceleration and deceleration.
<orientation_behavior>.bankPerTurn Float Default: 1.0 – animatable
The number of degrees the delegate will bank as a function of the turn angle at the current
frame. For example, if Bank per Turn=1, the delegate will bank one degree for every degree
it is turning at a given frame.
1796 Chapter 21 | character studio 3 MAXScript Extensions
Notes:
If this behavior is active, it controls the orientation of the delegate by allowing the animator to
specify limits and responsiveness on the pitch and heading of the object.
The animator can limit the min and max values, the rate, and can also set a ‘response’ value which
controls how quickly the pitch or heading follows the direction the object is moving in. A value
of 1.0 means it’s responsive, and will point in the direction the delegate is moving (within the
limits), while a lower value means that it is less responsive. It also calculates the roll, which is done
using the same parameters that the default behavior does.
See also
Crowd : Helper (p. 1771)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Path_Follow_Behavior : MAXObject
Constructor:
Path_Follow_Behavior ...
PathFollowBehavior ...
Properties:
<path_follow_behavior>.name String Default: “Path Follow”
See also
Crowd : Helper (p. 1771)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Repel_Behavior : MAXObject
Constructor:
Repel_Behavior ...
RepelBehavior ...
Properties:
<Repel_Behavior>.name String Default: “Repel”
The following MAXScript operations will cause Crowd to fail, either right away or later:
NEVER set a Crowd/Behavior ArrayParameter element to undefined.
See Also
Crowd : Helper (p. 1771)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Scripted_Behavior : MAXObject
Introduction to the Crowd System
The crowd system works by assembling all of the force vectors (p. 1677) and speeds for a delegate from
its active force behaviors. Then based upon the delegate’s motion parameters, these force vectors
(p. 1677) and speeds are averaged and integrated to create a velocity for the delegate. This velocity
may then be modified if the delegate has an active constraint behavior or if it has an active default
Avoidance behavior.
After the velocity is set, if there is an active orientation behavior, it is used to set the orientation of
the delegate, otherwise the orientation is calculated from the default delegate parameters. Finally,
the velocity is integrated and a new position is calculated.
The new position of the delegate isn’t set until after all of the forces are calculated for all of the
behaviors.
For a biped crowd, bipeds work off of goals and not forces when determining which direction they
should go in. So, in order to create a force behavior that will work with a Biped, a goal position must
be specified. No forces need to be integrated into velocities because the movement of the Biped isn’t
based upon calculating velocities but rather by selecting clips found in the motion flow graph.
1800 Chapter 21 | character studio 3 MAXScript Extensions
Constructor:
Scripted_Behavior ...
ScriptedBehavior ...
Properties:
<scripted_behavior>.name String Default: “Scripted”
Edit MaxScript:
This button “Edit MaxScript”, in the Scripted Behavior Rollout, opens a MAXScript editor window
that can be used to enter a scripted behavior script. The editor window is similar to other MaxScript
editor window but is slightly customized for scripted behaviors.
Called every time the crowd system is redrawn. You can use the low level drawing
functions from the gw struct, Viewport Drawing Methods (p. 1592), to have a custom display
for the behaviors.
Note:
This handler gets called a number of times, so the system will slow down if implemented.
on behaviorStarted <delegate> <behavior> <time> do <expr>
For example, a value of 5, (1+4), indicates that the force and speed are affected.
<point3_force> the force vector (p. 1677). It should be unit normalized and
then multiplied by the delegate’s average speed. Modify this value, greater
or less, to make the force stronger or weaker.
Notes:
Any behavior that sets the <int_flags> with a speed affected setting should ensure that a valid value
is set for <float_speed> and <Speed_Weight_at_the_Goal>. Note that a goal doesn’t need to be set for
this to work. This is how the ‘SpeedVary’ behavior works with Biped. It doesn’t explicitly set a goal
but still modifies the <Speed_Weight_at_the_Goal> value.
on constraint <delegate> <behavior> <time> <numSubSamples> <displayHelpers>
<finalSet> <velocity> <speed> <pos> do <expr>
Note:
In order to handle constraints working correctly within the avoidance system the constraint
behavior may be called more than once per frame. When the passed in parameter, finalSet, is true,
it will be the last time the constraint function is called for that frame.
Currently the constraint behavior’s “on constraint” event handler is called twice per frame. The first
call occurs before an existing Avoid_Behavior with the passed in parameter finalSet having a value
of false. The second call occurs, after the delegate’s limits and Avoid_Behavior are applied with the
passed in parameter finalSet having a value of true. This evaluation order is done so that the
delegate’s limits and the Avoid_Behavior can affect the changes that the constraint performs. The
second call is made to make sure that the constraint is still being met.
One reason to check the state of finalSet is if internally something was cached and you didn’t want
it to change. For example, the Surface_Follow constraint behavior keeps track of which triangle it’s
on and the barycentric coordinates of where it’s at. The simulation will not change these values until
finalSet is true.
<velocity> the current velocity of the delegate at this frame.
<speed> the current speed of the delegate at this frame.
<pos> the current position of the delegate at this frame.
Note:
After the last delegate’s “on constraint” has executed for the last frame of the simulation, “on
setupDelegates delegates behavior do” will be called with an empty array “#()
ReferenceTarget:Scripted_Behavior”. This is guarenteed and can be used by written constraint
behaviors to clear out any internal caches.
The event handler should return an array of the following type:
#(<int_flags>, <point3_velocity>, <point3_pos>, <point3_goal>,
<float_speed>)
Notes:
The purpose of passing the crowd delegate and behavior to all of the event handlers is that you can
call persisted global, saved with scene, MAXScript functions that work for more than one crowd
simulation.
Example:
The following is a pair of scripted behaviors called “FormationConstraint” and
“FormationOrientation”.
The “FormationOrientation” will constrain the orientation to a fixed location, in this case based on
the current delegate’s orientation found at its first rotation keyframe. The entire scripted orientation
behavior can be implemented with one event handler:
on orient delegate behavior time vel do
(
#(1,delegate.rotation.keys[1].value as quat )
)
See Also
Delegate:Helper (p. 1773)
Crowd : Helper (p. 1771)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
value_common_properties_operators_and_methods
Seek_Behavior : MAXObject
Constructor:
Seek_Behavior ...
SeekBehavior ...
Properties:
<seek_behavior>.name String Default: “Seek”
Notes:
You can perform the following MAXScript operations:
deleteitem <array> <itemnumber>
<array> = #(item,item...)
<array> = append <array> <item>
on all of the properties containing an ArrayParamater of objects listed below. You can also
undo/redo these operations.
<Seek_Behavior>.targets
The following MAXScript operations will cause Crowd to fail, either right away or later:
NEVER set a Crowd/Behavior ArrayParameter element to undefined.
Space_Warp_Behavior: MAXObject 1809
See Also
Crowd : Helper (p. 1771)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Space_Warp_Behavior: MAXObject
Constructor:
Space_Warp_Behavior ...
WSMBehavior ...
Properties:
<space_warp_behavior>.name String Default: “Space Warp”
<space_warp_behavior>.spaceWarp Node Default: Undefined
See also
Crowd : Helper (p. 1771)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Speed_Vary_Behavior : MAXObject
Constructor:
Speed_Vary_Behavior ...
SpeedVaryBehavior ...
Properties:
<speed_vary_behavior>.name String Default: “Speed Vary”
See also
Crowd : Helper (p. 1771)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Surface_Arrive_Behavior : MAXObject 1811
Surface_Arrive_Behavior : MAXObject
Constructor:
Surface_Arrive_Behavior ...
SurfaceArriveBehavior ...
Properties:
<Surface_Arrive_Behavior>.name String Default: “Surface Arrive”
Select a Crowd helper. > Modify panel > Global Clip Controllers rollout > New >
Choose GlobalClip object. > Select object in list. > Edit > Synthesis dialog >
State Tab > New State > Edit Properties > Clip State dialog
Create panel > Helpers > Object Type rollout > Crowd > Setup rollout > Cognitive
Controllers
Select a Crowd object. > Modify panel > Setup rollout > Cognitive Controllers
Notes:
You can perform the following MAXScript operations:
deleteitem <array> <itemnumber>
<array> = #(item,item...)
<array> = append <array> <item>
on all of the properties containing an ArrayParamater of objects listed below. You can also
undo/redo these operations.
<Surface_Arrive_Behavior>.surfaces
The following MAXScript operations will cause Crowd to fail, either right away or later:
NEVER set a Crowd/Behavior ArrayParameter element to undefined.
See Also
Crowd : Helper (p. 1771)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Surface_Follow_Behavior : MAXObject
Constructor:
Surface_Follow_Behavior ...
SurfaceFollowBehavior ...
Properties:
<Surface_Follow_Behavior>.name String Default: “Surface Follow”
Notes:
If the delegate starts out away from the surface to be followed then the target is most visible before
the delegate reaches the surface where the target is positioned along the surface edge.
While the delegate is actually following the surface, the target is usually coincident with the delegate
because Surface follow sets a new destination only a frame or two ahead.
<space_warp_behavior>.targetScale Float Default: 5.0
Specifies the overall size of the target icon.
<Surface_Follow_Behavior>.offset Float Default: 0.0 -- animatable
Specifies the delegate’s distance above the surface, using the surface normal.
<Surface_Follow_Behavior>.displayOffset Boolean Default: False
When true, shows the .offset distance as lines emanating from each vertex in the surface
object, perpendicular to the surface.
Notes:
You can perform the following MAXScript operations:
deleteitem <array> <itemnumber>
<array> = #(item,item...)
<array> = append <array> <item>
on all of the properties containing an ArrayParamater of objects listed below. You can also
undo/redo these operations.
<Surface_Follow_Behavior>.surfaces
The following MAXScript operations will cause Crowd to fail, either right away or later:
NEVER set a Crowd/Behavior ArrayParameter element to undefined.
See also
Crowd : Helper (p. 1771)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
1816 Chapter 21 | character studio 3 MAXScript Extensions
Wall_Repel_Behavior : MAXObject
Constructor:
Wall_Repel_Behavior ...
WallRepelBehavior ...
Properties:
<Wall_Repel_Behavior>.name String Default: “Wall Repel”
<Wall_Repel_Behavior>.repelGrids ArrayParameter Default: #() -- node array
Set the repelling grid.
<Wall_Repel_Behavior>.repelMethod Integer Default: 0 -- animatable
Determines whether delegate direction as influenced by the behavior is calculated by an
angular method or a force method.
0 – Angle: Applies a force to the delegate based on the angle between the delegate’s current
direction and the direction it would need to take in order to be moving directly away from
the source. If the behavior’s Weight is set to 1 the delegate will be given a force that points
directly away from the source. If Weight is set to .5, the force will bisect the angle between
its current direction and the direction opposite that of the source.
1 – Force: Always applies a force directly away from the source, but at different
magnitudes. If the behavior’s Weight is 1, the magnitude of the force will be the average
speed. If the Weight is .5, the magnitude of the force will be half the average speed.
<Wall_Repel_Behavior>.repelDirection Integer Default: 0 -- animatable
Determines whether the grid repels from its positive-axis side, its negative-axis side,
or both.
0 – Positive Axis: The grid repels only from the positive-axis side.
1 – Negative Axis: The grid repels only from the negative-axis side.
2 – Both Axes: The grid repels from both sides.
<Wall_Repel_Behavior>.useDistance Boolean Default: True
When true, the behavior applies only to delegates closer to the target than the
outerRadius value.
<Wall_Repel_Behavior>.innerDistance Float Default: 0.0 -- animatable
The distance from the target at which the force is applied at full strength.
<Wall_Repel_Behavior>.outerDistance Float Default: 10.0 -- animatable
The distance from the target at which the force begins to be applied.
<Wall_Repel_Behavior>.falloff Float Default: 2.0 -- animatable
See also
Crowd : Helper (p. 1771)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Wall_Seek_Behavior : MAXObject
Constructor:
Wall_Seek_Behavior ...
WallSeekBehavior ...
Properties:
<Wall_Seek_Behavior>.name String Default: “Wall Seek”
See also
Crowd : Helper (p. 1771)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Wander_Behavior : MAXObject 1819
Wander_Behavior : MAXObject
Constructor:
Wander_Behavior ...
WanderBehavior ...
Properties:
<wander_behavior>.name String Default: “Wander”
See Also
Crowd : Helper (p. 1771)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
SpaceWarps
Vector_Field: SpacewarpObject
Constructor:
Vector_Field ...
VectorField ...
Properties:
<Vector_Field>.Length Float Default: 0.0 -- world units
Specify the length dimension of the vector field lattice. The lattice should be larger than
the vector field object.
<Vector_Field>.Width Float Default: 0.0 -- world units
Specify the width dimension of the vector field lattice. The lattice should be larger than
the vector field object.
<Vector_Field>.Height Float Default: 0.0 -- world units
Specify the height dimension of the vector field lattice. The lattice should be larger than
the vector field object.
<Vector_Field>.LenSegs Integer Default: 1 Alias:
Length_Segments
Specify the resolution of the vector field lattice’s length segments. The greater the
resolution, the higher the accuracy of the simulation.
<Vector_Field>.WidSegs Integer Default: 1 Alias:
Width_Segments
Specify the resolution of the vector field lattice’s width segments. The greater the
resolution, the higher the accuracy of the simulation.
<Vector_Field>.HgtSegs Integer Default: 1 Alias:
Height_Segments
Specify the resolution of the vector field lattice’s height segments. The greater the
resolution, the higher the accuracy of the simulation.
<Vector_Field>.showLattice Boolean Default: True
Set on to display the vector field lattice as a yellow wireframe box. The vectors are
generated at lattice intersections inside the vector field range.
<Vector_Field>.showRange Boolean Default: True
Set on to display the volume about the obstacle object within which vectors are generated
as an olive-colored wireframe.
<Vector_Field>.showVectors Boolean Default: False
Set on to display vectors, which appear as blue lines emanating outward from the lattice
intersections within the range volume.
<Vector_Field>.showSurfSamps Boolean Default: False
Set on to display short green lines emanating from sample points on the surface of the
obstacle object.
1822 Chapter 21 | character studio 3 MAXScript Extensions
Notes:
In crowd simulations, the Range outline is where the delegates start to “see” the obstacle object, and
begin to turn to avoid it. If your crowd members are penetrating the obstacle, or even just coming
too close to it before turning, increase the Range setting. Also try increasing the Vector Field lattice
resolution and/or the Sample Res setting.
<Vector_Field>.resolution Integer Default: 1
Acts as a multiplier of the effective sampling rate used on the obstacle object’s surface to
calculate vector directions in the field. The basic sampling rate is determined by the
program from the size of the lattice and the size of each polygon.
<Vector_Field>.flipFaces Boolean Default: False
Setting to true causes flipped normals to be used during the computation of the vector
field. By default, vectors are generated in the same direction as the obstacle object’s face
normals, so that assuming its face normals point outward, objects move around its exterior
in a crowd simulation. However, if you want objects to remain within an object’s interior,
turn on flipFaces.
<Vector_Field>.blendStart Float Default: 0.0 -- world units
The distance from the object at which blending the vectors starts.
<Vector_Field>.blendFalloff Float Default: 2.0 -- world units
The falloff of the blend of the surrounding vectors.
<Vector_Field>.blendWidSegs Integer Default: 1
The number of adjacent lattice points to blend on the X axis.
<Vector_Field>.blendLenSegs Integer Default: 1
The number of adjacent lattice points to blend on the Y axis.
<Vector_Field>.blendHgtSegs Integer Default: 1
The number of adjacent lattice points to blend on the Z axis.
Methods:
vfields.computeVectors <Vector_Field>
Calculates the vector field using the current Vector Field parameters. Always recalculate
the vector field after changing any of the non-display related parameters.
vfields.BlendVectors <Vector_Field>
Blends the vectors for reducing abrupt changes in angles of neighboring vectors.
Associated Methods:
bindSpaceWarp <node> <Vector_Field_node>
See Also
Node Common Properties, Operators, and Methods (p. 820)
MAXWrapper Common Properties, Operators, and Methods (p. 809)
Value Common Properties, Operators, and Methods (p. 714)
Chapter 22: CS3Tools.cui Tutorial
The CS3Tools Custom User Interface implements several very useful tools. This tutorial will
concentrate on the Custom Keys Utility, a custom keys mechanism that gives one-touch access to 6
key frame settings that you use most when animating a Biped. The Custom Keys Utility uses 13 icon
buttons. The first 6 are “Set custom Biped Keys”. The next 6 are “Change Preset to current key”. The
following one is “Launch Preset Floater”.
Once you have stored your favorite custom keys, animation workflow is greatly improved, since you
spend little or no time tuning default key frame attributes that don’t fit your current character’s
situation or style. Simply pose your character and click on the custom key icon that fits your current
situation.
Overview
Custom Keys are implemented via a new dedicated 3ds max Tool Bar, called character studio Tool.
This tool bar is the home base for a growing number of MAXScript-enabled character studio
commands. All operations associated with Tool Bars are available. For example, individual icons can
be relocated, deleted, and renamed. Tool tips can also be customized, as implied above, to let you
annotate each custom key type for rapid recall. Custom Keys are displayed on the character studio
Tool Bar as color-coded “set key” icons, similar to the standard Biped red set key icon in the Biped
Motion panel. Each color indicates a specific custom key type. There are two icons for each key type
– one for setting a key, and second for storing the preset value, based on the currently selected track
and key. The second icon – used for storing the preset values – displays a small black arrow pointing
to the center of the icon – indicating that a value will be stored. Once you have set your keys as you
like them, you may choose to delete the storage icons entirely, to save space. You can also float or
re-dock the Custom Key icons to customize access to suit your style and needs. Additionally, you can
launch a floating rollout of the same set of custom keys.
To use Custom Keys, simply set a Biped key as you normally would using the Biped Motion Panel
and set its Key Info settings as you prefer. Next store that key for the currently selected track at the
current frame into one of the six preset custom key icons using the set key icons with the black
arrows.
1826 Chapter 22 | CS3Tools.cui Tutorial
File Details
character studio 3 ships with the following character studio Tool files:
..\ui\CS3Tools.cui
..\Scripts\Startup\CS3Customkeys.ms
..\Scripts\Startup\CS3CustomKeys-presets.ini
..\Scripts\Startup\CS3convertBips.ms
..\Scripts\Startup\CS3Bip2BonesFloater.ms
..\Stdplugs\stdscripts\CS3CustomKeysPresetFloater.ms
Tutorial_Filename_CS3CustomKeysPresetFloater_ms bitmap files:
\3ds3.1\Cstudio\ui\Cstudio_16a.bmp, Cstudio_16i.bmp, Cstudio_24a.bmp, and
Cstudio_24i.bmp.
Design Details
Custom Keys operate similar to channel buttons on a car radio. Anytime you “dial in” a set of
parameters for a particular Biped key using the standard Biped “Key Info” rollout, you can store
those values in one of the 6 custom key buttons available, by clicking on the associated tool bar icon.
All of the standard Biped Key Info parameters are supported, including: ease to, ease from, tension,
continuity, bias, IK Blend value, IK body/space setting, and pivot point information. This can be
seen by reviewing the struct Biped_key defined in ..\Scripts\Startup\CS3Customkeys.ms.
Custom Keys do not store transformation information (like a pose). Only Key Info attributes that
affect the interpolation of a Biped’s motion are stored. This allows stylistic settings to be easily
transferred from frame to frame and even from Biped to Biped.
Each Custom Key is stored in a structure (p. 707) with the name Biped_key. Here is the definition
of Biped_key:
struct Biped_key (type, ikblend, ikspace, easefrom, easeto, tension,
continuity, bias, ikAnkleTension, balanceFactor, dynamicsBlend,
ballisticTension)
Here is the initial Custom Key definition for the buffer “Preset Key A”. Note that it is global
(p. 646) and therefore visible in all running MAXScript code and will hold its value until
3ds max is exited.
Global keya_buffer = Biped_key type:#body ikblend:0.1 ikspace:1
easefrom:0.0 easeto:0.0 tension:25.0 continuity:0.0 bias:25.0
ikAnkleTension:.8 balanceFactor:1 dynamicsBlend:1 ballisticTension:0.5
1828 Chapter 22 | CS3Tools.cui Tutorial
The CS3Tools.cui has 13 icon buttons. The first 6 are “Set custom Biped Key *”. The next 6 are
“Change Preset * to current key”. The last one is “Launch Preset Floater”.
Pressing the 7th icon, “Change Preset A to current key”, will change the value of the specified
Preset A Key’s keya_buffer to the value of the currently selected key. This will trigger the
execution of the code:
macros.run “character studio Tool” “Change_Preset_Key_A”
The line above will be displayed in the MacroRecorder (p. l) if the MacroRecorder is enabled.
This macro, “Change_Preset_Key_A”, is defined in the file \3ds3.1\ui\macroscripts\character
studio Tool-Change_Preset_Key_A.mcr and contains:
macroScript Change_Preset_Key_A
category:”character studio Tool”
toolTip:”Change Preset A to current key”
Icon:#(”cstudio”,7)
(
keya_buffer = CS3Change_Key_FN keya_buffer
CS3Save_presets()
)
See help page Macro Scripts (p. 1624) in the “Interacting with the 3ds max User Interface” topic
and Defining Macro Scripts (p. 1521) in the “Creating MAXScript Tools” topic for additional
details on creating and using Macro Scripts.
Select the last icon, “Launch Preset Floater”, in the CS3Tools.cui. The Preset Floater dialog is
launched and displayed. There are 6 “Change *” buttons and 6 “Show *” buttons. The 6
“Change *” buttons on the floating rollout perform the same actions as the 6 icon buttons on
the CS Custom Key toolbar.
1829
Pressing the “Change A” button executes the following code from the file
..\Scripts\Startup\CS3CustomKeys.ms
on ChangeA pressed do
(
keya_buffer = CS3Change_Key_FN keya_buffer
CS3Save_presets()
)
Pressing the “Show A” button will display the current contents of the keya_buffer as seen here:
Note that in both cases of Changing Preset A, the same function “CS3Change_Key_FN“ was
called. Additionally, notice that CS3Save_presets() is called anytime that a preset is changed.
CS3Save_presets() will save all key values to a file called CS3CustomKeys-presets.ini that can be
included in next launch of CS3Customkeys.ms. This is accomplished by Save_presets formating
the presets as valid MAXScript code and using the include statement (p. lix) to include the code
in CS3Customkeys.ms. The included code redefines the global key_buffers already defined.
The file \3ds3.1\Scripts\Startup\CS3Customkeys.ms Tutorial_File_name_CS3Customkeys_ms
contains the following functions:
fn Set_One_Key_FN
fn Set_Key_FN
fn CS3Save_Presets
fn CS3Show_key_FN
fn CS3Change_Key_FN
fn ControllerOf
fn RootOf
The functions Change_Key_FN, Save_Presets and Set_Key_FN will be reviewed in more detail
below.
1830 Chapter 22 | CS3Tools.cui Tutorial
As seen in the above examples of “ChangeA”, the Change_Key_FN function is called with a single
parameter, the particular local_key_buffer, and in the above examples with the keya_buffer. The
local_key_buffer will either be returned unmodified or it will be returned modified.
The values for easeto, easeFrom, tension, continuity, bias, and ikAnkleTension are stored for all valid
keytypes while ikblend and ikspace is stored for only #body keys. For #vertical keys, dynamicsblend
and ballistictension are also stored. For #horizontal, balancefactor is also stored.
See BipedKey:MAXObject (p. 1761) for more details.
else
return local_key_buffer
else
return local_key_buffer
my_root = $.controller.rootnode
my_controller = $.controller
else
(
msgtext = “‘” + $.name + “‘ skipped.\n”
messagebox msgtext
1832 Chapter 22 | CS3Tools.cui Tutorial
return local_key_buffer
)
)
if (my_root.transform.controller.figuremode (p. 1736) == true) then
(
messagebox “Change Preset Key is not supported in Figure Mode.\n Please
exit Figure Mode first.\n”
return local_key_buffer
)
)
local_key_buffer.easefrom = my_key.easeto (p. 1761)
local_key_buffer.easeto = my_key.easefrom (p. 1761)
local_key_buffer.tension = my_key.tension (p. 1761)
local_key_buffer.continuity = my_key.continuity (p. 1761)
local_key_buffer.bias = my_key.bias (p. 1761)
return (local_key_buffer)
)
else
(
messagebox “Cannot change this preset because there is no key for
the selected track at the current frame.\n Please advance the time slider to a
frame where a key exists.\nOr select a track and frame where a key exists.\nOr set
a key first.\n”
return (local_key_buffer)
)
)
else
(
messagebox “There is no controller for the selected track.\nYou may need
to enable separate tracks.\n”
return (local_key_buffer)
)
)
CS3Save_Presets Code
-- *************************************************************
-- CS3Save_Presets - save all key values to a .ms file that can be re-read at next
launch
-- *************************************************************
FN CS3Save_Presets =
(
my_path = scriptspath (p. 630) + “startup\CS3CustomKeys-presets.ini”
outfile = createfile (p. 763) my_path
format “-- This file was created by the CS3 Custom Key Macro
\“Save_Key_Presets\“ to store user-customized presets for Biped custom key macro
tools\n” to:outfile
format “-- These values can be editted by hand for existing fields\n\n”
to:outfile
k = keya_buffer
format “Global keya_buffer = Biped_key type:% ikblend:% ikspace:% easefrom:%
easeto:% tension:% continuity:% bias:%\n” k.type k.ikblend k.ikspace k.easefrom
k.easeto k.tension k.continuity k.bias to:outfile
k = keyb_buffer
format “Global keyb_buffer = Biped_key type:% ikblend:% ikspace:% easefrom:%
easeto:% tension:% continuity:% bias:%\n” k.type k.ikblend k.ikspace k.easefrom
k.easeto k.tension k.continuity k.bias to:outfile
k = keyc_buffer
1834 Chapter 22 | CS3Tools.cui Tutorial
Set_Key_FN Code
The pseudo code for the Set_Key_FN is as follows:
function Set_Key_FN local_key_buffer
store state of shift key
if nothing selected then return false
if one object selected and not a Biped Object then return false
if local_key_buffer undefined then return false
-- process multiple selections independently so that we can
-- support key setting of multiple bipeds
else for each of the items in the selection
( if current item not a Biped Object then get next item
set my_root to the root of the hierarchy
if my_root is in figuremode then get the next item
if my_root is in motionmode then get the next item
if my_root is in footstepmode then get the next item
set my_controller to the item’s controller
if hierarchy root is the current item then
set my_controller to the current track ( horizontal / vertical /
turning)
else get the next item
messagebox msgtext
continue
)
my_root = $selection[i].controller.rootnode
if (my_root.transform.controller.figuremode (p. 1736) == true) then
(
msgtext = “‘” + $selection[i].name + “‘ is in Figure Mode.\nSet Key
is not supported in Figure Mode.\nPlease exit Figure Mode for this object
first.\nObject Skipped.\n”
messagebox msgtext
continue
)
my_controller = $selection[i].controller
if (my_root == selection[i) then -- user is working on COM
(
if (my_controller.trackselection (p. 1736) == 1) then
(
my_controller = my_controller.horizontal.controller (p. 1736)
)
else
(
msgtext = “‘” + $selection[i].name + “‘ skipped.\n”
messagebox msgtext
continue
)
)
-- loop through all keys and call only if a key is selected
found_selected_keys = 0
if (found_selected_keys == 0 ) then
(
msgtext = “Warning: No keys selected.\nNo changes made to “ +
$selection[i].name + “.”
messagebox (msgtext)
)
else
(
msgtext = “Changed “ + (found_selected_keys as string) + “ keys
in “ + $selection[i].name + “.”
messagebox (msgtext)
)
)
-- temp_index should now indicate the ordinal index of the key for
this track, 1st, 2nd, 3rd, etc.
-- if it is still zero, then the user has selected a track or mode
that prevents adding a key, like footsteps
return true
)
See Also
Biped MaxScript Extensions (p. 1725)
Crowd MaxScript Extensions (p. 1771)
Index
M MultiMaterial 1210
macro recorder l NoMaterial 1212
default options l RayTraceMaterial 1212
displaying output l Shellac 1233
explicit scene objects l StandardMaterial 1224
filter options l StandardXYZGen 1238
recording user actions l TexOutputClass 1239
selection-relative scene objects l TextureMap 1234
sub-object sets l TopBottom 1233
using MAXScript commands l Types 1204
macro recorder pane UVGenClass 1237
listener window xxxvi, xxxviii material - MAXWrapper 1203
macro scripts 1624 Material Editor 1606
creating xxxviii, xliv Material Level Show-in-viewport State 166
defining 1521 materialbutton 1500
macros const StructDef 239 MaterialByElement - Modifier 1136
macroScript 1521 materialID() 1079
macroScript Localization Support for CUI and MaterialLibrary values 795
menu files 176 MaterialModifier - modifier 1137
main toolbar 1574 materials assignment and texture coordinates
makeFirst() - splineOps 1079 1391
managing multiple rollouts in a scripted utility math 588
1468 math assignment 671
manual garbage collection 656 math expressions 670
mapbutton 1499 mathematical operations in MAXScript 588
mapKeys() method 144 Matrix3 Scripted Controller 96
mapPaths const StructDef 239 Matrix3 Values 744
mapped function definition 699 Matrix3Controller
MapScaler - SpacewarpModifier 1198 IK_ControllerMatrix3Controller 1313
marble - TextureMap 1261 Link_Control 1316
Mask - TextureMap 1262 LookAt 1319
MasterBlock - MasterBlockController 1320 MAXWrapper 1302
MasterBlockController PRS 1325
Block_Control 1311 Slave_Control 1333
MasterBlock 1320 MatteShadow - Material 1208
MasterBlockController - MAXWrapper 1301 MAX commands 1630
Material MAX commands in MAXScript 620
scripted plug-ins 1565 MAX Open & Save Dialogs 177
material MAXKey
Blend 1205 common properties
common properties operators
operators and methods 768
and methods 1203 values 767
CompositeMaterial 1206 MAXKeyArray Values 793
DoubleSided 1207 MAXNoteKey Values 818
MatteShadow 1208 MAXNoteKeyArray Values 817
MorpherMaterial 1209 maxOps 87
Index 1853
Turn_to_Patch - superclass modifier 342 and modify 3ds max NURBS models 1389
Turn_to_Poly - superclass modifier 343 USpawnDeflector - superclass SpacewarpObject
twist - modifier 1175 346
type #integer parameters in scripted plug-in pa- utilities
rameter blocks 93 defining l
type-free variables 653 list in MAXScript l
scripted l
U displaying xxxiv
-U switch (command line) lvii Utilities Global Utilities and Render Element
UDeflector - SpacewarpObject 1033 plug-ins 161
UDynaDeflector - superclass SpacewarpObject utility
345 clauses 1466
UDynaFlect - SpacewarpObject 1022 event handlers 1474
UI setting - customizing lvi managing multiple rollouts 1468
unbind() - splineOps 1079 properties
unBindKnot() 1079 methods
undefined value 753 and event handlers 1474
unDisplay() 755 scripted 1463
undo scripted utility panels 1464
editor windows commands xlvi utility panel xxxiv, l
listener window command xxxviii UVGenClass - material 1237
undo context 687 UVW_Xform - modifier 1187
Undo/Redo Dropdown Labels 184 UVWmap - modifier 1188
unhideAll() - splineOps 1079 uvwMappingHeightManip interfaces 551
unhidesegments() 1079 uvwMappingLengthManip interfaces 555
union - mesh 852 uvwMappingUTileManip interfaces 558
units const StructDef 258 uvwMappingVTileManip interfaces 562
unsupplied value 754 uvwMappingWidthManip interfaces 565
Unwrap_UVW - modifier 1176 UVWUnwrap - superclass modifier 347
Unwrap_UVW interfaces 530 UVWUnwrap interfaces 568
UOmniFlect - SpacewarpObject 1034
updateBindList() 1079 V
updateChangedXRefs() - xrefs 1038 validModifer() function 142
updateShape() 1079 Value
updateXRef() 1038 NURBSDisplay 1447
updating scripted plug-ins 1553 NURBSSelection 1448
useLargeVertexDots - preferences 1603 NURBSSet 1450
user interface colors 1604 NURBSSurfaceApproximation 1453
user-defined properties - node methods 848 value
useTransformGizmos - preferences 1603 Array 776
useVertexDots - preferences 1603 ArrayParameter 770
using BigMatrix 748
HTML help viewer 1715 BigMatrixRowArray 748
listener xxxvii BipedExportInterface 1458
MAXScript documentation xxxiii BitArray 791
using the NURBS classes and functions to create Bitmap 755
1868 Index
W Z
Wall_Repel_Behavior MAXObject 1816 Z_Depth - superclass MAXObject 350
Wall_Seek_Behavior MAXObject 1817 Zip-file Script Packages 122
Wander_Behavior ReferenceTarget 1819 Zoom to Bounds 184
water - TextureMap 1286 ZRenderElement - superclass MAXObject 351
wave - modifier 1194
Waveform_Float - FloatController 1335
WAVsound const StructDef 258
weld() - splineOps 1079
What 1
when construct 1650
while loop exit 697
while/do expression 694
wind - SpacewarpObject 1010
window objects - geometry 896
WindowStream values 767
with - loop exit 697
with animate context 683
wood - TextureMap 1287
working with
Atmospherics 1345
Editable Meshes 1077
MAXKey Values 769
Note Tracks 818
NURBS 1384
Values 716
working with the NURBS classes 1385
X
XForm - Modifier 1195
XRef files 1643
Xref Objects API 120
XRefObject - Node 1037
xrefPaths const StructDef 259
xrefs
addNewXRefFile() 1038
attemptUnresolvedXRefs() 1038
deleteAllXRefs() 1038
findUnresolvedXRefs() 1038
getXRefFile() 1038
getXRefFileCount() 1038
updateChangedXRefs() 1038
xrefs const Structdef 259
XRefScene Values 1038
1870 Index