User guide
62
Instance Methods for Attributes
The following two instance methods define the names, types, and values of attributes that should live on the current
custom scene graph location:
void getLocalAttrNames(std::vector<std::string>* names)
Fills the given list of names of attributes according to the attributes that should live on the scene graph location
represented by the current context.
Each name in the modified list should be the name of either a single attribute, like type, or the top-level name of a
group of attributes, like xform.
The following code snippet shows example implementations from two custom classes derived from
ScenegraphContext:
void CubeRootContext::getLocalAttrNames(
std::vector<std::string>* names) const
{
names->clear();
names->push_back("type");
names->push_back("xform");
}
void CubeContext::getLocalAttrNames(
std::vector<std::string>* names) const
names->clear();
names->push_back("name");
names->push_back("type");
names->push_back("xform");
names->push_back("geometry");
{
}
Note that the CubeRootContext::getLocalAttrNames() function does not add the geometry attribute to the list
of attribute names, as the corresponding scene graph location is of type group, which does not hold geometry data,
whereas the implementation in the CubeContext class does, as its corresponding location in the scene graph is of
type polymesh for which geometry data is provided.
Also note that the getLocalAttrNames() function of the root context does not contain "name" in the resulting list
of attribute names, as the name of the root location is defined by the location that is set in the
ScenegraphGeneratorSetup node's parameters.
The getLocalAttrNames() function is used to tell Katana what attributes are provided in a scene graph context by
populating the given list of attribute names. In order to access the actual attribute data, the getLocalAttr() function
is called on demand with the name of one of the attributes that are provided.
8 SCENE GRAPH GENERATOR PLUG-INS | SGG PLUG-IN API CLASSES