From 8f71b65d38f4e8cb5680e6881cba113fed78502a Mon Sep 17 00:00:00 2001 From: scrawl Date: Fri, 14 Apr 2017 15:04:53 +0200 Subject: [PATCH] sceneutil/attach: inherit the UserDataContainer to avoid the resource cache from being cleared incorrectly --- components/sceneutil/attach.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/components/sceneutil/attach.cpp b/components/sceneutil/attach.cpp index d4f324ced..e61b8a6e0 100644 --- a/components/sceneutil/attach.cpp +++ b/components/sceneutil/attach.cpp @@ -87,6 +87,8 @@ namespace SceneUtil { osg::ref_ptr handle = new osg::Group; + osg::UserDataContainer* udc = toAttach->getUserDataContainer(); + CopyRigVisitor copyVisitor(handle, filter); toAttach->accept(copyVisitor); copyVisitor.doCopy(); @@ -96,11 +98,13 @@ namespace SceneUtil osg::ref_ptr newHandle = handle->getChild(0); handle->removeChild(newHandle); master->asGroup()->addChild(newHandle); + newHandle->setUserDataContainer(udc); return newHandle; } else { master->asGroup()->addChild(handle); + handle->setUserDataContainer(udc); return handle; } }