|
osgEarth 2.1.1
|
Public Member Functions | |
| RemoveEmptyGroupsVisitor () | |
| void | apply (osg::Group &group) |
Static Public Member Functions | |
| static void | run (osg::Node *entry) |
Visitor that looks for empty group nodes and removes them from the scene graph. (Note, if the entry node is an empty group, it will not be affected.)
| RemoveEmptyGroupsVisitor::RemoveEmptyGroupsVisitor | ( | ) |
Definition at line 263 of file NodeUtils.cpp.
:
osg::NodeVisitor( osg::NodeVisitor::TRAVERSE_ALL_CHILDREN )
{
//nop
}
| void RemoveEmptyGroupsVisitor::apply | ( | osg::Group & | group | ) |
Definition at line 270 of file NodeUtils.cpp.
{
bool removed = true;
while( removed )
{
removed = false;
for( unsigned i = 0; i < group.getNumChildren(); ++i )
{
osg::Group* child = group.getChild(i)->asGroup();
if ( child )
{
if (child->className() == "Group" &&
child->getStateSet() == 0L &&
child->getCullCallback() == 0L &&
child->getUpdateCallback() == 0L &&
child->getUserData() == 0L &&
child->getName().empty() &&
child->getDescriptions().size() == 0 )
{
for( unsigned j = 0; j < child->getNumChildren(); ++j )
{
group.addChild( child->getChild( j ) );
}
group.removeChild( i-- );
removed = true;
}
}
}
}
traverse(group);
}
| static void osgEarth::RemoveEmptyGroupsVisitor::run | ( | osg::Node * | entry | ) | [inline, static] |
Definition at line 46 of file NodeUtils.
{
if ( entry ) {
RemoveEmptyGroupsVisitor v;
entry->accept( v );
}
}
Here is the caller graph for this function:
1.7.3