User guide

135
the command line as follows:
katana –script <script name>
Default Attributes
As discussed earlier, Katana only communicates values that have been set explicitly in a Katana project. As there are a
number of ways in which a particular parameter or Scene Graph attribute can obtain its value, a number of color
codes are used to denote how the value you see has been derived (for a full list see Help > User Guide > Editing a
Node's Parameters). For example, load MaterialScene.katana from the scenes directory. You can see that under
the Material node, parameters Kd_color and Ks have been set, and this is indicated by the state badge next to the
parameter name.
To see what is actually communicated to the renderer, right-click a Gaffer node and select Debugging > Open .rib
output in <your selected viewer> or Debugging > Open .ass output in <your selected viewer>.
Reading Parameters
Reading the parameters that have been set on a particular node, like in the above example, can be achieved by
running the following example script:
katana –scripts ViewParams.py
which simply obtains a reference to the Material node and outputs the value of the Ks parameter to the console.
Now, suppose our script wanted to read both the Ks parameter (set on the Node) and Kd parameter (taking its
default), and make some decision based on their values. Intuitively, you would expect the following code fragment
would achieve this:
# Access the Ks and Kd parameter on the material node
specularParam = m.getParameter('shaders.prmanSurfaceParams.Ks.value')
diffuseParam = m.getParameter('shaders.prmanSurfaceParams.Kd.value')
# Make decision to do something
if specularParam.getValue(1) > 0.1:
if diffuseParam.getValue(1) > 0.5:
print 'diffuse > 0.5'
else:
print 'diffuse < 0.5'
19 UNIVERSAL ATTRIBUTES | DEFAULT ATTRIBUTES