Render attributes ================= This example shows how to query the render attributes of an object or scene path, as they would be sent to renderer. These attributes are usually the geometric setup of the object (such as sideness, subsivision, etc.) and shader setup (such as the surface shader, or connected subshaders.) Querying attributes is useful for automated sanity checking, or transfering data from Guerilla to another software. Inspecting render attributes ---------------------------- .. code-block:: python from guerilla import SceneGraphNode, subshader result = SceneGraphNode.getrenderattributes ("Sphere1", False) # result is a dictionary, it contains an attributes field attributes = result["attributes"] for name, value in attributes.iteritems (): # attribute are named 'category.item' # For instance, the primary visibility attribute is visibility.primary # Dynamic Attributes and shader parameters are named 'variable.###', # and their value can be a subshader object print (name, value) if isinstance (value, subshader): print (value.getname ()) for subname, subvalue in value.getparameters ().iteritems (): print (subname, subvalue) Inspecting a render attribute origin ------------------------------------ Calling getrenderattributes with origin = True, you get the RenderGraph node that set each attribute, as a string path. .. code-block:: python from guerilla import SceneGraphNode, subshader result = SceneGraphNode.getrenderattributes ("Sphere1", True) subdiv_origin = result["origin"].get ("trace.subdivlevel") if subdiv_origin: print ("the node that set the subdiv level is "+subdiv_origin) Note that only RenderGraph nodes are set as origin. If a attribute was set directly in the scene graph, its origin is not returned.