Re: [osg-users] DEEP_COPY_USERDATA isn't that deep

16 views
Skip to first unread message

Chris Djali

unread,
Oct 20, 2019, 3:47:37 PM10/20/19
to osg-...@lists.openscenegraph.org
Hi,

It's been pointed out to me that the DefaultUserDataContainer object list can be a little bit more deeply copied with this change:


Code:
--- a/src/osg/UserDataContainer.cpp
+++ b/src/osg/UserDataContainer.cpp
@@ -56,7 +56,10 @@ DefaultUserDataContainer::DefaultUserDataContainer(const DefaultUserDataContaine
itr != udc._objectList.end();
++itr)
{
- _objectList.push_back(copyop(itr->get()));
+ if (copyop.getCopyFlags()&osg::CopyOp::DEEP_COPY_USERDATA)
+ _objectList.push_back(osg::clone(itr->get(), copyop));
+ else
+ _objectList.push_back(copyop(itr->get()));
}
}




This will make _objectList at least point to copies of the objects instead of literally the same objects, which is a step in the right direction, but those copies will still be shallow copies.

Cheers,
Chris

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





_______________________________________________
osg-users mailing list
osg-...@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Reply all
Reply to author
Forward
0 new messages