Generic Class


These interface classes are not intended for direct usage; rather they should be inherited by your own subclass. (See Anatomy of a LightWave Python Plug-in)


class lwsdk.IGeneric

Bases: lwsdk.lwsdk.IHandlerFuncs

Proxy of C++ PCore::IGeneric class

 process(LWLayoutGeneric access) → int

Generic plug-ins are of the "single-shot" type. This is the entry point where Generic-class plug-ins perform all their actions.


class lwsdk.LWLayoutGeneric(*args)

Bases: object

Proxy of C++ PCore::LWLayoutGeneric class

 commandArguments(void data) → char

The function returns the string of arguments the Layout Generic plugin was called with, or None if no arguments were supplied.

 data → void

This is an opaque pointer to data used internally by Layout. Pass this as the first argument to the LWLayoutGeneric::lookup(), LWLayoutGeneric::execute() and LWLayoutGeneric::evaluate() methods.

 evaluate(void data, char command) → int

Issue the command with the name and arguments in the command string. This is an alternative to using LWLayoutGeneric::lookup() and LWLayoutGeneric::execute(). The command and its arguments are written to a single string and delimited by spaces.

 execute(void data, LWCommandCode cmd, PyObject py_dyna_values) → PyObject

Issue the command given by the command code argument. py_dyna_values is an array of DynaValue arguments.

 loadScene(char file, char name) → int

Load a scene file. The scene is loaded from the file named in the first argument. The second argument is the default filename for subsequent saving of the scene and the name that will be displayed to the user.

 lookup(void data, char cmdName) → LWCommandCode

Returns an integer code corresponding to the command name. The command is issued by passing the command code to the LWLayoutGeneric::execute() method. Command codes are constant for a given Layout session, so this only needs to be called once per command, after which the codes can be cached and then used in any number of calls to LWLayoutGeneric::execute().

 saveScene(char file) → int

Save the scene in its current state as a LightWave scene file.


class lwsdk.GenericFactory(name, klass)

Bases: lwsdk.lwsdk.IGenericFactory

Default Python Factory for IGeneric



class add_null(lwsdk.IGeneric):
    def __init__(self, context):
        super(add_null, self).__init__()

    # LWGeneric -------------------------------------------
    def process(self, ga):
        result = ga.evaluate(, "AddNull Null")
        result = ga.evaluate(, "Position 0 1 0")
ServerRecord = { lwsdk.GenericFactory("LW_PyAddNull", add_null) : ServerTagInfo }

Table Of Contents

Previous topic

Master Class

Next topic

Command Sequence Class

This Page