LightWrap++
AC++wrapperfortheLightWave3DSDK
The design of LightWrap++

The basic idea behind LightWrap++ is to make it as easy as possible for a C++ savvy programmer to develop for LightWave3D.

The LightWave 3D SDK

LightWave plugins are shared libraries that get loaded by the main appliaction on demand. In LW SDK terminology, a plugin play the role of a server, while LW itself is the host.

This basically means that a plugin "serves" functionality to LW.

From the C based SDK to LightWrap++

LWInstance

The void * pointer LWInstance that is passed around by LightWave is used to store a pointer to the plugin class. The Adaptor casts the LWInstance to the plugin class and calls the appropriate member function. The member functions are in turn virtual, and may be overrided by the derived class (which is the plugin class written by the user).

In the case of XPanels and LWPanels, the pointer to the class is stored as userdata, either as userdata for the Panel or for the control itself.

Advantages of using LWPP

Internals and technicalities

Exceptions

Every Callback from LightWave that is wrapped in the Adaptor classes catches exceptions and displays an error if one has been caught.

If possible an error code will be returned to LightWave 3D (for example in the Activate() functions).

Versioning

lwpp can adapt itself to different versions of the LW SDK. Version 7.5 and 9.3 are currently supported. Plugins written for an older SDK still work with newer version of LightWave 3D, with the exception of CameraHandlers written for LightWave 3D 9.0 - but this is due to a breaking change in the LW SDK.

The Preprocessor variable LW_SDK can be set to the following values:

  • 75
  • 93
Warning:
This will not automatically include the right headers.