Base Class Interfaces

These classes are inherited by the handler interfaces. (see Handler Interfaces)

Note

These base classes are not intended for direct usage; rather they are inherited by handler classes, which are themselves intended to be subclassed by you in your Python script. (see Anatomy of a LightWave Python Plug-in)

IPlugin

This class is the “superclass” from which all other classes inherit. At this time, it provides no functionality beyond providing a base type for all plug-in subclasses.

class lwsdk.IPlugin(self)

Bases: object

Proxy of C++ PCore::IPlugin class

Handler Interfaces

class lwsdk.IHandlerFuncs(self)

Bases: lwsdk.IPlugin

Proxy of C++ PCore::IHandlerFuncs class

 inst_acquire()

This Python-only callback method may be used by the script as a boundary function to know when it is safe to acquire resources that may cause the script instance to be "locked" by the Python interpreter. Such "locking" occurs as reference counts to script elements accumulate. If any such locks exist on resources when the script is ready to terminate, the Python class destructor method (__del__()) will not be invoked, and the script instance will languish in memory, unused but consuming memory and resources. In this arrangement, the IHandlerFuncs::inst_release() becomes functionally equivalent to the __del__() destructor method, but is guaranteed to be called (whereas the destructor may not be if "locks" exist).

The "ring_test.py" example Python plug-in uses this method to attach to the communication channel, and it is released when the corresponding IHandlerFuncs::inst_release() method is invoked. The use of a callback (which is a required parameter to the LWComRing::ringAttach() method) causes a "lock" on the class instance within the Python interpreter. Only by calling the LWComRing::ringDetach() method in IHandlerFuncs::inst_release() callback will that particular "lock" be freed, and the script instance made available for reclamation.

 inst_copy(PyObject src) → LWError

This callback is invoked when a copy of your script instance is being made by LightWave. Copy the salient elements from your script instance into the one provided.

Return None if there were no issues with the copy, or return a character string with pertinent information to indicate an error.

 inst_descln() → char

The return value of this callback is a description (as a character string) of your plug-in that will be displayed to the user on the Plug-in panel. Since this callback will be used whenever that information needs to be refreshed, you may include information about active settings or states within the returned string to keep the user informed.

 inst_load(LWLoadState arg0) → LWError

This callback is invoked by LightWave after your script has been activated from an in-progress scene or object load. It indicates that the load has progressed to a point where you can use the provided LWLoadState class instance to read in settings your plug-in may have previously stored using IHandlerFuncs::inst_save().

 inst_release()

This Python-only callback method is invoked by PCore when termination of the script is imminent, but before the actual destruction of the script instance. Within this callback, you should release all "locked" resources you may have acquired in the IHandlerFuncs::inst_acquire() method.

 inst_save(LWSaveState arg0) → LWError

This callback is invoked by LightWave after the presence of your script has been stored into an in-progress scene or object save. At the point the callback is activated, you may use the provided LWSaveState class instance to write your settings into the scene or object file.

class lwsdk.IInterfaceFuncs(self)

Bases: object

Proxy of C++ PCore::IInterfaceFuncs class

 inter_ui() → int

When the user indicates a wish to interact with your plug-ins Graphical User Interface (GUI), this callback will be invoked. Within this callback, you should create an instance of your GUI, post it to the user to manipulate, and then update your script's operational parameters from the result, if indicated.

Several of the included Python example plug-in scripts implement this callback and provide GUIs so their data may be modified by the user.

 inter_xpanel() → LWXPanelID

!! NOT IMPLEMENTED !!

class lwsdk.IGizmoFuncs(self)

Bases: object

Proxy of C++ PCore::IGizmoFuncs class

 gizmo_adjust(LWToolEvent event, int handle) → int

Drag the given handle to a new location and return the index of the handle that should continue being dragged (often the same as the input).

 gizmo_count(LWToolEvent event) → int

Returns the number of handles. If zero, then the gizmo_start() callback is used to set the initial handle point.

 gizmo_dirty() → int

Returns true (1) if either the wireframe or help string need to be refreshed.

 gizmo_done()

Destroy the instance. Called when the user discards the tool.

 gizmo_down(LWToolEvent event) → int

Process a mouse-down event. If this function returns false (0), handle processing will be done instead of raw mouse event processing.

 gizmo_draw(LWCustomObjAccess ca)

Display a wireframe representation of the tool in a 3D viewport. Typically this draws the handles.

gizmo_end(self, LWToolEvent arg0, int i) → int
 gizmo_event(int code)

