From 1a5f620b7a79093d0676c157809894508fd69ec4 Mon Sep 17 00:00:00 2001 From: tritao Date: Mon, 13 Jan 2025 18:42:43 +0000 Subject: [PATCH] Gui: Bind `View3DInventorViewer::setOverrideMode` to Python. --- src/Gui/View3DViewerPy.cpp | 16 ++++++++++++++++ src/Gui/View3DViewerPy.h | 2 ++ 2 files changed, 18 insertions(+) diff --git a/src/Gui/View3DViewerPy.cpp b/src/Gui/View3DViewerPy.cpp index bbc96195cf70..318a1e77b605 100644 --- a/src/Gui/View3DViewerPy.cpp +++ b/src/Gui/View3DViewerPy.cpp @@ -24,6 +24,7 @@ #ifndef _PreComp_ # include +# include #endif #include @@ -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, @@ -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; diff --git a/src/Gui/View3DViewerPy.h b/src/Gui/View3DViewerPy.h index 9e53d36dca8e..c675fd64af49 100644 --- a/src/Gui/View3DViewerPy.h +++ b/src/Gui/View3DViewerPy.h @@ -74,6 +74,8 @@ class View3DInventorViewerPy : public Py::PythonExtension