From Konstantin Sinitsyn, "At this moment, I just introducing to OSG. When I reviewing optimizer code, I find a mistake in Optimizer::RemoveLoadedProxyNodesVisitor, as it seems. This optimizer removes proxy nodes that fully loaded and in some cases attach their childs to parrents directly (without creating of group). I dont understand how this works, because if proxy node doesn't have any attributes such as name, description, node mask and any callbacks, then new group does not created to hold proxy node childs. And code below trying to attach their children to all parents but seems like only first child beeing attached to all parents correctly.

"
This commit is contained in:
Robert Osfield
2009-03-12 17:47:50 +00:00
parent f3ba8c8707
commit 8194246ba3

View File

@@ -1506,14 +1506,15 @@ void Optimizer::RemoveLoadedProxyNodesVisitor::removeRedundantNodes()
// take a copy of parents list since subsequent removes will modify the original one.
osg::Node::ParentList parents = group->getParents();
for(unsigned int i=0;i<group->getNumChildren();++i)
for(osg::Node::ParentList::iterator pitr=parents.begin();
pitr!=parents.end();
++pitr)
{
osg::Node* child = group->getChild(i);
for(osg::Node::ParentList::iterator pitr=parents.begin();
pitr!=parents.end();
++pitr)
(*pitr)->removeChild(group.get());
for(unsigned int i=0;i<group->getNumChildren();++i)
{
(*pitr)->replaceChild(group.get(),child);
osg::Node* child = group->getChild(i);
(*pitr)->addChild(child);
}
}