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."
Merged from svn/trunk using: svn merge -r 9919:9920 http://www.openscenegraph.org/svn/osg/OpenSceneGraph/trunk/src/osgUtil/Optimizer.cpp
This commit is contained in:
@@ -1494,14 +1494,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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user