nifloader: attempt to remove redundant root node when a Skeleton is added

coverity_scan^2
scrawl 8 years ago
parent 2a42c4781e
commit 4d53ab6c32

@ -361,7 +361,19 @@ namespace NifOsg
if (nif->getUseSkinning())
{
osg::ref_ptr<SceneUtil::Skeleton> skel = new SceneUtil::Skeleton;
skel->addChild(created);
osg::Group* root = created->asGroup();
if (root && root->getDataVariance() == osg::Object::STATIC)
{
skel->setStateSet(root->getStateSet());
skel->setName(root->getName());
for (unsigned int i=0; i<root->getNumChildren(); ++i)
skel->addChild(root->getChild(i));
root->removeChildren(0, root->getNumChildren());
created = skel;
}
else
skel->addChild(created);
created = skel;
}

Loading…
Cancel
Save