The New Kid

Beginning with LightWave 11, a new scripting option was introduced: Python. This is the first new scripting alternative within the product since LScript premiered back in the late 1990’s.

The introduction of Python into LightWave was engineered as a two-tiered integration. The first tier was designed to wrap the LightWave SDK as closely as possible in a one-to-one fashion. This means that Python scripts would be coded to function in much the same way a native-code plug-ins (e.g., C++), using the same “low-level” mechanisms and interfaces. This first tier was introduced in the 11.x series.

The second tier, scheduled for the LightWave 12.x series and beyond, added “high-level” elements on top of the first tier, “softening” the raw exposure to the LightWave SDK with simplified functionalities intended to reduce the code burden on the script writer, and expedite overall plug-in creation (much as LScript does in its wrapping of the LightWave SDK).

Both tiers are designed to exist simultaneously within the Python environment, providing the script writer alternatives that best suit their needs. Indeed, any combination of the “low-level” and “high-level” tier elements can be intermixed at the writer’s whim.

The PCore System


The following section deals with arcane programming subjects, and may lead to confusion, lost time, and in rare cases, hysterical ravings. Please proceed with caution.

The best approach to integrating Python (or any new scripting language, for that matter) is to bind it tightly to the LightWave SDK such that changes to the SDK are reflected with the utmost immediacy, and with as little human intervention as possible. This highly automated approach would provide the best way to ensure that the environment available within LightWave Python was as current as possible with the state of the LightWave SDK. The LightWave PCore system was designed to provide this automated language binding approach.

The LightWave PCore system contains a subsystem (the “wrapper”) that automatically generates a more-orthodox interface layer from the idiomatic LightWave SDK design, based on metadata that is used to “decorate” elements within the LightWave SDK headers (this PCore metadata is for internal use only, and is automatically extracted from the SDK headers before they reach you). This generated wrapper layer is then fed to a tool that generates Python bindings.

The PCore metadata can associate SDK elements with a number of different interface layer elements, and from that, a code “wrapper layer” is generated, typically comprised of C++ classes and methods, that is then submitted for generating Python bindings for LightWave.

For example, the LWMasterHandler structure declaration within the SDK headers is “decorated” by the PCore metadata as a ‘handler’ type based on its intended use, and this type information is then used by the PCore wrapper to generate C++ classes (with all methods and their requisite content) that serve as proxies for these elements (see this generated C++ class in Master Class). These automatically generated C++ class interfaces are then exported to the Python environment for direct use by you in your LightWave Python scripts.

Additionally, the PCore system is also responsible for providing the ‘glue’ that makes it possible to treat a Python script, with the properly formatted content, as a LightWave plug-in.

Table Of Contents

Previous topic

Welcome to LightWave Python’s documentation!

Next topic

Anatomy of a LightWave Python Plug-in

This Page