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

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

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

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

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

getProperty and setProperty

The getProperty() and setProperty() functions allow you to access and set properties using computed property names: These form 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.

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.