Chapter 1. Registering Classes

All Realsoft applications support plugin interface, so plugin libraries cannot simply register all classes they implement. The side effect would be that in the first case a plugin would turn say a console based rendering application into an application which has a user interaface, tools, and other user interface objects one can typically find from the Realsoft 3D modeling, rendering and animation program.

The plugin must honor the nature and structure of the application that attemps to load the plugin, by registering only those classes the application already manages.

This can be done by using R3ClassFind() function. For example, register new tool button classes only if the application has a tool bar class. Register new geometric object classes only if the application has a geometric layer, used for managing this type of 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)) {
    // register new geometric classes 
    RegisterMySphere(app);
  }   

  if(R3ClassFind(R3CLID_MATERIALLAYER)) {
    // register material classes 
    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);
  }