User guide
153
prmanSurfaceParams.Kd_color.value').getXML() )
Returns:
<numberarray_parameter name="value" size="3" tupleSize="3">
<number_parameter name="i0" value="1"/>
<number_parameter name="i1" value="1"/>
<number_parameter name="i2" value="1"/>
</numberarray_parameter
Observe that Kd_color is a tuple made up of 3 entries, which are all floats in the 0 to 1 range. You can construct an
attribute of this type using the following Python:
yourColor = PyScenegraphAttr.FloatAttr( [ 1.0, 1.0, 1.0 ] )
Inheritance Rules for Attributes
By default, attributes are inherited from parent locations. However, attributes can be overwritten at specified
locations where the values differ from ones defined higher up in the hierarchy, as used for Light Linking.
Some attributes are not inherited, for instance the globalStatements of a renderer defined at /root or the globals
defined at /root/world. Another example is the xform attribute, where it would not make sense to inherit a
transform defined for a group to all its children and thus perform the operation multiple times.
Setting Group Inheritance using the API
To prevent an attribute from being inherited, use the API function setGroupInherit( ) to disable group inheritance.
For example:
FnKat::GroupBuilder gb;
gb.setGroupInherit(false);
gb.build();
Light Linking
Light linking is a typical example of how a standard setting is defined high up in the hierarchy and then overridden at
a specified scene graph location where a different setting is needed. Shadow Linking works in the exact same way.
1. In an empty scene, create a sphere using a PrimitiveCreate Node.
Set the name to /root/world/geo/sphere.
2. Add a plane with a PrimitiveCreate node.
Set the name to /root/world/geo/plane.
3. Add a Merge node and connect both PrimitiveCreate nodes as inputs.
4. Add a light with a Gaffer node.
21 LOCATIONS AND ATTRIBUTES | INHERITANCE RULES FOR ATTRIBUTES