Gui: allow to dump only the visible part of the scene graph
Gui.ActiveDocument.ActiveView.dump("scene.iv", True)
The second parameter is optional and by default False
This commit is contained in:
@@ -823,16 +823,29 @@ void View3DInventor::restoreOverrideCursor()
|
||||
_viewer->getWidget()->setCursor(QCursor(Qt::ArrowCursor));
|
||||
}
|
||||
|
||||
void View3DInventor::dump(const char* filename)
|
||||
// defined in SoFCDB.cpp
|
||||
extern SoNode* replaceSwitchesInSceneGraph(SoNode*);
|
||||
|
||||
void View3DInventor::dump(const char* filename, bool onlyVisible)
|
||||
{
|
||||
SoGetPrimitiveCountAction action;
|
||||
action.setCanApproximate(true);
|
||||
action.apply(_viewer->getSceneGraph());
|
||||
|
||||
SoNode* node = _viewer->getSceneGraph();
|
||||
if (onlyVisible) {
|
||||
node = replaceSwitchesInSceneGraph(node);
|
||||
node->ref();
|
||||
}
|
||||
|
||||
if ( action.getTriangleCount() > 100000 || action.getPointCount() > 30000 || action.getLineCount() > 10000 )
|
||||
_viewer->dumpToFile(_viewer->getSceneGraph(), filename, true);
|
||||
_viewer->dumpToFile(node, filename, true);
|
||||
else
|
||||
_viewer->dumpToFile(_viewer->getSceneGraph(), filename, false);
|
||||
_viewer->dumpToFile(node, filename, false);
|
||||
|
||||
if (onlyVisible) {
|
||||
node->unref();
|
||||
}
|
||||
}
|
||||
|
||||
void View3DInventor::windowStateChanged(MDIView* view)
|
||||
|
||||
Reference in New Issue
Block a user