Enviroment Class

Note

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)

Handler

class lwsdk.IEnvironment(self)

Bases: lwsdk.lwsdk.IHandlerFuncs, lwsdk.lwsdk.IInterfaceFuncs, lwsdk.lwsdk.IGizmoFuncs, lwsdk.lwsdk.IItemFuncs, lwsdk.lwsdk.IRenderFuncs

Proxy of C++ PCore::IEnvironment class

 evaluate(LWEnvironmentAccess arg0) → LWError

This is where the environment handler does its work. At each time step in the animation, the evaluation function is called for each affected pixel in the image. The LWEnvironmentAccess class instance provided (described below) contains information about the environment to be colored.

 flags() → unsigned int

Returns flag bits combined using bitwise-or.

Access

class lwsdk.LWEnvironmentAccess(self, LWEnvironmentAccess source_)

Bases: object

Proxy of C++ PCore::LWEnvironmentAccess class

 colRect → double

In preview mode, this is where the evaluation function modifies the color at the corners of the rectangular area defined by LWEnvironmentAccess::h and LWEnvironmentAccess::p. The preview display interpolates between these at points inside the rectangle.

 color → double

In real mode, this is where the evaluation function modifies the color of the point defined by the direction vector LWEnvironmentAccess::dir.

 dir → LWDVector

A vector pointing toward a point on the backdrop to be colored. Use this when evaluating in real mode.

 h → double

The heading extent of a rectangular area of the backdrop, expressed in radians. In preview mode, this, along with LWEnvironmentAccess::p, form a bounding box in spherical coordinates of an area to be colored. They should be ignored in real mode.

 mode → LWEnvironmentMode

The context of the evaluation. Currently this distinguishes between rendering (lwsdk.EHMODE_REAL) and lower quality previewing (lwsdk.EHMODE_PREVIEW).

 p → double

The pitch extent of a rectangular area of the backdrop, expressed in radians. In preview mode, this, along with LWEnvironmentAccess::h, form a bounding box in spherical coordinates of an area to be colored. They should be ignored in real mode.

Factory

class lwsdk.EnvironmentFactory(name, klass)

Bases: lwsdk.lwsdk.IEnvironmentFactory

Default Python Factory for IEnvironment

 create(context)
 destroy(instance)

Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
class horizon(lwsdk.IEnvironment):
    def __init__(self, context, count):
        super(horizon, self).__init__()

        self._skySq  = 2.0
        self._gndSq  = 2.0
[...]
    # LWEnvironment ---------------------------------------
    def flags(self):
        return 0

    def evaluate(self, ea):
        dir = lwsdk.Vector(ea.dir)
        color = lwsdk.Color(ea.color)
[...]
ServerRecord = { lwsdk.EnvironmentFactory("LW_PyHorizon", horizon) : ServerTagInfo }

Table Of Contents

Previous topic

Image Saver Class

Next topic

Shader Class

This Page