GlobalAvailability LightWave 6.0 Global class plug-ins provide services that other plug-ins can use. They extend the list of globals that are part of the plug-in API. Other plug-ins call your global class plug-in by calling the GlobalFunc with your server name as the first argument. LightWave calls your activation function, which fills in the local->data field. This is then passed back to the caller as the return value of the GlobalFunc call. Activation Function The local argument to a global's activation function is an LWGlobalService. typedef struct st_LWGlobalService { const char *id; void *data; } LWGlobalService;
Global class plug-ins are available in both Modeler and Layout by default. If you don't want to run in one of these components, call the System ID global in your activation function and return AFUNC_BADAPP if the LWSYS_TYPEBITS of the return value don't match a program you will run in. The following fragment will allow your global to be activated in Layout and Screamernet, but not in Modeler. unsigned long sysid, app; sysid = ( unsigned long ) global( LWSYSTEMID_GLOBAL, GFUSE_TRANSIENT ); app = sysid & LWSYS_TYPEBITS; if ( app != LWSYS_LAYOUT && app != LWSYS_SCREAMERNET ) return AFUNC_BADAPP; Example The vecmath sample is a Global class plug-in that provides a library of vector and matrix routines. Information on how to use this library in your plug-ins is given in the comments at the top of the source file. |