Compiling the NeL Tools
Distribution Notes
Given that Max plug-ins are linked to the 3DSMax SDK (which is not Gnu GPL) and to NeL (which is Gnu GPL), anyone distributing plug-ins in binary form will be in breach of the Gnu GPL.
In English than means that you shouldn't distribute the plug-ins as binaries. You are, of course, free to distribute the source code.
The plugin_max has been tested on 3DStudio MAX 3.1 with Character Studio 3 by Nevrax and unofficially tested by the community on all versions 3DStudio MAX 8 and lower. Plugins compiled against 3DStudio MAX 4.2 and higher are not guaranteed to work, use at your own discretion.
3DStudio MAX Plug-In 3.1
Common Problems
The 3DStudio MAX plug-in, called plugin_max, is highly likely to produce the following error when compiled:
D:\Program Files\wpkg-sync\include\stlport\stl/_alloc.h(358) :
fatal error C1076: compiler limit : internal heap limit reached; use /Zm to specify a higher limit
Go to the C/C++ settings for the project. Under project options you will see the compiler flags /FD /c, in between those add /Zm300 so it is /FD /Zm300 /c and recompile. 
If you used the wpkg-sync tool to get additional libraries, you may get the following linker error:
libxml2.lib(nanohttp.obj) : error LNK2001: unresolved external symbol _imp_WSAStartup@8
Just add ws2_32.lib to the link list.
The wpkg-sync tool and the libraries that it provided are out of date and no longer supported. If you are running MSVC6 it is recommended that you manually compile the prerequisites.
3DStudio MAX 4.2 and Newer
The information below is based on information from Vincent Caron and the original text is stored in code/nel/tools/3d/plugin_max/compilation_notes_vc7.txt.
To the knowledge of the community 3DStudio MAX 4.2 and newer only properly compiled on Microsoft Visual Studio 7.1 and 8
MAX SDK Setup
You must install the MAX SDK on your machine. Let's say that MAXPATH (e.g. c:\3dsmax) is the installation path of your 3DStudio MAX software. You must add the following C++ paths from the global settings of VC7 (Tools/Options/Projects/VC++ Directories):
- Library Files: MAXPATH\Lib
- Include Files: MAXPATH\Include and MAXPATH\Include\Maxscrpt
Due to a conflict between a NT's include file and a Maxscript one (<parser.h>), you must insert the MAX include files before any reference to the Platform SDK includes.
Upon compilation, the plugins and needed DLLs will all be output in the 'code/nel/lib7/' folder. Update your MAXPATH/plugin.ini file to add this plugin path. Example:
[Directories]
Standard MAX plug-ins=C:\3dsmax42\stdplugs
Additional MAX plug-ins=C:\3dsmax42\plugins
NeL plug-ins=C:\nel_cvs\code\nel\lib7
Finally, you'll have to install some startup scripts. They reside in the 'code/nel/tools/3d/plugin_max/script/startup/' folder, and they have to be copied in 'MAXPATH/scripts/startup'.
Note (2002/08/07): nel_material.ms and nel_multi_set.ms do not run well under Max4.2 for now, you should currently ignore them (don't copy them).
MAX Plugin Compilation
Open 'code/nel/tools/3d/plugin_max/plugin_max_public.sln'. It will build several targets, along some NeL dependencies. You should see the following files in 'code/nel/lib7/' :
- Shared components
- nel_3dsmax_shared<suffix>.dll
- object_viewer.dll
- MAX Plugins
- nelexport.dlu
- neltileutility.dlu
- nelconvertpatch.dlm
The <suffix> part depends on your build profile ('rd' for ReleaseDebug, 'df' for DebugFast, etc).
MAX Plugin Runtime Setup
In order that all DLL can be found at load time, update your PATH environment variable to add the full name (ie. including the drive letter) of your 'code/nel/lib7/' path.
NT/2K/XP users: Config Panel/System/'Advanced' tab/'Environment Variables' button. PATH should be defined in the global variables. You don't have to reboot, but you must restart the current running applications in order they notice this change.
Win95/98/Me users : edit your PATH in C:\AUTOEXEC.BAT, then reboot (no alternative.)
Last step : the object viewer needs a config file at runtime, use the one provided with the distribution. Copy 'code/nel/tools/3d/object_viewer/object_viewer.cfg' into your 'code/nel/lib7/' path (side by side with the MAX plugins.) You may edit it as fit.
MAX Plugin Simple Test
- Launch 3DSMax. It should load the nel*_ startup scripts and maybe generate some errors due to MaxScript differences between 3.x and 4.x. You can 'safely' ignore them (for now.)
- Create a simple primitive, like a 'teapot' : select 'teapot' from the primitive tab on the right, then click on the viewport to place it and size it.
- Select the 'Tool' tab (little hammer, right-most), click the 'More' button. The dialog should show a list of plugins, 'NeL Export' and 'NeL Tile Bank' being among them. Select 'NeL Export'.
- Now click on the 'View Scene' button in the bottom right panel. You should see the Object Viewer popup with a gray teapot. MAX navigations shortcuts are available (Ctrl/Alt + middle mouse button, etc.)