Process a general event: lwsdk.DROP, lwsdk.RESET or lwsdk.ACTIVATE

 gizmo_handle(LWToolEvent event, int handle, LWDVector pos) → int

Returns the 3D location and priority of the handle, or zero if the handle is currently invalid.

Note that the third parameter, pos, is currently unused and should be ignored.

 gizmo_help(LWToolEvent event) → char

Returns a text string to be displayed as a help tip for this tool. The string should have anchorage within the Python instance, or it may be consumed by Python's garbage collector.

 gizmo_move(LWToolEvent event)

Process a mouse-move event. This is only called if the gizmo_down() function returned true (1).

 gizmo_panel() → LWXPanelID

!! NOT IMPLEMENTED !!

 gizmo_start(LWToolEvent event) → int

Take an initial mouse-down position and return the index of the handle that should be dragged.

 gizmo_up(LWToolEvent event)

Process a mouse-up event. This is only called if the gizmo_down() function returned true (1).

class lwsdk.IItemFuncs(self)

Bases: object

Proxy of C++ PCore::IItemFuncs class

 item_changeID(LWItemID arg0)

Object's in a LightWave scene all have unique "object identifiers" (or "object ids") associated with them. If it ever happens that a scene object has its identifier altered (as may be the case in, for example, a load-from-scene situation), this callback will be invoked with a sequence of LWItemID pairs, with the first id of each pair representing the "before" value, and the second, the "after" value.

 item_changeName(arg0)

!! NOT DOCUMENTED !!

 item_useItems() → LWItemID

When called, LightWave is querying the plug-in for information about the objects in which it takes an active interest. A sequence containing one or more LWItemID values should be returned, or None if this is not applicable.

class lwsdk.IRenderFuncs(self)

Bases: object

Proxy of C++ PCore::IRenderFuncs class

 rend_cleanup()

Called after the last frame of a rendering session is completed.

 rend_init(int arg0) → LWError

This is a boundary callback that lets the plug-in know that a rendering operation is about to begin. This is called before the first frame of a rendering session is begun. arg0 will be either lwsdk.LWINIT_PREVIEW or lwsdk.LWINIT_RENDER. Returns a string containing an error message if an error occurs, otherwise returns None.

 rend_newTime(LWFrame arg0, LWTime arg1) → LWError

Called at the start of a new sampling pass. This may be called more than once for the same frame but for slightly different times. Returns an error message string, or None.

class lwsdk.ILayoutToolFuncs(self)

Bases: object

Proxy of C++ PCore::ILayoutToolFuncs class

 tool_adjust(LWToolEvent event, int handle) → int

Drag the given handle to a new location and return the index of the handle that should continue being dragged (often the same as the input).

 tool_count(LWToolEvent event) → int

Returns the number of handles. If zero, then the gizmo_start() callback is used to set the initial handle point.

 tool_dirty() → int

Returns true (1) if either the wireframe or help string need to be refreshed.

 tool_done()

Destroy the instance. Called when the user discards the tool.

 tool_down(LWToolEvent event) → int

Process a mouse-down event. If this function returns false (0), handle processing will be done instead of raw mouse event processing.

 tool_draw(LWCustomObjAccess ca)

Display a wireframe representation of the tool in a 3D viewport. Typically this draws the handles.

tool_end(self, LWToolEvent arg0, int i) → int
 tool_event(int code)

Process a general event: lwsdk.DROP, lwsdk.RESET or lwsdk.ACTIVATE

 tool_handle(LWToolEvent event, int handle, LWDVector pos) → int

Returns the 3D location and priority of the handle, or zero if the handle is currently invalid.

Note that the third parameter, pos, is currently unused and should be ignored.

 tool_help(LWToolEvent event) → char

Returns a text string to be displayed as a help tip for this tool. The string should have anchorage within the Python instance, or it may be consumed by Python's garbage collector.

 tool_move(LWToolEvent event)

Process a mouse-move event. This is only called if the gizmo_down() function returned true (1).

 tool_panel() → LWXPanelID

!! NOT IMPLEMENTED !!

 tool_start(LWToolEvent event) → int

Take an initial mouse-down position and return the index of the handle that should be dragged.

 tool_up(LWToolEvent event)

Process a mouse-up event. This is only called if the gizmo_down() function returned true (1).

Factory Interfaces

For the most part, Factories are mechanisms that serve their purpose without the need for your direct usage of them. Creating instances of them, and providing them in your ServerRecord is sufficient.

However, you may subclass a Factory Interface to implement your own special functionality (as long as you retain the base functionality of the interface). The “master_test.py” example Python plug-in actually performs such a subclassing of its Factory Interface to provide some additional functionality. Please refer to that script for more details.

