CPIDSOEXPORT CPI_Bool rpiPluginInit( void ) {} CPIDSOEXPORT void upiPluginCleanup( void ) {}which are used to initialize and cleanup the plugin, respectively. These functions are called only once each, Init() at startup time and Cleanup() when RAYZ exits. The register and unregister calls are put here. For example, a node would have the following (taken from Simple.C):
///////////////////////////////////////////// // register node and image op CPIDSOEXPORT CPI_Bool rpiPluginInit( void ) { CPI_Bool retval = CPI_TRUE; retval = cpiRegisterImageOp( &opinfo ); if ( retval ) // if success, register the node retval = cpiRegisterNode( &ninfo ); return retval; } ////////////////////////////////////////////// // unregister node and image op CPIDSOEXPORT void upiPluginCleanup( void ) { cpiUnregisterImageOp( "opname" ); cpiUnregisterNode( "nodename" ); }The declaration "CPIDSOEXPORT" is there to make sure that things work properly under Windows, and should be present for portability reasons.
Notice that plugin types are registered using the address of the structure, but unregistered by their name (which RAYZ knows from the registration call). Each plugin type has its own register/unregister calls, as shown in this table (this information is also in CPI_Register.h):
Plugin Type | Register Call | Unregister Call | Structure Type |
---|---|---|---|
Device | cpiRegisterDevice() | cpiUnregisterDevice() | RPI_DeviceInfo |
File Importer | cpiRegisterFileImporter() | cpiUnregisterFileImporter() | RPI_FileImportInfo |
File Manager | cpiRegisterFileManager() | cpiUnregisterFileManager() | RPI_FMInfo |
Node | cpiRegisterNode() | cpiUnregisterNode() | RPI_NodeInfo |
Image Format | cpiRegisterImageReader() | cpiUnregisterImageReader() | RPI_ImageInfo |
Image Op | cpiRegisterImageOp() | cpiUnregisterImageOp() | RPI_ImageOpInfo |
LUT | cpiRegisterLUT() | cpiUnregisterLUT() | RPI_LUTInfo |
Overlay | cpiRegisterOverlay() | cpiUnregisterOverlay() | RPI_OverlayInfo |
Expression | cpiRegisterExpression() | cpiUnregisterExpression() | RPI_ExpressionInfo |
Curve Read/Write | cpiRegisterCurveIO() | cpiUnregisterCurveIO() | RPI_CurveIOInfo |
ScriptOption | cpiRegisterScriptOption() | cpiUnregisterScriptOption() | RPI_ScriptInfo |