Open Inventor Release 2024.2.0
 
Loading...
Searching...
No Matches
Defining the Constructor

Implement the constructor for the class. Begin with the macro SO_ENGINE_CONSTRUCTOR(). Then use the macros SO_ENGINE_ADD_INPUT() and SO_ENGINE_ADD_OUTPUT() to add the engine inputs and outputs and to set default values for the outputs. Perform any other class-specific initialization, if needed. For example:

SoOnOff::SoOnOff()
{
SO_ENGINE_CONSTRUCTOR( SoOnOff );
SO_ENGINE_ADD_INPUT( on, () ); // no default value for
// trigger fields
SO_ENGINE_ADD_INPUT( off, () ); // no default value
SO_ENGINE_ADD_INPUT( toggle, () ); // no default value
SO_ENGINE_ADD_OUTPUT( isOn, SoSFBool );
SO_ENGINE_ADD_OUTPUT( isOff, SoSFBool );
state = FALSE; // engine is off by default
}

Notice that this is where the outputs are bound to a particular field type.