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: object
Proxy of C++ PCore::LWImageLoaderLocal class
Call this when you're ready to begin sending image data to LightWave. This will be after you've opened and examined the image file and know what it contains. The pixel type code in arg2
tells LightWave what kind of pixel data you will be sending, and this will in general depend on what kind of pixel data the file contains, although it doesn't have to. Pixel type codes are listed on the Image I/O page.
The LWImageLoaderLocal::begin()
method returns an instance of a LWImageProtocol
, which is what you'll use to actually transfer the image data. (See the example Image Loader Python scripts.) If you call LWImageLoaderLocal::begin()
, you must also be sure to call LWImageLoaderLocal::done()
so that LightWave can free resources associated with the LWImageProtocol
instance it allocated for you.
Completes the image loading process. The protocol is the LWImageProtocolID
returned by LWImageLoaderLocal::begin()
. Only call LWImageLoaderLocal::done()
if you previously called LWImageLoaderLocal::begin()
.
The name of the file to load.
The loader can use this LWMonitor
class instance to update the user about its progress through the frame. You don't have to use this, but you're encouraged to if your image loading takes an unusual amount of time.
Pass this as the first argument to the begin and done functions. It's an opaque pointer to data used internally by LightWave.
Set this to indicate whether the image was loaded successfully. See the imgload.html
file in the LWSDK for possible result codes.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | class ascii_image(lwsdk.IImageLoader):
def __init__(self, context):
super(ascii_image, self).__init__()
# LWImageLoader -------------------------------------------
def process(self, loader_access):
loader_access.result = lwsdk.IPSTAT_BADFILE
# open and process 'filename'
if os.path.exists(loader_access.filename) and \
(loader_access.filename.endswith('.txt') or loader_access.filename.endswith('.asc')):
[...]
ServerRecord = { lwsdk.ImageLoaderFactory("LW_PyASCIIImage", ascii_image) : ServerTagInfo }
|