Class and Object Inspector Functions

MAXScript provides a number of built-in functions that display information about the classes that are accessible in your particular 3ds Max installation. These functions are useful as an online reference for the core 3ds Max classes and provide the only way of determining what properties in third-party plug-in classes are accessible.

apropos

The apropos() function is used to search for and print out information about global variables by name pattern and class of contents.

This function has the form:

apropos <pattern_string> [ to:<stream> ]

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]>

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

Here's a fragment of the first example's output:

lights (const ObjectSet): $lights

lightLevel (system Float): 1.0

Sunlight (const MAXClass): Sunlight

Directionallight (const MAXClass): Directionallight

lightLevelController (system Control): Controller:Bezier_Float

light (const MAXSuperClass): light

NewLight (const Primitive): NewLight()

lightTintColor (system Color): (color 255 255 255)

Volume_Light (const MAXClass): Volume_Light

lightTintColorController (system Control): Controller:Bezier_Color

gw.getMaxLights (Primitive): getMaxLights()

gw.setLight (Primitive): setLight()

To make scripting easier to teach and use everyday, a ScriptTool function for Help has been added. It is an alias for apropos.

Typing Help "Box", will show all the commands using the name BOX.

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 to output the display to.

The pattern string has this form:

"<class_name>[ :<superclass_name> ][ .<property_name> ]"

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 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.

The showProperties() function has the form:

showProperties <maxwrapper_object> [ <property_pattern> ] [ to:<stream> ]

where <maxwrapper_object> is the 3ds Max entity to be inspected, the optional <property_pattern> is a wild-card pattern that names the properties to be inspected, and the optional to:<stream> keyword argument specifies a Stream Value to output the display to.

If the property name pattern is not supplied, all properties are listed.

Examples:

showProperties $foo.bend -- show properties of the bend modifier on object foo

ffdmod = $baz.'FFD_box__4x4x4' -- point to the FFD modifier on object baz

showProperties ffdmod "disp*" to:log -- show properties starting with "disp" in the

-- FFD modifier

showProperties $foo.pos.controller -- sub controllers in a position list controller

 

Notes:

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.

showProperties includes properties defined by FPS interfaces in 3ds Max 8 and higher. See Inspecting Interface Properties for an example.

 

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

.tension : float

.continuity : float

.inPoints (Inside Points) : boolean

.outPoints (Outside Points) : boolean

.offset : float

.lattice_transform : transform

OK -- result from line 5

To make scripting easier to teach and use everyday, a ScriptTool function for "Show" has been added.

Show is the short way of typing ShowProperties

Example:

Show $ --will show you the properties of the selected object

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 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)

Notes:

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.

getPropNames includes properties defined by FPS interfaces in 3ds Max 8 and higher. See Inspecting Interface Properties for an example.

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.

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

getPropNames and Interfaces

The getPropNames method has been extended to work with the various interface values. The method will return the names of properties exposed by the interface.

 

For example:

getpropnames s.inode

#(#boneEnable, #posTaskWeight, #rotTaskWeight, #boneAutoAlign, #boneFreezeLength, #boneScaleType, #stretchTM, #boneAxis, #boneAxisFlip, #primaryVisibility, #secondaryVisibility, #applyAtmospherics, #vertexColorType, #showVertexColors, #shadeVertexColors, #handle, #posInParent, #rotInParent, #scaleInParent, #scaleOrientInParent)

getProperty and setProperty

The getProperty() and setProperty() functions allow you to access and set properties using computed property names.

The forms for each of these functions are:

getProperty <obj> <property_name>

setProperty <obj> <property_name> <value>

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.

 

hasProperty

The hasProperty() function allows you to test whether an object has a specified property name. Unlike isProperty(), the property name string supports wildcard patterns.

 

hasProperty <obj> <prop_name_or_pattern_string>

Returns true if the object has the given property or has properties matching the string pattern.

Examples:

isProperty $Box01 "height" --test for height in a Box

true

isProperty $Box01 "radius" --test for radius in a Box

false

isProperty $Sphere01 "radius" --test for radius in a Sphere
true

isProperty $Sphere01 "rad*" --test for any property name
true --starting with "rad" in a Sphere

 

isProperty

The isProperty() function allows you to test whether an object has a specified property.

isProperty <MAXWrapper_object> <property_name_or_string>

isProperty() returns true if the specified property is a property of the MAXWrapper object, false otherwise. 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:

isProperty $Box01 #height --test for height in a Box

true

isProperty $Box01 #radius --test for radius in a Box

false

isProperty $Sphere01 #radius --test for radius in a Sphere
true

 

The difference between hasProperty and isProperty

hasProperty and isProperty do entirely different things.

For example:

hasProperty $Box01 "name" 

false

isProperty $Box01 "name" 

true

 

hasProperty uses the same code as showPropeties, but instead of returning a list of the properties found, it returns true on the first property name that matches the specified pattern. showProperties is looking at just the box base object and its MAXClass definition. It does not look at any higher level properties (and in versions prior to 3ds Max 8 it does not look at any of the FPS interface exposed properties).

isProperty on the other hand actually tries to access the specified object with the specified name and to detect whether the access succeeded or failed.

 

isPropertyAnimatable

isPropertyAnimatable <obj> <string_or_name>

Returns true if the property is found and is animatable. Returns false if the property is not found or is not animatable.

For example

s = Sphere() --create a sphere

$Sphere:Sphere01 @ [0.000000,0.000000,0.000000]

isPropertyAnimatable s #radius --check if radius is animatable

true

isPropertyAnimatable s #mapCoords --check if UV coords are

false

 

Another example:

s = Sphere() --create a sphere

--Print a list of all properties of the sphere and whether

--they are animatable or not:

for i in getPropNames s do

format "% Property: % - Animatable: %\n" s.name i (isPropertyAnimatable s i)

Result:

Sphere01 Property: #smooth - Animatable: true

Sphere01 Property: #radius - Animatable: true

Sphere01 Property: #mapCoords - Animatable: false

Sphere01 Property: #segs - Animatable: true

Sphere01 Property: #slice - Animatable: false

Sphere01 Property: #hemisphere - Animatable: true

Sphere01 Property: #sliceFrom - Animatable: true

Sphere01 Property: #sliceTo - Animatable: true

Sphere01 Property: #chop - Animatable: false

Sphere01 Property: #recenter - Animatable: false

OK

OK

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

For more information about accessing animatable properties in MAXScript, see also Indexed Access to Animatable Properties in 3ds Max Objects.

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 Nested Object Properties for details.

See also

showInterfaces Inspector Function

GetInterfaces Interface Inspector

showInterface Inspector Function

getClassInstances

 

Core Interfaces

Other Interfaces