Gui: expose functions to Python to add and remove a manipulator

This commit is contained in:
wmayer
2023-10-05 16:27:35 +02:00
committed by Yorik van Havre
parent 26b5adceda
commit cb786fcbcd
2 changed files with 42 additions and 0 deletions

View File

@@ -66,6 +66,7 @@
#include "WidgetFactory.h"
#include "Workbench.h"
#include "WorkbenchManager.h"
#include "WorkbenchManipulatorPython.h"
#include "Inventor/MarkerBitmaps.h"
#include "Language/Translator.h"
@@ -357,6 +358,18 @@ PyMethodDef Application::Methods[] = {
"Remove an added document observer.\n"
"\n"
"obj : object"},
{"addWorkbenchManipulator", (PyCFunction) Application::sAddWbManipulator, METH_VARARGS,
"addWorkbenchManipulator(obj) -> None\n"
"\n"
"Add a workbench manipulator to modify a workbench when it is activated.\n"
"\n"
"obj : object"},
{"removeWorkbenchManipulator", (PyCFunction) Application::sRemoveWbManipulator, METH_VARARGS,
"removeWorkbenchManipulator(obj) -> None\n"
"\n"
"Remove an added workbench manipulator.\n"
"\n"
"obj : object"},
{"listUserEditModes", (PyCFunction) Application::sListUserEditModes, METH_VARARGS,
"listUserEditModes() -> list\n"
"\n"
@@ -1533,6 +1546,32 @@ PyObject* Application::sRemoveDocObserver(PyObject * /*self*/, PyObject *args)
PY_CATCH;
}
PyObject* Application::sAddWbManipulator(PyObject * /*self*/, PyObject *args)
{
PyObject* o;
if (!PyArg_ParseTuple(args, "O",&o))
return nullptr;
PY_TRY {
WorkbenchManipulatorPython::installManipulator(Py::Object(o));
Py_Return;
}
PY_CATCH;
}
PyObject* Application::sRemoveWbManipulator(PyObject * /*self*/, PyObject *args)
{
PyObject* o;
if (!PyArg_ParseTuple(args, "O",&o))
return nullptr;
PY_TRY {
WorkbenchManipulatorPython::removeManipulator(Py::Object(o));
Py_Return;
}
PY_CATCH;
}
PyObject* Application::sCoinRemoveAllChildren(PyObject * /*self*/, PyObject *args)
{
PyObject *pynode;