MAX Class IDs and Superclass IDs (SDK)

3DS Max Plug-In SDK

MAX Class IDs and Superclass IDs (SDK)

You'll notice that the MAXScript wrapper classes correspond roughly to MAX object superclasses, there are no C++ classes in MAXScript for individual MAX object classes (Box, Sphere, Bend, StdMaterial, etc.). This is primarily because the MAX object classes present in any running copy of MAX is dynamic depending on the plug-ins that are loaded. MAXScript deals with this in much the same way the MAX SDK does by having descriptor classes whose instances define individual MAX plug-in classes. There are two MAXScript classes for this MAXScript-specific metadata, both Value subclasses so their instances can be manipulated as values in the scripter:

Value

MAXSuperClass 

MAXClass 

The MAXSuperClass instances correspond to object superclasses in MAX and there is one instance per MAX superclass ID. The MAXClass instances correspond roughly to ClassDesc instances in MAX and there is one MAXClass instance per MAX Class ID.

All of the superclass instances and most of the MAXClass instances corresponding to the core objects in MAX are statically instantiated in MAXScript. There are also many MAXClass instances created dynamically by the MAXScript plug-in scanner which attempts to construct metadata for 3rd-party and new MAX plug-ins that it finds as MAX starts up.

MAXScript extension DLLs can statically define new MAXClass instances to provide complete metadata for new or 3rd-party MAX plug-ins. The advantage of doing this is that you can typically provide a much more complete description for new MAX object classes than the plug-in scanner can construct.

These are declared as static instances using the MAXClass constructor described below. As an example, here is the definition for the Box primitive object from the MAXScript core:

MAXClass box

("Box", Class_ID(BOXOBJ_CLASS_ID, 0), GEOMOBJECT_CLASS_ID, &geom_class, 0,

accessors, 

paramblock, 

"length", BOXOBJ_LENGTH, TYPE_FLOAT, 25.0, 

"width", BOXOBJ_WIDTH, TYPE_FLOAT, 25.0, 

"height", BOXOBJ_HEIGHT, TYPE_FLOAT, 25.0, 

"widthsegs", BOXOBJ_WSEGS, TYPE_INT, 1, 

"lengthsegs", BOXOBJ_LSEGS, TYPE_INT, 1, 

"heightsegs", BOXOBJ_HSEGS, TYPE_INT, 1, 

"mapcoords", BOXOBJ_GENUVS, TYPE_BOOL, FALSE, 

end, 

end, 

end 

);

This declares a static instance named 'box' that defines a scripter-visible name, the MAX class ID and superclass ID, and specifies the MAXSuperClass instance for this class and a set of MAX SDK ParamBlock-based properties. The property definitions define a scripter-visible name, parameter ID, type info and a useful default value, used when creating instances of the class in the scripter. The property definitions can also include properties not carried in ParamBlocks, for which you supply getter and setter C++ functions, so you can define any number of real or virtual properties.

As a side-effect of this declaration, a scripter global variable of the given name is created and loaded with the MAXClass value. Scripts can use this value both as a class value in methods such as classOf() and to construct new MAX objects. MAXClass values, like several other class values in MAXScript can be 'applied' like a constructor in C++ to a set of arguments to create instances of themselves. In the case of MAXClass instances, all the properties you describe in its constructor can be used as creation arguments in MAXScript.