From 173a09fb32bc59c6ac397d81a63961f26e6fff02 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 7 May 2003 15:26:08 +0000 Subject: [PATCH] Added UserData to NodeVisitor. --- include/osg/NodeVisitor | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/include/osg/NodeVisitor b/include/osg/NodeVisitor index 5392343ec..ba4847ab7 100644 --- a/include/osg/NodeVisitor +++ b/include/osg/NodeVisitor @@ -150,6 +150,21 @@ class SG_EXPORT NodeVisitor : public virtual Referenced /** Get the traversal mode.*/ inline TraversalMode getTraversalMode() const { return _traversalMode; } + /** + * Set user data, data must be subclased from Referenced to allow + * automatic memory handling. If you own data isn't directly + * subclassed from Referenced then create and adapter object + * which points to your own objects and handles the memory addressing. + */ + inline void setUserData(Referenced* obj) { _userData = obj; } + + /** Get user data.*/ + inline Referenced* getUserData() { return _userData.get(); } + + /** Get const user data.*/ + inline const Referenced* getUserData() const { return _userData.get(); } + + /** Method for handling traversal of a nodes. If you intend to use the visitor for actively traversing the scene graph then make sure the accept() methods call @@ -241,6 +256,8 @@ class SG_EXPORT NodeVisitor : public virtual Referenced NodePath _nodePath; + ref_ptr _userData; + };