User guide
136
This code can be found in ViewSetAndDefaultParamsError.py and run using:
katana –scripts ViewSetAndDefaultParamsError.py
However, you'll find that this script does not work, complaining that diffuseParam is of NoneType. This would
suggest that our call to getParameter failed to return a Parameter object.
Why is this the case when we can clearly see the values present in the Parameters tab, or, when inspecting the
generated location in the Attributes tab? The reason for this lies in the node's dynamic parameters, how they are
updated using universal attributes, and how universal attributes are populated using DAPs.
Reading Default Parameters
For values that have not been set locally, there exists a mechanism through which Katana is able to learn about these
values so they can be displayed in the UI and through its APIs. There are three concepts related to this, which are
encapsulated within a single function call you need to use.
Universal Attributes and DAPs
Universal attributes are the complete set of scene graph attributes for a particular scene graph location, including
default values (where they have not been specified) and UI hints allowing them to be displayed correctly. Values are
provided in a waterfall fashion, such that if a local value has not been set it falls back on inherited scene graph
attributes, Args files and the DAP mechanism.
Universal attributes are generated automatically in UI mode each time you open the Parameter interface, or inspect
the values generated at a location in the Scene Graph tab. Katana requests the universal attributes for a particular
location then use the returned object to display the required values.
As mentioned earlier, within Katana there is group of systems known as Default Attribute Producers that are
responsible for providing default values to universal attributes where no value has been specified. To force the
production of the universal attributes for a given node you can call getUniversalAttr() on it, which returns a
PyScenegraphAttr object that you can view by running the script, GetUniversalAttrs.py.
With this object, Katana can then update the appropriate portions of the UI by simply iterating over this object to
obtain the required values.
Dynamic Parameters
Closely related to the universal attributes are node parameters, which are dependent on attributes in the incoming
Scene Graph.
Taking the Material node in MaterialScene.katana as an example, if we want to edit our existing material using
another Material node downstream in edit mode, we need to be able to display the existing material's values in the
19 UNIVERSAL ATTRIBUTES | DEFAULT ATTRIBUTES