Skip to content

Commit

Permalink
Gui: Bind View3DInventorViewer::setOverrideMode to Python.
Browse files Browse the repository at this point in the history
  • Loading branch information
tritao authored and chennes committed Jan 17, 2025
1 parent 318e6f7 commit 1a5f620
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/Gui/View3DViewerPy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

#ifndef _PreComp_
# include <Inventor/nodes/SoCamera.h>
# include <string>
#endif

#include <Base/GeometryPyCXX.h>
Expand Down Expand Up @@ -97,6 +98,10 @@ void View3DInventorViewerPy::init_type()
"isRedirectedToSceneGraph() -> bool: check whether event redirection is enabled.");
add_varargs_method("grabFramebuffer", &View3DInventorViewerPy::grabFramebuffer,
"grabFramebuffer() -> QImage: renders and returns a 32-bit RGB image of the framebuffer.");

add_varargs_method("setOverrideMode", &View3DInventorViewerPy::setOverrideMode,
"setOverrideMode(mode): sets the display override mode.");

add_varargs_method("setEnabledNaviCube", &View3DInventorViewerPy::setEnabledNaviCube,
"setEnabledNaviCube(bool): enables or disables the navi cube of the viewer.");
add_varargs_method("isEnabledNaviCube", &View3DInventorViewerPy::isEnabledNaviCube,
Expand Down Expand Up @@ -581,6 +586,17 @@ Py::Object View3DInventorViewerPy::grabFramebuffer(const Py::Tuple& args)
return wrap.fromQImage(img.mirrored());
}

Py::Object View3DInventorViewerPy::setOverrideMode(const Py::Tuple& args)
{
const char* mode;
if (!PyArg_ParseTuple(args.ptr(), "s", &mode)) {
throw Py::Exception();
}

_viewer->setOverrideMode(std::string(mode));
return Py::None();
}

Py::Object View3DInventorViewerPy::setEnabledNaviCube(const Py::Tuple& args)
{
PyObject* m=Py_False;
Expand Down
2 changes: 2 additions & 0 deletions src/Gui/View3DViewerPy.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ class View3DInventorViewerPy : public Py::PythonExtension<View3DInventorViewerPy
Py::Object isRedirectedToSceneGraph(const Py::Tuple& args);
Py::Object grabFramebuffer(const Py::Tuple& args);

Py::Object setOverrideMode(const Py::Tuple& args);

// NaviCube handling
Py::Object setEnabledNaviCube(const Py::Tuple& args);
Py::Object isEnabledNaviCube(const Py::Tuple& args);
Expand Down

0 comments on commit 1a5f620

Please sign in to comment.