User guide

58
_numberOfCubes = numberOfCubesAttr.getValue(20, false);
// Update the rotation flag
FnKat::IntAttribute rotateCubesAttr = \
args.getChildByName("rotateCubes");
_rotateCubes = \
bool(rotateCubesAttr.getValue(0, false));
return true;
}
NOTE: Versions of Katana prior to 2.0v1 provided you with default values for all SGG arguments if they
had not been specified locally. In versions 2.0v1 and later, this is no longer the case and you must now
specify the default value yourself. This can be achieved using the FnAttribute library, for example:
FnKat::IntAttribute attr = args.getChildbyName("attr");
int value = attr.getValue(20, //DEFAULT VALUE
false); //THROW ERROR IF DEFAULT VALUE NOT
//AVAILABLE OTHERWISE RETURN DEFAULT
//VALUE
FnKat::ScenegraphContext* getRoot()
Returns an instance of a class derived from ScenegraphContext that represents the root location of the tree of scene
graph locations that are generated by the SGG plug-in.
This is the first step of traversing the contexts in order to create a scene graph structure where the subsequent steps
involve retrieving the child and sibling nodes.
FnKat::ScenegraphContext* CubeMaker::getRoot()
{
return new CubeRootContext(_numberOfCubes,
_rotateCubes);
}
Registering an SGG Plug-in
In the implementation of a custom ScenegraphGenerator-derived class you also need to add some data structures
and functions that make the plug-in known to Katana. These are easy to add using two predefined macros, as shown
in the following code example:
DEFINE_SGG_PLUGIN(CubeMaker)
8 SCENE GRAPH GENERATOR PLUG-INS | SGG PLUG-IN API CLASSES