OpenGLContext.visitor

Traversal objects for Contexts and scenegraphs

Functions

Classes

class _Finder( Visitor ):
Traverse a scenegraph looking for bindable nodes
This is a simple implementation of a scenegraph-search which looks for all nodes which are instances of any of a given set of classes/types.
Attributes: result -- the resulting set of node-paths desiredTypes -- the node-types being searched for
See the find function for the normal usage API
Extremely basic visitor/traversal object for scenegraphs
The "visitor" does not actually follow the classic visitor pattern (where the nodes dispatch the visitor to their children). Instead, it is a traversal mechanism that has four major points of customisation:
vmethods
virtual methods which are applied to a node during traversal. Each applicable vmethod (is registered as a method for one of the node's parent classes) is applied _in turn_, so it is possible to have large numbers of vmethods called for any given node. Return values are callable tokens which perform any state-resetting required
See: buildVMethods
preVisit
called for _every_ node before visiting, if it returns a false value, then the node's vmethods and children are _not_ processed.
postVisit
called for _every_ node where preVisit returned a true value as the last customisation point before the visitor finished processing the node.
Note: For the purposes of the visitor, a Context is just a node like any other. It produces a single "child" node which is either a scenegraph or a special node which calls the Context's Render method.
There is a log associated with the visitors which will log the particular nodes, their vmethods, and any finalisation tokens being run. By default this log is set to WARN level. You can set it to INFO to see the verbose trace (warning, this will seriously slow down your rendering on many systems!) The logging calls are eliminated (regardless of the logging setting) under a python -O or python -OO run.