Hi,

I am in a situation where I receive a osg::ref_ptr<Group> to which I should add 
a Transform Node (or basically prepend it)

Usually the group I receive is in a hierarchy of nodes, so I was thinking about 
getting parents of this group, removing this group as a child and add the 
Transform instead. 

But is there a better way?
Since I actually do not know anything about the parents of the group it is also 
possible that there is no parent yet so the exchange is getting difficult.

Now I am wondering if it is possible and safe to swap the inner pointer of the 
ref_ptr. Basically my functions looks like

Code:

void foo (osg::ref_ptr<osg::Group> myGroup)
{
  // do something
 osg::ptr_ref<osg::MatrixTransform> mat = new MatrixTransform;
 // change
 myGroup.swap(mat);
}




Which is called from a parent function like

Code:

void parentFoo()
{
  osg::ref_ptr<osg::Group> myGroup = new osg::Group;
  foo(myGroup);

  // now I need myGroup to point to MatrixTransform without noticing it

}




Is this going to work?
I have no compiler on this maschine to test right now so I am just assuming and 
browsing the docs.


Thank you!

Cheers,
Sam

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=29515#29515





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to