mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 19:19:56 +00:00
Merge pull request #211 from OpenMW/master
Add OpenMW commits up to 5 May 2017
This commit is contained in:
commit
a7b06b342f
1 changed files with 13 additions and 4 deletions
|
@ -81,14 +81,23 @@ namespace SceneUtil
|
|||
std::string mFilter2;
|
||||
};
|
||||
|
||||
void mergeUserData(osg::UserDataContainer* source, osg::Object* target)
|
||||
{
|
||||
if (!target->getUserDataContainer())
|
||||
target->setUserDataContainer(source);
|
||||
else
|
||||
{
|
||||
for (unsigned int i=0; i<source->getNumUserObjects(); ++i)
|
||||
target->getUserDataContainer()->addUserObject(source->getUserObject(i));
|
||||
}
|
||||
}
|
||||
|
||||
osg::ref_ptr<osg::Node> attach(osg::ref_ptr<osg::Node> toAttach, osg::Node *master, const std::string &filter, osg::Group* attachNode)
|
||||
{
|
||||
if (dynamic_cast<SceneUtil::Skeleton*>(toAttach.get()))
|
||||
{
|
||||
osg::ref_ptr<osg::Group> handle = new osg::Group;
|
||||
|
||||
osg::UserDataContainer* udc = toAttach->getUserDataContainer();
|
||||
|
||||
CopyRigVisitor copyVisitor(handle, filter);
|
||||
toAttach->accept(copyVisitor);
|
||||
copyVisitor.doCopy();
|
||||
|
@ -98,13 +107,13 @@ namespace SceneUtil
|
|||
osg::ref_ptr<osg::Node> newHandle = handle->getChild(0);
|
||||
handle->removeChild(newHandle);
|
||||
master->asGroup()->addChild(newHandle);
|
||||
newHandle->setUserDataContainer(udc);
|
||||
mergeUserData(toAttach->getUserDataContainer(), newHandle);
|
||||
return newHandle;
|
||||
}
|
||||
else
|
||||
{
|
||||
master->asGroup()->addChild(handle);
|
||||
handle->setUserDataContainer(udc);
|
||||
handle->setUserDataContainer(toAttach->getUserDataContainer());
|
||||
return handle;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue