Registering Classes

The plugin must study the features available in the application that loads the plugin and register and plug-in only the corresponding features.

This can be done by using R3ClassFind() function. For example, register new tool button classes only if the application has a tool bar. Register new geometric object classes only if the application has a geometric layer for managing geometric objects.

Below is an example about how to some of the most commonly needed classes can be registered.


int R3LibraryInit(R3APP *app) {
  if(R3ClassFind(R3CLID_PRIMLAYER))
    RegisterMySphere(app);
  if(R3ClassFind(R3CLID_MATERIALLAYER)) 
    RegisterMyMaterial(App);
  if(R3ClassFind(R3CLID_WFENGINE)) 
    RegisterMySphereWire(app);
  if(R3ClassFind(R3CLID_LAYERLIST))  
    RegisterMySphereInteractor(app);
  if(R3ClassFind(R3CLID_TOOLBAR))  
    RegisterMySphereTool(app);
  if(R3ClassFind(R3CLID_PROPERTYWINDOW))  
    RegisterMySpherePropertyGadget(app);
  if(R3ClassFind(R3CLID_CONTROLBAR))  
    RegisterMySphereControlGadget(app);
  if(R3ClassFind(R3CLID_NUMERICBAR)) 
    RegisterMySphereNumericGadget(app);
  if(R3ClassFind(R3CLID_FILER)) 
    RegisterIgesFormat(app); 
  if(R3ClassFind(R3CLID_FLOAD)) 
    RegisterIgesLoadGadget(app);
  if(R3ClassFind(R3CLID_FSAVE)) 
     RegisterIgesSaveGadget(app);
     ...
}