Displacement 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.IDisplacement(self)

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

Proxy of C++ PCore::IDisplacement class

 evaluate(LWDisplacementAccess arg0)

This is where the displacement happens. At each time step, the evaluation function is called for each vertex in the object. The position of the vertex is examined and modified through the LWDisplacementAccess class instance (described below).

 flags() → unsigned int

Returns bit flags combined using bitwise-or. The following flags tell Layout whether the displacement will be in world coordinates and whether it should occur after morphing, or before or after the object has been deformed by bones. lwsdk.LWDMF_LAST tells deformation should be done after all other deformations, including subdivision, have been applied.

Only one of these flags should be set:

lwsdk.LWDMF_WORLD
lwsdk.LWDMF_BEFOREBONES
lwsdk.LWDMF_AFTERMORPH
lwsdk.LWDMF_LAST

Another flag specifies if a per-vertex normal is needed. If this flag is returned, the LWDisplacementAccess::wNorm member will be filled with valid data.

lwsdk.LWDMF_NEED_NORMALS

Access

class lwsdk.LWDisplacementAccess(self, LWDisplacementAccess source_)

Bases: object

Proxy of C++ PCore::LWDisplacementAccess class

 info → LWMeshInfo

A LWMeshInfo instance for the object.

 oPos → LWDVector

The original point location in object coordinates. This is read-only.

 point → LWPntID

The point ID. This can be used to retrieve other information about the point from the LWMeshInfo class instance.

 source → LWDVector

The location to be transformed in place by the displacement. If the flags function returned the lwsdk.LWDMF_WORLD bit, the source is in world coordinates and has already been modified by morphing, bones and object motion. Otherwise the source is in object coordinates (after morphing, before item motion, and before or after bone effects, depending on whether the flags function returned lwsdk.LWDMF_BEFOREBONES).

 wNorm → LWDVector

The average normal of the polygon normals of the polygons surrounding the currently evaluated vertex. This member will only be filled with valid data when the lwsdk.LWDMF_NEED_NORMALS flag has been specified.

Factory

class lwsdk.DisplacementFactory(name, klass)

Bases: lwsdk.lwsdk.IDisplacementFactory

Default Python Factory for IDisplacement

 create(context)
 destroy(instance)

Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
class lazy_points(lwsdk.IDisplacement):
    def __init__(self, context):
        super(lazy_points, self).__init__()
        self._itemid = context
        self._lag_rate = .25;
        self._controls = []
[...]
    # LWDisplacement --------------------------------------
    def flags(self):
        return lwsdk.LWDMF_WORLD

    def evaluate(self, da):
        item_info = lwsdk.LWItemInfo()

        pivot = item_info.param(self._itemid, lwsdk.LWIP_PIVOT, self._time)
[...]
ServerRecord = { lwsdk.DisplacementFactory("LW_PyLazyPoints", lazy_points) : ServerTagInfo }

Table Of Contents

Previous topic

Object Replacement Class

Next topic

Instancer Class

This Page