Interface: maxOps

Interfaces > Core Interfaces > maxOps

 

   

Core Interfaces - Quick Navigation

This Core Interface exposes various 3ds Max system properties and methods to MAXScript.

Topic Navigation  

Version and License Info

Progressive Mode

Create Tab

Motion Tab > Trajectory

Set Key Mode

Paint Selection Brush

Viewport Display

Iterative Rendering

Name Suffix Length

Window/Crossing Selection Type

Color By ID

Material Editor Mode

Trackbar, Controllers

Delete Animation

Hierarchy Tab

Display Tab

AutoKey Default Key

Bitmap Importer

Custom User Interface

Render Element Manager

Collapse and Clone Nodes

Node Handle

Find Nodes

Version and License Info

Properties:

maxOps.productAppID: enum : Read 		

productAppID enums: {#none|#max|#viz|#gmax,#vizR} 	 

Returns the application ID.

The enum values returned are as follows:

#none - no ID

#max - 3ds Max

#viz - Autodesk VIZ

#gmax - gmax

#vizR -VIZrender

   

maxOps.productID : enum : Read   

productID enums: {#3dsMax|#3dsMaxDesign} 

Returns the 3ds Max "flavour".

The enum values returned are as follows:

#3dsMax - 3ds Max Entertainment Version

#3dsMaxDesign - 3ds Max Design Version

Available in 3ds Max 2010 and higher.

   

maxOps.productVersion : enum : Read 

productVersion enums: {#productVersionDevel|#productVersionTrial|#productVersionOrdinary|#productVersionEdu|#productVersionNFR} 

Returns the Product Version type.

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

NOTE:It should be noted that all copies of 3ds Max return a hardwarelockid of "-1" while under the grace period and until they have been authorized. You can also check for that number and initiate your own demo mode .

   

maxOps.licenseBehavior : enum : Read 

licenseBehavior enums: {#licenseBehaviorPermanent|#licenseBehaviorExtendable|#licenseBehaviorNonextendable} 

Returns the License Behavior.

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 : integer : Read 

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.

   

maxOps.isNetworkLicense 

The property is read-only, with a boolean value: true means a network license, false means a local license.

FOR EXAMPLE:

--This example displays the values of your Cdilla license:
rollout CdillaOPS "License Properties" width:220 height:270
(
groupBox grp1 "License Values" pos:[18,18] width:180 height:265
button btn5 "Days until Expiration" pos:[50,45] width:119 height:18
editText edt5 "" pos:[50,75] width:119 height:18
button btn6 "License Version" pos:[50,105] width:119 height:18
editText edt6 "" pos:[50,135] width:119 height:18
button btn7 "License Behavior" pos:[50,165] width:119 height:18
editText edt7 "" pos:[50,195] width:119 height:18
button btn8 "Hardware Lock ID" pos:[50,225] width:119 height:18
editText edt8 "" pos:[50,255] width:119 height:18
on btn5 pressed do
edt5.text = (maxOps.licenseDaysLeft as string)
on btn6 pressed do
(
version = maxOps.productVersion as string
edt6.text = substring version 15 version.count
)
on btn7 pressed do
(
version = maxOps.licenseBehavior as string
edt7.text = substring version 16 version.count
)
on btn8 pressed do
edt8.text = (hardwarelockid as string)
)
rof = newRolloutFloater "License Status" 230 380
addRollout CdillaOPS rof

   

Methods:

maxOps.isFeatureLicensed <integer>featureNumber 

Returns true if the given feature is licensed, false otherwise.

   

Trackbar, Controllers

Properties:

maxOps.trackbar : Interface : Read 

Contains the Trackbar Interface.

   

maxOps.overrideControllerRangeDefault : boolean : Read|Write 

When set to true, new procedural controllers that normally require a range will be set to infinite range. When set to false (default behavior prior to 3ds Max 8), the range of such controllers will be set explicitly to the current animation range, causing the controllers to stop updating after the last frame of the range should the scene animation range be increased later. Available in 3ds Max 8 and higher.

   

maxOps.springQuickEditMode : boolean : Read|Write 

Get/set Spring Quick Edit mode on and off. Corresponds to the checkbox in the Animation tab of the Preferences dialog.

   

maxOps.springRollingStart : integer : Read|Write 

Get/set the Spring Controller's Rolling Start value. Corresponds to the Rollback value in the Animation tab of the Preferences dialog.

Methods:

maxOps.getTrackBar() 

Returns the interface to the trackbar. See Trackbar Interface for details.

   

Progressive Mode

Properties:

maxOps.inProgressiveMode : boolean : Read 

Returns true if 3ds Max is in Progressive mode, false otherwise.

When a time sequence of matrices is computed and has to be assigned to the transformation matrix of a node that employs the standard PRS controller and the standard Euler XYZ controller for the rotation, we would achieve a better animation result if the euler angles for the current frame were calculated based on the angles from the previous frame. The Progressive Mode tells the Euler controller to derive angles based on the previous frame. It is assumed that in this mode, the node transformation is set in strictly forward time order.

Also see beginProgressiveMode() and endProgressiveMode() methods below.

   

Methods:

<void>maxOps.beginProgressiveMode() 

Enables Progressive mode. See also maxOps.inProgressiveMode property above.

   

<void>maxOps.endProgressiveMode() 

Disables Progressive mode. See also maxOps.inProgressiveMode property above.

   

Delete Animation

Methods:

<void>deleteSelectedAnimation() 

Deletes selected animation.

   

Create Tab

Properties:

maxOps.autoGrid : boolean : Read|Write 

Enable/Disable the AutoGrid option.

   

maxOps.startNewShapeLock : boolean : Read|Write 

Enable/Disable the Start New Shape option checkbox.

   

Methods:

<void>startNewShape() 

Start the creation of a new Shape.

   

Hierarchy Tab

Properties:

maxOps.pivotMode : enum : Read|Write 

pivotMode enums: {#none | #pivotOnly | #objectOnly | #hierarchyOnly} 

This property corresponds to the pivot buttons in the Pivot subpanel of the Hierarchy Panel.

   

Motion Tab > Trajectory

Properties:

maxOps.trajectoryMode : bool : Read|Write 					 

When set to true , the Hierarchy tab of the Command Panel will be switched to Trajectories mode.

When set to false , the Hierarchy tab of the Command Panel will be switched to Parameters mode.

If the Command Panel is not in the Hierarchy tab, it will be switched to it automatically.

Available in 3ds Max 2008 and higher.

 

maxOps.trajectoryKeySubMode : bool : Read|Write 				  

When set to true , the Trajectories mode will be switched to Key Sub-Object mode.

If the Command Panel is not in the Hierarchy tab, it will be switched to it automatically.

If the Hierarchy has not been set to Trajectories mode by setting maxops.trajectoryMode=true or by manually switching with the mouse , it will be set to Trajectories mode automatically.

Available in 3ds Max 2008 and higher.

 

maxOps.trajectoryAddKeyMode : bool : Read|Write 				

When set to true, the Add Key mode in the Trajectories rollout of the Hierarchy tab of the Command Panel will be turned on. When false, it will be turned off.

If the Command Panel is not in the Hierarchy tab, it will be switched to it automatically.

If the Hierarchy has not been set to Trajectories mode by setting maxops.trajectoryMode=true or by manually switching with the mouse , it will be set to Trajectories mode automatically.

If the Trajectories mode is not in Key Sub-Object mode by setting maxops.trajectoryKeySubMode=true or by manually switching with the mouse, the Sub-Object mode will be set automatically.

Available in 3ds Max 2008 and higher.

Methods:

   

<void>maxOps.deleteSelectedTrajectoryKey() 

Deletes the selected trajectory key. Available in 3ds Max 2008 and higher.

Display Tab

Properties:

maxOps.hideFrozenObjects : boolean : Read|Write 

Gets/Sets the state of the Hide Frozen Objects checkbox in the Display tab.

NOTE:You have to call completeRedraw() after setting this property.

Set Key Mode

Properties:

maxOps.setKeyMode : boolean : Read|Write 

Get/set the SetKey mode state

   

maxOps.setKeySuspend : boolean : Read|Write 

Get/set the SetKey Suspend mode state

   

maxOps.setKeyFilters : enum by value array : Read 

setKeyFilters enums: {#all | #position | #rotation | #scale | #ikParams | #objParams | #custAttribs | #modifiers | #materials|#other} 

Always returns the fixed list of the filter names.

   

maxOps.setKeyNodeSets : String array : Read 

Returns an array of node sets.

NOTE:

The array does not include "Selected".

   

maxOps.setKeyNodeSetCurrent : String : Read|Write 

Returns "" if the current setKey node set is "Selected", setting it to "" sets the current setKey node set to "Selected".

NOTE:

A "SetKey NodeSet" is what is shown in the dropdown list above the Key Filters button in the status panel. The first entry in this dropdown is "Selected", which corresponds to a set name of "". The remaining items are all character nodes in the scene and all named selection sets in the scene.

Methods:

   

<boolean>maxOps.getSetKeyMode() 

This method returns true if Set Key mode is active, false if not active.

   

maxOps.getSetKeyFilterState <enum>filter 

filter enums: {#position | #rotation | #scale | #ikParams | #objParams | #custAttribs | #modifiers | #materials} 

Returns the state of the specified SetKey filter.

   

maxOps.setSetKeyFilterState <enum>filter <bool>onOff 

filter enums: {#position | #rotation | #scale | #ikParams | #objParams | #custAttribs | #modifiers | #materials} 

Sets the state of the specified SetKey filter.

FOR EXAMPLE:

-- print SetKey Filters state
for filter in maxops.setKeyFilters do
format "% : %\n" (filter as string) (maxops.getSetKeyFilterState filter)
-- turn all on
for filter in maxops.setKeyFilters do
maxops.setSetKeyFilterState filter true

   

<void>maxOps.getDefaultTangentType<&enum>dfltInTangentType <&enum>dfltOutTangentType 

dfltInTangentType enums: {#smooth|#linear|#step|#fast|#slow|#custom|#flat} 
dfltInTangentType is Out parameter 
dfltOutTangentType enums: {#smooth|#linear|#step|#fast|#slow|#custom|#flat} 
dfltOutTangentType is Out parameter 

Returns the default In and Out tangent types into the two Out parameters passed by-reference.

Available in 3ds Max 8 and higher.

   

<void>maxOps.setDefaultTangentType <enum>dfltInTangentType <enum>dfltOutTangentType writeInCfgFile:<boolean> 

dfltInTangentType enums: {#smooth|#linear|#step|#fast|#slow|#custom|#flat} 
dfltOutTangentType enums: {#smooth|#linear|#step|#fast|#slow|#custom|#flat} 
writeInCfgFile default value: true 

Sets the default In and Out tangent types. When writeInCfgFile: is set to true (default), the changes will also be recorded in the configuration file, making them sticky between 3ds Max sessions.

Available in 3ds Max 8 and higher.

EXAMPLE:

maxops.setDefaultTangentType #slow #fast
OK
maxops.getDefaultTangentType &inTangent &outTangent
OK
inTangent
#slow
outTangent
#fast
NOTE:The flyout in the 3ds Max GUI provides icons only for the cases where the In and Out tangents are equal. The above method can be used to set the default tangents to any combination of In and Out types which cannot be represented by the flyout icons. In these cases, a special icon with a question mark ? will be displayed in the GUI.

AutoKey Default Key

Properties:

   

maxOps.autoKeyDefaultKeyOn: boolean : Read|Write 

When this option is set to true (default), creating a key in AutoKey mode on a frame other than the one specified by maxops.autoKeyDefaultKeyTime will create a key on the frame specified by maxops.autoKeyDefaultKeyTime with the initial value of the animated property. This is the default behavior of 3ds Max since its first release.

When this option is set to false , no key other than the one on the current frame will be created by the AutoKey feature.

Available in 3ds Max 2008 and higher.

   

maxOps.autoKeyDefaultKeyTime : time : Read|Write 

When maxops.autoKeyDefaultOn is set to true , a key will be created automatically on the frame defined by this time value.

Possible values are 0f and 1f .

Available in 3ds Max 2008 and higher.

Paint Selection Brush

Properties:

maxOps.paintSelBrushSize : integer : Read|Write 

Get/Set the size of the Paint Selection brush. The Paint Selection is a selection mode accessible through the Selection Region flyout. The value corresponds to the "Paint Selection Brush Size" value under Customize>Preferences>General>Scene Selection. Note that right-clicking the Paint Selection icon in the main toolbar will open the Preferences dialog.

   

Bitmap Importer

Methods:

<bool>maxOps.canImportBitmap <filename>fileName 

Returns true if a bitmap importer is present for the extension in the file name, false otherwise. Does not check to see if the file exists or if it is a valid bitmap file.

   

Viewport Display

Methods:

bool>maxOps.displayActiveCameraViewWithMultiPassEffect() 

If the active view is a Camera view and a multi-pass effect is turned on in the camera's properties, then this function returns true . Otherwise it does nothing and returns false .

   

maxOps.setActiveViewportTransparencyDisplay <integer>transparencyLevel 

Takes a single integer argument:

0 - turns off transparency in the active viewport

1 - sets it to screendoor

2 - sets it to blended transparency.

   

<IObject>maxops.getViewportShadingSettings() 

Returns an <IObject:ViewportShadingSettings> object exposing several interfaces related to advanced viewport shading controls.

See Viewport Shading Settings for details.

Available in 3ds Max 2010 and higher.

EXAMPLE:

vss = maxops.getViewportShadingSettings()
<IObject:ViewportShadingSettings>
showInterfaces vss

Custom User Interface

Methods:

<bool>maxOps.loadCUIFile <filename>fileName 

Returns true if successful and false otherwise.

   

Iterative Rendering

Properties:

<bool>maxOps.rendUseIterative 

Get/set the Iterative Rendering mode in 3ds Max 2009 and higher.

When set to true , only the current frame will be rendered and no file will be saved to disk.

When set to false , the Render Dialog settings for Time Output and File Saving will be respected (this is the default and the only behavior in releases prior to 3ds Max 2009).

NOTE:

Iterative rendering CANNOT be activated using the render() method.

You can use max quick render after setting maxOps.rendUseIterative to true to perform an iterative rendering.

   

Render Element Manager

Methods:

maxOps.GetCurRenderElementMgr() 

Returns the current render element manager.

   

maxOps.GetRenderElementMgr <enum> 

{#Production|#Draft}

Gets a specific render element manager.

NOTE:

The #Draft renderer was retired in 3ds Max 6.

Calling this method with #Draft argument will return undefined in 3ds Max 6 and higher.

   

Node Name Suffix Length

Properties:

<integer>maxOps.nameSuffixLength 

Controls the number of digits appended as suffix to the name of newly created scene nodes, layers etc.

Available in 3ds Max 2011 and higher.

NOTE:

In 3ds Max 2011, the default value was changed from 2 to 3 and is now controlled by the "NameSuffixLength" key in the [Preferences] category of the 3dsmax.ini file.

This is to ensure better sorting of up to 999 objects using the MAXScript sort() method. If you intend to work with more than 1000 objects, you can increase the maxOps.nameSuffixLength value to 4 or more to ensure enough leading zeros.

In addition, note that newly created nodes will receive a number one higher than the highest number in the scene without filling gaps. For example. if you create objects Box001, Box002 and Box003 and delete Box002, the next automatically named object will have the name Box004 and not Box002.

   

Collapse and Clone Nodes

Methods:

<bool>maxOps.CollapseNode <node>node <boolean>noWarning 

Collapses the complete modifier stack of the node.

When noWarning is set to true, no prompt will be issued. Returns true if successful and false otherwise.

   

<bool>maxOps.CollapseNodeTo <node>node <index>modIndex <boolean>noWarning 

Collapses the modifier stack up to the indexed modifier.

The modifiers are counted from top of the stack. All modifiers below and INCLUDING the specified one will be collapsed.

When noWarning is set to true, no prompt will be issued.

Returns true if successful and false otherwise.

   

<bool>maxOps.CloneNodes <&node array>nodes offset:<point3> expandHierarchy:<boolean> cloneType:<enum> actualNodeList:<node array> newNodes:<node array> 

This method will return true if successful, otherwise it will return false .

<&node array>nodes 

This is the list of nodes that you want to clone. nodes is In parameter.

<&point3>offset 

The positional offset that will be applied to the cloned nodes. offset is In parameter.

expandHierarchy:<boolean> 

expandHierarchy default value: false 

Indicates if children will be cloned in hierarchies.

cloneType:<enum> 

cloneType enums: {#copy|#instance|#reference} 
cloneType default value: #copy

Specifies the clone type - Copy, Instance or Reference.

 actualNodeList:<node array> 

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:<node array> 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 returned in the actualNodeList array and the newNodes array.

NOTE:

actualNodeList and newNodes take an argument of <&node array>, and are Out parameters. This is important because:

1) the variables should be passed by reference, and

2) we don't need to initialize the variables to arrays since they are only Out parameters (MAXScript doesn't try to convert the value passed in to an array).

FOR EXAMPLE:

s=sphere()

-- variables not passed by reference, does not work right
maxops.clonenodes s actualNodeList:a newNodes:b
a --> undefined
b --> undefined

-- variables passed by reference without initializing, works right
maxops.clonenodes s actualNodeList:&c newNodes:&d
c --> #($sphere01)
d --> #($sphere03)

Also note that the first argument type is specified as <&node array>nodes , In parameter. Since it is an In parameter, we know that the method does not change the contents of the array passed, so there is no point in passing this array by reference.

In addition, MAXScript automatically wraps the single argument passed into a temporary array, so we can use s instead of #(s) to supply the node array.

WARNING!

You may not use maxOps.cloneNodes inside an undo off context. Doing so will crash 3ds Max when using the Undo function!

Window/Crossing Selection Type

Methods:

maxOps.setSelectionType <boolean>auto <enum>method 

method enums: {#window|#crossing|#leftToRight|#rightToLeft} 

Controls the window/crossing modes of the selection tool.

When the first argument is set to true, it enables the Customize>Preferences>General tab>Auto Window/Crossing By Direction option. The second argument can be either 0 or 1 or the equivalent enums #leftToRight and #rightToLeft.

When the first argument is set to false, it sets the state of the Window/Crossing icon in the Main Toolbar, while disabling the Customize>Preferences>General tab>Auto Window/Crossing By Direction. The second argument can be either 0 or 1 or the equivalent enums #window and #crossing.

In other words,

true 1 : Enables auto Window/Crossing: moving left-to-right is crossing selection

true 0 : Enables auto Window/Crossing: moving right-to-left is crossing selection

false 1 : Disables auto Window/Crossing, turns ON crossing selection

false 0 : Disables auto Window/Crossing, turns OFF crossing selection

The method returns true if successful, false otherwise.

   

Node Handle

Methods:

maxOps.getNodeByHandle <DWORD>handle 

Returns a node associated with a given handle.

   

Color By ID

Methods:

<void>maxOps.colorById <DWORD>id <&color>color 

color is Out parameter   

Returns a specific color for each unique ID passed. The result is written to the Out parameter by reference.

This method is used internally to generate colors representing Material and Object IDs in the respective RenderElements.

Available in 3ds Max 8 and higher.

FOR EXAMPLE:

for i = 0 to 9 do
(
 maxops.colorById i &theColor
 format "ID:% Color:%\n" i theColor
)

RESULT:

ID:0 Color:(color 100 100 100)
ID:1 Color:(color 213 16 100)
ID:2 Color:(color 70 188 100)
ID:3 Color:(color 183 104 100)
ID:4 Color:(color 40 20 100)
ID:5 Color:(color 153 192 100)
ID:6 Color:(color 10 108 100)
ID:7 Color:(color 123 24 100)
ID:8 Color:(color 236 196 100)
ID:9 Color:(color 93 112 100)

Find Nodes

Methods:

<void>maxOps.findNodes <&node array>templateNodes <&node array>foundNodes nodePropsToMatch:<&enum array> 

templateNodes is In parameter 
foundNodes is Out parameter 
nodePropsToMatch enums: {#nodePropMaterial|#nodePropLayer} 
nodePropsToMatch default value: #() 
nodePropsToMatch is In parameter 

Finds nodes similar to the ones specified in the template. Optionally matches material and layer properties.

Available in 3ds Max 2008 and higher.

FOR EXAMPLE:

(
resetMaxFile #noPrompt --reset max file
--create 10 boxes and 10 spheres:
for i = 1 to 10 do box pos:[i*50,0,0]
for i = 1 to 10 do sphere pos:[i*50,100,0]
$Box*.material = standard() --assign standard material to all boxes
$Box01.material = multiMaterial() --change material of first box
--find all objects similar to the Box01 and Sphere01
--that have the same material as the template object
maxOps.findNodes #($Box01,$Sphere01) &foundNodes nodePropsToMatch:#(#nodePropMaterial)
print foundNodes --print the resulting array
)

RESULT:

$Box:Box01 @ [50.000000,0.000000,0.000000]
$Sphere:Sphere01 @ [50.000000,100.000000,0.000000]
$Sphere:Sphere02 @ [100.000000,100.000000,0.000000]
$Sphere:Sphere09 @ [450.000000,100.000000,0.000000]
$Sphere:Sphere08 @ [400.000000,100.000000,0.000000]
$Sphere:Sphere07 @ [350.000000,100.000000,0.000000]
$Sphere:Sphere10 @ [500.000000,100.000000,0.000000]
$Sphere:Sphere06 @ [300.000000,100.000000,0.000000]
$Sphere:Sphere03 @ [150.000000,100.000000,0.000000]
$Sphere:Sphere04 @ [200.000000,100.000000,0.000000]
$Sphere:Sphere05 @ [250.000000,100.000000,0.000000]
OK

As you can see, only the first box was collected because all other boxes have a different material.

All spheres have the same material (no material at all), so they were all collected as similar to the $Sphere01.

Material Editor Mode

Properties:

maxOps.mtlDlgMode 

Get/set the Material Editor Mode in 3ds Max 2011 and higher.

If a Material Editor is already open, setting this property immediately switches the Editor to the given mode.

Possible values are:

#basic(0) - Compact Material Editor mode

#advanced(1) - Slate Material Editor mode

See also the MatEditor - Open and Close the Material Editor topic for more related methods.

The maxOps.mtlDlgMode property described above is also available through the MatEditor struct for convenience.