added dumpNodeTree() for debugging

This commit is contained in:
Josh Holtrop 2011-02-09 23:53:10 -05:00
parent 6715b06b44
commit c218c8956f

View File

@ -15,10 +15,29 @@ using namespace std;
typedef vector< refptr<Node> >::const_iterator Node_Iterator;
#ifdef NODE_TREE_DEBUG
static void dumpNodeTree(refptr<Node> node)
{
static int depth = 0;
for (int i = 0; i < depth; i++)
cerr << ' ';
cerr << typeid(*node).name() << endl;
depth++;
for (Node_Iterator it = node->getChildren().begin(); it != node->getChildren().end(); it++)
{
dumpNodeTree(*it);
}
depth--;
}
#endif
void Scene::load(const char * filename)
{
refptr<Scope> scope = new Scope();
refptr<Node> node = parse(filename, scope);
#ifdef NODE_TREE_DEBUG
dumpNodeTree(node);
#endif
if ( ! node.isNull() )
{
/* evaluate any scripting nodes in the node tree */