User guide
57
Instance Methods
The following instance methods are to be implemented in a class derived from the abstract ScenegraphGenerator
class:
• bool checkArgs(FnKat::GroupAttribute args)
• bool setArgs(FnKat::GroupAttribute args)
• FnKat::ScenegraphContext* getRoot()
bool checkArgs(FnKat::GroupAttribute args)
Checks the given argument structure against the expected argument structure regarding types, names, sizes, and
other attribute properties.
Returns true if the given argument structure is valid as input for the setArgs() function of the SGG plug-in (see
below), otherwise false.
The attributes in this case correspond to parameters in the ScenegraphGeneratorSetup node's parameter interface.
Any extra arguments in the given argument structure can quietly be ignored.
The default implementation simply returns true. This function does not necessarily need to be implemented, but it is
generally seen as good style if it is.
bool setArgs(FnKat::GroupAttribute args)
Applies the parameter values contained in the given argument structure to the scene graph generator plug-in.
Returns true if the parameter values were applied successfully, otherwise false.
Katana passes the arguments defined by the static getArgumentTemplate() function with their current parameter
values to this function to be used at runtime by the plug-in.
It is common to store values from arguments that are defined for the SGG plug-in in private or protected instance
variables of the ScenegraphGenerator-derived class, and to use them in the contexts that create locations and
attributes in the scene graph. These variables can be initialized in the constructor of the class and updated in the
setArgs() function, as shown in the following example:
bool CubeMaker::setArgs(
FnKat::GroupAttribute args)
{
if (!checkArgs(args))
return false;
// Apply the number of cubes
FnKat::IntAttribute numberOfCubesAttr = \
args.getChildByName("numberOfCubes");
8 SCENE GRAPH GENERATOR PLUG-INS | SGG PLUG-IN API CLASSES