Maxscripts

Maxscripts:

The following describes the Maxscripts as they were in the manager branch when the manger project ended.

Dependencies:

These scripts are dependent on a number of external files. If these files aren ’ t where the script tries to find them, the script will throw an error and stop execution. Max will open the script and show the line at which the error occurred. It should be easy to tell what file it ’ s looking for. The following files are needed:

ShaderTuple.h

Collisiontuple.h

animatedgeometryeventtuple.h

CollHelper.ms

This script defines custom max helper objects which represent collision geometry. In addition macros are defined which allow conversion of editable poly objects to and from these custom collision objects.

This script parses the collision tuple found in the renderlib in order to obtain the current set of collision types.

The max exporter understands these collision objects and has a routine for exporting them as collision meshes.

CrowdLocator.ms

This script defines a custom object which represents a locator for a crowd member. This script was mainly (solely) used for placing players in the dugout for The Bigs and may or may not be useful for future projects.

The exporter understands and exports these objects.

CustAttrib.ms

This is an extremely important and complicated script. This script is used to define "custom attributes" for objects. These attributes are used to store game specific information on nodes in max. An event handler catches the "node created" event and automatically attached the custom attributes. The exporter heavily interacts with this script reading and exporting many of these attributes.

The following attributes are defined:

mHasLightmap – specifies whether or not the object has a lightmap

mLightmapChannel – specifies which channel the lightmap is gets its texture coordinates from.

mDoNotExport – If true, the exporter ignores this node.

mLessThanEqualZTest – Allows the artist to specify what type of z test is used when rendering the object

mAnimated – Specifies an object is animated (such as the taxis in times square). If true the exporter will export a geometry animation for this object.

mAnimTrigger – On The Bigs many of the geometry animations were triggered by an event such as a collision or homerun. This property specifies that event. The events are obtained by parsing animatedgeometryeventtuple.h.

mVertexAnimated – Specifies is vertex animated. Examples of vertex animated objects are the flags and the foul poles.

mInternal – Specifies if the vertex animation is internal to the max file (foul poles) or comes from another max file (flags). Internal vertex animations are processed at export time using VertexAnimPrep.ms

mLastFrame – Allows the artist to specify the last frame of the animation

mColor – A generic color attribute. This was used on The Bigs for the flags. The artist would pick a color which was then used as the lighting for the object.

mNightColor – Same as above but used for the night time stadiums,

mZBias – This was mainly used to prevent z fighting on the psp. The z bias biases the z test for the object. For more info ask Ju-Lian.

Additional utilities are defined in this script as well:

A utility for updating the attributes is used when new attributes are added. What this utility does is goes through the objects in the scene and removes the old copy of the attribute, then attaches the new one, maintaining all the old settings.

A utility for batch setting attributes is defined. This utility imply applies allows attributes to be set for all the objects in the current selection.

DynamicTextures.ms

This scipt defines a custom attribute which is attached to texture maps using the "Dynamic Texture" utility. Dynamic textures (on The Bigs) where used for texture swaps especially due to collisions. This script references the same animations triggers mentioned in the custom attributes script above.

ExportOptions.ms

This script is used to specify options for the exporter. The options are saved in a file called ExporterOptions which is located in the 3dsMax8 root directory. The exporter then opens and parses this file and behaves accordingly.

Mesh, material and animation export can be turned on and off. The next generation target check box would be unchecked for the ps2 environments which told the exporter to ignore lightmaps.

FlattenUVs.ms


 * This is a small production script defining a utility for flattening UVs.

GlobalSettings.ms

LightProbe.ms

This script defines a utility for rendering cube maps. It ’ s used in conjunction with the above global settings script.

Massive.ms

This script defined a custom attribute for textures which allows them to be specified as massive.

MaterialConverter.ms

This is an unsused script. It was written for converting materials to use directx shaders but running directx shaders in the max viewport proved to be too slow.

ParticleEmitter.ms

This is another unused script. It was written to place particle emitters but made unneeded by pyro.

PS2MaterialStripper.ms

This script is used to convert materials for use with last generation platforms. All normal maps etc are removed.

RemoveAttributes.ms

This script defines a utility for removing bad custom attributes from objects. See known issues section for more information.

SeatRowAttribute.ms

This is a script used for placing seats. This script is dependent on the global settings script. The file name for where the x-ref objects live is obtained from the global settings.

This script defines a custom attribute which can be attached to tape objects. This attribute contains information which essentially turns the tape into a seat row object.

Various utilities are defined which place seats along the tapes and in doing so, store the information about the seat in the above mentioned custom attribute. The max exporter reads and exports this seat row information.

ShaderManager.ms

This script is another one of the long complicated ones. This script is used to manage and assist the artists in using materials that match game shaders. It is dependent on shadertuple.h which it parses to get the up to date list of game shaders. The script defines a custom attribute which can be attached to all the materials by running a utility which is also defined in this script. The attribute contains methods which allow the artist to compare the settings of max materials with properties of game shaders.

This script is responsible for the famous blue castle shader bug wherein copies of the custom attribute appear on nodes in the scene. On occasion so many) copies (hundreds) of this attributes become attached to a single node that the node then becomes impossible for the artist to work with.  Utilities have been written which clean the scene up but the figuring out why this is happening and fixing it remains an important task.

UVAnimate.ms

This script defines a custom attribute which can be attached to materials allowing the textures to animate.

VertexAnimPrep.ms

The script is used to prepare "internal" vertex animations for export. This was used for the foul poles on The Bigs. The script handles the pre and post export events. Preexport a snapshot is taken of the object at each from of the animation. These snapshots are exporters. Post export the snapshots are deleted.

XRefAttribs.ms

This script defines a custom attribute which can be attached to x-ref objects to mark their type. It may be used with the seat placing routines.