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)
Bases: lwsdk.lwsdk.IHandlerFuncs, lwsdk.lwsdk.IInterfaceFuncs, lwsdk.lwsdk.IGizmoFuncs, lwsdk.lwsdk.IItemFuncs, lwsdk.lwsdk.IRenderFuncs
Proxy of C++ PCore::IInstancer class
This is where the instancing happens. At each new time, the evaluation function is called for each instancer plug-in in the host object. Instances can be added, destroyed and modified using the LWItemInstancerFuncs
global, using the LWItemInstancerID from the LWInstancerAccess
instance provided (described below), as the first parameter into the functions.
Bases: object
Proxy of C++ LWInstancerAccess class
The ID of the internal instancer.
The mode the plugin should operate in. These are:
lwsdk.LWINSTEVAL_RENDER
: the instancer is being evaluated for render purposes. lwsdk.LWINSTEVAL_OPENGL
: the instancer is being evaluated for OpenGL display purposes.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | class city_block(lwsdk.IInstancer):
# NORTH (+Z)
# ^
# |
# NW_CORNER----------------NE_CORNER
# | |
# | |
# WEST (-X) <-- | CENTER | --> EAST (+X)
# | |
# | |
# SW_CORNER----------------SE_CORNER
# |
# v
# SOUTH (-Z)
SOURCE_CENTER, SOURCE_NWCORNER, SOURCE_SWCORNER, SOURCE_SECORNER, SOURCE_NECORNER = range(0, 5)
# specifically, what value has been modified?
MOD_ANCHOR = 0x0001
MOD_WIDTH = 0x0002
MOD_DEPTH = 0x0004
MOD_MARGIN = 0x0008
MOD_RAND_WIDTH = 0x0010
MOD_WIDTH_MIN = 0x0020
MOD_WIDTH_MAX = 0x0040
MOD_RAND_DEPTH = 0x0080
MOD_DEPTH_MIN = 0x0100
MOD_DEPTH_MAX = 0x0200
MOD_RAND_HEIGHT = 0x0400
MOD_HEIGHT_MIN = 0x0800
MOD_HEIGHT_MAX = 0x1000
MOD_REGENERATE = MOD_ANCHOR | MOD_WIDTH | MOD_DEPTH
def __init__(self, context):
super(city_block, self).__init__()
self._itemid = context
[...]
# LWInstancer -----------------------------------------
def evaluate(self, ia):
inst_funcs = lwsdk.LWItemInstancerFuncs()
if self._grid_refresh or (not self._instancer_active):
while inst_funcs.numInstances(ia.instancer):
inst_funcs.destroyInstance(ia.instancer, inst_funcs.first(ia.instancer))
[...]
ServerRecord = { lwsdk.InstancerFactory("LW_PyCityBlock", city_block) : ServerTagInfo }
|