added Node::evaluate(parent)
git-svn-id: svn://anubis/fart/branches/scene-file-scripting@335 7f9b0f55-74a9-4bce-be96-3c2cd072584d
This commit is contained in:
parent
74f27c2076
commit
b851c3be98
@ -21,7 +21,12 @@ void Scene::load(const char * filename)
|
||||
refptr<Node> node = parse(filename, scope);
|
||||
if ( ! node.isNull() )
|
||||
{
|
||||
processScene(node);
|
||||
refptr<Node> dummy = new Node();
|
||||
/* evaluate any scripting nodes in the node tree */
|
||||
node->evaluate(dummy);
|
||||
|
||||
/* now we have a new node tree under 'dummy' with no scripting nodes */
|
||||
processScene(dummy->getChildren()[0]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -233,14 +238,6 @@ vector<ShapeRef> Scene::processGeneralItems(refptr<Node> node)
|
||||
{
|
||||
shapes.push_back(processShape(*it));
|
||||
}
|
||||
else if ( typeid(**it) == typeid(ForNode) )
|
||||
{
|
||||
incoming = processForNode(*it);
|
||||
}
|
||||
else if ( (*it)->isExpression() )
|
||||
{
|
||||
(*it)->getNumber(); /* evaluate the expression */
|
||||
}
|
||||
while (incoming.size() > 0)
|
||||
{
|
||||
shapes.push_back(incoming[0]);
|
||||
|
@ -47,6 +47,19 @@ class Node
|
||||
std::cerr << "Warning: Node::getNode() called!" << std::endl;
|
||||
return NULL;
|
||||
}
|
||||
virtual void evaluate(refptr<Node> parent)
|
||||
{
|
||||
std::cerr << "Warning: Node::evaluate() called!" << std::endl;
|
||||
}
|
||||
virtual void evaluateChildren(refptr<Node> parent)
|
||||
{
|
||||
for (std::vector< refptr<Node> >::iterator it = m_children.begin();
|
||||
it != m_children.end();
|
||||
it++)
|
||||
{
|
||||
(*it)->evaluate(parent);
|
||||
}
|
||||
}
|
||||
|
||||
virtual bool isShape() { return false; }
|
||||
virtual bool isMaterial() { return false; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user