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:
wmayer
2020-01-16 13:28:01 +01:00
parent 0b4f82f280
commit efa4cb66a2
3 changed files with 21 additions and 7 deletions

View File

@@ -113,7 +113,7 @@ void View3DInventorPy::init_type()
add_varargs_method("stopAnimating",&View3DInventorPy::stopAnimating,"stopAnimating()");
add_varargs_method("setAnimationEnabled",&View3DInventorPy::setAnimationEnabled,"setAnimationEnabled()");
add_varargs_method("isAnimationEnabled",&View3DInventorPy::isAnimationEnabled,"isAnimationEnabled()");
add_varargs_method("dump",&View3DInventorPy::dump,"dump()");
add_varargs_method("dump",&View3DInventorPy::dump,"dump(filename, [onlyVisible=False])");
add_varargs_method("dumpNode",&View3DInventorPy::dumpNode,"dumpNode(node)");
add_varargs_method("setStereoType",&View3DInventorPy::setStereoType,"setStereoType()");
add_varargs_method("getStereoType",&View3DInventorPy::getStereoType,"getStereoType()");
@@ -1233,11 +1233,12 @@ Py::Object View3DInventorPy::listCameraTypes(const Py::Tuple& args)
Py::Object View3DInventorPy::dump(const Py::Tuple& args)
{
char* filename;
if (!PyArg_ParseTuple(args.ptr(), "s", &filename))
PyObject *onlyVisible = Py_False;
if (!PyArg_ParseTuple(args.ptr(), "s|O", &filename, &onlyVisible))
throw Py::Exception();
try {
_view->dump(filename);
_view->dump(filename, PyObject_IsTrue(onlyVisible));
return Py::None();
}
catch (const Base::Exception& e) {