Building the Sample Files

3DS Max Plug-In SDK

Building the Sample Files

See Also: Main Plug-In Classes.

Overview

The SDK provides sample code for many of the plug-in types. This section discusses the procedure to build and run the sample plug-ins included in the SDK. All the sample code is located in the sub-directories of \MAXSDK\SAMPLES. A MAK file is provided to build each sample.

Each MAK file has several configurations within it. There is a Release configuration, and a Hybrid configuration. In the special developer SDK available to registered developers (See Debugging) there is an extra Debug configuration. Developers may use any of these. Developers using the standard SDK should use the Hybrid configuration for source level debugging and the Release configuration for distribution code. The plug-ins that ship with 3ds max were created using the Release configuration.

These configurations differ based on their optimization of the code, their inclusion of debug symbols, and their use of runtime libraries.

The Release configuration creates optimized code while the other configurations do not.

Both the Hybrid and the Debug configurations contain debug symbols useful in source level debugging. The Release configuration does not include debug symbols.

The Release and Hybrid configurations both use the same runtime libraries. These are called Multithreaded DLL in VC++. The Debug configuration uses a different one, the Debug Multithreaded DLL library. The difference is the Debug configuration uses a different heap to track memory. The non debug libraries use the same heap as regular release code. The issue is that heaps cannot be mixed and matched. This is why a special Debug version of 3ds max is required to use the special Debug configuration.

Developers using the standard SDK should use the Hybrid configuration for debugging and the Release configuration for distribution code.

Building the Samples

The MAK files assume the SDK is installed in the \MAXSDK directory off the root of the drive.

The MAK files also assume that the directory to store the 3ds max plug-ins is \MAXSDK\PLUGIN. If this is not where you wish to put them you will need to change the output file directory. Load the MAK file by choosing File / Open Workspace... changing the List File of Type... to *.MAK and selecting the MAK file.

1 From the Build pull down menu choose Settings...

2 From the Project Settings dialog box choose the Link Tab.

3 Under Output File Name: Enter the path to the desired plug-in directory and the output file name.

To build one of the sample projects:

1 Load the MAK file into VC++.

2 From the Build menu choose Rebuild All. This will compile and link the plug-ins in the MAK file. Note that this process will overwrite any plug-in DLLs with the same name in the destination directory.

Running The Sample Programs

Important Note: The SDK plug-ins are the same as the standard 3ds max plug-ins. If you want to run the samples you should copy the plug-in from the \MAXSDK\PLUGIN directory to your \3DSMAX\STDPLUGS directory. This will replace the standard 3ds max plug-in with the SDK version. If you try to load them both (i.e. put them in separate directories and tell 3ds max to load plug-ins from each of these directories) you'll have a Class_ID conflict. 3ds max will not load two plug-ins that have the same Class_ID. It will only load the first one and put up a warning about the second one.

Another option is to change the Class_ID used in the sample code before it is compiled. 3ds max may then load both plug-ins. For more information on Class_IDs see the section DLL Functions and Class Descriptors.

Ready To Build Plug-In Projects

The 3ds max 4.0 SDK comes provided with an SDK appwizard that can be used with Microsoft Visual C++. This appwizard allows you to quickly generate skeleton source code for a variety of different plugin types and essentially replaced the previous R3_SKELETON projects included in the previous release of the software.

The generated code from the appwizard provides a quick way to start building plugins. Each project follows a standard structure with regard to headers and code files. Developers should find it easy to take this generated code and can start creating plugins without manually setting up the entire project from scratch.