This is the most basic plugin you can write using lwpp.
This is a generic plugin that just opens a requestor with displaying "Hello World".
The first thing that needs to be done is to include the appropriate header. Since this is a simple Generic plugin, all you need is this:
Next you define that class that will be the plugin. The name of the class has no significance (but we advise to name it like your plugin). Since this is a Generic plugin, it needs to be derived from the LayoutGenericHandler class.
- Note:
- All of LightWrap++ is contained in the lwpp namespace. We advise against a using lwpp;, instead explicitly use the namespace when using LightWrap++ to make your code more explicit.
Our class only contains one member function, "Activate", which gets called when the user selects the plugin within Lightwave.
{
public:
int Activate()
{
Here we just display a requester using the
lwpp::LWMessage class (which is available at all times during the life cycle of lwpp plugins).
The last thing to do is to register the plugin with Lightwave. Every Adaptor class (which are template classes to connect the lwpp classes with Lightwave) has a constructor that makes the plugin available for Lightwave. The first paremeter to the constructor is the name of the plugin, the second (optional) parameter are the tags.
The name if the instance (hwInstance in this case) is of no importance.
That's all there is to it. Here is the complete code again:
{
public:
{
return 0;
}
};