Fixed compilation error in src/osgDB/FileUtils.cpp.

Added support for nested NodeCallbacks, allowing them to be chained together
so that multiple operations can be applied.
This commit is contained in:
Robert Osfield
2001-11-11 22:32:59 +00:00
parent 879a753ee2
commit 5ceefdcc12
9 changed files with 67 additions and 11 deletions

View File

@@ -39,9 +39,50 @@ class SG_EXPORT NodeCallback : public Referenced {
/** Callback method call by the NodeVisitor when visiting a node.*/
virtual void operator()(Node*, NodeVisitor*) {}
/** Call any nested callbacks and then traverse the scene graph. */
void traverse(Node* node,NodeVisitor* nv);
void setNestedCallback(NodeCallback* nc) { _nestedCallback = nc; }
NodeCallback* getNestedCallback() { return _nestedCallback.get(); }
inline void addNestedCallback(NodeCallback* nc)
{
if (nc)
{
if (_nestedCallback.valid())
{
nc->addNestedCallback(_nestedCallback.get());
_nestedCallback = nc;
}
else
{
_nestedCallback = nc;
}
}
}
inline void removeNestedCallback(NodeCallback* nc)
{
if (nc)
{
if (_nestedCallback==nc)
{
NodeCallback* nested_nc = _nestedCallback->getNestedCallback();
if (nested_nc) _nestedCallback = nc;
else _nestedCallback = 0;
}
else
{
_nestedCallback->removeNestedCallback(nc);
}
}
}
public:
Requirements _requirements;
ref_ptr<NodeCallback> _nestedCallback;
};
}; // namespace