Note

Factory Interfaces are documented here only for completeness.

class lwsdk.IFactoryFuncs(self)

Bases: object

Proxy of C++ PCore::IFactoryFuncs class

 destroy(PyObject arg0)
 name() → char
class lwsdk.ICommandSequenceFactory(self)

Bases: lwsdk.IFactoryFuncs

Proxy of C++ PCore::ICommandSequenceFactory class

 create(PyObject context) → PyObject
 destroy(PyObject arg0)
 name() → char
class lwsdk.IGenericFactory(self)

Bases: lwsdk.IFactoryFuncs

Proxy of C++ PCore::IGenericFactory class

 create(PyObject context) → PyObject
 destroy(PyObject arg0)
 name() → char
class lwsdk.IImageLoaderFactory(self)

Bases: lwsdk.IFactoryFuncs

Proxy of C++ PCore::IImageLoaderFactory class

 create(PyObject context) → PyObject
 destroy(PyObject arg0)
 name() → char
class lwsdk.IImageSaverFactory(self)

Bases: lwsdk.IFactoryFuncs

Proxy of C++ PCore::IImageSaverFactory class

 create(PyObject context, LWImageSaverLocal imagesaver_local) → PyObject
 destroy(PyObject arg0)
 name() → char
class lwsdk.IEnvironmentFactory(self)

Bases: lwsdk.IFactoryFuncs

Proxy of C++ PCore::IEnvironmentFactory class

 create(PyObject context) → PyObject
 destroy(PyObject arg0)
 name() → char
class lwsdk.IShaderFactory(self)

Bases: lwsdk.IFactoryFuncs

Proxy of C++ PCore::IShaderFactory class

 create(PyObject context) → PyObject
 destroy(PyObject arg0)
 name() → char
class lwsdk.IObjReplacementFactory(self)

Bases: lwsdk.IFactoryFuncs

Proxy of C++ PCore::IObjReplacementFactory class

 create(PyObject context) → PyObject
 destroy(PyObject arg0)
 name() → char
class lwsdk.IDisplacementFactory(self)

Bases: lwsdk.IFactoryFuncs

Proxy of C++ PCore::IDisplacementFactory class

 create(PyObject context) → PyObject
 destroy(PyObject arg0)
 name() → char
class lwsdk.IInstancerFactory(self)

Bases: lwsdk.IFactoryFuncs

Proxy of C++ PCore::IInstancerFactory class

 create(PyObject context) → PyObject
 destroy(PyObject arg0)
 name() → char
class lwsdk.ILayoutToolFactory(self)

Bases: lwsdk.IFactoryFuncs

Proxy of C++ PCore::ILayoutToolFactory class

 create(PyObject context) → PyObject
 destroy(PyObject arg0)
 name() → char
class lwsdk.INodeFactory(self)

Bases: lwsdk.IFactoryFuncs

Proxy of C++ PCore::INodeFactory class

 create(PyObject context) → PyObject
 destroy(PyObject arg0)
 name() → char
class lwsdk.IChannelFactory(self)

Bases: lwsdk.IFactoryFuncs

Proxy of C++ PCore::IChannelFactory class

 create(PyObject context) → PyObject
 destroy(PyObject arg0)
 name() → char
class lwsdk.IItemMotionFactory(self)

Bases: lwsdk.IFactoryFuncs

Proxy of C++ PCore::IItemMotionFactory class

 create(PyObject context) → PyObject
 destroy(PyObject arg0)
 name() → char
class lwsdk.IMasterFactory(self)

Bases: lwsdk.IFactoryFuncs

Proxy of C++ PCore::IMasterFactory class

 create(PyObject context) → PyObject
 destroy(PyObject arg0)
 name() → char
class lwsdk.IFrameBufferFactory(self)

Bases: lwsdk.IFactoryFuncs

Proxy of C++ PCore::IFrameBufferFactory class

 create(PyObject context) → PyObject
 destroy(PyObject arg0)
 name() → char
class lwsdk.ICustomObjFactory(self)

Bases: lwsdk.IFactoryFuncs

Proxy of C++ PCore::ICustomObjFactory class

 create(PyObject context) → PyObject
 destroy(PyObject arg0)
 name() → char
class lwsdk.IImageFilterFactory(self)

Bases: lwsdk.IFactoryFuncs

Proxy of C++ PCore::IImageFilterFactory class

 create(PyObject context) → PyObject
 destroy(PyObject arg0)
 name() → char

Table Of Contents

Previous topic

The Python ‘lwsdk’ Module

Next topic

Handler Interfaces

This Page